<%@ Page Title="" Language="C#" MasterPageFile="~/eosWinkartWeb/eosWinkartWeb.Master"
    AutoEventWireup="true" CodeBehind="addPersonToSection.aspx.cs" Inherits="WebKart.eosWinkartWeb.addPersonToSection" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table width="100%">
        <tr>
            <td colspan="2" class="CenterTD">
                <asp:Label ID="lblError" runat="server" Text="" SkinID="LblError"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="RightTD">
                <telerik:RadComboBox ID="ddlPersons" runat="server" Width="280px" Height="250px"
                    EmptyMessage="نام خانوادگی پرسنل مورد نظررا وارد کنید"   DataTextField="PersonName"
                    CloseDropDownOnBlur="True" ShowDropDownOnTextboxClick="True" Filter="Contains"
                    DataValueField="perno" AllowCustomText="True" Font-Names="Tahoma" Font-Size="10pt"
                    MarkFirstMatch="True" Skin="Vista" ItemRequestTimeout="5000" LoadingMessage="در حال بارگذاری..."
                    Sort="Ascending" OnSelectedIndexChanged="ddlPersons_SelectedIndexChanged">
                </telerik:RadComboBox>
            </td>
            <td class="LeftTD">
                لیست کاربران:
            </td>
        </tr>
        <tr>
            <td class="RightTD">
                <asp:DropDownList ID="ddlSections" runat="server" SkinID="ddlYellow" Width="200px">
                </asp:DropDownList>
                <asp:CheckBox ID="chkWithOutGroup" runat="server" Text="آزاد از گروه" Font-Names="Tahoma"
                    Font-Size="10pt" OnCheckedChanged="chkWithOutGroup_CheckedChanged" AutoPostBack="True" />
            </td>
            <td class="LeftTD" style="width: 250px">
                قسمت کاری:
            </td>
        </tr>
        <tr>
            <td class="LeftTD">
                <asp:Button ID="btnAddAdmin" runat="server" Text="اضافه کردن مدیر" OnClick="btnAddAdmin_Click"
                    SkinID="btnOrange" />
                    
                                    <asp:Button ID="btnSearch" runat="server" Text="جستجو" 
                    SkinID="btnOrange" onclick="btnSearch_Click" />
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <telerik:RadGrid runat="server" ID="grdSectionsAdmins" Skin="WebBlue" 
                    AutoGenerateColumns="False" DataSourceID="adminOds" Font-Names="Tahoma" Font-Size="10pt"
                    OnItemCommand="grdSectionsAdmins_ItemCommand" OnSortCommand="grdSectionsAdmins_SortCommand"
                    AllowPaging="True" PageSize="20" OnItemDataBound="grdSectionsAdmins_OnItemDataBound"
                    OnPageSizeChanged="grdSectionsAdmins_OnPageSizeChanged" 
                    OnPageIndexChanged="grdSectionsAdmins_OnPageIndexChanged" GridLines="None">
                    <MasterTableView NoDetailRecordsText="" NoMasterRecordsText="اطلاعاتی برای نمایش موجود نمی باشد"
                        AllowCustomPaging="False" AllowCustomSorting="True">
                        <Columns>
                            <telerik:GridBoundColumn DataField="section" HeaderText="قسمت " UniqueName="section"
                                AllowSorting="false">
                                <HeaderStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" />
                                <ItemStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="personName" HeaderText="اسم مدیر" UniqueName="personName"
                                AllowSorting="True">
                                <HeaderStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" />
                                <ItemStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="AdminSectionName" HeaderText="قسمت دسترسی" UniqueName="NAME"
                                AllowSorting="True">
                                <HeaderStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" />
                                <ItemStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="AdminSectionCode" HeaderText="کد قسمت دسترسی"
                                UniqueName="sectionCode" AllowSorting="True">
                                <HeaderStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" />
                                <ItemStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Left" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="id" HeaderText="شناسه" UniqueName="id" Display="false"
                                AllowSorting="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="perno" HeaderText="شماره پرسنلی" UniqueName="perno"
                                Display="false" AllowSorting="False">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                    <ClientSettings EnableRowHoverStyle="true" ReorderColumnsOnClient="True" EnablePostBackOnRowClick="true"
                        AllowAutoScrollOnDragDrop="False">
                        <Selecting EnableDragToSelectRows="False" AllowRowSelect="True" />
                    </ClientSettings>
                </telerik:RadGrid>
                <asp:ObjectDataSource runat="server" ID="adminODS" EnablePaging="True" StartRowIndexParameterName="startRecord"
                    MaximumRowsParameterName="maxRecords" SelectCountMethod="GetCount" SelectMethod="GetAdmins"
                    TypeName="Eos.WebKart.Domain.Sections"></asp:ObjectDataSource>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Panel runat="server" ID="pnlAdminDetail" Visible="false">
                    <table width="100%" cellpadding="3" cellspacing="4">
                        <tr>
                            <td class="RightTD" colspan="3">
                                <asp:Label ID="lblSelectedCode" runat="server" Text="" Visible="false"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="RightTD">
                                <asp:Button ID="btnDeleteSection" runat="server" Text="حذف قسمت" SkinID="btnOrangeFreeSize"
                                    OnClick="btnDeleteSection_Click" CausesValidation="False" />
                            </td>
                            <td class="RightTD">
                                <asp:TextBox ID="txtPerName2" runat="server" Width="300px" AutoCompleteType="DisplayName"></asp:TextBox>
                                <cc1:AutoCompleteExtender ID="AutoCompleteExtender2" runat="server" MinimumPrefixLength="1"
                                    ServiceMethod="GetALlPersons" ServicePath="~/service/personsName.asmx" TargetControlID="txtPerName2">
                                </cc1:AutoCompleteExtender>
                            </td>
                            <td class="LeftTD">
                                تغییر مدیر گروه:
                            </td>
                        </tr>
                        <tr>
                            <td class="RightTD">
                                <asp:Button ID="btnChangeSection" runat="server" Text="اعمال تغییرات" SkinID="btnOrangeFreeSize"
                                    OnClick="btnChangeSection_Click" CausesValidation="False" />
                            </td>
                            <td class="RightTD">
                                <asp:DropDownList ID="ddlSection2" runat="server" SkinID="ddlYellow" Width="200px">
                                </asp:DropDownList>
                                <asp:CheckBox ID="chkWithOutGroup2" runat="server" Text="آزاد از گروه" Font-Names="Tahoma"
                                    Font-Size="10pt" AutoPostBack="True" OnCheckedChanged="chkWithOutGroup2_CheckedChanged" />
                            </td>
                            <td class="LeftTD">
                                تغییر گروه:
                            </td>
                        </tr>
                        <tr>
                            <td class="RightTD">
                                <asp:Button ID="btnEditAdminPermission" runat="server" Text="دسترسی های مدیر" SkinID="btnOrangeFreeSize"
                                    OnClick="btnEditAdminPermission_Click" CausesValidation="False" />
