<%@ page language="C#" autoeventwireup="true" inherits="ImportAlarmLog, App_Web_importalarmlog.aspx.92002ead" enableEventValidation="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="~/UserControls/iERPToolBar.ascx" TagName="iERPToolBar" TagPrefix="dsit" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head id="Head1" runat="server">
    <title>..:: ICDAS 2.1 ::..</title>
    <meta http-equiv="X-UA-Compatible" content="IE=9">

    <script language="javascript" src="../App_Include/JavaScript/js_functions.js"> </script>

    <script language="javascript">

        function resizeObject() {
            var w = getBrowserWindowSize().width;
            var h = getBrowserWindowSize().height - 10;
            //window.resizeTo(w, h);
            var cObj;
            cObj = document.getElementById("divChildBody");
            if (cObj != null) {
                //cObj.style.height = parseInt((h*79)/100) +"px";
                cObj.style.height = (parseInt(h) - 10) + "px";
            }

            cObj = document.getElementById("<%#pnlGridDevice.ClientID%>");
            if (cObj != null) {
                cObj.style.height = (parseInt(h) - 250) + "px";
                cObj.style.width = (parseInt(w) - 20) + "px";
            }
            hideWait();
        }


        function validateRecord() {
            var doc = document.forms[0];

            if (Trim(doc.hdnGRowCount.value) == "0") {
                alert("Please Import Alarm Log File...");
                return false;
            }
            else {
                return true;
            }
        }
        function validateImport() {
            var doc = document.forms[0];

            return true;
        }

        function ClearName() {
            var doc = document.forms[0];
            doc.ImpFU.value = "";
        }
        function ImportName() {
            var doc = document.forms[0];
            var ImgTL = document.getElementById("<%#ImpFU.ClientID %>");
            var fileExt = Trim(ImgTL.value);
            if (fileExt != "") {
                var filename = Split(fileExt, "\\");
                var counter = 0;
                for (x in filename) {
                    counter = counter + 1;
                }
                var name1 = filename[counter - 1];
                //                if (name1.toUpperCase() == "NEWTALRM.NEC")
                if (name1.toUpperCase().search("_A.NEC") != -1) {
                    //                    txtImportCaption.value = name1;
                }
                else {
                    alert("Please Select Alarm File Only...".toUpperCase());
                    var Imgbtn = document.getElementById("<%#imgbtnClear.ClientID %>");
                    Imgbtn.click();
                }

            }
        }

       			
    </script>

