<%@ page language="C#" autoeventwireup="true" enableeventvalidation="false" inherits="Forms_Firmware_Upgrade, App_Web_5q3yf04y" %>

<%@ Register Assembly="TimePicker" Namespace="MKB.TimePicker" TagPrefix="MKB" %>
<%@ Register Src="~/UserControls/New_Header.ascx" TagPrefix="uc1" TagName="header" %>
<%@ Register Src="~/UserControls/New_Footer.ascx" TagPrefix="uc2" TagName="footer" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<%--<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.2, Version=8.2.10.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.2, Version=8.2.10.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.2, Version=8.2.10.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.2.Export" Namespace="DevExpress.Web.ASPxGridView.Export"
    TagPrefix="exp" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.2" Namespace="DevExpress.Web.ASPxEditors"
    TagPrefix="dxe" %>--%>

<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dxw" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Page-Enter" content="blendTrans(Duration=0)" />
    <meta http-equiv="Page-Exit" content="blendTrans(Duration=0)" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>tSense-IoT Firmware Upgrade</title>
    <link id="reset" runat="server" href="../css/reset.css" rel="stylesheet" type="text/css" />
    <link id="stylesheet2" runat="server" href="../css/stylesheet2.css" rel="stylesheet" type="text/css" />
    <link id="dropdown" runat="server" href="../css/dropdown.css" rel="stylesheet" type="text/css" />

    <%--Custom Theme for DevEx 14.2--%>
    <link id="GridView" runat="server" type="text/css" href="~/App_Themes/Office2003Blue/GridView/grid.css" rel="stylesheet" />
    <link id="Editors" runat="server" type="text/css" href="~/App_Themes/Office2003Blue/Editors/styles.css" rel="stylesheet" />

    <script src="../js/jquery-1.11.2.min.js" type="text/javascript"></script>
    <script src="../js/DateValidations.js" type="text/javascript"></script>

    <%--********* For Bootstrap Implementation *************--%>
    <link id="BootStrapCss" href="../css/bootstrap.css" runat="server" rel="stylesheet" type="text/css" />
    <link id="mainstyle" runat="server" href="../css/mainstyle.css" rel="stylesheet" type="text/css" />
    <%--********* End of Bootstrap Implementation *************--%>

    <script src="../js/wow.min.js"></script>
