<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="pg_CoursesEdit.aspx.cs" Inherits="rl_admins_pg_CoursesEdit" Title="Untitled Page" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" Runat="Server">
    <div class="contentDiv">
        <table border="0" cellpadding="0" cellspacing="0" >
            <tr id="Tr1">
                <td id="rightTableData" valign="top">
                    <div id="linksPanel" style="margin-right:15px; margin-top : 10px;">
                        <table id="tblpanel" border="0" cellpadding="0" cellspacing="0" style="width:200px;">
                            <tr>
                                <td id="panelheadright" class="panelheadright">
                                </td>
                                <td id="panelheadrepeat" class="panelheadrepeat" align="center" style="width:160px;">
                                    <asp:Label ID="lblpanelHead" runat="server" Text="منوی سایت" style="color:White; font-weight:bold; "></asp:Label>
                                </td>
                                <td id="panelheadleft" class="panelheadleft">
                                </td>
                            </tr>
                            <tr>
                                <td id="panelmarginright" class="panelmarginright">
                                </td>
                                <td valign="top" class="panelcontentback" style="background-image:none; background-color : White; "> <!-- ************ Content Place !-->
                                    <div class="panelcontent" style="margin-top:17px;">
                                        <asp:Panel ID="panelMenues" runat="server">
                                        </asp:Panel>
                                    </div>
                                </td>
                                <td id="panelmarginleft" class="panelmarginleft" align="left">
                                </td>
                            </tr>
                            <tr>
                                <td id="panelbottomright" class="panelbottomright" align="right" >
                                </td>
                                <td id="panelbottomrepeat" class="panelbottomrepeat" style="width:160px;">
                                </td>
                                <td id="panelbottomleft" class="panelbottomleft" align="left";>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
                <td id="contentTableData" style="width:100%; padding-right : 10px;" align="right"; valign="top"; >
                    <div class="content" style="margin-top:15px;">
                        <p style="margin-right:10px;">
                            لیست دوره های ثبت شده :
                        </p>
                    </div>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:ASPNETDB_ConnectionString %>"
                                ProviderName="System.Data.SqlClient" 
                                SelectCommand="SELECT * FROM [t_Courses] ORDER BY [courseId]"></asp:SqlDataSource>
                            <div id="gridUsers" style="padding-right: 20px; padding-left : 35px;">
                                <asp:GridView ID="GridView1" runat="server" style="width:100%;" 
                                    AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
                                    DataKeyNames="courseId" DataSourceID="SqlDataSource1" CssClass="grid" 
                                    PageSize="15" PagerStyle-CssClass="gridPager" 
                                    onrowcommand="GridView1_RowCommand">
                                    <PagerSettings NextPageText="&gt;" PreviousPageText="&lt;" />
                                    <Columns>
                                        <asp:BoundField DataField="courseId" HeaderText="کد دوره" 
                                            InsertVisible="False" ReadOnly="True" HeaderStyle-CssClass="gridHeader" 
                                            ItemStyle-CssClass="gridCell" >
                                            <HeaderStyle CssClass="gridHeader" />
                                            <ItemStyle CssClass="gridCell" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="courseName" HeaderText="نام دوره"  
                                            HeaderStyle-CssClass="gridHeader" ItemStyle-CssClass="gridCell">
                                            <HeaderStyle CssClass="gridHeader" />
                                            <ItemStyle CssClass="gridCell" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="beginDate" HeaderText="تاریخ شروع"  
                                            HeaderStyle-CssClass="gridHeader" ItemStyle-CssClass="gridCell">
                                            <HeaderStyle CssClass="gridHeader" />
                                            <ItemStyle CssClass="gridCell" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="duration" HeaderText="مدت دوره"  
                                            HeaderStyle-CssClass="gridHeader" ItemStyle-CssClass="gridCell">
                                            <HeaderStyle CssClass="gridHeader" />
                                            <ItemStyle CssClass="gridCell" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="endDate" HeaderText="تاریخ پایان" 
                                            HeaderStyle-CssClass="gridHeader" ItemStyle-CssClass="gridCell" >
                                            <HeaderStyle CssClass="gridHeader" />
                                            <ItemStyle CssClass="gridCell" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="amount" HeaderText="هزینه دوره"  
                                            HeaderStyle-CssClass="gridHeader" ItemStyle-CssClass="gridCell">
                                            <HeaderStyle CssClass="gridHeader" />
                                            <ItemStyle CssClass="gridCell" />
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="نمایش در لیست" HeaderStyle-CssClass="gridHeader" ItemStyle-CssClass="gridCell">
                                            <ItemTemplate>
                                                    <asp:LinkButton ID="btnShowInList" runat="server" CommandName="ShowInList" CommandArgument='<%#Eval("courseId") %>' CssClass='<%#FindCssClass(Eval("showInList")) %>' Width="60px" Height="20px" style="margin-top:4px;" ><%#FindShowButtonText(Eval("showInList"))%></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle CssClass="gridHeader" />
                                            <ItemStyle CssClass="gridCell" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="ویرایش دوره" HeaderStyle-CssClass="gridHeader" ItemStyle-CssClass="gridCell">
                                            <ItemTemplate>
                                                    <asp:LinkButton ID="btnEdit" runat="server" CommandName="EditPress" CommandArgument='<%#Eval("courseId") %>' CssClass="gridsmallbuttons" Width="60px" Height="20px" style="margin-top:4px;" >ویرایش</asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle CssClass="gridHeader" />
                                            <ItemStyle CssClass="gridCell" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="حذف دوره" HeaderStyle-CssClass="gridHeader" ItemStyle-CssClass="gridCell">
                                            <ItemTemplate>
                                                    <asp:LinkButton ID="btnDelete" runat="server" CommandName="DeletePress" CommandArgument='<%#Eval("courseId") %>' CssClass="gridsmallbuttons" Width="60px" Height="20px" style="margin-top:4px;" >حذف</asp:LinkButton>
                                                    <cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText="آیا برای حذف دوره اطمینان دارید؟" TargetControlID="btnDelete">
                                                    </cc1:ConfirmButtonExtender>
                                            </ItemTemplate>
                                            <HeaderStyle CssClass="gridHeader" />
                                            <ItemStyle CssClass="gridCell" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <PagerStyle CssClass="gridPager" BorderStyle="None" HorizontalAlign="Center" 
                                        VerticalAlign="Middle" />
                                </asp:GridView>
                                <div style="text-align:left; margin-top : 10px;">
                                    <asp:LinkButton ID="btnNewCourse" runat="server" Height="25px" 
                                        Width="100px" CssClass="buttons" onclick="btnNewCourse_Click" >دوره جدید</asp:LinkButton>
                                </div>
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>

