<%@ Page Language="c#" Inherits="WebApp.Wpdcc.Recover" CodeBehind="Recover.aspx.cs" %>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>指定网站数据恢复</title>
    <meta name="description" content="overview &amp; stats" />
    <!--#include file = "../assets/head.htm" -->
</head>
<body class="no-skin">
    <div class="main-content-inner">
        <!-- #section:basics/content.breadcrumbs -->
        <div class="breadcrumbs" id="breadcrumbs">
            <script type="text/javascript">
                try { ace.settings.check('breadcrumbs', 'fixed') } catch (e) { }
            </script>

            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa fa-home home-icon"></i>
                    主页
                </li>
                <li>站点管理</li>
                <li class="active">站点恢复</li>
            </ul>
            <!-- /.breadcrumb -->

            <!-- /section:basics/content.searchbox -->
        </div>
        <!-- /section:basics/content.breadcrumbs -->

        <div class="page-content">
            <!-- PAGE CONTENT BEGINS -->

            <form id="frmRecover" method="post" runat="server">
                <div class="page-header">
                    <asp:ScriptManager ID="ScriptManager1" runat="server">
                    </asp:ScriptManager>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:DropDownList ID="ddlWeb" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlWeb_SelectedIndexChanged">
                            </asp:DropDownList>
                            &nbsp;
                            <asp:DropDownList ID="ddlSchoolList" runat="server">
                            </asp:DropDownList>

                            <%--<asp:DropDownList ID="ddlState" runat="server" >
                            </asp:DropDownList>--%>
                            &nbsp;<asp:Button ID="btnQuery" CssClass="btn btn-sm btn-primary" runat="server" Text="查看" OnClick="btnQuery_Click" />
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ddlWeb" EventName="SelectedIndexChanged" />
                        </Triggers>
                    </asp:UpdatePanel>
                </div>

                <div class="row">
                    <div class="col-xs-12">
                        <asp:DataGrid ID="backupList" CssClass="table table-striped table-bordered" runat="server" AutoGenerateColumns="False" OnItemCommand="backupList_ItemCommand" OnItemDataBound="backupList_ItemDataBound">
                            <Columns>
                                <asp:BoundColumn DataField="pkId" HeaderText="ID" HeaderStyle-CssClass="title"></asp:BoundColumn>
                                <asp:BoundColumn DataField="schoolName" HeaderText="站点名称" HeaderStyle-CssClass="title"></asp:BoundColumn>
                                <asp:BoundColumn DataField="applyID" HeaderText="站点ID" HeaderStyle-CssClass="title" Visible="False"></asp:BoundColumn>
                                <asp:TemplateColumn HeaderText="备份包信息" HeaderStyle-CssClass="title">
                                    <ItemTemplate>
                                        <asp:Label ID="lblBackInfo" runat="server" Style="cursor: default" Text='<%# DataBinder.Eval(Container, "DataItem.name") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateColumn>
                                <asp:BoundColumn DataField="updatetime" HeaderText="备份时间" HeaderStyle-CssClass="title" Visible="true"></asp:BoundColumn>
                                <asp:TemplateColumn HeaderText="文件大小" HeaderStyle-CssClass="title">
                                    <ItemTemplate>
                                        <asp:Label ID="lblSize" runat="server" Text='<%# Convert.ToDouble(DataBinder.Eval(Container, "DataItem.fileSize")).ToString("f3") + "M"%>'>
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateColumn>
                                <asp:BoundColumn DataField="remark" HeaderText="备注" HeaderStyle-CssClass="title"></asp:BoundColumn>
                                <asp:BoundColumn DataField="type" HeaderText="备份类型" HeaderStyle-CssClass="title"></asp:BoundColumn>
                                <asp:TemplateColumn HeaderText="执行" HeaderStyle-CssClass="title">
                                    <ItemTemplate>
                                        <div class="action-buttons">
                                            <asp:LinkButton ID="btnRecover" runat="server" CommandName="recover" CommandArgument='<%# DataBinder.Eval(Container, "DataItem.name") %>'><i class="ace-icon glyphicon glyphicon-repeat green" title="恢复"></i></asp:LinkButton>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateColumn>
                                <asp:BoundColumn Visible="False" DataField="zipName" HeaderText="zipName"></asp:BoundColumn>
                                <asp:BoundColumn Visible="False" DataField="lastBackupType" HeaderText="lastBackupType"></asp:BoundColumn>
                                <asp:BoundColumn Visible="False" DataField="webState" HeaderText="webState"></asp:BoundColumn>
                            </Columns>
                        </asp:DataGrid>

                        <div class="clearfix">
                            <div class="col-xs-12">
                                <asp:Label ID="lblPage" runat="server"></asp:Label>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <input id="Hidden1" runat="server" type="hidden" />
        
    </div>
    <!--#include file = "../assets/foot.htm" -->
    <script language="javascript" type="text/javascript">
        function checkLastBackup(type, lastBackupType, backupName) {
            if (lastBackupType != -1) {
                if (type == 1 && lastBackupType == 1) {
                    return confirm("您确定要恢复“" + backupName + "”的数据吗？");
                }
                else if (type == 1 && lastBackupType == 0) {
                    return confirm("您所要恢复的备份包属于完整备份，与该站点在本系统进行最后备份的类型“数据备份”不一致！\r\n如果恢复，子站将完全恢复该数据包的图片和数据。\r\n您确定要恢复“" + backupName + "”的数据吗？");
                }
                else if (type == 0 && lastBackupType == 0) {
                    return confirm("该备份包属于数据备份。\r\n恢复后，请及时还原对应Images文件夹，以保证数据完整。\r\n您确定要恢复“" + backupName + "”的数据吗？");
                }
                else {
                    return confirm("您所要恢复的备份包属于数据备份，与该站点在本系统进行最后备份的类型“完整备份”不一致！\r\n如果恢复，子站只恢复该数据包中的数据。恢复后，请及时还原对应的Images文件夹，以保证数据完整。\r\n您确定要恢复“" + backupName + "”的数据吗？");
                }
            }
            else {
                return confirm("您确定要恢复“" + backupName + "”的数据吗？");
            }
        }
    </script>
</body>
</html>