<%--                                <asp:Button ID="btnAccessToReports" runat="server" Text="دسترسی به گزارشات سفارشی"
                                    SkinID="btnOrangeFreeSize" CausesValidation="False" OnClick="btnAccessToReports_Click" />--%>
                            </td>
                            <td class="RightTD">
                                <asp:DropDownList ID="ddlPattern" runat="server" DataTextField="PatternName" DataValueField="PatternId"
                                    Width="250px">
                                </asp:DropDownList>
                            </td>
                            <td class="LeftTD">
                                انتخاب روند:
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
    </table>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"
        InitialDelayTime="2" MinDisplayTime="100" Width="184px">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="chkWithOutGroup">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ddlSections" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="grdSectionsAdmins">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlAdminDetail" />
                    <telerik:AjaxUpdatedControl ControlID="grdSectionsAdmins" />
                    <telerik:AjaxUpdatedControl ControlID="lblError" />
                    <telerik:AjaxUpdatedControl ControlID="chkWithOutGroup2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnChangeSection">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lblError" />
                    <telerik:AjaxUpdatedControl ControlID="grdSectionsAdmins" />
                    <telerik:AjaxUpdatedControl ControlID="pnlAdminDetail" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnDeleteSection">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lblError" />
                    <telerik:AjaxUpdatedControl ControlID="grdSectionsAdmins" />
                    <telerik:AjaxUpdatedControl ControlID="pnlAdminDetail" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="chkWithOutGroup2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ddlSection2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnAddAdmin">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lblError" />
                    <telerik:AjaxUpdatedControl ControlID="grdSectionsAdmins" />
                    <telerik:AjaxUpdatedControl ControlID="pnlAdminDetail" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grdSectionsAdmins" />
                    <telerik:AjaxUpdatedControl ControlID="pnlAdminDetail" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
</asp:Content>
