<%@ Reference Page="~/admin/backup/operate.aspx" %>

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

<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head runat="server">
    <title>指定网站数据恢复</title>
    <!--#include file = "../Css/adminCssEdit.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>

</head>
<body>
    <div class="list-func-box func-box">
        <div class="hd">
            子站数据恢复</div>
        <form id="frmRecover" method="post" runat="server">
        <div class="bd">
            <div class="function-hd">
                <div class="search-box fr">
                </div>
                <!--/search-box-->
                <div class="action-field">
                 <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
                 <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                           子站服务器：<asp:DropDownList ID="ddlWeb" runat="server" Width="180px" AutoPostBack="True"
                        OnSelectedIndexChanged="ddlWeb_SelectedIndexChanged">
                    </asp:DropDownList>
                    子站名称：
                            <asp:DropDownList ID="ddlSchoolList" Width="224px" runat="server">
                            </asp:DropDownList>
                            <asp:DropDownList ID="ddlState" runat="server" Width="208px" Visible="False">
                            </asp:DropDownList>
                            <asp:Button ID="btnQuery" CssClass="btn" runat="server" Text="查看" OnClick="btnQuery_Click" />
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ddlWeb" EventName="SelectedIndexChanged" />
                        </Triggers>
                    </asp:UpdatePanel>
                </div>
                <!--/action-field-->
            </div>
           
            <asp:DataGrid ID="backupList"  CssClass="list-table" runat="server" Width="100%" 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>
                            &nbsp;<asp:LinkButton ID="btnRecover" runat="server" CommandName="recover" CommandArgument='<%# DataBinder.Eval(Container, "DataItem.name") %>'>恢复</asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:BoundColumn Visible="False" DataField="zipName" HeaderText="zipName"></asp:BoundColumn>
                    <asp:BoundColumn Visible="False" DataField="lastBackupType" HeaderText="lastBackupType">
                    </asp:BoundColumn>
                </Columns>
            </asp:DataGrid>
            <div class="ft">
                <div class="pagination">
                    <asp:Label ID="lblPage" runat="server"></asp:Label>
                </div>
            </div>
            <input id="Hidden1" runat="server" type="hidden" />
        </div>
        </form>
    </div>
</body>
</html>
