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

<%@ Register Src="~/Controls/PhoneNumber.ascx" TagName="PhoneNumber" TagPrefix="uc1" %>
<%@ Register Src="~/Controls/DefaultHeader.ascx" TagName="DefaultHeader" TagPrefix="uc" %>
<%@ Register Src="~/Controls/ScriptingHelper.ascx" TagName="ScriptingHelper" 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">
        <cc1:ExtendedValidationSummary ID="m_extValidationSummaryTop" runat="server" HeaderText="<%$ Resources: OrganizationManagement, LabelSelectOrganizationUnit %>" Width="1186" />

    <script src="../../../script/eSetFormControls.js" type="text/javascript"></script>

    <script src="../../../script/eGridHelper.js" type="text/javascript"></script>

    <uc:ScriptingHelper ID="ScriptingHelper1" runat="server" />
    <table width="100%">
        <tr>
            <td>
                <h1>
                    <asp:Literal ID="m_litOrganizationUnitManagementHeader" runat="server" Text="<%$ Resources: OrganizationManagement, HeaderTextOrganizationUnits %>"
                        />
                </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_litSearchOrganizationUnitsHeader" runat="server" Text="<%$ Resources: Default, LabelSearchCriteria %>" />
    </div>
    <div id="m_pnlMasterSearchCriteria" style="background-color: #DBDCDE">
        <b><span style="color: #ff0000">*</span></b>
        <asp:Label ID="lblRequired" runat="server" Text="<%$ Resources : Default,LabelIndicatesRequiredFields %>"></asp:Label>
        <table border="0" cellpadding="0" cellspacing="0" class="gvTable" width="100%">
            <tr>
                <td>
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td align = "right">
                                <asp:Literal ID="m_litOrganizationUnitName" runat="server" Text="<%$ Resources: OrganizationManagement, LabelOrganizationNameColon %>"/>
                                <b><span style="color: #ff0000">*</span></b>
                            </td>
                            <td>
                                <%--<asp:TextBox ID="m_txtOrgUnitName" runat="server" Width="165px" TabIndex="1"></asp:TextBox>
                               <SmartAjaxToolkit:SmartAutoCompleteExtender ID="SmartAutoCompleteExtender1" runat="server"
                                OnAutoCompleteCallback="SearchOrganizationUnits" TargetControlID="m_txtOrgUnitName"
                                UpdateMode="Callback" EnableCaching="false" MinimumPrefixLength="2" /> --%>
                                <asp:DropDownList ID="m_ddlOrgs" runat="server" Width="171px">
                                    <asp:ListItem Value="0" Text="<%$ Resources: OrganizationManagement, AllOrgDropDownItem %>"></asp:ListItem>
                                </asp:DropDownList>

                        <asp:CustomValidator ID="m_cvOrgType" runat="server" ControlToValidate="m_ddlOrgs"
                        Text="<%$ Resources:Default, ValidatorText %>" OnServerValidate="m_ddlOrgs_ServerValidate"
                        ErrorMessage="<%$ Resources: OrganizationManagement, LabelOrganizationUnitNameSearchRequired %>"
                        ToolTip="<%$ Resources: OrganizationManagement, LabelOrganizationUnitNameSearchRequired %>" />
                            </td>
                            <td align = "right">
                                <asp:Literal ID="m_litLocationId" runat="server" Text="<%$ Resources: OrganizationManagement, LabelLocationIDColon %>" />
                            </td>
                            <td>
                                <asp:TextBox ID="m_txtLocationID" runat="server" Width="165px" TabIndex="2"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td align = "right" style="height: 27px">
                                <asp:Literal ID="m_litOrganizationUnitType" runat="server" Text="<%$ Resources: OrganizationManagement, LabelOrganizationUnitTypeColon %>"
                                    />
                            </td>
                            <td style="height: 27px">
                                <asp:DropDownList ID="m_ddlOrgUnitType" runat="server" Width="171px" TabIndex="3">
                                    <asp:ListItem Text="<%$ Resources: Default, ListItemAll %>"></asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td align = "right" style="height: 27px">
                                <asp:Literal ID="m_litPhoneNumber" runat="server" Text="<%$ Resources: UsersManagement, LabelUserPhoneNumber %>" /></td>
                            <td style="height: 27px">
                                <uc1:PhoneNumber ID="m_ucPhoneNumber" runat="server" Required="false" />
                                </td>
                        </tr>
                        <tr>
                            <td align = "right">
                                <asp:Literal ID="m_litCity" runat="server" Text="<%$ Resources: AddressResources, City %>" />
                            </td>
                            <td>
                                <asp:TextBox ID="m_txtCity" runat="server" Width="165px" TabIndex="5"></asp:TextBox>
                               <SmartAjaxToolkit:SmartAutoCompleteExtender ID="SmartAutoCompleteExtender2" runat="server"
                                OnAutoCompleteCallback="SearchCity" TargetControlID="m_txtCity"
                                UpdateMode="Callback" EnableCaching="false" MinimumPrefixLength="2" /> 
                                </td>
                            <td align = "right">
                                <asp:Label ID="m_lblTable1BodyRow42" runat="server" 
                                    Text="<%$ Resources: UsersManagement, LabelUserExtColon %>"></asp:Label></td>
                            <td>
                                <asp:TextBox ID="m_txtPhoneExtension" runat="server" Width="50px" TabIndex="6"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td align = "right">
                                <asp:Literal ID="m_litMainContact" runat="server" Text="<%$ Resources: OrganizationManagement, LabelMainContactLastNameColon %>"
                                    /></td>
                            <td>
                                <asp:TextBox ID="m_txtLastName" runat="server" TabIndex="7" Width="165px"></asp:TextBox></td>
                            <td align = "right">
                                <asp:Literal ID="m_litCountry" runat="server" Text="<%$ Resources: AddressResources, Country  %>" /></td>
                            <td>
                                <asp:DropDownList ID="m_ddlCountry" runat="server" TabIndex="8" OnSelectedIndexChanged="m_ddlCountry_SelectedIndexChanged" AutoPostBack="true">
                                    <asp:ListItem Text="<%$ Resources: Default, ListItemAll %>"></asp:ListItem>
                                </asp:DropDownList></td>
                        </tr>
                        <tr>
                            <td align = "right">
                                <asp:Literal ID="m_litZip" runat="server" Text="<%$ Resources: AddressResources, Zip %>" />
                            </td>
                            <td>
                                <asp:TextBox ID="m_txtZip" runat="server" Width="60px" TabIndex="9"></asp:TextBox>
                               <SmartAjaxToolkit:SmartAutoCompleteExtender ID="SmartAutoCompleteExtender3" runat="server"
                                OnAutoCompleteCallback="SearchZipCodes" TargetControlID="m_txtZip"
                                UpdateMode="Callback" EnableCaching="false" MinimumPrefixLength="2" />  
                               </td>
                            <td align = "right">
                                <asp:Literal ID="m_litState" runat="server" Text="<%$ Resources: AddressResources, State  %>" /></td>
                            <td>
                                <asp:DropDownList ID="m_ddlState" runat="server" TabIndex="10">
                                    <asp:ListItem Text="<%$ Resources: Default, ListItemAll %>"></asp:ListItem>
                                </asp:DropDownList></td>
                        </tr>
                        <tr>
                            <td align = "right">
                                <asp:Literal ID="m_litPageSize" runat="server" Text="<%$ Resources: HandsetManagement, LabelRecordsPerPageColon %>" />
                            </td>
                            <td>
                                <asp:DropDownList ID="m_ddlPageSize" runat="server">
                                    <asp:ListItem Text="20" Value="20"></asp:ListItem>
                                    <asp:ListItem Text="50" Value="50"></asp:ListItem>
                                    <asp:ListItem Text="100" Value="100"></asp:ListItem>
                                   <%--<asp:ListItem Text="<%$ Resources: Default, ListItemAll %>" Value = "0"></asp:ListItem> --%>
                                </asp:DropDownList>
                            </td>
                            <td align = "right">
                                <asp:Literal ID="m_litFulfillmentLocation" runat="server" Text="<%$ Resources: FulfillmentManagement, LabelFulfillmentLocationColon %>"
                                    />
                            </td>
                            <td>
                                <asp:CheckBox ID="m_chkFulfillmentLocation" runat="server" TabIndex="11" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <div style="padding-left: 275px; background-color: White">
            <asp:Button ID="m_btnSetFilter" runat="server" Text="<%$ Resources: Default, ButtonSearch %>" CssClass="pagebutton"
                OnClick="m_btnSetFilter_Click" />
            <input id="m_btnClear" type="button" runat="server" value="<%$ Resources: Default, ButtonClear %>" class="pagebutton"
                />
        </div>
    </div>
    <asp:Panel ID="m_pnlSearchResults" runat="server">
        <h2>
           <asp:Literal ID="m_litSearchResultsHeader" runat="server" Text="<%$ Resources: Default, LabelSearchResults %>"  />
           <asp:Label ID="m_lblSuccessMessage" runat="server" CssClass="successmessage" Visible="False" /> 
           <asp:Label ID="m_lblFailureMessage" runat="server" CssClass="failuremessage" Visible="False" /> 
        </h2>
    </asp:Panel>
    <cc1:HitsSearchGridView ID="m_gvOrgUnit" runat="server" AutoGenerateColumns="False"
        CssClass="gvTable" AllowPaging="True" ShowMenu="True" ShowSelectField="True"
        ClientFunctionEmailSelected="EmailAllSelected();" CustomPagerID="HitsPager1"
        OnMenuItemCommand="m_gvOrgUnit_MenuItemCommand" OnCustomPageIndexChanged="m_gvOrgUnit_PageIndexChanged"
        OnCustomPageIndexChanging="m_gvOrgUnit_PageIndexChanging" OnRowDataBound="m_gvOrgUnit_RowDataBound"
        RowStyle-VerticalAlign="Top" ShowActivateMenu="False" ShowDeActivateMenu="False"
        ShowEmailMenu="False" ShowHotlineMenu="False" ShowDeHotlineMenu="False" ClientFunctionPrint="window.print();" AtlasScriptManagerID="" ClientFunctionActivateSelected="" ClientFunctionDeActivateSelected="" ClientFunctionDeHotline="" ClientFunctionDelete="" ClientFunctionExportSelected="" ClientFunctionHotline="" ClientFunctionSetStatus="" CssClassCustomPaging="" CssClassMenu="" PropagateActionToChildID="" ShowDeleteMenu="True" ShowDeSelectMenu="True" ShowExportCSV="True" ShowExportCSVWithSummary="False" ShowExportMenu="True" ShowExportXML="True" ShowExportXMLWithSummary="False" ShowPrintMenu="True" ShowSelectMenu="True" ShowSetStatus="False">
        <Columns>
            
            <asp:TemplateField>
                <headertemplate>
                            <asp:Literal runat="server" ID="m_litOrganizationUnitNameHeader" Text="<%$ Resources: OrganizationManagement, HeaderTextOrganizationUnitName %>"></asp:Literal>
                            <br />
                            <uc:CustomSorter runat="server" ID="m_csOrganizationUnitName" SortExpression="OrganizationUnitName" OnSortAscendingClicked="CustomSorter_Clicked" OnSortDescendingClicked="CustomSorter_Clicked"></uc:CustomSorter>
                    </headertemplate>
                <itemstyle width="250px" />
                <itemtemplate>
                            <asp:LinkButton runat="server" ID="m_lbOrgUnitName" Font-Underline="True" Text="<%# ((HITSWebService.OrganizationUnitData)Container.DataItem).OrganizationUnitName %>" OnClick="m_lbOrgUnitName_Click"></asp:LinkButton>
                    </itemtemplate>
            </asp:TemplateField>
            
             <asp:TemplateField>
                <headertemplate>
                    <asp:Literal runat="server" ID="m_litStoreOwnedByHeader" Text="<%$ Resources: OrganizationManagement, HeaderTextStoreOwnedBy %>"></asp:Literal>
                    <br />
                    <uc:CustomSorter runat="server" ID="m_csStoreOwnedBy" OnSortAscendingClicked="CustomSorter_Clicked" OnSortDescendingClicked="CustomSorter_Clicked"></uc:CustomSorter>
                </headertemplate>
                <itemstyle width="80px" />
                <itemtemplate>
                        <asp:Label runat="server" ID="m_lblStoreOwnedBy"></asp:Label>
                </itemtemplate>
            </asp:TemplateField>
             
            <asp:TemplateField>
                <headertemplate>
                    <asp:Literal runat="server" ID="m_litOrganizationUnitTypeNameHeader" Text="<%$ Resources: OrganizationManagement, HeaderTextType %>"></asp:Literal>
                    <br />
                    <uc:CustomSorter runat="server" ID="m_csOrganizationUnitTypeName" SortExpression="OrganizationUnitTypeName" OnSortAscendingClicked="CustomSorter_Clicked" OnSortDescendingClicked="CustomSorter_Clicked"></uc:CustomSorter>
                </headertemplate>
                <itemstyle width="80px" />
                <itemtemplate>
                        <asp:Label runat="server" ID="m_lblOrganizationUnitTypeName"></asp:Label>
                </itemtemplate>
            </asp:TemplateField>
            
             <asp:TemplateField>
                <headertemplate>
                    <asp:Literal runat="server" ID="m_litOrganizationUnitTypeHeader" Text="<%$ Resources: OrganizationManagement, HeaderTextOrgUnitType %>"></asp:Literal>
                    <br />
                    <uc:CustomSorter runat="server" ID="m_csOrganizationUnitType" SortExpression="OrganizationUnitType" OnSortAscendingClicked="CustomSorter_Clicked" OnSortDescendingClicked="CustomSorter_Clicked"></uc:CustomSorter>
                </headertemplate>
                <itemstyle width="80px" />
                <itemtemplate>
                        <asp:Label runat="server" ID="m_lblOrganizationUnitType"></asp:Label>
                </itemtemplate>
            </asp:TemplateField>
            
            <asp:TemplateField>
                <headertemplate>
                    <asp:Literal runat="server" ID="m_litLocIDHeader" Text="<%$ Resources: OrganizationManagement, HeaderTextLocID %>"></asp:Literal>
                    <br />
                    <uc:CustomSorter runat="server" ID="m_csLocID" SortExpression="LocID" OnSortAscendingClicked="CustomSorter_Clicked" OnSortDescendingClicked="CustomSorter_Clicked"></uc:CustomSorter>
                </headertemplate>            
                <itemstyle width="55px" />
                <itemtemplate>
                    <asp:Label runat="server" ID="m_lblLocID"></asp:Label>
                </itemtemplate>
            </asp:TemplateField>
            
           <asp:TemplateField HeaderText="Address">
               <edititemtemplate></edititemtemplate>
               
              <headertemplate>
                   <asp:Literal runat="server" ID="m_litAddress" Text="<%$ Resources: AddressResources, TableHeaderAddress %>"></asp:Literal><br /><br />
                </headertemplate>
                 
               <itemstyle width="295px" />
               <itemtemplate>
                     <asp:Label runat="server" Text="<%# ((HITSWebService.OrganizationUnitData)Container.DataItem).Address1 %>" ID="m_lblAddress"></asp:Label>
                     <asp:Label runat="server" Text="<%# ((HITSWebService.OrganizationUnitData)Container.DataItem).Address2 %>" ID="m_lblAddress2"></asp:Label>
                     <br />
                     <asp:Label runat="server" Text="<%# ((HITSWebService.OrganizationUnitData)Container.DataItem).City %>" ID="m_lblCity"></asp:Label>,
                     <asp:Label runat="server" Text="<%# ((HITSWebService.OrganizationUnitData)Container.DataItem).State %>" ID="m_lblState"></asp:Label>
                      <asp:Label runat="server" Text="<%# ((HITSWebService.OrganizationUnitData)Container.DataItem).PostalCode %>" ID="m_lblZipCode"></asp:Label>
                      <asp:Label runat="server" Text="<%# ((HITSWebService.OrganizationUnitData)Container.DataItem).Country %>" ID="m_lblCountry"></asp:Label>
                </itemtemplate>
            </asp:TemplateField>
            <asp:TemplateField ShowHeader="False">
                <headertemplate>
                    <asp:Literal runat="server" ID="m_litOrgUnitContactsHeader" Text="<%$ Resources: OrganizationManagement, ContactsTableHeader %>"></asp:Literal>
                    <br />
                    <uc:CustomSorter runat="server" ID="m_csContacts" OnSortAscendingClicked="CustomSorter_Clicked" OnSortDescendingClicked="CustomSorter_Clicked"></uc:CustomSorter>
                </headertemplate>
                <ItemStyle Width="20%"></ItemStyle>
                <ItemTemplate>
                    <asp:LinkButton runat="server" ID="m_lbtnContact" Font-Underline="True" OnClick="m_lbtnContact_Click"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
                        
            <asp:TemplateField ShowHeader="False">
                <headertemplate>
                    <asp:Literal runat="server" ID="m_litOrgUnitTelephoneHeader" Text="<%$ Resources: OrganizationManagement, TelephoneTableHeader %>"></asp:Literal>
                    <br />
                    <uc:CustomSorter runat="server" ID="m_csTelephone" OnSortAscendingClicked="CustomSorter_Clicked" OnSortDescendingClicked="CustomSorter_Clicked"></uc:CustomSorter>
                </headertemplate>
                <ItemStyle Width="25%"></ItemStyle>
                <ItemTemplate>
                    <asp:Label runat="server" ID="m_lblPhone"></asp:Label>
                    <asp:Label runat="server" ID="m_lblExtension"></asp:Label>
                    <br />
                    <asp:Label runat="server" ID="m_lblFax"></asp:Label>
                    <br />
                    <asp:HyperLink runat="server" Text="<%# ((HITSWebService.OrganizationUnitData)(Container.DataItem)).MainPhone %>" CssClass="EmailBox" Font-Underline="True" ID="m_hlEmail" ></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <headertemplate>
                    <asp:Literal runat="server" ID="m_litRepLocHeader" Text="<%$ Resources: OrganizationManagement, HeaderTextReplenishmentLocation %>"></asp:Literal>
                    <br />
                    <uc:CustomSorter runat="server" ID="m_csRepLoc" OnSortAscendingClicked="CustomSorter_Clicked" OnSortDescendingClicked="CustomSorter_Clicked"></uc:CustomSorter>
                </headertemplate>
                <itemstyle width="80px" />
                <itemtemplate>
                        <asp:Label runat="server" ID="m_lblRepLoc"></asp:Label>
                </itemtemplate>
            </asp:TemplateField>
            
            <asp:TemplateField>
                <headertemplate>
                    <asp:Literal runat="server" ID="m_litLandmarksHeader" Text="<%$ Resources: FulfillmentManagement, LabelLandmarks %>"></asp:Literal>
                    <br />
                    <uc:CustomSorter runat="server" ID="m_csLandmarks" OnSortAscendingClicked="CustomSorter_Clicked" OnSortDescendingClicked="CustomSorter_Clicked"></uc:CustomSorter>
                </headertemplate>
                <itemstyle width="200px" />
                <itemtemplate>
                        <asp:Label runat="server" ID="m_lblLandmarks"></asp:Label>
                </itemtemplate>
            </asp:TemplateField>
            
            <asp:TemplateField>
                <headertemplate>
            <asp:Literal runat="server" ID="m_litHoursOfOperation" Text="<%$ Resources: OrganizationManagement, HeaderTextHoursOfOperation %>"></asp:Literal>
                                <br />
                                <uc:CustomSorter runat="server" ID="m_csHoursOfOperation" SortExpression="HoursOfOperations" OnSortAscendingClicked="CustomSorter_Clicked" OnSortDescendingClicked="CustomSorter_Clicked"></uc:CustomSorter>
            </headertemplate>
                <itemstyle width="200px" />
                <itemtemplate>
            <asp:Label runat="server" ID="m_lblHoursOfOperation"></asp:Label>
            </itemtemplate>
            </asp:TemplateField>
            
            <asp:TemplateField>
                <headertemplate>
            <asp:Literal runat="server" ID="m_litFulfillmentLocationHeader" Text="<%$ Resources: FulfillmentManagement, HeaderTextFulDotLocDot %>"></asp:Literal>
                                <br />
                                <uc:CustomSorter runat="server" ID="m_csFulfillmentLocation" SortExpression="FulfillmentLocation" OnSortAscendingClicked="CustomSorter_Clicked" OnSortDescendingClicked="CustomSorter_Clicked"></uc:CustomSorter>
            </headertemplate>
                <itemstyle width="70px" />
                <itemtemplate>
            <asp:Label runat="server" ID="m_lblFulfillmentLocation"></asp:Label>
            </itemtemplate>
            </asp:TemplateField>
            
            <asp:TemplateField HeaderText="<%$ Resources: OrganizationManagement, HeaderTextOrgUnitId %>" Visible="False" >
                <itemtemplate>
            <asp:Label runat="server" Text="<%# ((HITSWebService.OrganizationUnitData)Container.DataItem).OrganizationUnitId %>" ID="m_lblOrgUnitId"></asp:Label>
            </itemtemplate>
            </asp:TemplateField>
            
        </Columns>
        
        <PagerTemplate>
            <cc1:HitsPager ID="HitsPager1" runat="server" GoButtonText="<%$ Resources : Default, GoButtonText %>" />
        </PagerTemplate>
        <HeaderStyle CssClass="thead" />
        <AlternatingRowStyle CssClass="alt" />
        <PagerSettings Mode="NumericFirstLast" />
        <RowStyle VerticalAlign="Top" />
    </cc1:HitsSearchGridView>
    <asp:Label ID="m_lblNoOrgUnitsFound" Font-Bold="True" ForeColor="Red" runat="server"
        Visible="False" Text="<%$ Resources: Default, LabelNoResultsFound %>"  />
    <asp:ObjectDataSource ID="odsOrgUnit" runat="server" SelectMethod="Select" TypeName="OUDataSource"
        EnablePaging="True" SelectCountMethod="SelectCount">
        <SelectParameters>
            <asp:SessionParameter Name="objOrgUnit" SessionField="OrgUnit" Type="Object" />
            <asp:ControlParameter ControlID="m_gvOrgUnit"  Name="startRowIndex"
                PropertyName="PageIndex" Type="Int32" />
            <asp:Parameter DefaultValue="10" Name="maximumRows" Type="Int32" />
            <asp:SessionParameter Name="strOrganizationUnitSortCriteria" SessionField="OrganizationUnitSortExpression_SessionKey"
                Type="Object" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:Literal ID="m_litJSHelper" runat="server"/>
</asp:Content>