</head>
<body>
    <div id="container">
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
            </asp:ScriptManager>
            <uc1:header ID="ucHeader" runat="server" />
            <!-- Content Starts Here -->
            <div id="outer">
                <div id="inner">
                    <div id="float-wrap">
                        <!-- Main Content Starts Here -->
                        <div id="content">
                            <div class="content-wrap">
                                <div id="top-content">
                                    <div id="heading">
                                        <img class="icon" src="../images/configuration-icon.jpg" alt="" />
                                        <h1>
                                            <asp:Literal ID="lblConfigurationCaption" runat="server"></asp:Literal></h1>
                                        <%--<a href="Dashboard.aspx"><asp:Label ID="lblHomeCaption" Text="Home" runat="server"></asp:Label></a>--%>
                                        <asp:LinkButton ID="lnkHomeCaption" runat="server"></asp:LinkButton>
                                        <span>&gt;</span><span><a href="ConfigurationSetup.aspx">
                                            <asp:Label ID="lblDeviceCaption" Text="Device" runat="server"></asp:Label></a></span><span>
                                            &gt;</span><span><a href="Firmware_upgrade.aspx"><asp:Label ID="lblUpgradeCaption"
                                                Text="Upgrade" runat="server"></asp:Label></a></span>
                                    </div>
                                    <div id="control-box">
                                        <table border="0" cellpadding="0" cellspacing="0" id="control-tbl" width="100%">
                                            <tr>
                                                <td>
                                                    <%-- <dxw:ASPxComboBox ID="imgcombo" runat ="server" ItemImage-Url="images/073.png"></dxw:ASPxComboBox>--%>
                                                </td>
                                                <td>
                                                    <div id="control-btn">
                                                        <span>&nbsp;</span>
                                                        <asp:ImageButton ID="lnkViewUpgradeHistory" runat="server" ImageUrl="~/images/btn-upgrade-history.jpg"
                                                            OnClick="lnkViewUpgradeHistory_Click" />
                                                        <asp:ImageButton ID="lnkUpgradeFirmware" runat="server" ImageUrl="~/images/btn-upgrade-firmware.jpg"
                                                            OnClick="lnkUpgradeFirmware_Click" />
                                                        <asp:ImageButton ID="btnBack" runat="server" PostBackUrl="~/Forms/ConfigurationSetup.aspx"
                                                            ImageUrl="~/Images/btn-back-to-configuration.jpg" />
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div class="clear clearfix">
                                    </div>
                                </div>
                                <div class="clear clearfix">
                                </div>
                                <asp:Panel ID="pnlUploadFirmwareFile" runat="server" Style="display: none; position: absolute; top: 150px; left: 150px; width: 500px; height: 240px;">
                                    <asp:UpdatePanel ID="upServiceCategory" runat="server" UpdateMode="Conditional">
                                        <ContentTemplate>
                                            <div id="con">
                                                <table cellpadding="0" cellspacing="0" border="0" width="96%" class="popup">
                                                    <tr>
                                                        <td class="top-l">&nbsp;
                                                        </td>
                                                        <td class="top-m">&nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="left">&nbsp;
                                                        </td>
                                                        <td>
                                                            <div class="top">
                                                                <h1>
                                                                    <asp:Label ID="lblFirmwareUploadHeading" Text="Upload Firmware Version" runat="server"></asp:Label></h1>
                                                                <div class="close">
                                                                    <asp:ImageButton ID="ibtClose" runat="server" OnClientClick="CategoryPopup(false);"
                                                                        ImageUrl="~/Images/popup-close.gif" />
                                                                </div>
                                                                <div class="clear clearfix">
                                                                </div>
                                                            </div>
                                                            <div class="popup-cont">
                                                                <table class="form-tbl" width="85%" border="0" cellspacing="0" cellpadding="0">
                                                                    <tr>
                                                                        <td>
                                                                            <asp:Label ID="lblFirmwareCategoryy" runat="server" Text="Firmware Category"></asp:Label>
                                                                            <span class="redtxt">*</span>
                                                                        </td>
                                                                        <td>
                                                                            <asp:DropDownList ID="DropDownList4" runat="server" align="Left" cellpadding="2"
                                                                                TabIndex="1">
                                                                            </asp:DropDownList>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>
                                                                            <asp:Label ID="lblFirmwareVersionUpload" runat="server" Text="Firmware File"></asp:Label>
                                                                        </td>
                                                                        <td>
                                                                            <asp:FileUpload ID="fuFirmwareFile" runat="server" TabIndex="2" />
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td></td>
                                                                        <td>
                                                                            <table cellpadding="0" cellspacing="0" border="0" style="padding-left: 0px">
                                                                                <tr>
                                                                                    <td style="padding-left: 0px">
                                                                                        <asp:ImageButton ID="ibtnSaveFirmwareVersion" runat="server" CausesValidation="true"
                                                                                            TabIndex="3" ImageUrl="~/images/btn-save.jpg" OnClientClick="return ValidationFirmwareUpgrade(true);"
                                                                                            OnClick="ibtnSaveFirmwareVersion_Click" />
                                                                                    </td>
                                                                                    <td>
                                                                                        <asp:ImageButton ID="ibtnCancelFirmwareUpload" runat="server" ImageUrl="~/images/btn-cancel.jpg"
                                                                                            CausesValidation="false" onkeydown="return setFocus(event,'txtCategoryName');"
                                                                                            OnClientClick="CategoryPopup(false);" TabIndex="4" />
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="bottom-l">&nbsp;
                                                        </td>
                                                        <td class="bottom-m">&nbsp;
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                </asp:Panel>
                                <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <div class="form-box">
                                            <h1>
                                                <span class="icon">
                                                    <asp:Image runat="server" ID="imgFirmwareUpgrade" ImageUrl="../images/firmware-icon.gif" /></span>
                                                <asp:Label ID="lblFirmwareUpgrade" runat="server" Text="Firmware Upgrade"></asp:Label>
                                            </h1>
                                            <cc1:CalendarExtender ID="ceEndDate" CssClass="cal_Theme1" runat="server" Format="dd/MM/yyyy"
                                                TargetControlID="txtEndDate">
                                            </cc1:CalendarExtender>
                                            <cc1:CalendarExtender ID="ceStartDate" CssClass="cal_Theme1" runat="server" Format="dd/MM/yyyy"
                                                TargetControlID="txtStartDate">
                                            </cc1:CalendarExtender>
                                            <asp:Panel ID="pnlUpgradeFirmware" runat="server">
                                                <table border="0" cellpadding="0" cellspacing="0" class="form-tbl">
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblFleet" runat="server" Text="Fleet"></asp:Label>
                                                            <asp:Label ID="lblFleetReq" runat="server" ForeColor="Red">*</asp:Label>
                                                        </td>
                                                        <td>
                                                            <%--<dxw:ASPxComboBox runat="server" ID="ddlFleet" ClientInstanceName="ddlFleet"
                                                                        Width="200px" ValueType="System.String" CssFilePath="~/App_Themes/Office2003Blue/Editors/styles.css"
                                                                        CssPostfix="Office2003_Blue"  DropDownStyle="DropDownList"
                                                                        >
                                                                    </dxw:ASPxComboBox>--%>
                                                            <asp:DropDownList runat="server" ID="ddlFleet" align="Left" cellpadding="2" AutoPostBack="true" onchange="ShowPopUp();"
                                                                OnSelectedIndexChanged="ddlFleet_SelectedIndexChanged">
                                                            </asp:DropDownList>
                                                            <%--<cc1:CascadingDropDown ID="ddlFleet_CascadingDropDown" runat="server" LoadingText="Loading..."
                                                            Enabled="True" TargetControlID="ddlFleet" Category="Fleet" 
                                                            ServiceMethod="GetOrganizationList" ServicePath="~/Cascading_Drop_Down.asmx">
                                                        </cc1:CascadingDropDown>--%>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="lblVehicle" runat="server" Text="Vehicle"></asp:Label>
                                                            <asp:Label ID="lblVehReq" runat="server" ForeColor="Red">*</asp:Label>
                                                        </td>
                                                        <td>
                                                            <%--<dxw:ASPxComboBox runat="server" ID="ddlVehicle" ClientInstanceName="ddlVehicle"
                                                                        Width="200px" ValueType="System.String" CssFilePath="~/App_Themes/Office2003Blue/Editors/styles.css"
                                                                        CssPostfix="Office2003_Blue"  DropDownStyle="DropDownList"
                                                                        >
                                                                    </dxw:ASPxComboBox>--%>
                                                            <asp:DropDownList runat="server" ID="ddlVehicle" AutoPostBack="true" Width="275px" onchange="ShowPopUp();"
                                                                OnSelectedIndexChanged="ddlVehicle_SelectedIndexChanged">
                                                            </asp:DropDownList>
                                                            <%--<cc1:CascadingDropDown ID="ddlVehicle_CascadingDropDown" runat="server" LoadingText="Loading..."
                                                            Enabled="True" TargetControlID="ddlVehicle" Category="Vehicle" ParentControlID="ddlFleet"
                                                            ServiceMethod="GetOrganizationList" ServicePath="~/Cascading_Drop_Down.asmx">
                                                        </cc1:CascadingDropDown>--%>
                                                        </td>
                                                    </tr>
                                                    <tr id="trCurrentVersion" runat="server">
                                                        <td valign="middle">
                                                            <asp:Label ID="lblBoxIdd" runat="server" Text="Box Id"></asp:Label>
                                                        </td>
                                                        <td>
                                                            <%--<dxw:ASPxComboBox runat="server" ID="ddlFirmwareVersions" ClientInstanceName="ddlFirmwareVersions"
                                                                        Width="200px" ValueType="System.Int32" DropDownStyle ="DropDownList" AutoPostBack ="true"     CssFilePath="~/App_Themes/Office2003Blue/Editors/styles.css"
                                                                        CssPostfix="Office2003_Blue" EnableCallbackMode ="true" 
                                                                        >
                                                                    </dxw:ASPxComboBox>--%>
                                                            <asp:Label ID="lblBoxId" runat="server" align="Left" Font-Bold="true"></asp:Label>
                                                        </td>
                                                        <td valign="middle">
                                                            <asp:Label ID="lblCurrentFirmwareVersion" runat="server" Text="Current Firmware Version"></asp:Label>
                                                        </td>
                                                        <td width="50%">
                                                            <%--<dxw:ASPxComboBox runat="server" ID="ddlFirmwareVersions" ClientInstanceName="ddlFirmwareVersions"
                                                                        Width="200px" ValueType="System.Int32" DropDownStyle ="DropDownList" AutoPostBack ="true"     CssFilePath="~/App_Themes/Office2003Blue/Editors/styles.css"
                                                                        CssPostfix="Office2003_Blue" EnableCallbackMode ="true" 
                                                                        >
                                                                    </dxw:ASPxComboBox>--%>
                                                            <asp:Label ID="ddlCurrentFirmwareVersion" runat="server" align="Left" Font-Bold="true"
                                                                Width="100%"></asp:Label>
                                                            <%--<cc1:CascadingDropDown ID="ddlFirmwareVersionsCascadingDropDown" runat="server"  LoadingText="Loading..."
                                                            Enabled="True" TargetControlID="ddlFirmwareVersions" Category="Version" ParentControlID="ddlVehicle"
                                                            ServiceMethod="GetOrganizationList" ServicePath="~/Cascading_Drop_Down.asmx">
                                                        </cc1:CascadingDropDown>--%>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td valign="middle">
                                                            <asp:Label ID="lblFirmwareCategory" runat="server" Text="Firmware Category"></asp:Label>
                                                            <asp:Label ID="Label3" runat="server" ForeColor="Red">*</asp:Label>
                                                        </td>
                                                        <td>
                                                            <%--<dxw:ASPxComboBox runat="server" ID="ddlFirmwareVersions" ClientInstanceName="ddlFirmwareVersions"
                                                                        Width="200px" ValueType="System.Int32" DropDownStyle ="DropDownList" AutoPostBack ="true"     CssFilePath="~/App_Themes/Office2003Blue/Editors/styles.css"
                                                                        CssPostfix="Office2003_Blue" EnableCallbackMode ="true" 
                                                                        >
                                                                    </dxw:ASPxComboBox>--%>
                                                            <asp:DropDownList ID="ddlFirmwareCategory" runat="server" align="Left" AutoPostBack="true"
                                                                cellpadding="2" OnSelectedIndexChanged="ddlFirmwareCategory_SelectedIndexChanged">
                                                            </asp:DropDownList>
                                                        </td>
                                                        <td valign="middle">
                                                            <asp:Label ID="lblFirmwareVersions" runat="server" Text="Firmware Version"></asp:Label>
                                                            <asp:Label ID="lblFVReq" runat="server" ForeColor="Red">*</asp:Label>
                                                        </td>
                                                        <td>
                                                            <%-- <dxw:ASPxComboBox runat="server" ID="ddlFirmwareVersions" ClientInstanceName="ddlFirmwareVersions"
                                                                        Width="200px" ValueType="System.Int32" DropDownStyle ="DropDownList" AutoPostBack ="true"     CssFilePath="~/App_Themes/Office2003Blue/Editors/styles.css"
                                                                        CssPostfix="Office2003_Blue" EnableCallbackMode ="true" 
                                                                        >
                                                                    </dxw:ASPxComboBox>--%>
                                                            <asp:DropDownList ID="ddlFirmwareVersions" runat="server" align="Left" cellpadding="2"
                                                                Width="275px">
                                                            </asp:DropDownList>
                                                            <%--<cc1:CascadingDropDown ID="ddlFirmwareVersionsCascadingDropDown" runat="server"  LoadingText="Loading..."
                                                            Enabled="True" TargetControlID="ddlFirmwareVersions" Category="Version" ParentControlID="ddlVehicle"
                                                            ServiceMethod="GetOrganizationList" ServicePath="~/Cascading_Drop_Down.asmx">
                                                        </cc1:CascadingDropDown>--%>
                                                        </td>
                                                        <td></td>
                                                    </tr>
                                                    <tr id="trMandatory" runat="server">
                                                        <%--<td>
                                                    </td>--%>
                                                        <td colspan="3">
                                                            <asp:Label ID="Label2" runat="server" ForeColor="Red">*</asp:Label>&nbsp;
                                                        <asp:Label ID="lblIndicatesMandatory" runat="server">Required fields</asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr id="trUpdateButton" runat="server">
                                                        <td colspan="4">
                                                            <center>
                                                                <asp:ImageButton ID="btnUpgrade" runat="server" ImageUrl="~/images/btn-upgrade-firmware.jpg"
                                                                    OnClientClick="return validateOTAFilename();" OnClick="btnUpgrade_Click" Text="Upgrade Firmware" />
                                                                <asp:ImageButton ID="btnScheduleCommands" runat="server" OnClick="btnScheduleCommands_Click"
                                                                    ImageUrl="~/images/schedule-a-command.png"></asp:ImageButton>
                                                                <asp:ImageButton ID="lbtnScheduleListing" runat="server" OnClick="lbtnScheduleListing_Click"
                                                                    ImageUrl="~/images/btn-view-schedules.png"></asp:ImageButton>
                                                                <asp:ImageButton ID="btnFirmwareFileUpload" runat="server" ImageUrl="~/images/upload1.png"
                                                                    OnClientClick="CategoryPopup(true, this);" Text="Upload Firmware File" />
                                                            </center>
                                                        </td>
                                                    </tr>
                                                    <tr id="trSearch" runat="server">
                                                        <td>
                                                            <asp:Label ID="lblDateFrom" runat="server" Text="From Date"></asp:Label>
                                                        </td>
                                                        <%-- <td>
                                                        <asp:Label ID="lblDateFrom" runat="server" Text="Date"></asp:Label>
                                                    </td>--%>
                                                        <td style="margin: 0px; padding: 0px">
                                                            <table align="left" border="0" cellpadding="0" cellspacing="0">
                                                                <tr>
                                                                    <td>
                                                                        <asp:TextBox ID="txtStartDate" runat="server" CssClass="date" oncopy="return false"
                                                                            oncut="return false" onkeydown="doCheckBackSpaceOrDelete()" onkeypress="return false"
                                                                            onpaste="return false" ToolTip="dd/MM/yyyy"></asp:TextBox>
                                                                    </td>
                                                                    <td style="vertical-align: middle">
                                                                        <MKB:TimeSelector ID="tsFromHrs" runat="server" AmPm="AM" DisplaySeconds="False"
                                                                            CssClass="form-tbls" Hour="8" Font-Size="10pt" Height="37px" SelectedTimeFormat="Twelve">
                                                                        </MKB:TimeSelector>
                                                                        <%-- <asp:DropDownList ID="ddlFromHours" runat="server" CssClass="time" onchange="CheckTimePicker(this,'ddlFromAMPM');">
                                                                        <asp:ListItem>00</asp:ListItem>
                                                                        <asp:ListItem>01</asp:ListItem>
                                                                        <asp:ListItem>02</asp:ListItem>
                                                                        <asp:ListItem>03</asp:ListItem>
                                                                        <asp:ListItem>04</asp:ListItem>
                                                                        <asp:ListItem>05</asp:ListItem>
                                                                        <asp:ListItem>06</asp:ListItem>
                                                                        <asp:ListItem>07</asp:ListItem>
                                                                        <asp:ListItem>08</asp:ListItem>
                                                                        <asp:ListItem>09</asp:ListItem>
                                                                        <asp:ListItem>10</asp:ListItem>
                                                                        <asp:ListItem>11</asp:ListItem>
                                                                        <asp:ListItem>12</asp:ListItem>
                                                                    </asp:DropDownList>
                                                                    <asp:DropDownList ID="ddlFromAMPM" runat="server" CssClass="time">
                                                                        <asp:ListItem>AM</asp:ListItem>
                                                                        <asp:ListItem>PM</asp:ListItem>
                                                                    </asp:DropDownList>--%>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                        <td>
                                                            <asp:Label ID="lblDateTo" runat="server" Text="To Date"></asp:Label>
                                                        </td>
                                                        <td style="margin: 0px; padding: 0px">
                                                            <table align="left" cellpadding="0" cellspacing="0">
                                                                <tr>
                                                                    <td>
                                                                        <asp:TextBox ID="txtEndDate" runat="server" CssClass="date" oncopy="return false"
                                                                            oncut="return false" onkeydown="doCheckBackSpaceOrDelete()" onkeypress="return false"
                                                                            onpaste="return false" ToolTip="dd/MM/yyyy"></asp:TextBox>
                                                                    </td>
                                                                    <td style="vertical-align: middle">
                                                                        <MKB:TimeSelector ID="tsToHrs" runat="server" AmPm="AM" DisplaySeconds="False" Hour="8"
                                                                            CssClass="form-tbls" Font-Size="10pt" Height="37px" SelectedTimeFormat="Twelve">
                                                                        </MKB:TimeSelector>
                                                                        <%--<asp:DropDownList ID="ddlToHours" runat="server" CssClass="time" onchange="CheckTimePicker(this,'ddlToAMPM');">
                                                                        <asp:ListItem>00</asp:ListItem>
                                                                        <asp:ListItem>01</asp:ListItem>
                                                                        <asp:ListItem>02</asp:ListItem>
                                                                        <asp:ListItem>03</asp:ListItem>
                                                                        <asp:ListItem>04</asp:ListItem>
                                                                        <asp:ListItem>05</asp:ListItem>
                                                                        <asp:ListItem>06</asp:ListItem>
                                                                        <asp:ListItem>07</asp:ListItem>
                                                                        <asp:ListItem>08</asp:ListItem>
                                                                        <asp:ListItem>09</asp:ListItem>
                                                                        <asp:ListItem>10</asp:ListItem>
                                                                        <asp:ListItem>11</asp:ListItem>
                                                                        <asp:ListItem>12</asp:ListItem>
                                                                    </asp:DropDownList>
                                                                    <asp:DropDownList ID="ddlToAMPM" runat="server" CssClass="time">
                                                                        <asp:ListItem>AM</asp:ListItem>
                                                                        <asp:ListItem>PM</asp:ListItem>
                                                                    </asp:DropDownList>--%>
                                                                    </td>
                                                                    <td>
                                                                        <td>
                                                                            <asp:ImageButton ID="btnSearch" runat="server" ImageUrl="~/images/btn-search.jpg"
                                                                                OnClientClick="ShowPopUp()" OnClick="btnSearch_Click" Text="Search" />
                                                                        </td>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    <tr id="trIndicates" runat="server">
                                                        <td colspan="2">
                                                            <asp:Label ID="Label1" runat="server" ForeColor="Red">*</asp:Label>&nbsp;
                                                        <asp:Label ID="Label4" runat="server">indicates mandatory fields</asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4">
                                                            <div id="divMsg" runat="server" align="center" style="font-weight: bold;">
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <asp:Panel ID="pnlScheduleCmds" runat="server" Visible="false">
                                                        <tr>
                                                            <td>
                                                                <p style="white-space: nowrap">
                                                                    <asp:Label ID="lblToCaption" runat="server" Text="Retries Period"></asp:Label>
                                                                    <asp:Label ID="lblEffectiveTillMandatory" runat="server" ForeColor="Red">*</asp:Label>
                                                                </p>
                                                            </td>
                                                            <td>
                                                                <asp:DropDownList ID="ddlRetriesTime" runat="server">
                                                                    <asp:ListItem Text="1 Day" Value="1" Selected="True"></asp:ListItem>
                                                                    <asp:ListItem Text="3 Days" Value="3"></asp:ListItem>
                                                                    <asp:ListItem Text="7 Days" Value="7"></asp:ListItem>
                                                                </asp:DropDownList>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2">
                                                                <asp:Label ID="Label5" runat="server" ForeColor="Red">*</asp:Label>&nbsp;
                                                            <asp:Label ID="Label6" runat="server">Required Fields</asp:Label>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td class="label"></td>
                                                            <td class="dropdown">
                                                                <asp:ImageButton ID="ibtnSaveSchedules" runat="server" OnClientClick="return validateOTAFilename();"
                                                                    OnClick="btnUpgrade_Click" ImageUrl="~/images/schedule.png"></asp:ImageButton>
                                                                <asp:ImageButton ID="ibtnCancel" runat="server" ImageUrl="~/images/btn-cancel.jpg"
                                                                    OnClick="ibtnCancel_Click" />
                                                            </td>
                                                        </tr>
                                                    </asp:Panel>
                                                    <tr id="trProcessingBar" runat="server">
                                                        <td>&nbsp;
                                                        </td>
                                                        <td>&nbsp;
                                                        </td>
                                                        <td>&nbsp;
                                                        <table cellpadding="0" cellspacing="0" border="0" align="left" id="trTimer" runat="server"
                                                            visible="false">
                                                            <tr>
                                                                <td>
                                                                    <b>
                                                                        <p>
                                                                            <img alt="Processing" src="../images/loader12.gif" align="left" />
                                                                            Command is in-progress....
                                                                        </p>
                                                                    </b>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </asp:Panel>
                                        </div>
                                        <asp:Panel ID="pnlUpgradeHistory" runat="server" CssClass="ControlHide">
                                            <div id="grid-dsply">
                                                <div id="top">
                                                    <div class="left-col">
                                                        <span class="txt">
                                                            <asp:Label ID="Label11" Text="Firmware Upgrade History" runat="server"></asp:Label>
                                                        </span>
                                                    </div>
                                                    <div class="right-col">
                                                        <span class="dropdown">
                                                            <dxw:ASPxComboBox ID="ASPxCboExport" runat="server" ValueType="System.String" Width="80px" Height="20px"
                                                                ShowImageInEditBox="false" ItemImage-Height="12px" ClientInstanceName="ASPxCboExport" SelectedIndex="0"
                                                                CssFilePath="~/App_Themes/Office2003Blue/Editors/styles.css" CssPostfix="Office2003_Blue"
                                                                EnableTheming="true" Theme="Office2003Blue">
                                                                <Items>
                                                                    <dxw:ListEditItem ImageUrl="../images/icn-pdf.jpg" Text="pdf" Value="pdf" />
                                                                    <dxw:ListEditItem ImageUrl="../images/icn-excel.jpg" Text="xls" Value="xls" />
                                                                    <dxw:ListEditItem ImageUrl="../images/icn-excel-xlsx.png" Text="xlsx" Value="xlsx" />
                                                                    <dxw:ListEditItem ImageUrl="../images/icn-word.jpg" Text="rtf" Value="rtf" />
                                                                    <%--<dxw:ListEditItem ImageUrl="../images/icn-csv.gif" Text="csv" Value="csv" />--%>
                                                                </Items>
                                                            </dxw:ASPxComboBox>
                                                        </span><span class="txt">
                                                            <asp:ImageButton ID="btnExport" runat="server" ImageUrl="~/images/btn-export.jpg"
                                                                OnClick="btnExport_Click" /></span>
                                                    </div>
                                                </div>
                                                <div class="clear clearfix">
                                                </div>
                                                <dxw:ASPxGridView ID="gvData" ClientInstanceName="gvData" KeyFieldName="SlNo" runat="server"
                                                    Settings-ShowFilterRow="true" Width="100%" AutoGenerateColumns="False"
                                                    CssFilePath="~/App_Themes/Office2003Blue/GridView/styles.css" CssPostfix="Office2003_Blue"
                                                    EnableTheming="true" Theme="Office2003Blue" OnHtmlRowCreated="gvData_HtmlRowCreated">
                                                    <ClientSideEvents SelectionChanged="function(s, e) { OnGridSelectionChanged(); }" />
                                                    <Settings ShowVerticalScrollBar="true" VerticalScrollableHeight="170" />
                                                    <%--<Images ImageFolder="~/App_Themes/Office2003Blue/GridView/">
                                                    <CollapsedButton Height="12px" Url="~/App_Themes/Office2  003 Blue/GridView/gvCollapsedButton.png"
                                                        Width="11px" />
                                                    <ExpandedButton Height="12px" Url="~/App_Themes/Office2003Blue/GridView/gvExpandedButton.png"
                                                        Width="11px" />
                                                    <DetailCollapsedButton Height="12px" Url="~/App_Themes/Office2003Blue/GridView/gvCollapsedButton.png"
                                                        Width="11px" />
                                                    <DetailExpandedButton Height="12px" Url="~/App_Themes/Office2003Blue/GridView/gvExpandedButton.png"
                                                        Width="11px" />
                                                </Images>--%>
                                                    <Styles CssFilePath="~/App_Themes/Office2003Blue/GridView/grid.css" AlternatingRow-Enabled="True"
                                                        CssPostfix="Office2003_Blue">
                                                        <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                                        </Header>
                                                        <LoadingPanel ImageSpacing="10px">
                                                        </LoadingPanel>
                                                        <PagerBottomPanel CssClass="PageFooter">
                                                        </PagerBottomPanel>
                                                        <PagerTopPanel CssClass="PageFooter">
                                                        </PagerTopPanel>
                                                    </Styles>
                                                    <SettingsPager PrevPageButton-Image-Url="../App_Themes/Office2003Blue/GridView/pPrev.gif"
                                                        PrevPageButton-Image-UrlDisabled="../App_Themes/Office2003Blue/GridView/pPrevDisabled.gif"
                                                        NextPageButton-Image-UrlDisabled="../App_Themes/Office2003Blue/GridView/pNextDisabled.gif"
                                                        NextPageButton-Image-Url="../App_Themes/Office2003Blue/GridView/pNext.gif" AlwaysShowPager="true">
                                                    </SettingsPager>
                                                    <Columns>
                                                        <dxw:GridViewDataColumn FieldName="BoxId" Caption="Device ID" VisibleIndex="0"
                                                            Settings-AllowSort="True" Width="10%" CellStyle-HorizontalAlign="Left">
                                                            <HeaderCaptionTemplate>
                                                                <span class="icon">
                                                                    <asp:Image ID="imgDeviceId" ImageUrl="..\Images\icn-device-id.gif" runat="server" /></span>
                                                                <span class="label">
                                                                    <asp:Label ID="lblDeviceId" runat="server" Text="Device ID"></asp:Label></span>
                                                            </HeaderCaptionTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <%--  <dxw:GridViewDataColumn FieldName="SentDateTimeSort" Caption="Date and time" VisibleIndex="1"
                                                        Width="12%">
                                                        <HeaderCaptionTemplate>
                                                            <span class="icon">
                                                                <asp:Image ID="imgDateTime" ImageUrl="..\Images\icn-date-time.gif" runat="server" /></span>
                                                            <span class="label">
                                                                <asp:Label ID="lblDateTime" runat="server" Text="Date and time"></asp:Label></span>
                                                        </HeaderCaptionTemplate>
                                                        <DataItemTemplate>
                                                            <asp:Label ID="lblSentDateTime" runat="server" Text='<%#Eval("SentDateTime") %>'></asp:Label>
                                                        </DataItemTemplate>
                                                        <Settings AllowAutoFilter="false" AllowSort="true" ShowFilterRowMenu="false" />
                                                    </dxw:GridViewDataColumn>--%>
                                                        <dxw:GridViewDataColumn FieldName="SentDateTime" Caption="Date and time" VisibleIndex="1"
                                                            Width="12%" Visible="false">
                                                            <HeaderCaptionTemplate>
                                                                <span class="icon">
                                                                    <asp:Image ID="imgDateTime" ImageUrl="..\Images\icn-date-time.gif" runat="server" /></span>
                                                                <span class="label">
                                                                    <asp:Label ID="lblDateTime" runat="server" Text="Date and time"></asp:Label></span>
                                                            </HeaderCaptionTemplate>
                                                            <DataItemTemplate>
                                                                <asp:Label ID="lblSentDateTime" runat="server" Text='<%#Eval("SentDateTime") %>'></asp:Label>
                                                            </DataItemTemplate>
                                                            <Settings AllowAutoFilter="false" AllowSort="true" ShowFilterRowMenu="false" />
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="VehicleDescription" Caption="Vehicle Name" VisibleIndex="2"
                                                            Width="10%">
                                                            <HeaderCaptionTemplate>
                                                                <span class="icon">
                                                                    <asp:Image ID="imgVehicleName" ImageUrl="..\Images\icn-vehicle-name.gif" runat="server" /></span>
                                                                <span class="label">
                                                                    <asp:Label ID="lblVehicleName" runat="server" Text="Vehicle Name"></asp:Label></span>
                                                            </HeaderCaptionTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="FileName" Caption="Filename" VisibleIndex="3"
                                                            Width="25%">
                                                            <HeaderCaptionTemplate>
                                                                <span class="icon">
                                                                    <asp:Image ID="imgOTAFilename" ImageUrl="..\Images\hex-file-name.png" runat="server" /></span><span
                                                                        class="label">
                                                                        <asp:Label ID="lblOTAFilename" runat="server" Text="Filename"></asp:Label></span>
                                                            </HeaderCaptionTemplate>
                                                            <Settings AllowAutoFilter="false" AllowSort="true" ShowFilterRowMenu="false" />
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="UserName" Caption="User" VisibleIndex="4" Width="10%">
                                                            <HeaderCaptionTemplate>
                                                                <span class="icon">
                                                                    <asp:Image ID="imgUserName" ImageUrl="..\Images\usermanage-icon.gif" runat="server" /></span>
                                                                <span class="label">
                                                                    <asp:Label ID="lblUserName" runat="server" Text="User Name"></asp:Label></span>
                                                            </HeaderCaptionTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataTextColumn FieldName="Status" Caption="Status" VisibleIndex="5"
                                                            Width="15%">
                                                            <HeaderCaptionTemplate>
                                                                <span class="icon">
                                                                    <asp:Image runat="server" ID="imgStatus" ImageUrl="..\Images\icn-status.gif" /></span>
                                                                <span class="label">
                                                                    <asp:Label ID="lblStatus" runat="server" Text="Status"></asp:Label></span>
                                                            </HeaderCaptionTemplate>
                                                            <DataItemTemplate>
                                                                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                                                    <tr>
                                                                        <td align="left" width="25px">
                                                                            <asp:Image ID="imgStatus" runat="server" />
                                                                        </td>
                                                                        <td align="left">
                                                                            <asp:Label ID="lblStatus" runat="server" Text='<%# Eval("Status") %>'></asp:Label>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataTextColumn>
                                                        <dxw:GridViewDataTextColumn Width="3%">
                                                            <DataItemTemplate>
                                                                <asp:ImageButton ID="ibtAbort" runat="server" title="Abort Upgrade Process" AlternateText="Abort Upgrade Process"
                                                                    OnClick="AbortUpgrade" CommandArgument='<%# Eval("BoxId") %>' ImageUrl="~/images/icn-abort-process.gif"
                                                                    ImageAlign="Middle" CssClass="handButton" />
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataTextColumn>
                                                    </Columns>
                                                    <Settings ShowStatusBar="Auto" />
                                                    <SettingsText EmptyDataRow="No firmware upgrade history for the search criteria." />
                                                </dxw:ASPxGridView>
                                                <dxw:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server" GridViewID="gvData"
                                                    ReportHeader="{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Times New Roman;}}
\viewkind4\uc1\pard\qc\b\fs20 Firmware Upgrade Details\b0\f1\par
}
">
                                                    <PageFooter Right="[Page # of Pages #]">
                                                    </PageFooter>
                                                </dxw:ASPxGridViewExporter>
                                            </div>
                                        </asp:Panel>
                                    </ContentTemplate>
                                    <Triggers>
                                        <asp:PostBackTrigger ControlID="btnExport" />
                                        <asp:PostBackTrigger ControlID="ibtnSaveFirmwareVersion" />
                                    </Triggers>
                                </asp:UpdatePanel>
                            </div>
                        </div>
                    </div>
                    <!-- Main Content Ends Here -->
                    <div id="left">
                    </div>
                    <div class="clear clearfix">
                    </div>
                </div>
                <div id="right">
                </div>
                <div class="clear clearfix">
                </div>
            </div>
            <cc1:ModalPopupExtender ID="mpeProgressIndicator" runat="server" PopupControlID="progressPopUp"
                TargetControlID="btnTesting">
            </cc1:ModalPopupExtender>
            <asp:Button ID="btnTesting" Style="display: none;" runat="server" />
            <asp:Panel ID="progressPopUp" runat="server" CssClass="processMessage" Style="z-index: 1000; display: none;">
                <center>
                    <br />
                    <img alt="Please Wait ..." src="../images/47.gif" /><br />
                    <br />
                    <asp:Label ID="lbl_msg12" Text="Processing... Please Wait..." runat="server" CssClass="specialdisplay"></asp:Label>
                    <br />
                    <br />
                </center>
            </asp:Panel>
        </form>
    </div>
    <div style="height: 5px">
    </div>
    <uc2:footer ID="footer" runat="server" />

    <script language="javascript" type="text/javascript">
        function CategoryPopup(isShow, control) {
            if (document.getElementById('pnlUploadFirmwareFile') != null) {
                document.getElementById('pnlUploadFirmwareFile').style.display = (isShow) ? "block" : "none";
                document.getElementById('ddlFirmwareCategory').focus();
            }

            if (!isShow) {
                // document.getElementById('ddlFirmwareCategory').focus();
            }

            if (isShow && control != null) {
                //                document.getElementById('ibtnDeleteCategory').style.display = (control.id == 'ibtnEditCategory') ? "block" : "none";

                //                if (control.id == 'ibtnAddCategory') {
                //                    document.getElementById('txtCategoryName').value = '';
                //                    document.getElementById('txtDescription').value = '';
                //                }

                // return true;
            }

            return false;
        }

        // Upgrade Firmware
        function ValidationFirmwareUpgrade() {
            var CategoryName = document.getElementById('DropDownList4');
            var FirwareFile = document.getElementById('fuFirmwareFile');
            var isError = false;
            var controlToBeFocused;
            var alertMessage = '';

            if (document.getElementById("DropDownList4").value == "- Select -") {
                alertMessage = 'Please select Firmware Category.';
                isError = true;
                document.getElementById("ddlFirmwareCategory").focus();
                CategoryName.style.backgroundColor = 'lightyellow';
                controlToBeFocused = CategoryName;
            }
            else {
                CategoryName.style.backgroundColor = 'white';
            }

            if (document.getElementById("fuFirmwareFile").value.length == 0) {
                alertMessage += (alertMessage.length == 0 ? '' : '\n') + 'Please select firmware version File.';
                if (!isError) {
                    isError = true;

                    controlToBeFocused = FirwareFile;
                }
                FirwareFile.style.backgroundColor = 'lightyellow';
            }
            else {
                FirwareFile.style.backgroundColor = 'white';
            }
            if (isError) {
                controlToBeFocused.focus();
                alert(alertMessage);
                return false;
            }
            else {
                return true;
            }
        }
        //Included by Sakthi Gopinath S on 08-Jul-2011
        //For OTA Filename validation
        function validateOTAFilename() {
            var firmCategory = document.getElementById('ddlFirmwareCategory').value;
            var firmFilename = document.getElementById('ddlFirmwareVersions').value;
            if (firmCategory == "" || firmCategory == "- Select -") { alert('Please select firmware category'); document.getElementById('ddlFirmwareCategory').focus(); return false; }
            else if (firmFilename == "" || firmFilename == "- Select -") { alert('Please select firmware version'); document.getElementById('ddlFirmwareVersions').focus(); return false; }

            var currOTAFilename = document.getElementById('ddlCurrentFirmwareVersion').firstChild.data;
            var index = document.getElementById('ddlFirmwareVersions').selectedIndex;
            var selOTAFilename = document.getElementById('ddlFirmwareVersions').options[index].text;
            var result = true;
            if (selOTAFilename == "" || selOTAFilename == "- Select -") {
                alert("Please select Firmware version.");
                document.getElementById("ddlFirmwareVersions").focus();
                return false;
            }
            //else if(currOTAFilename.indexOf("(")!=-1 && selOTAFilename.indexOf("QA_")!=-1)
            //{
            //    alert("You cannot upgrade this firmware version.");
            //    document.getElementById("ddlFirmwareVersions").focus();
            //    return false;
            //}

            //if(currOTAFilename.indexOf("(")!=-1)
            //{
            //    result = validateFileMatching(currOTAFilename,selOTAFilename,1);
            //}
            //else
            //{
            //    result = validateFileMatching(currOTAFilename,selOTAFilename,0);
            //}
            if (result == true) { if (window.confirm('Are you sure want to upgrade the firmware?') == false) { result = false; } }
            else { alert('You cannot upgrade this firmware version'); }
            return result;
        }

        //Validate whether OTA Filename is old or new version and send to corresponding process.
        function validateFileMatching(currFilename, selFilename, ver) {
            var curArr = currFilename.replace("QA_", "").replace(".hex", "").split('_');
            var selArr = selFilename.replace("QA_", "").replace(".hex", "").split('_');
            var val1 = 0;
            var val2 = 0;
            var result = false;
            if (ver == 1) {
                if (curArr[0].indexOf("T") != -1 || curArr[0].indexOf("t") != -1) {
                    val1 = parseInt(curArr[0].replace("T", ""), 10);
                }
                if (selArr[0].indexOf("T") != -1 || selArr[0].indexOf("t") != -1) {
                    val2 = parseInt(selArr[0].replace("T", ""), 10);
                }
                result = validateVal(val1, val2, 1);
                if (result) {
                    val1 = curArr[1];
                    val2 = selArr[1];
                    result = validateVal(val1, val2, 0);
                    if (result) {
                        var splArr1 = curArr[2].split("(");
                        var splArr2 = selArr[2].split("(");
                        if (splArr1.length == splArr2.length) {
                            val1 = parseInt(splArr1[0], 10);
                            val2 = parseInt(splArr2[0], 10);
                            result = validateVal(val1, val2, 2);
                            //if(result)
                            //{
                            //    var splArr3 = currFilename.replace(".hex","").split(")");
                            //    var splArr4 = selFilename.replace(".hex","").split(")");
                            //    if(splArr3.length = splArr4.length)
                            //    {
                            //        result = (splArr3[1]==splArr4[1])?true:false;
                            //    }
                            //    else
                            //    {
                            //        result=false;
                            //    }
                            //}
                        }
                        else {
                            result = validateFileMatching(currFilename, selFilename, 0);
                        }
                    }
                }
            }
            else if (ver == 0) {
                if (curArr[0].indexOf("T") != -1 || curArr[0].indexOf("t") != -1) {
                    val1 = parseInt(curArr[0].replace("T", ""), 10);
                }
                if (selArr[0].indexOf("T") != -1 || selArr[0].indexOf("t") != -1) {
                    val2 = parseInt(selArr[0].replace("T", ""), 10);
                }
                result = validateVal(val1, val2, 1);
            }
            return result;
        }

        function validateVal(val1, val2, opr) {
            var valid = false;
            //Validate Alphabet
            if (opr == 0) {
                if (val1.charCodeAt(0) <= val2.charCodeAt(0)) { valid = true; }
            }
                //validate number whether the values are greater than or less than one from previous
            else if (opr == 1) {
                if (val2 >= val1 || val2 == val1 - 1) { valid = true; }
            }
                //validate number whether the values are equal or not
            else if (opr == 2) {
                if (val2 == val1) { valid = true; }
            }
            return valid;
        }
    </script>

</body>
</html>
