175 lines
7.1 KiB
C#
175 lines
7.1 KiB
C#
|
|
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;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 判断页面是否刷新
|
|||
|
|
/// </summary>
|
|||
|
|
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(), "", "<script type='text/javascript'>alert('还原成功!');location.replace('" + Request.Url.AbsoluteUri + "')</script>");
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('数据库被占用,请过两分钟再试!!');location.replace('" + Request.Url.AbsoluteUri + "')</script>");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('文件不存在!');location.replace('" + Request.Url.AbsoluteUri + "')</script>");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
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(), "", "<script type='text/javascript'>open('/dd/abchhhjjkkkllyyuuuppaaassddddd.rar','_blank');</script>");
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('文件正在使用,请过两分钟再试!');location.replace('" + Request.Url.AbsoluteUri + "')</script>");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('文件不存在!');location.replace('" + Request.Url.AbsoluteUri + "')</script>");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
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(), "", "<script type='text/javascript'>alert('删除成功!');location.replace('" + Request.Url.AbsoluteUri + "')</script>");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('文件不存在!');location.replace('" + Request.Url.AbsoluteUri + "')</script>");
|
|||
|
|
}
|
|||
|
|
}*/
|
|||
|
|
|
|||
|
|
protected void Button_Back_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Mtxfw.Utility.Common.BackUpData(1,"");
|
|||
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('备份成功!');location.replace('" + Request.Url.AbsoluteUri + "')</script>");
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|