<%@ Page Title="" Language="C#" MasterPageFile="~/Application.Master" AutoEventWireup="true" CodeBehind="SystemDiagnosis.aspx.cs" Inherits="ICDAS_3_0_Web_App.ICDAS_3_0.Administrator.SystemDiagnosis" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript">

        window.onload = function () {
            debugger;
            var h = document.getElementById("<%=div_position.ClientID%>");
            var k = document.getElementById("<%=div_position1.ClientID%>");
            document.getElementById("<%=dvScroll.ClientID%>").scrollTop = h.value;
            document.getElementById("<%=dvScroll1.ClientID%>").scrollTop = k.value;
        }
        function SetDivPosition() {
            var intY = document.getElementById("<%=dvScroll.ClientID%>").scrollTop;
            var h = document.getElementById("<%=div_position.ClientID%>");
            h.value = intY;
        }
        function SetDivPosition1() {

            var intX = document.getElementById("<%=dvScroll1.ClientID%>").scrollTop;
            var k = document.getElementById("<%=div_position1.ClientID%>");
            k.value = intX;
        }

        function afterpostback() {
            var h = document.getElementById("<%=div_position.ClientID%>");
            document.getElementById("<%=dvScroll.ClientID%>").scrollTop = h.value;
        }
        function afterpostback1() {
            var k = document.getElementById("<%=div_position1.ClientID%>");
            document.getElementById("<%=dvScroll1.ClientID%>").scrollTop = k.value;

        }
    </script>

    <style type="text/css">
        #ImgWait {
            padding-left: 300px;
            padding: 10px;
            position: absolute;
            width: 100%;
            border-radius: 10px;
            filter: alpha(opacity=100);
            opacity: 1;
        }
    </style>
    <script type="text/javascript">
        var confirmed = false;
        function ConfirmRestart(controlID) {
            if (confirmed) { return true; }

            bootbox.confirm("ARE YOUR SURE YOU WANT TO RESTART THIS SERVICE?", function (result) {
                if (result) {
                    if (controlID != null) {
                        var controlToClick = document.getElementById(controlID);
                        if (controlToClick != null) {
                            confirmed = true;
                            controlToClick.click();
                            confirmed = false;
                        }
                    }
                }

            });

            return false;

        }
    </script>
