using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.IO; using System.Collections; using System.Configuration; namespace Mtxfw.VipSite { public partial class Admin_Member_BackUpData : Mtxfw.Utility.MemberBase { public Mtxfw.DAL.queue_window daoQuque = new DAL.queue_window(); Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info(); Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results(); Mtxfw.Utility.Config Config = new Mtxfw.Utility.Config(""); private Mtxfw.Utility.Config config = new Mtxfw.Utility.Config(""); public int gtype = 0; #region 判断页面是否刷新 private bool _refreshState; private bool _isRefresh; /// /// 判断页面是否刷新 /// public bool IsRefresh { get { return _isRefresh; } } protected override void LoadViewState(object savedState) { object[] allStates = (object[])savedState; base.LoadViewState(allStates[0]); _refreshState = (bool)allStates[1]; _isRefresh = _refreshState == (bool)Session["__ISREFRESH"]; } protected override object SaveViewState() { Session["__ISREFRESH"] = _refreshState; object[] allStates = new object[2]; allStates[0] = base.SaveViewState(); allStates[1] = !_refreshState; return allStates; } #endregion protected override void OnLoad(EventArgs e) { base.OnLoad(e); string hostname = Request.Url.Host; if (!IsPostBack) { if (Session["IFPassword"] == null) { Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_BackUpData.aspx"); } if (IFStores != 1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } if (MemberJS.IndexOf("数据管理") == -1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } Data_Bind(); Page.Title = "数据管理 - " + GetWebName; Btn_Delete.Attributes.Add("onclick", "return confirm(\"此操作将会清空会员和奖金数据,您要确定清空数据吗?\");"); } Btn_Delete.Click += delegate(object s, EventArgs ex) { Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = Card; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = "清空所有注单数据"; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); Mtxfw.Utility.Common.BackUpData(1,""); daoUser.DeleteData(gtype); Response.Redirect(Request.Url.AbsolutePath); }; } 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; if (AspNetPager1.RecordCount == 0) { AspNetPager1.Visible = false; } 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); ClientScript.RegisterStartupScript(this.GetType(), "", ""); } catch { ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } else { ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } 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); ClientScript.RegisterStartupScript(this.GetType(), "", ""); } catch { ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } else { ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } protected void Delete_Click(object s, CommandEventArgs e) { FileInfo fileinfo = new FileInfo(Server.MapPath(e.CommandName)); if (fileinfo.Exists) { fileinfo.Delete(); ClientScript.RegisterStartupScript(this.GetType(), "", ""); } else { ClientScript.RegisterStartupScript(this.GetType(), "", ""); } }*/ protected void Button_Back_Click(object sender, EventArgs e) { Mtxfw.Utility.Common.BackUpData(1,""); ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } }