<%@ Page Language="C#" MasterPageFile="~/masterpages/eDashboard.master" AutoEventWireup="true" Inherits="site_HITS_EmployeeMaster" Title="Brightstar Device Protection: User Master"
    Theme="eMain" Culture="auto" UICulture="auto" Codebehind="Default.aspx.cs" %>

<%@ Register Src="~/Controls/PhoneNumber.ascx" TagName="PhoneNumber" TagPrefix="uc1" %>
<%@ Register Src="~/Controls/ScriptingHelper.ascx" TagName="ScriptingHelper" TagPrefix="uc" %>
<%@ Register Src="~/Controls/DefaultHeader.ascx" TagName="DefaultHeader" TagPrefix="uc" %>
<%@ Register Src="~/Controls/CustomSorter.ascx" TagName="CustomSorter" TagPrefix="uc" %>

<%@ Register Assembly="eSecuritel.HITS.UI.Components" Namespace="eSecuritel.HITS.UI.Components" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="eContent" runat="server">

    <script src="../../../script/eSetFormControls.js" type="text/javascript"></script>
    <script src="../../../script/eGridHelper.js" type="text/javascript"></script>
    <uc:ScriptingHelper ID="ScriptingHelper1" runat="server" />

    <script type="text/javascript">
        function resetLoginStatus() {

            var elementRef = document.getElementById('<%= m_rdolistLoginStatus.ClientID%>');
            var radioButtons = elementRef.getElementsByTagName('input');

            for (var x = 0; x < radioButtons.length; x++) {
                radioButtons[x].checked = false;
            }
            radioButtons[0].checked = true;
        }

     </script> 

    <table width="100%">
        <tr>
            <td>
                <h1>
                    <asp:Literal ID="m_litUserManagementHeader" runat="server" Text="<%$ Resources: UsersManagement, LabelUsers %>"
                         />
                </h1>
            </td>            
        </tr>
    </table>
    
    <uc:DefaultHeader ID="DefaultHeader1" runat="server" OnImportClicked="DefaultHeader1_ImportClick" OnSyncClicked="DefaultHeader1_SyncClick"/>
   
    <div class="mastersearch">
        <img src="../../../images/Collapse_13x13.jpg" class="showstate" onclick="expandMasterSearch(this, 'm_pnlMasterSearchCriteria')"
            alt="contract" />
        <asp:Literal ID="m_litSearchUsersHeader" runat="server" Text="<%$ Resources: Default, LabelSearchCriteria %>" />
    </div>
    <div id="m_pnlMasterSearchCriteria" style="background-color: #DBDCDE">
        <table border="0" cellpadding="0" cellspacing="0" class="gvTable">
            <tr>
                <td>
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td align = "right" style="width:150px;">
                                <asp:Literal ID="m_litFirstName" runat="server" Text="<%$ Resources: UsersManagement, LabelUserFirstName %>" />
                            </td>
                            <td style="width: 180px;">
                                <asp:TextBox ID="m_txtFirstName" runat="server" Width="160px"></asp:TextBox>
                                <SmartAjaxToolkit:SmartAutoCompleteExtender ID="SmartAutoCompleteExtender1" runat="server"
                                    OnAutoCompleteCallback="SearchUsersByFirstName" TargetControlID="m_txtFirstName" UpdateMode="Callback"
                                    EnableCaching="false" MinimumPrefixLength="2" />
                            </td>
                            <td align = "right" style="width:150px;">
                                <asp:Literal ID="m_litLastName" runat="server" Text = "<%$ Resources: UsersManagement, LabelUserLastName %>" />
                            </td>
                            <td>
                                <asp:TextBox ID="m_txtLastName" runat="server" Width="165px"></asp:TextBox>
                               <SmartAjaxToolkit:SmartAutoCompleteExtender ID="SmartAutoCompleteExtender2" runat="server"
                                    OnAutoCompleteCallback="SearchUsersByLastName" TargetControlID="m_txtLastName" UpdateMode="Callback"
                                    EnableCaching="false" MinimumPrefixLength="2" /> 
                            </td>
                        </tr>
                        <tr>
                            <td align = "right">
                                <asp:Literal ID="m_litOrganization" runat="server" Text = "<%$ Resources: OrganizationManagement, LabelOrganizationColon %>" />
                            </td>
                            <td>
                                <asp:DropDownList ID="m_ddlOrg" runat="server" Width="172px">
                                </asp:DropDownList>
                            </td>
                            <td align = "right">
                                <asp:Literal ID="m_litOrganizatinUnit" runat="server" Text = "<%$ Resources: OrganizationManagement, OrganizationUnitLabel %>" />
                            </td>
                            <td>
                                <asp:TextBox ID="m_txtOrgUnit" runat="server" Width="165px"></asp:TextBox>
                                <SmartAjaxToolkit:SmartAutoCompleteExtender ID="SmartAutoCompleteExtender3" runat="server"
                                    OnAutoCompleteCallback="SearchUsersByOrgUnit" TargetControlID="m_txtOrgUnit" UpdateMode="Callback"
                                    EnableCaching="false" MinimumPrefixLength="2" /> 
                            </td>
                        </tr>
                        <tr>
                            <td align = "right">
                                <asp:Literal ID="m_litActive" runat="server" Text = "<%$ Resources: Default, LoginStatus %>" />
                            </td>
                            <td>
                                <%--<asp:DropDownList ID="m_ddlActive" runat="server">
                                    <asp:ListItem Text="<%$ Resources: Default, BothListItem %>" Value="B" />
                                    <asp:ListItem Text="<%$ Resources: Default, YesListItem %>" Value="Y" />
                                    <asp:ListItem Text="<%$ Resources: Default, NoListItem %>" Value="N" />
                                </asp:DropDownList>--%>
                                <asp:RadioButtonList id="m_rdolistLoginStatus" runat="server" DataTextField="RefName" DataValueField="ID" RepeatDirection="Horizontal" />
                            </td>
                            <td align = "right">
                                <asp:Literal ID="m_litPageSize" runat="server" Text = "<%$ Resources: Default, RecordsperpageLabel %>" />
                            </td>
                            <td>
                                <asp:DropDownList ID="m_ddlPageSize" runat="server">
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>   
   <div class="masterpadding"></div> 
   
    <div class="subpanelheader hr">
        <img id="m_imgSearchCriteria" runat="server" src="../../../images/Collapse_13x13.jpg" class="showstate" onclick="expandMasterSearch(this, 'm_pnlAdditionalCriteria')"
            alt="contract" />
        <asp:Literal ID="m_litAdditionalSearchCriteriaHeader" runat="server" Text="<%$ Resources: Default, AdditionalSearchCriteriaLabel %>"
             /></div>
            
    <div id="m_pnlAdditionalCriteria" style="<%=AdditionalCriteriaStyle %>">
        <div class="mastersubpanelAddition">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td align = "right" style="width:125px;">
                        <asp:Literal ID="m_litEmail" runat="server" Text = "<%$ Resources: UsersManagement, LabelUserEmail %>" />
                    </td>
                    <td style="width:180px;">
                        <asp:TextBox ID="m_txtEmail" runat="server" Width="165px"></asp:TextBox>
                    </td>
                    <td align = "right" style="width:150px;">
                        <asp:Literal ID="m_litLogin" runat="server" Text = "<%$ Resources: UsersManagement, LabelUserLogin %>" />
                    </td>
                    <td>
                        <asp:TextBox ID="m_txtLogin" runat="server" Width="165px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align = "right">
                        <asp:Literal ID="m_litWorkPhone" runat="server" Text = "<%$ Resources: UsersManagement, LabelUserPhoneNumber %>" />
                    </td>
                    <td>                       
                        <uc1:PhoneNumber ID="m_ucPhone" runat="server" Required="false" />                       
                    </td>
                    <td align = "right">
                        <asp:Literal ID="m_litPhoneExtension" runat="server" Text = "<%$ Resources: UsersManagement, LabelUserExtColon %>" />
                    </td>
                    <td>
                        <asp:TextBox ID="m_txtPhoneExtension" runat="server" Width="45px" MaxLength="6"></asp:TextBox>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    
    <div style="padding-left: 230px">
        <asp:Button ID="m_btnSearch" runat="server" Text="<%$ Resources: Default, ButtonSearch %>" CssClass="pagebutton"
            OnClick="m_btnSearch_Click" UseSubmitBehavior="False" />
        <input id="m_btnClear" type="button" runat="server" value="<%$ Resources: Default, ButtonClear %>" class="pagebutton" onclick="resetLoginStatus()" />
    </div>
    <asp:Panel ID="m_pnlSearchResults" runat="Server" Visible="False">
        <h2>
            <asp:Label ID = "Label1" runat = "server" Text = "<%$ Resources: Default, LabelSearchResults %>" />
            <asp:Label ID="m_lblStatus" runat="server" CssClass="successmessage" />
        </h2>           
    </asp:Panel>    
        
    
    <asp:Panel ID="m_pnlGridUsers" runat="server" Visible="False">
        <cc1:HitsSearchGridView ID="m_grdUsers" runat="server" AutoGenerateColumns="False"
            Width="100%" AllowPaging="True" OnRowDataBound="grdUsers_RowDataBound" OnRowCommand="grdUsers_RowCommand" OnPageIndexChanged="grdUsers_PageIndexChanged"
            OnPageIndexChanging="grdUsers_PageIndexChanging" OnMenuItemCommand="grdUsers_MenuItemCommand"
            ShowMenu="True" ShowSelectField="True" ShowActivateMenu="False" ShowDeActivateMenu="False"
            ShowEmailMenu="True" ShowPrintMenu="True" ShowHotlineMenu="False" ShowDeHotlineMenu="False"
            CustomPagerID="HitsPager1" ClientFunctionPrint="window.print();" OnCustomPageIndexChanged="grdUsers_PageIndexChanged"
            OnCustomPageIndexChanging="grdUsers_PageIndexChanging" 
            ShowDeleteMenu="True" ShowDeSelectMenu="True" ShowExportMenu="True" ShowSelectMenu="True"
            AtlasScriptManagerID="" ClientFunctionActivateSelected="" ClientFunctionDeActivateSelected=""
            ClientFunctionDeHotline="" ClientFunctionDelete="" ClientFunctionEmailSelected=""
            ClientFunctionExportSelected="" ClientFunctionHotline="" ClientFunctionSetStatus=""
            CssClassCustomPaging="" CssClassMenu="" PropagateActionToChildID="" ShowExportCSV="True"
            ShowExportCSVWithSummary="False" ShowExportXML="True" ShowExportXMLWithSummary="False"
            ShowSetStatus="False">
            <Columns>
                <asp:TemplateField ItemStyle-Width = "12%" ItemStyle-Height = "25px">
                    <headertemplate>
                                <asp:Literal runat="server" ID="m_litUserGridLoginColumnHeader" Text="<%$ Resources: UsersManagement, HeaderTextUserLogin %>"></asp:Literal>
                                <br />
                                <uc:CustomSorter runat="server" ID="m_csLogin" OnSortAscendingClicked="customSorter_SortClicked" OnSortDescendingClicked="customSorter_SortClicked" SortExpression="Login"></uc:CustomSorter>
                    </headertemplate>
                    <itemtemplate>
                                <asp:LinkButton ID = "m_lbLogin" runat = "server" Font-Underline="true" />
                    </itemtemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width = "12%" ItemStyle-Height = "25px">
                    <headertemplate>
                                <asp:Literal runat="server" ID="m_litUserGridLastNameColumnHeader" Text="<%$ Resources: UsersManagement, HeaderTextUserLastName %>"></asp:Literal>
                                <br />
                                <uc:CustomSorter runat="server" ID="m_csLastname" OnSortAscendingClicked="customSorter_SortClicked" OnSortDescendingClicked="customSorter_SortClicked" SortExpression="LastName"></uc:CustomSorter>
                    </headertemplate>
                    <itemtemplate>
                                <asp:Label ID = "m_lblLastName" runat = "server" />
                    </itemtemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width = "12%" ItemStyle-Height = "25px">
                    <headertemplate>
                                <asp:Literal runat="server" ID="m_litUserGridFirstNameColumnHeader" Text="<%$ Resources: UsersManagement, HeaderTextUserFirstName %>"></asp:Literal>
                                <br />
                                <uc:CustomSorter runat="server" ID="m_csFirstName" OnSortAscendingClicked="customSorter_SortClicked" OnSortDescendingClicked ="customSorter_SortClicked" SortExpression="FirstName" />
                    </headertemplate>
                    <itemtemplate>
                                <asp:Label ID = "m_lblFirstName" runat = "server" />
                    </itemtemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width = "16%" ItemStyle-Height = "25px">
                    <headertemplate>
                                <asp:Literal runat="server" ID="m_litUserGridDepartmentsColumnHeader" Text="<%$ Resources: UsersManagement, HeaderTextUserDepartments %>"></asp:Literal>
                                <br />
                                <uc:CustomSorter runat="server" ID="m_csDepartments" OnSortAscendingClicked="customSorter_SortClicked" OnSortDescendingClicked="customSorter_SortClicked" SortExpression="Departments" />
                    </headertemplate>
                    <itemtemplate>
                                <asp:Label  ID = "m_lblDepartments" runat = "server" />
                    </itemtemplate>
                </asp:TemplateField>
                 <asp:TemplateField ItemStyle-Width = "7%" ItemStyle-Height = "25px">
                    <headertemplate>
                                <asp:Literal runat="server" ID="m_litUserGridActiveColumnHeader" Text="<%$ Resources: Default, LoginStatus2 %>"></asp:Literal>
                                <br />
                                <uc:CustomSorter runat="server" ID="m_csActive" OnSortAscendingClicked="customSorter_SortClicked" OnSortDescendingClicked="customSorter_SortClicked" SortExpression="LOGIN_STATUS"></uc:CustomSorter>
                    </headertemplate>  
                    <itemtemplate>
                                <asp:Label ID = "m_lblActive" runat = "server" />
                    </itemtemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width = "12%" ItemStyle-Height = "25px">
                    <headertemplate>
                                <asp:Literal runat="server" ID="m_litUserGridWorkPhoneColumnHeader" Text="<%$ Resources: UsersManagement, HeaderTextUserWorkPhone %>"></asp:Literal>                    
                    </headertemplate>
                    <itemtemplate>
                                <asp:Label ID = "m_lblWorkPhone" runat = "server" />
                    </itemtemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width = "7%" ItemStyle-Height = "25px">
                    <headertemplate>
                                <asp:Literal runat="server" ID="m_litUserGridExtColumnHeader" Text="<%$ Resources: UsersManagement, HeaderTextUserExt %>"></asp:Literal>
                    </headertemplate>
                    <itemtemplate>
                                <asp:Label ID = "m_lblExtension" runat = "server"/>    
                    </itemtemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width = "22%" ItemStyle-Height = "25px">
                    <headertemplate>
                                <asp:Literal runat="server" ID="m_litUserGridEmailColumnHeader" Text="<%$ Resources: UsersManagement, HeaderTextUserEmail %>"></asp:Literal>
                                <br />
                                <uc:CustomSorter runat="server" ID="m_csEmail" OnSortAscendingClicked="customSorter_SortClicked" OnSortDescendingClicked="customSorter_SortClicked" SortExpression="Email" />
                    </headertemplate>
                    <itemtemplate>
                                <asp:HyperLink ID = "m_hypUserEmail" runat = "server" CssClass = "EmailBox" Font-Underline="true"/>
                    </itemtemplate>
                </asp:TemplateField>
                
            </Columns>
            <PagerTemplate>
                <cc1:HitsPager ID="HitsPager1" runat="server" GoButtonText="<%$ Resources: Default, GoButtonText %>" />
            </PagerTemplate>
            <PagerSettings Mode="NumericFirstLast" />
            <RowStyle HorizontalAlign="Left" VerticalAlign="Top" />
            <EditRowStyle HorizontalAlign="Left" VerticalAlign="Top" />
        </cc1:HitsSearchGridView>
        <br />
    </asp:Panel>
    
    <asp:Label ID="m_lblNoUserResultsFound" Font-Bold="True" ForeColor="Red" runat="server"
        Visible="False" Text="<%$ Resources: Default, LabelNoResultsFound %>" />
        
    <asp:ObjectDataSource ID="m_odsUser" runat="server" SelectMethod="Select" SelectCountMethod="SelectCount"
        TypeName="UserDataSource" EnablePaging="True">
        <SelectParameters>
            <asp:SessionParameter Name="userData" SessionField="UserSearchData_SessionKey"
                Type="Object" />
            
            
            <asp:ControlParameter ControlID="m_grdUsers" DefaultValue="" Name="startRowIndex" PropertyName="PageIndex"
                    Type="Int32" />
            <asp:Parameter DefaultValue="10" Name="maximumRows" Type="Int32" />
            <asp:SessionParameter Name="userSortExpression" SessionField="UserSortExpression" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>