</head>
<body bottommargin="0" leftmargin="0" topmargin="0" rightmargin="0" onload="resizeObject(); resizeHolder(); init();">
    <form id="Form1" runat="server" class="formbg">
    <asp:ToolkitScriptManager runat="Server" EnablePartialRendering="true" AsyncPostBackTimeout="0"
        ID="ToolkitScriptManager1" />
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="left" class="formbg">
        <tr>
            <td valign="top" align="left">
                <div id="divMainBody" align="center" runat="server" width="100%" height="100%">
                    <div id="divHeader" runat="server" style="border-style: none; height: 26px; width: 100%;
                        position: absolute; left: 1px; top: 8px;" align="center">
                        <dsit:iERPToolBar ID="iERPToolBar1" runat="server" Caption="Branch Master" PageAccess="11111"
                            ValidateLogin="true" />
                    </div>
                    <asp:UpdatePanel ID="uplChildBody" runat="server" UpdateMode="Always">
                        <ContentTemplate>
                            <asp:HiddenField ID="hdnRecordKeyId" runat="server" Value="0" />
                            <asp:HiddenField ID="hdnRecordIds" runat="server" />
                            <asp:HiddenField ID="hdnUserId" runat="server" Value="" />
                            <asp:HiddenField ID="hdnBusinessUnitId" runat="server" Value="" />
                            <asp:HiddenField ID="hdnBranchId" runat="server" Value="" />
                            <asp:HiddenField ID="hdnEquipmentId" runat="server" Value="" />
                            <asp:HiddenField ID="hdnEquipmentType" runat="server" Value="" />
                            <asp:HiddenField ID="hdnstatus" runat="server" Value="0" />
                            <asp:HiddenField ID="hdnLoginComments" runat="server" Value="0" />
                            <asp:HiddenField ID="hdnGRowCount" runat="server" Value="0" />
                            <asp:Timer ID="tmrDataLog" runat="server" Interval="10" Enabled="false" OnTick="tmrDataLog_Tick">
                            </asp:Timer>
                            <div id="divChildBody" runat="server" style="overflow: auto; width: 99%;">
                                <table width="100%" style="vertical-align: top;" align="left" cellpadding="1" cellspacing="0"
                                    border="0" class="tablefont">
                                    <tr height="62px">
                                        <td colspan="5">
                                            &nbsp
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="10%">
                                            Instrument Name
                                        </td>
                                        <td width="40%">
                                            <asp:TextBox ID="txtEquipmentName" runat="server" Width="70%" MaxLength="50" ReadOnly="true"></asp:TextBox>
                                        </td>
                                        <td width="1%">
                                        </td>
                                        <td width="9%">
                                            Status
                                        </td>
                                        <td width="40%">
                                            <asp:TextBox ID="txtStatus" runat="server" Width="30%" MaxLength="50" ReadOnly="true"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="10%">
                                        </td>
                                        <td width="40%">
                                        </td>
                                        <td width="1%">
                                        </td>
                                        <td width="9%">
                                        </td>
                                        <td width="40%">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="10%">
                                            IP Address
                                        </td>
                                        <td width="40%">
                                            <asp:TextBox ID="txtEquipmentId1" runat="server" Width="10%" MaxLength="3" CssClass="numInput"
                                                ReadOnly="true"></asp:TextBox>
                                            .
                                            <asp:TextBox ID="txtEquipmentId2" runat="server" Width="10%" MaxLength="3" CssClass="numInput"
                                                ReadOnly="true"></asp:TextBox>
                                            .
                                            <asp:TextBox ID="txtEquipmentId3" runat="server" Width="10%" MaxLength="3" CssClass="numInput"
                                                ReadOnly="true"></asp:TextBox>
                                            .
                                            <asp:TextBox ID="txtEquipmentId4" runat="server" Width="10%" MaxLength="3" CssClass="numInput"
                                                ReadOnly="true"></asp:TextBox>
                                        </td>
                                        <td width="1%">
                                        </td>
                                        <td width="9%">
                                        </td>
                                        <td width="40%">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="10%">
                                            Login Interval
                                        </td>
                                        <td width="40%">
                                            <asp:TextBox ID="txtEquipmnetLogRate" runat="server" Width="10%" MaxLength="3" CssClass="numInput"
                                                ReadOnly="true"></asp:TextBox>
                                            &nbsp mins (Max 480)
                                        </td>
                                        <td width="1%">
                                        </td>
                                        <td width="9%">
                                            Active Probes
                                        </td>
                                        <td width="40%">
                                            <asp:TextBox ID="txtActiveChannel" runat="server" Width="10%" MaxLength="3" CssClass="numInput"
                                                ReadOnly="true"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="10%">
                                        </td>
                                        <td width="40%">
                                        </td>
                                        <td width="1%">
                                        </td>
                                        <td width="9%">
                                        </td>
                                        <td width="40%">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left" width="10%" height="25">
                                            Select File*
                                        </td>
                                        <td align="left" width="40%">
                                            <input onkeypress="suppresskey();" onchange="ImportName();" id="ImpFU" style="width: 90%;
                                                border-top-style: groove; border-right-style: groove; border-left-style: groove;
                                                height: 20px; border-bottom-style: groove" type="file" size="50" name="fileUpload"
                                                runat="server"/>
                                        </td>
                                        <td width="1%">
                                        </td>
                                        <td align="left" colspan="2" width="49%">
                                            <asp:ImageButton ID="imgbtnClear" runat="server" ImageUrl="~/ToolBarIcon/data-clear.png"
                                                BackColor="Transparent" OnClientClick="ClearName();" ToolTip="Clear" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="10%" align="left">
                                            Page Size
                                        </td>
                                        <td width="40%" align="left">
                                            <asp:TextBox ID="txtGridPageSize" runat="server" CssClass="numInput" Width="15%"
                                                MaxLength="5">25</asp:TextBox>
                                        </td>
                                        <td width="0%" align="left">
                                        </td>
                                        <td width="10%" align="left">
                                        </td>
                                        <td width="40%" align="left">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" colspan="5">
                                            <asp:Button ID="BtnImport" runat="server" CssClass="submit" Height="25px" Text="Import"
                                                Width="100px" BorderWidth="0px" OnClick="BtnImport_Click" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td valign="top" colspan="5">
                                        </td>
                                    </tr>
                                </table>
                                <table width="100%" style="vertical-align: top;" align="left" cellpadding="1" cellspacing="0"
                                    border="0" class="tablefont">
                                    <tr>
                                        <td class="frametitle" align="center" style="height: 20px" width="98%">
                                            <font size="2"><b></b>&nbsp;<strong>[Records Found :
                                                <asp:Label ID="lblreccount" runat="server"></asp:Label>]</strong> </font>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Panel ID="pnlGridDevice" ScrollBars="Auto" runat="server" Visible="true" Width="99%">
                                                <asp:GridView ID="GVDevice" Width="100%" runat="server" CellPadding="0" AllowSorting="false"
                                                    AutoGenerateColumns="False" OnRowDataBound="ItemDataBound" BorderColor="#E0E4EA"
                                                    AllowPaging="true" OnPageIndexChanging="ChangePage" PageSize="25">
                                                    <Columns>
                                                        <asp:BoundField DataField="EquipmentMasterId" HeaderText="EquipmentMasterId">
                                                            <HeaderStyle CssClass="hiddencol"></HeaderStyle>
                                                            <ItemStyle CssClass="hiddencol"></ItemStyle>
                                                        </asp:BoundField>
                                                        <asp:BoundField DataField="AlarmLogDateTime" HeaderText="Log Date Time">
                                                            <HeaderStyle CssClass="DGR_HEADER" Width="20%"></HeaderStyle>
                                                            <ItemStyle CssClass="" Width="20%" HorizontalAlign="Center"></ItemStyle>
                                                        </asp:BoundField>
                                                        <asp:BoundField DataField="AlarmEvent" HeaderText="Alarm Desc">
                                                            <HeaderStyle CssClass="DGR_HEADER" />
                                                            <ItemStyle HorizontalAlign="left" Width="80%" />
                                                        </asp:BoundField>
                                                    </Columns>
                                                    <HeaderStyle CssClass="DGR_FIXEDHEADER" />
                                                    <PagerSettings Position="TopAndBottom" />
                                                    <PagerStyle CssClass="DGR_PAGER"></PagerStyle>
                                                    <RowStyle CssClass="DGR_ITEM" />
                                                </asp:GridView>
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </ContentTemplate>
                        <Triggers>
                            <asp:PostBackTrigger ControlID="BtnImport" />
                        </Triggers>
                    </asp:UpdatePanel>
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
