<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="System_Diagnosis.aspx.cs" Inherits="Neclog_3_0.System_Diagnosis" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="~/../App_Include/StyleSheet/AdminLTE.min.css" rel="stylesheet" />

    <script type="text/javascript" lang="javascript">
        {
            function CheckValidation() {
                if (confirm("DO YOU WANT TO RESTART THE SEVICE ?")) {
                    return true;
                }
                else {
                    return false;
                }
            }

            //This function designed to resolve the Tab index issue when postbacks.
            function tabClick(e) {
                debugger;
                var varLiInstrumentLog = document.getElementById("<%=liTagInstrumentLog.ClientID%>");
                var varLiErrorLog = document.getElementById("<%=liTagErrorLog.ClientID%>");

                if (e.id == varLiInstrumentLog.id)     //Checks which Tab got clicked.
                {
                    document.getElementById("<%=hdnTabClickedIndication.ClientID%>").value = '0';   //This value indicates that, Keep InstrumentLog tab active.
                    document.getElementById("<%=Instrument_Log.ClientID%>").setAttribute("class", "chart tab-pane active");
                    document.getElementById("<%=Error_Log.ClientID%>").setAttribute("class", "chart tab-pane");
                }
                else {
                    document.getElementById("<%=hdnTabClickedIndication.ClientID%>").value = '1';   //This value indicates that, Keep ErrorLog tab active.
                    document.getElementById("<%=Instrument_Log.ClientID%>").setAttribute("class", "chart tab-pane");
                    document.getElementById("<%=Error_Log.ClientID%>").setAttribute("class", "chart tab-pane active");
                }
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <div class='divtable'>
        <div class='form-box'>
            <div class="box box-success">
                <div class="box-header with-border">
                    <div class='row'>
                        <div class='col-md-10'>
                            <asp:Label ID="lblTitle" runat="server" class="box-title"></asp:Label>
                            <asp:HiddenField ID="hdnTabClickedIndication" runat="server" />
                        </div>
                        <div class='col-md-2'>
                            <asp:Button ID="btnRestartService" runat="server" Text="Restart Service" OnClick="RestartService" CssClass="myButton" OnClientClick="javascript:return CheckValidation();" ToolTip="Restart Service" />
                        </div>
                    </div>
                </div>
                <!-- /.box-header -->
                <!-- form start -->
                <div class="form-horizontal">
                    <div class="box-body">
                        <div class="form-group">
                            <%--<asp:Image src="~/../Images/SystemDiagnosis.png" runat="server" />"--%>
                            <!-- Small boxes (Stat box) -->
                            <div class="row">
                                <div class="col-lg-2 col-xs-6">
                                    <!-- small box -->
                                    <div class="small-box bg-green-gradient">
                                        <div class="inner">
                                            <h5><b>LAST FILE MOVED</b></h5>
                                            <p style="font-size: 12px; font-family: Arial; text-align: center;">
                                                <asp:Literal ID="litLastFileMoved" runat="server" />
                                            </p>
                                        </div>
                                        <div class="icon">
                                            <i class="ion ion-bag"></i>
                                        </div>
                                        <a href="#" class="small-box-footer">
                                            <%--<i class="fa fa-arrow-circle-right"></i>--%>
                                        </a>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-xs-6">
                                    <!-- small box -->
                                    <div class="small-box bg-aqua-gradient">
                                        <div class="inner">
                                            <h5><b>LAST FILE CHECKED</b></h5>
                                            <p style="font-size: 12px; font-family: Arial; text-align: center">
                                                <asp:Literal ID="litLastFileChecked" runat="server" />
                                            </p>
                                        </div>
                                        <div class="icon">
                                            <i class="ion ion-bag"></i>
                                        </div>
                                        <a href="#" class="small-box-footer">
                                            <%--<i class="fa fa-arrow-circle-right"></i>--%>
                                        </a>
                                    </div>
                                </div>

                                <div class="col-lg-2 col-xs-6">
                                    <!-- small box -->
                                    <div class="small-box bg-red-gradient">
                                        <div class="inner">
                                            <h5><b>LAST FILE PROCESSED</b></h5>
                                            <p style="font-size: 12px; font-family: Arial; text-align: center">
                                                <asp:Literal ID="litLastFileProcessed" runat="server" />
                                            </p>
                                        </div>
                                        <div class="icon">
                                            <i class="ion ion-bag"></i>
                                        </div>
                                        <a href="#" class="small-box-footer">
                                            <%--<i class="fa fa-arrow-circle-right"></i>--%>
                                        </a>
                                    </div>
                                </div>

                                <div class="col-lg-2 col-xs-6">
                                    <!-- small box -->
                                    <div class="small-box bg-purple-gradient">
                                        <div class="inner">
                                            <h5><b>LAST EMAIL SENT</b></h5>
                                            <p style="font-size: 12px; font-family: Arial; text-align: center">
                                                <asp:Literal ID="litLastEmailSentTime" runat="server" />
                                            </p>
                                        </div>
                                        <div class="icon">
                                            <i class="ion ion-bag"></i>
                                        </div>
                                        <a href="#" class="small-box-footer">
                                            <%--<i class="fa fa-arrow-circle-right"></i>--%>
                                        </a>
                                    </div>
                                </div>

                                <div class="col-lg-2 col-xs-6">
                                    <!-- small box -->
                                    <div class="small-box bg-blue-gradient">
                                        <div class="inner">
                                            <h5><b>LAST SMS SENT</b></h5>
                                            <p style="font-size: 12px; font-family: Arial; text-align: center">
                                                <asp:Literal ID="litLastSMSSentTime" runat="server" />
                                            </p>
                                        </div>
                                        <div class="icon">
                                            <i class="ion ion-bag"></i>
                                        </div>
                                        <a href="#" class="small-box-footer">
                                            <%--<i class="fa fa-arrow-circle-right"></i>--%>
                                        </a>
                                    </div>
                                </div>

                                <div class="col-lg-2 col-xs-6">
                                    <!-- small box -->
                                    <div class="small-box bg-yellow-gradient">
                                        <div class="inner">
                                            <h5><b>LAST DB. BACKUP</b></h5>
                                            <p style="font-size: 12px; font-family: Arial; text-align: center">
                                                <asp:Literal ID="litLastDatabaseTime" runat="server" />
                                            </p>
                                        </div>
                                        <div class="icon">
                                            <i class="ion ion-bag"></i>
                                        </div>
                                        <a href="#" class="small-box-footer">
                                            <%--<i class="fa fa-arrow-circle-right"></i>--%>
                                        </a>
                                    </div>
                                </div>

                            </div>
                        </div>
                        <div class="form-group">
                            <div class="box-body">
                                <div class="nav-tabs-custom">
                                    <ul class="nav nav-tabs pull-left">
                                        <li id="liTagInstrumentLog" class="active" onclick="tabClick(this)" runat="server"><a href="#Instrument_Log" data-toggle="tab">Instrument Log</a></li>
                                        <li id="liTagErrorLog" onclick="tabClick(this)" runat="server"><a href="#Error_Log" data-toggle="tab">Error Log</a></li>
                                    </ul>
                                </div>

                                <div class="tab-content no-padding">
                                    <div id="Instrument_Log" runat="server" style="position: relative; height: 275px; overflow-y: auto;">
                                        <div class="table-responsive">
                                            <table class="table no-margin">
                                                <thead>
                                                    <tr>
                                                        <th>Instrument Name</th>
                                                        <th>IP</th>
                                                        <th>Mode</th>
                                                        <th>Data Log</th>
                                                        <th>Alarm Log</th>
                                                       <%-- <th>Data Log File</th>
                                                        <th>Alarm Log File</th>--%>
                                                    </tr>
                                                </thead>
                                                <tbody id="tbodyInstrumentStatus" runat="server">
                                                    <tr>
                                                        <td><a href="pages/examples/invoice.html">OR9842</a></td>
                                                        <td>Call of Duty IV</td>
                                                        <td><span class="label label-success">Shipped</span></td>
                                                        <td>
                                                            <div class="sparkbar" data-color="#00a65a" data-height="20">90,80,90,-70,61,-83,63</div>
                                                        </td>
                                                        <td></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <!-- /.table-responsive -->
                                    </div>
                                    <div id="Error_Log" runat="server" style="position: relative; height: 300px;">
                                        <div class="table-responsive" style="position: relative; height: 300px; overflow-y: scroll;">
                                            <table class="table no-margin" style="width: 100%">
                                                <thead>
                                                    <tr>
                                                        <th>File Name</th>
                                                        <th>
                                                            <div style="width: 100%">
                                                                <div style="width: 40%; float: left">
                                                                    Date Time
                                                                </div>
                                                                <div style="width: 40%; float: left">
                                                                    <asp:UpdatePanel runat="server" UpdateMode="Always">
                                                                        <ContentTemplate>
                                                                            <asp:DropDownList ID="ddlFilterDTBasedErrorLog" AutoPostBack="true" OnSelectedIndexChanged="filterDTBasedErrorLog_SelectedIndexChanged" class="form-control" Width="70px" runat="server">
                                                                                <asp:ListItem Text="15" Value="15" Selected="True" />
                                                                                <asp:ListItem Text="30" Value="30" />
                                                                                <asp:ListItem Text="60" Value="60" />
                                                                            </asp:DropDownList>
                                                                            <asp:Timer ID="Timer1" runat="server" Interval="10000" Enabled="true" OnTick="Timer1_Tick">
                                                                            </asp:Timer>
                                                                        </ContentTemplate>
                                                                        <Triggers>
                                                                            <asp:PostBackTrigger ControlID="ddlFilterDTBasedErrorLog" />
                                                                        </Triggers>
                                                                    </asp:UpdatePanel>
                                                                </div>
                                                            </div>
                                                        </th>
                                                        <th>Equipment Name</th>
                                                        <th>Error Message</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="tbodyFileErrorLog" runat="server">
                                                </tbody>
                                            </table>
                                        </div>
                                        <!-- /.table-responsive -->
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