</asp:Content>
<asp:Content ID="cotMain" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="upnlwzSystemDiagnosis" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_content">
                            <asp:HiddenField ID="hdnRecordId" Value="" runat="server" />
                            <asp:HiddenField ID="hdnRecordIds" Value="" runat="server" />
                            <asp:HiddenField ID="hdnRowIndex" Value="0" runat="server" />
                            <asp:HiddenField ID="hdnBusinessUnitId" Value="0" runat="server" />
                            <asp:HiddenField ID="hdnBranchId" Value="0" runat="server" />
                            <asp:HiddenField ID="hdnCompanyCode" Value="0" runat="server" />
                            <asp:HiddenField ID="hdnComments" runat="server" />
                            <asp:HiddenField ID="div_position" Value="0" runat="server" />
                            <asp:HiddenField ID="div_position1" Value="0" runat="server" />
                            <div class="x_title">
                                <h4>
                                    <asp:Label ID="lblFormTitle" runat="server">System Diagnosis</asp:Label></h4>
                                <div class="clearfix"></div>
                            </div>
                            <div id="wizard" class="form_wizard wizard_horizontal">
                                <ul class="wizard_steps">
                                    <li>
                                        <a runat="server" id="aStep1" class="selected">
                                            <span class="step_no">1</span>
                                            <small>Equipment Status</small>
                                            </span>
                                        </a>
                                    </li>
                                    <li>
                                        <a runat="server" id="aStep2" class="disabled">
                                            <span class="step_no">2</span>
                                            Service Status
                                            </span>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                            <asp:UpdatePanel ID="UpdtPnlWzApplication" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <div id="dvmain" runat="server" class="col-xs-12 col-sm-12 col-lg-12">
                                        <div class="row">
                                            <div class="col-xs-12 col-sm-12 col-lg-12">
                                                <asp:Button ID="btnStartStop" formnovalidate="false" runat="server" Text="STOP" CssClass="btn btn-primary btn-danger btn-sm" ToolTip="STOP" Width="60px" OnClick="btnStartStop_Click" />
                                                <asp:Button ID="btnReset" formnovalidate="false" runat="server" Text="RESET" ToolTip="RESET" Style="background-color: #cfcfcf; color: black;" CssClass="btn btn-primary btn-sm" OnClick="btnReset_Click" />
                                                <asp:Button ID="btnRestartServerService" formnovalidate="false" runat="server" Text="RESTART SERVER SERVICE" ToolTip="RESTART SERVER SERVICE" CssClass="btn btn-primary btn-sm" OnClick="btnRestartServerService_Click" OnClientClick="return ConfirmRestart(this.id);" />
                                                <asp:DropDownList ID="ddlCommGroup" runat="server" Style="width: 165px; height: 30px;" OnSelectedIndexChanged="ddlCommGroup_SelectedIndexChanged" AutoPostBack="true">
                                                </asp:DropDownList>
                                                <asp:Button ID="btnRestartLocalService" formnovalidate="false" runat="server" Text="RESTART LOCAL SERVICE" ToolTip="RESTART LOCAL SERVICE" CssClass="btn btn-primary btn-sm" OnClick="btnRestartLocalService_Click" OnClientClick="return ConfirmRestart(this.id);" />
                                            </div>
                                        </div>
                                    </div>
                                    <br />
                                    <br />
                                    <asp:Wizard ID="wzMain" CssClass="col-sm-12" DisplaySideBar="false" OnActiveStepChanged="wzMain_ActiveStepChanged"
                                        runat="server" class="form_wizard wizard_horizontal">
                                        <WizardSteps>
                                            <asp:WizardStep ID="Step0" runat="server">
                                                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                                                    <div class="row">
                                                        <div class="col-xs-12 col-sm-12 col-lg-12">
                                                            <table id="tblHeader0" runat="server" class="table table-bordered dt-responsive nowrap" style="background-color: lightgray;">
                                                                <tr>
                                                                    <td style="width: 12%; text-align: center">Equipment Name</td>
                                                                    <td style="width: 0%; text-align: center" visible="false">Department Name</td>
                                                                    <td style="width: 8%; text-align: center">Status</td>
                                                                    <td style="width: 20%; text-align: center">Service Status</td>
                                                                    <td style="width: 20%; text-align: center">Data Log Status</td>
                                                                    <td style="width: 20%; text-align: center">Alarm Log Status</td>
                                                                    <td style="width: 20%; text-align: center">RealTime</td>
                                                                    <td style="width: 0%; text-align: center" visible="false">Biometric</td>
                                                                </tr>
                                                            </table>
                                                        </div>
                                                        <div class="col-xs-12 col-sm-12 col-lg-12">
                                                            <div id="dvScroll" onscroll="SetDivPosition()" runat="server" style="height: 350px; overflow: auto; overflow-x: hidden;">
                                                                <asp:GridView ID="grdEqiupmentStatus" runat="server" ShowHeaderWhenEmpty="true" CellPadding="0" CellSpacing="0"
                                                                    AllowPaging="false" AllowSorting="false" AutoGenerateColumns="False"
                                                                    CssClass="table table-striped table-bordered dt-responsive nowrap"
                                                                    ShowHeader="false">
                                                                    <HeaderStyle CssClass="bg-success" />
                                                                    <EmptyDataRowStyle HorizontalAlign="Center" />
                                                                    <EmptyDataTemplate>
                                                                        No Records Found
                                                                    </EmptyDataTemplate>
                                                                    <Columns>
                                                                        <asp:BoundField DataField="EquipmentMasterId" HeaderText="EquipmentMasterId">
                                                                            <HeaderStyle CssClass="hidden txtalign" />
                                                                            <ItemStyle CssClass="hidden" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField DataField="EquipmentName" HeaderText="Equipment Name">
                                                                            <ItemStyle Width="12%" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField DataField="CompanyName" HeaderText="Company Name" Visible="false">
                                                                            <ItemStyle Width="0%" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField DataField="StatusOnline" HeaderText="Status">
                                                                            <ItemStyle ForeColor="Black" />
                                                                            <ItemStyle Width="8%" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField DataField="ServiceStatus" HeaderText="Service Status">
                                                                            <ItemStyle Width="20%" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField DataField="LogStatus" HeaderText="Data Log Status">
                                                                            <ItemStyle Width="20%" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField DataField="AlarmLogsStatus" HeaderText="Alarm LogStatus">
                                                                            <ItemStyle Width="20%" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField DataField="RealTime" HeaderText="RealTime">
                                                                            <ItemStyle Width="20%" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField DataField="Biometric" HeaderText="Biometric" Visible="false">
                                                                            <ItemStyle Width="0%" />
                                                                        </asp:BoundField>
                                                                    </Columns>
                                                                </asp:GridView>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </asp:WizardStep>
                                            <asp:WizardStep ID="Step1" runat="server">
                                                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                                                    <div class="row">
                                                        <div class="col-xs-12 col-sm-12 col-lg-12">
                                                            <table id="tblHeader" runat="server" class="table table-bordered dt-responsive nowrap" style="background-color: lightgray;">
                                                                <tr>
                                                                    <td style="width: 49%; text-align: center">Service Step</td>
                                                                    <td style="width: 51%; text-align: center">Service Step Value</td>
                                                                </tr>
                                                            </table>
                                                        </div>
                                                        <div class="col-xs-12 col-sm-12 col-lg-12">
                                                            <div id="dvScroll1" onscroll="SetDivPosition1()" runat="server" style="height: 350px; overflow: auto; overflow-x: hidden;">
                                                                <asp:GridView ID="grdServiceStatus" runat="server" ShowHeaderWhenEmpty="true" CellPadding="0" CellSpacing="0"
                                                                    AllowPaging="false" AllowSorting="false" AutoGenerateColumns="False"
                                                                    CssClass="table table-striped table-bordered dt-responsive nowrap"
                                                                    ShowHeader="false">
                                                                    <HeaderStyle CssClass="bg-success" />
                                                                    <EmptyDataRowStyle HorizontalAlign="Center" />
                                                                    <EmptyDataTemplate>
                                                                        No Records Found
                                                                    </EmptyDataTemplate>
                                                                    <Columns>
                                                                        <asp:BoundField DataField="ServiceStatusId" HeaderText="EquipmentMasterId">
                                                                            <HeaderStyle CssClass="hidden txtalign" />
                                                                            <ItemStyle CssClass="hidden" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField DataField="Service Step" HeaderText="Service Step" />
                                                                        <asp:BoundField DataField="Service Step Value" HeaderText="Service Step Value">
                                                                            <ItemStyle Width="50%" />
                                                                        </asp:BoundField>
                                                                    </Columns>
                                                                </asp:GridView>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </asp:WizardStep>
                                        </WizardSteps>
                                        <StartNavigationTemplate>
                                            </br>
                                                <asp:Button ID="btnNext" formnovalidate="false" runat="server" Text="Service Status" ToolTip="SERVICE STATUS" CommandName="MoveNext" CssClass="btn btn-primary btn-sm" CausesValidation="true" />
                                        </StartNavigationTemplate>
                                        <FinishNavigationTemplate>
                                            </br>
                                                <asp:Button ID="btnPrevious" runat="server" formnovalidate="true" Text="Equipment Status" CssClass="btn btn-success btn-sm" ToolTip="EQUIPMENT STATUS" CommandName="MovePrevious" />
                                        </FinishNavigationTemplate>
                                    </asp:Wizard>
                                    <asp:Timer ID="Timer1" runat="server" Interval="30000" OnTick="Timer1_Tick" Enabled="true">
                                    </asp:Timer>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </div>
                    </div>
                </div>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
            <asp:AsyncPostBackTrigger ControlID="ddlCommGroup" EventName="SelectedIndexChanged" />
        </Triggers>
    </asp:UpdatePanel>

</asp:Content>
