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

<%@ 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" />
    
    <asp:Label ID="m_litSearchTip" runat="server" Text="<%$ Resources: Default, LabelSearchTip %>" CssClass="floatright" />
    
    <h1>
        <asp:Literal ID="m_litOrganizationManagementHeader" runat="server" Text="<%$ Resources: OrganizationManagement, OrganizationsHeaderLabel %>" />
    </h1>
    
    <uc:DefaultHeader ID="DefaultHeader1" runat="server" OnImportClicked="DefaultHeader1_ImportClick" />
    
    <div class="mastersearch">
        <img src="../../../images/Collapse_13x13.jpg" class="showstate" onclick="expandMasterSearch(this, 'm_pnlMasterSearchCriteria')"
            alt="contract" />
        <asp:Literal ID="m_litSearchOrganizations" 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>
                </td>
                <td align="right">
                    <asp:Literal ID="m_litOrgName" runat="server" Text="<%$ Resources: OrganizationManagement, LabelOrganizationNameColon %>"/>
                </td>
                <td>
                    <asp:TextBox ID="m_txtOrgName" runat="server" Width="165px" ></asp:TextBox>
                    <SmartAjaxToolkit:SmartAutoCompleteExtender ID="SmartAutoCompleteExtender1" runat="server"
                        OnAutoCompleteCallback="SearchOrganizationsIntellisense" TargetControlID="m_txtOrgName" UpdateMode="Callback"
                        EnableCaching="false" MinimumPrefixLength="2" />
                </td>
                <td align="right">
                    <asp:Literal ID="m_litPageSize" runat="server" Text="<%$ Resources: Default, LabelRecordsPerPageColon %>" />
                </td>
                <td>
                    <asp:DropDownList ID="m_ddlPageSize" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td align="right">
                    <asp:Literal ID="m_litOrgType" runat="server" Text="<%$ Resources: OrganizationManagement, OrganizationTypeLabel %>"/>
                </td>
                <td>
                    <asp:DropDownList ID="m_ddlOrgTypes" runat="server" Width="150px" >
                        <asp:ListItem Value="0" Text="<%$ Resources: OrganizationManagement, AllOrgDropDownItem %>"></asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td colspan="2">&nbsp;</td>
            </tr>
        </table>
        <div class="searchButtonsAlignment">
            <asp:Button ID="m_btnSearch" runat="server" Text="<%$ Resources: Default, ButtonSearch %>" CssClass="pagebutton"
                Font-Bold="False" OnClick="m_btnSearch_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"
                Text=" " />
        </h2>
    </asp:Panel>
    <div id="orgGrid">
    <asp:Panel ID="m_pnlOrganizationGrid" Visible="False" runat="server">
        <cc1:HitsSearchGridView ID="m_gvOrg" runat="server" AutoGenerateColumns="False" AllowPaging="True"
            OnRowDataBound="m_gvOrgRowDataBound" OnCustomPageIndexChanged="m_gvOrg_PageIndexChanged"
            OnCustomPageIndexChanging="m_gvOrg_PageIndexChanging" OnRowCommand="m_gvOrg_RowCommand"
            OnMenuItemCommand="m_gvOrg_MenuItemCommand"
            ShowMenu="True" ShowHotlineMenu="False" ShowDeHotlineMenu="False" CustomPagerID="HitsPager1"
            ShowSelectField="True" ClientFunctionPrint="window.print();" AtlasScriptManagerID=""
            ClientFunctionActivateSelected="" ClientFunctionDeActivateSelected="" ClientFunctionDeHotline=""
            ClientFunctionDelete="" ClientFunctionEmailSelected="" ClientFunctionExportSelected=""
            ClientFunctionHotline="" CssClassCustomPaging="" CssClassMenu="" PropagateActionToChildID=""
            ShowActivateMenu="True" ShowDeActivateMenu="True" ShowDeleteMenu="True" ShowDeSelectMenu="True"
            ShowEmailMenu="True" ShowExportCSV="True" ShowExportCSVWithSummary="False" ShowExportMenu="True"
            ShowExportXML="True" ShowExportXMLWithSummary="False" ShowPrintMenu="True" ShowSelectMenu="True" 
            ClientFunctionSetStatus="" ShowSetStatus="False">
            <Columns>
                <asp:TemplateField>
                    <headertemplate>
                        <asp:Literal runat="server" ID="m_litOrganizationText" Text="<%$ Resources: OrganizationManagement, OrganizationNameTableHeader %>"></asp:Literal>
                            <br />
                            <uc:CustomSorter runat="server" ID="m_csOrganization" SortExpression="CompanyName" OnSortAscendingClicked="customSorter_SortClicked" OnSortDescendingClicked="customSorter_SortClicked"></uc:CustomSorter>
                    </headertemplate>
                    <itemstyle width="14%" />
                    <itemtemplate>
                        <asp:LinkButton runat="server" ID="m_lbtnOrgName" Font-Underline="True" CommandName="Select"></asp:LinkButton>
                </itemtemplate>
                </asp:TemplateField>
                
                <asp:TemplateField Visible="False">
                    <headertemplate>
                        <asp:Literal runat="server" ID="m_litOrganizationHeader" Text="<%$ Resources: OrganizationManagement, IDLabel %>"></asp:Literal>
                        <br />
                       <uc:CustomSorter runat="server" ID="m_csOrganizationId" SortExpression="CompanyId" OnSortAscendingClicked="customSorter_SortClicked" OnSortDescendingClicked="customSorter_SortClicked"></uc:CustomSorter>
                </headertemplate>
                    <itemtemplate>
                            <asp:Literal runat="server" ID="m_litOrganizationId"></asp:Literal>
                    </itemtemplate>
                </asp:TemplateField>
                
                <asp:TemplateField>
                    <headertemplate>
                            <asp:Literal runat="server" ID="m_litOrganizationHeaderLoaderID" Text="<%$ Resources: OrganizationManagement, LoaderIDTableHeader %>"></asp:Literal>
                            <br />
                            <uc:CustomSorter runat="server" ID="m_csLoaderId" SortExpression="LoaderCompanyId" OnSortAscendingClicked="customSorter_SortClicked" OnSortDescendingClicked="customSorter_SortClicked"></uc:CustomSorter>
                    </headertemplate>
                    <itemstyle width="6%" />
                    <itemtemplate>
                            <asp:Literal runat="server" ID="m_litLoaderId"></asp:Literal>
                    </itemtemplate>
                </asp:TemplateField>

                <asp:TemplateField>
                    <headertemplate>
                            <asp:Literal runat="server" ID="m_litOrganizationHeaderCompanyID" Text="<%$ Resources: OrganizationManagement, CompanyIDTableHeader %>"></asp:Literal>
                            <br />
                            <uc:CustomSorter runat="server" ID="m_csCompanyId" SortExpression="LoaderCompanyId" OnSortAscendingClicked="customSorter_SortClicked" OnSortDescendingClicked="customSorter_SortClicked"></uc:CustomSorter>
                    </headertemplate>
                    <itemstyle width="7%" />
                    <itemtemplate>
                            <asp:Literal runat="server" ID="m_litCompanyId"></asp:Literal>
                    </itemtemplate>
                </asp:TemplateField>

                <asp:TemplateField>
                    <headertemplate>
                        <asp:Literal runat="server" ID="m_litOrganizationUrl" Text="<%$ Resources: OrganizationManagement, OrganizationUrlTableHeader %>"></asp:Literal>
                    </headertemplate>
                    <itemstyle width="14%" />
                    <itemtemplate>
                        <asp:HyperLink runat="server" ID="m_lbtnOrgUrl" Font-Underline="True"></asp:HyperLink>
                </itemtemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="<%$ Resources: OrganizationManagement, LoaderIDTableHeader %>">
                    <headertemplate>
                        <asp:Literal runat="server" ID="m_litModelDescription" Text="<%$ Resources: OrganizationManagement, OrganizationTypeTableLabel %>"></asp:Literal>
                        <br /><br />
                    </headertemplate>
                    <itemstyle />
                    <itemtemplate>
                        <asp:Literal runat="server" ID="m_litOrganizationTypeName"></asp:Literal>
                        <asp:HiddenField ID="m_hidOrganizationTypeId" runat="server" />
                    </itemtemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="<%$ Resources: OrganizationManagement, ActiveTableHeader %>">
                    <headertemplate>
                        <asp:Literal runat="server" ID="m_litActiveHead" Text="<%$ Resources: OrganizationManagement, ActiveTableLabel %>"></asp:Literal>
                            <br /><br />
                    </headertemplate>
                    <itemstyle width="50px" />
                    <itemtemplate>
                            <asp:Literal runat="server" ID="m_litActive"></asp:Literal>
                    </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>
    </asp:Panel>
    </div>
    <asp:Label ID="m_lblNoOrgsFound" Font-Bold="True" ForeColor="Red" runat="server"
        Visible="False" Text="<%$ Resources: OrganizationManagement, LabelNoResultsFound %>"/>

    <asp:ObjectDataSource ID="m_objOrgDataSource" runat="server" SelectMethod="Select"
        SelectCountMethod="SelectCount" TypeName="OrganizationDataSource" EnablePaging="True">
        <SelectParameters>
            <asp:SessionParameter Name="companySearchCriteria" SessionField="OrgData" Type="Object" DefaultValue="null" />
            <asp:ControlParameter Name="startRowIndex" PropertyName="PageIndex" Type="Int32" ControlID="m_gvOrg"  />
            <asp:Parameter DefaultValue="10" Name="maximumRows" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    
    <asp:Literal ID="m_litJSHelper" runat="server"/>
</asp:Content>