@model  Com._9pm2.ClientWeb.Models.DatabaseBackupModel
@{
    ViewBag.Title = "数据库备份";
}
<script src="../../Scripts/backupdb.js?vn=20180813"></script>

<style>
    td {
        height: 40px !important;
    }
    .db-file{
        display:block;
    }
</style>

@if (!string.IsNullOrEmpty(Model.Message) && Model.Message.ToString() == "1")
{
    <div class="info-msg" style="display:block">数据库备份成功！</div>
}

<div class="callout lead callout-success ">
    提示：请定期备份数据库。请将备份文件复制或转移到安全存储设备上(比如：独立的移动硬盘)，以便服务器遭遇意外灾害时恢复数据。
</div>

<div class="error-msg"></div>

<div>

    <table id="tableEdit" class="font85 tableEdit" style="width:100%">

        <tr>
            <td class="label">数据文件大小</td>
            <td>
                @foreach(var f in Model.DataSize)
                {
                    <span class="db-file">@f</span>
                }
            </td>
        </tr>

        <tr>
            <td class="label">日志文件大小</td>
            <td>
                @foreach (var f in Model.LogSize)
                {
                    <span class="db-file">@f</span>
                }
            </td>
        </tr>

        <tr>
            <td class="label">备份文件路径</td>
            <td>
                @Model.BackupPath
            </td>

        </tr>
        <tr>
            <td class="label">备份记录</td>
            <td>
                <table style="width:800px">
                    <thead>
                        <tr>
                            <th>文件名称</th>
                            <th>备份时间</th>
                            <th>文件大小</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var f in Model.Files)
                        {
                            <tr>
                                <td>@f.FileName</td>
                                <td>@f.CreateTime</td>
                                <td>@f.FileSize</td>
                                <td>
                                    <a href="javascript:void(0)" onclick="Delete('@f.FileName')">删除</a>
                                </td>
                            </tr>
                        }
                        @if (Model.Files.Count == 0)
                        {
                            <tr>
                                <td colspan="4" style="text-align:center;font-size:16px">您还没有备份过数据库</td>
                            </tr>
                        }
                    </tbody>
                </table>
            </td>
        </tr>

        <tr>
            <td class="label">备份</td>
            <td>
                <button type="button" class="btn btn-primary" onclick="Backup()">立即备份</button>
                <span class="gray">提示：请尽量选择系统空闲时间段进行备份，比如，您可以在员工下班后进行备份。</span>
            </td>
        </tr>

    </table>

</div>
