<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RestoreDB.aspx.cs" Inherits="ICDAS_3_0_Web_App.RestoreDB" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <!-- Bootstrap -->
    <link href="Style/bootstrap.min.css" rel="stylesheet" />
    <!-- Font Awesome -->
    <link href="Style/font-awesome/font-awesome.min.css" rel="stylesheet" />
    <!-- NProgress -->
    <link href="Style/nprogress.css" rel="stylesheet" />
    <!-- iCheck -->
    <link href="Style/skins/flat/green.css" rel="stylesheet" />
    <!-- bootstrap-progressbar -->
    <link href="Style/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet" />
    <!-- Custom Theme Style -->
    <link href="Style/custom.min.css" rel="stylesheet" />

    <!-- Bootstrap Alert Box -->
    <script src="javascript/jquery/jquery.min.js"></script>
    <script src="javascript/bootstrap/bootstrap.js"></script>
    <script src="javascript/bootstrap/bootbox.min.js"></script>

    <script type="text/javascript">

        var confirmed = false;

        function ConfirmDBRestore(controlID) {
            if (confirmed) { return true; }

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

            });

            return false;

        }

        function RediretToHomePage() {
            bootbox.alert('DATABASE RESTORED SUCCESSFULLY, PLEASE RE LOGIN', function () {
                window.open('Login.aspx', '_self');
            });
        }

    </script>

</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:UpdatePanel ID="upnlwzRestoreDB" UpdateMode="Always" runat="server">
            <ContentTemplate>
                <div>
                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <div class="x_panel">
                            <div class="x_content">
                                <section>
                                    <div class="col-xs-12 col-sm-12 col-lg-12 x_title">
                                        <div class="col-xs-12 col-sm-12 col-lg-6">
                                            <h4>
                                                <asp:Label ID="lblFormTitle" runat="server">Restore Database</asp:Label></h4>
                                        </div>
                                        <div class="col-xs-12 col-sm-12 col-lg-6" style="text-align: right;">
                                            <asp:Button ID="btnRDBLogin" runat="server" Text="Back to Login" OnClick="btnRDBLogin_Click" Visible="false" CssClass="btn btn-primary btn-sm" />
                                        </div>
                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="col-xs-12 col-sm-12 col-lg-12">
                                        <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-lg-12">
                                                        <div class="row">
                                                            <div class="col-xs-12 col-sm-12 col-lg-12" style="text-align: center; color: red;">
                                                                <asp:Label runat="server" ID="lblAlertMessage"></asp:Label>
                                                            </div>
                                                        </div>
                                                        <div class="row">
                                                            <div class="col-xs-12 col-sm-12 col-lg-12" style="text-align: center;">
                                                                <img src="Images/database-backup.jpg" class="img-responsive center-block" border="0" />
                                                            </div>
                                                        </div>
                                                        <div class="row">
                                                            <div class="col-xs-12 col-sm-12 col-lg-12" style="text-align: right; padding-right: 25px;">
                                                                <asp:Button ID="btnLogin" runat="server" Text="Back to Login" OnClick="btnLogin_Click" CssClass="btn btn-primary btn-sm" />
                                                                <asp:Button ID="btnCreateDatabase" runat="server" CommandName="MoveNext" OnClick="btnCreateDatabase_Click" Text="Restore New Database" OnClientClick="return ConfirmDBRestore(this.id);" CssClass="btn btn-primary btn-sm" />
                                                            </div>
                                                        </div>
                                                    </div>
                                                </asp:WizardStep>
                                                <asp:WizardStep ID="Step1" runat="server">
                                                    <div class="col-xs-12 col-sm-12 col-lg-12">
                                                        <div class="row">
                                                            <div style="text-align: center;">
                                                                <asp:Label runat="server" ID="lblResponseMessage"></asp:Label>
                                                            </div>
                                                        </div>
                                                        <div class="row">
                                                            <div class="col-xs-12 col-sm-12 col-lg-12">
                                                                <asp:Timer ID="Timer1" runat="server" Enabled="false" Interval="5000" OnTick="Timer1_Tick">
                                                                </asp:Timer>
                                                                <img class="img-responsive center-block" runat="server" id="imgloading" src="Images/database-Restore-processing.gif" />
                                                            </div>
                                                        </div>
                                                        <div class="row">
                                                            <div class="col-xs-12 col-sm-12 col-lg-12" style="text-align: center;">
                                                                <img src="Images/database-restored-failed.gif" class="img-responsive center-block" id="imgDBRestore" visible="false" runat="server" border="0" />
                                                            </div>
                                                        </div>
                                                        <div class="row">
                                                            <div class="col-xs-12 col-sm-12 col-lg-12" style="text-align: center;">
                                                                <asp:Button ID="btnTryAgain" OnClick="btnTryAgain_Click" Visible="false" runat="server" Text="Try Again" CssClass="btn btn-danger btn-sm" />
                                                            </div>
                                                        </div>
                                                    </div>
                                                </asp:WizardStep>
                                            </WizardSteps>
                                            <StartNavigationTemplate>
                                                <asp:Button ID="StepNextButton" Visible="false" runat="server" Text="Take BackUp" CommandName="MoveNext" CssClass="btn btn-primary btn-sm" />
                                            </StartNavigationTemplate>
                                            <FinishNavigationTemplate>
                                                <br />
                                                <asp:Button ID="StepPreviousButton" Visible="false" runat="server" Text="Previous" CssClass="btn btn-success btn-sm" CommandName="MovePrevious" />
                                            </FinishNavigationTemplate>
                                        </asp:Wizard>
                                    </div>
                                </section>
                            </div>
                        </div>
                    </div>
            </ContentTemplate>
            <Triggers>
            </Triggers>
        </asp:UpdatePanel>
    </form>
</body>
</html>
