<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="User_Group.aspx.cs" Inherits="Neclog_3_0.User_Group" %>

<%@ Register Src="~/UserControls/ucSearchControl.ascx" TagName="ucSearchControl" TagPrefix="ucSearch" %>
<%@ Register TagPrefix="OBint" Namespace="Obout.Interface" Assembly="obout_Interface" %>
<%@ Register TagPrefix="OBgrid" Namespace="Obout.Grid" Assembly="obout_Grid_NET" %>
<%@ Register TagPrefix="OBcmb" Namespace="Obout.ComboBox" Assembly="obout_ComboBox" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        //This function is created for gridview Check Box operation.
        function chkUserGroupCheckbox(e) {
            document.getElementById("<%=hdnCheckbox.ClientID %>").value = e.id;
        }

        function grdSearch_OnClientDblClick(recordIndex) {
            grdSearch_OnInternalClientDblClick(recordIndex);
            var cObj = document.getElementById("<%= btnEdit.ClientID%>");
            cObj.click();
        }
    </script>
    <div class='divtable'>
        <asp:HiddenField ID="hdnRecordKeyId" runat="server" />
        <asp:HiddenField ID="hdnCheckbox" runat="server" />
        <div class='form-box'>
            <div class="box box-success">
                <div class="box-header with-border">
                    <div class='row'>
                        <div class='col-md-7'>
                            <asp:Label ID="lblTitle" runat="server" class="box-title"></asp:Label>
                            <asp:HiddenField ID="hdnHeaderNote" Value="0" runat="server" />
                            <asp:HiddenField ID="hdnFooterNote" Value="0" runat="server" />
                        </div>
                        <div class='col-md-5' align="right">
                            <asp:UpdatePanel runat="server" UpdateMode="Always">
                                <ContentTemplate>
                                    <asp:Button ID="btnSearch" runat="server" Text="Find" OnClick="SearchData" CssClass="myButton" CausesValidation="false" ToolTip = "Find" />&nbsp;
                                    <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="AddData" CssClass="myButton" CausesValidation="false" ToolTip = "Add" />&nbsp;
                                    <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="SaveData" CssClass="myButton" ClientIDMode="Static" ToolTip = "Save" />&nbsp;
                                    <asp:Button ID="btnEdit" runat="server" Text="Edit" OnClick="btnEdit_Click" CssClass="myButton" ClientIDMode="Static" ToolTip="Edit" />
                                    <asp:Button ID="btnDelete" runat="server" Text="Delete" OnClientClick="return validateDelete();" OnClick="btnDelete_Click" CssClass="myButton" ClientIDMode="Static" ToolTip="Delete" />&nbsp;
                                    <asp:Button ID="btnPrint" runat="server" Text="Print" OnClick="btnPrint_Click" CssClass="myButton" CausesValidation="false" ToolTip="Print" />
                                    </ContentTemplate>
                                <Triggers>
                                    <asp:PostBackTrigger ControlID="btnPrint" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </div>
                    </div>
                </div>
                <!-- /.box-header -->
                <!-- form start -->

                <div class="form-horizontal">
                    <div class="box-body" id="divFormContent" runat="server">
                        <div class="form-group">
                            <asp:Label ID="Label1" runat="server" Text="User Group*" class="col-sm-2 control-label"></asp:Label>
                            <div class="col-sm-5">
                                <asp:TextBox runat="server" ID="txtGroupName" MaxLength="50" class="form-control" />
                            </div>
                            <div class="col-sm-5">
                                <asp:RequiredFieldValidator runat="server" ControlToValidate="txtGroupName"
                                    CssClass="text-alert" ErrorMessage="User Group Name field is required." />
                            </div>
                        </div>
                        <div class="form-group">
                            <asp:Label ID="Label32" runat="server" Text="Details" class="col-sm-2 control-label"></asp:Label>
                            <div class="col-sm-5">
                                <asp:TextBox runat="server" ID="txtDescription" MaxLength="250" TextMode="MultiLine" class="form-control"  />
                            </div>
                        </div>
                        <div class="col-lg-12" align="center">
                            <asp:Label Text="Access Rights - Select / Deselect All" runat="server" />
                            <asp:CheckBox Text="" ID="chkSelectAll" OnCheckedChanged="chkSelectAll_CheckedChanged" AutoPostBack="true" runat="server" />
                        </div>
                        <div class="form-group">
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                <ContentTemplate>
                                    <div class="row">
                                        <div class="col-lg-12 ">
                                            <div class="table-responsive">
                                                <OBgrid:Grid ID="grdUserGroup" AllowSorting="false" Width="100%" AllowPaging="false" runat="server" CallbackMode="true" AutoGenerateColumns="false" FolderStyle="~/App_Include/StyleSheet/Grid" OnRowDataBound="grdUserGroup_RowDataBound" AllowAddingRecords="False" AllowPageSizeSelection="False" AllowMultiRecordSelection="False" ShowFooter="True">
                                                    <Columns>
                                                        <OBgrid:Column TemplateID="tplMenuCode" HeaderText="MenuCode" DataField="MenuCode" Visible="false" Index="0"  runat="server"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplModuleCode" HeaderText="ModuleCode" DataField="ModuleCode" Visible="false" Index="1" runat="server"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplModuleGroup" HeaderText="ModuleGroup" DataField="ModuleGroup" Visible="false" Index="2" runat="server"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplMenuLevel" HeaderText="MenuLevel" DataField="MenuLevel" Visible="false" Index="3" runat="server"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplMenuName" HeaderText="Menu Name" DataField="MenuName" Width="40%" Index="4" runat="server"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplSrNo" HeaderText="SrNo" DataField="SrNo" Visible="false" Index="5" runat="server"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplMenuType" HeaderText="MenuType" DataField="MenuType" Visible="false" Index="6" runat="server"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplUserGroupId" HeaderText="UserGroupId" DataField="UserGroupId" Visible="false" Index="7" runat="server"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplModuleCommand" HeaderText="ModuleCommand" DataField="ModuleCommand" Visible="false" Index="8" runat="server"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplModuleImagePath" HeaderText="ModuleImagePath" DataField="ModuleImagePath" Visible="false" Index="9" runat="server"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplProjectAccessId" HeaderText="ProjectAccessId" DataField="ProjectAccessId" Visible="false" Index="10" runat="server"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplMenuShowRight" HeaderText="View" HeaderAlign="Center" Align="Center" DataField="MenuShowRight" Width="12%" Index="11"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplMenuAddRight" HeaderText="Add / Save" HeaderAlign="Center" Align="Center" DataField="MenuAddRight" Width="12%" Index="12"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplMenuEditRight" HeaderText="Edit / Update" HeaderAlign="Center" Align="Center" DataField="MenuEditRight" Width="12%" Index="13"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplMenuDeleteRight" HeaderText="Delete" HeaderAlign="Center" Align="Center" DataField="MenuDeleteRight" Width="12%" Index="14"></OBgrid:Column>
                                                        <OBgrid:Column TemplateID="tplMenuShowPrint" HeaderText="Print" HeaderAlign="Center" Align="Center" DataField="MenuShowPrint" Width="12%" Index="15"></OBgrid:Column>
                                                    </Columns>
                                                    <Templates>
                                                        <OBgrid:GridTemplate ID="tplMenuCode" ControlID="lblMenuCode">
                                                            <Template> 
                                                                <asp:Label ID="lblMenuCode" runat="server"></asp:Label>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplModuleCode" ControlID="lblModuleCode">
                                                            <Template> 
                                                                <asp:Label ID="lblModuleCode" runat="server"></asp:Label>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplModuleGroup" ControlID="lblModuleGroup">
                                                            <Template> 
                                                                <asp:Label ID="lblModuleGroup" runat="server"></asp:Label>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplMenuLevel" ControlID="lblMenuLevel">
                                                            <Template> 
                                                                <asp:Label ID="lblMenuLevel" runat="server"></asp:Label>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplMenuName" ControlID="lblMenuName">
                                                            <Template> 
                                                                <div id="lblMenuName" runat="server" style="text-align:left;width:100%"></div>
                                                                <%--<asp:Label ID="lblMenuName" runat="server"></asp:Label>--%>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplSrNo" ControlID="lblSrNo">
                                                            <Template> 
                                                                <asp:Label ID="lblSrNo" runat="server"></asp:Label>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplMenuType" ControlID="lblMenuType">
                                                            <Template> 
                                                                <asp:Label ID="lblMenuType" runat="server"></asp:Label>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplUserGroupId" ControlID="lblUserGroupId">
                                                            <Template> 
                                                                <asp:Label ID="lblUserGroupId" runat="server"></asp:Label>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplModuleCommand" ControlID="lblModuleCommand">
                                                            <Template> 
                                                                <asp:Label ID="lblModuleCommand" runat="server"></asp:Label>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplModuleImagePath" ControlID="lblModuleImagePath">
                                                            <Template> 
                                                                <asp:Label ID="lblModuleImagePath" runat="server"></asp:Label>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplProjectAccessId" ControlID="lblModuleImagePath">
                                                            <Template> 
                                                                <asp:Label ID="lblProjectAccessId" runat="server"></asp:Label>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplMenuShowRight" ControlID="chkMenuShowRight">
                                                            <Template> 
                                                                <asp:CheckBox ID="chkMenuShowRight" runat="server" onClick="chkUserGroupCheckbox(this);" AutoPostBack="false"/>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplMenuAddRight" ControlID="chkMenuAddRight">
                                                            <Template> 
                                                                <asp:CheckBox ID="chkMenuAddRight" runat="server" onClick="chkUserGroupCheckbox(this);" AutoPostBack="false" />
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplMenuEditRight" ControlID="chkMenuEditRight">
                                                            <Template> 
                                                                <asp:CheckBox ID="chkMenuEditRight" runat="server" onClick="chkUserGroupCheckbox(this);" AutoPostBack="false" />
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplMenuDeleteRight" ControlID="chkMenuDeleteRight">
                                                            <Template> 
                                                                <asp:CheckBox ID="chkMenuDeleteRight" runat="server" onClick="chkUserGroupCheckbox(this);" AutoPostBack="false"/>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                        <OBgrid:GridTemplate ID="tplMenuShowPrint" ControlID="chkMenuShowPrint">
                                                            <Template> 
                                                                <asp:CheckBox ID="chkMenuShowPrint" runat="server" onClick="chkUserGroupCheckbox(this);" AutoPostBack="false"/>
                                                            </Template>
                                                        </OBgrid:GridTemplate>
                                                    </Templates>
                                                </OBgrid:Grid>
                                            </div>
                                        </div>
                                    </div>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                            <script type="text/javascript">
                                $(function () {
                                    $('[id*=grdUserGroup]').footable();
                                });

                                var prm = Sys.WebForms.PageRequestManager.getInstance();
                                if (prm != null) {
                                    prm.add_endRequest(function (sender, e) {
                                        if (sender._postBackSettings.panelsToUpdate != null) {
                                            $('.footable').footable();
                                        }
                                    });
                                }
                            </script>
                        </div>
                    </div>
                </div>

                <div class="box-body" id="divSearchContent" runat="server" visible="false">
                    <ucSearch:ucSearchControl ID="ucSearch" runat="server" strSearchProcedurename = "UserGroup_Search" 
                        strDelePrecedure="UserGroup_Delete"  strDeletekeys="0,3" strDeleteColName="@hdnRecordKeyId,@sssUserId" blnOutParameter="true" strColWidth="0,30,65,0" />
                </div>
            </div>
        </div>
    </div>
</asp:Content>
