using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.IO; using System.Collections; using System.Configuration; namespace Mtxfw._admin { public partial class admin_BackUpData : Mtxfw.Utility.AdminPage { public Mtxfw.DAL.Link dao = new Mtxfw.DAL.Link(); public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config(); protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { Data_Bind(); } AspNetPager1.PageChanged += delegate(object s, EventArgs ex) { Data_Bind(); }; } protected void Data_Bind() { //获取数据源 int PageIndex = 1; if (Request.QueryString["page"] != null) { PageIndex = int.Parse(Request.QueryString["page"].ToString()); } int rcount = 0; DataTable dtb = Mtxfw.Utility.Common.GetFilesDataView(PageIndex, Server.MapPath(ConfigurationManager.AppSettings["selfName"]), out rcount); DataView dv = dtb.DefaultView; AspNetPager1.PageSize = 10; AspNetPager1.RecordCount = rcount; Mtxfw.Utility.Tools.ToBind(Repeater1, dv); } /*protected void UpData_Click(object s, CommandEventArgs e) { FileInfo fileinfo = new FileInfo(Server.MapPath(e.CommandName)); if (fileinfo.Exists) { try { Mtxfw.Utility.Common.DbRestore(e.CommandName); Mtxfw.Utility.Tools.Message("还原成功!", Request.Url.AbsoluteUri); } catch { Mtxfw.Utility.Tools.Message("数据库被占用,请过两分钟再试!", Request.Url.AbsoluteUri); } } else { Mtxfw.Utility.Tools.Message("文件不存在!", Request.Url.AbsoluteUri); } } protected void LoadData_Click(object s, CommandEventArgs e) { FileInfo fileinfo = new FileInfo(Server.MapPath(e.CommandName)); if (fileinfo.Exists) { try { fileinfo.CopyTo(Server.MapPath("/dd/abchhhjjkkkllyyuuuppaaassddddd.rar"), true); Response.Write(""); } catch { Mtxfw.Utility.Tools.Message("文件正在使用,请过两分钟再试!", Request.Url.AbsoluteUri); } } else { Mtxfw.Utility.Tools.Message("文件不存在!", Request.Url.AbsoluteUri); } } protected void Delete_Click(object s, CommandEventArgs e) { FileInfo fileinfo = new FileInfo(Server.MapPath(e.CommandName)); if (fileinfo.Exists) { fileinfo.Delete(); Mtxfw.Utility.Tools.Message("删除成功!", Request.Url.AbsoluteUri); } else { Mtxfw.Utility.Tools.Message("文件不存在!", Request.Url.AbsoluteUri); } }*/ protected void Button_Back_Click(object sender, EventArgs e) { Mtxfw.Utility.Common.BackUpData(1); Response.Redirect(Request.Url.AbsoluteUri); } } }