protected void Page_Load(object sender, EventArgs e) { Permissions.ComRedirect(Page, Permissions.redirUrl); Response.Cache.SetExpires(DateTime.Now); Permissions.CheckManagePermission(EnumCompanyPermission.MemberSPOff); AjaxPro.Utility.RegisterTypeForAjax(typeof(AjaxClass)); Translations(); if (!this.IsPostBack) { if (Session["Company"] != null) { string ManageID = Session["Company"].ToString(); txtOperatorNo.Text = ManageID; txtOperatorName.Text = DataBackupBLL.GetNameByAdminID(ManageID); } if (Request.QueryString["Number"] != null) { this.txtNumber.Text = Request.QueryString["Number"].ToString(); } this.Label1.Text = GetTran("007567", "冻结会员"); if (Request.QueryString["type"] != null) { if (Request.QueryString["Number"] != null) { this.txtNumber.Text = Request.QueryString["Number"].ToString(); } Label1.Text = GetTran("007224", "解冻会员"); } } }
/// <summary> /// 删除选定的数据库备份 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbtnDelete_Command(object sender, CommandEventArgs e) { ///当GridView有数据时才能删除 if (gvBackupDatabase.Rows.Count != 0) { int index = gvBackupDatabase.PageIndex; //注意:一定要正确取到文件名和路径 string strPathFileName = gvBackupDatabase.Rows[index].Cells[3].Text; try { File.Delete(strPathFileName); ///删除指定文件路径名数据记录 int delCount = DataBackupBLL.DelBackupDatabaseByFilePathName(strPathFileName); if (delCount != 0) { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("000749", "删除成功!"))); BackupDatabaseDataBind(); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("000417", "删除失败!"))); } } catch { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001387", "删除失败,请联系管理员!"))); return; } } }
/// <summary> /// 记录备份日志 /// </summary> protected void BackupLog() { ///根据管理员编号得到管理员姓名 string strOperator = DataBackupBLL.GetNameByAdminID(Session["Company"].ToString()); DateTime strDataBackupTime = DateTime.Now;// File.GetLastWriteTime(strPathFileName); BackupDatabaseModel backupDatabaseModel = new BackupDatabaseModel(); backupDatabaseModel.DataBackupTime = strDataBackupTime; backupDatabaseModel.OperatorNum = strOperator; backupDatabaseModel.PathFileName = strPathFileName1; ///向数据库备份路径表中插入记录 int addCount = DataBackupBLL.AddBackupDatabase(backupDatabaseModel); if (addCount != 0) { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("004212", "备份日志记录成功!"))); BackupDatabaseDataBind(); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("004210", "备份日志记录失败,请联络管理员!"))); return; } }
/// <summary> /// 备份数据库 /// </summary> protected void Backup() { ///设定要备份的数据库名 string strDataBaseName = DataBackupBLL.GetDataBaseName(); ///备份数据库 int backupCount = DataBackupBLL.BackupDatabaseInfo(strDataBaseName, strPathFileName); try { if (backupCount != 0) { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("004215", "备份已经成功!"))); lblMessage.Text = ""; lblMessage.Text = GetTran("004214", "已经将系统数据库备份为:") + strPathFileName1;// +" 建立的时间为: " + File.GetLastWriteTime(strPathFileName); BackupLog(); } } catch { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("004213", "备份失败,请联系管理员"))); return; } }
protected void Page_Load(object sender, EventArgs e) { Permissions.ComRedirect(Page, Permissions.redirUrl); Response.Cache.SetExpires(DateTime.Now); Permissions.CheckManagePermission(EnumCompanyPermission.MemberOffView); AjaxPro.Utility.RegisterTypeForAjax(typeof(AjaxClass)); if (!this.IsPostBack) { if (Session["Company"] != null) { string ManageID = Session["Company"].ToString(); txtOperatorNo.Text = ManageID; txtOperatorName.Text = DataBackupBLL.GetNameByAdminID(ManageID); } if (Request.QueryString["Number"] != null) { this.txtNumber.Text = Request.QueryString["Number"].ToString(); this.Label4.Text = new AjaxClass().GetName(Request.QueryString["Number"].ToString()); } if (Request.QueryString["type"] != null && Request.QueryString["type"] == "2") { Label1.Text = GetTran("003024", "恢复注销会员"); Label2.Text = GetTran("007237", "恢复注销会员编号") + ":"; Label3.Text = GetTran("007238", "恢复注销原因") + ":"; } else { Label1.Text = GetTran("001282", "会员注销"); Label2.Text = GetTran("001295", "恢复注销会员编号") + ":"; Label3.Text = GetTran("007164", "注销原因") + ":"; } } Translations(); }
/// <summary> /// 备份数据库 /// </summary> protected void Backup() { ///设定要备份的数据库名 string strDataBaseName = DataBackupBLL.GetDataBaseName(); ///备份数据库 int backupCount = DataBackupBLL.BackupDatabaseInfo(strDataBaseName, "D:\\DBBackup\\" + strDataBaseName + ".bak"); try { if (backupCount != 0) { //Process.Start("D:\\DBBackup\\dbcmd.bat"); //调用bat命令文件,将备份的bak数据库文件打包成rar格式的 //Thread.Sleep(6000); //程序睡眠6秒中 Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("004215", "备份已经成功!"))); lblMessage.Text = ""; lblMessage.Text = GetTran("004214", "已经将系统数据库备份为:") + strDataBaseName + ".bak";// +" 建立的时间为: " + File.GetLastWriteTime(strDataBaseName + ".bak"); BackupLog(strDataBaseName + ".bak"); } } catch { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("004213", "备份失败,请联系管理员"))); return; } }
///<summary> ///备份会员基本信息 ///</summary> private void BackupMemberInfo(int qishu) { ///把数据从会员信息表中复制到会员备份基本信息表中 DataBackupBLL.AddAllDataFromMemberInfo(qishu); DataTable dt, oldDt; dt = new DataTable(); ///从会员备份基本信息表获取所有的信息 oldDt = DataBackupBLL.GetAllInfoFromBackupMemberInfo(); //Clone the datatable structure dt = oldDt.Clone(); foreach (DataColumn col in dt.Columns) { if (col.ColumnName == "Sex") { //Update the column data type col.DataType = typeof(String); } } for (int i = 0; i < oldDt.Rows.Count; i++) { DataRow newRow = dt.NewRow(); newRow.ItemArray = oldDt.Rows[i].ItemArray; dt.Rows.Add(newRow); //By WangHua 2010-02-02(等到数据完善后才取消注释) dt.Rows[i]["Name"] = Encryption.Encryption.GetDecipherName(Convert.ToString(dt.Rows[i]["Name"])); dt.Rows[i]["HomeTele"] = Encryption.Encryption.GetDecipherTele(Convert.ToString(dt.Rows[i]["HomeTele"])); dt.Rows[i]["OfficeTele"] = Encryption.Encryption.GetDecipherTele(Convert.ToString(dt.Rows[i]["OfficeTele"])); dt.Rows[i]["MobileTele"] = Encryption.Encryption.GetDecipherTele(Convert.ToString(dt.Rows[i]["MobileTele"])); dt.Rows[i]["FaxTele"] = Encryption.Encryption.GetDecipherTele(Convert.ToString(dt.Rows[i]["FaxTele"])); dt.Rows[i]["Address"] = Encryption.Encryption.GetDecipherAddress(Convert.ToString(dt.Rows[i]["Address"])); if (Convert.ToString(dt.Rows[i]["Sex"]) == "1") { dt.Rows[i]["Sex"] = GetTran("000094", "男"); } else { dt.Rows[i]["Sex"] = GetTran("000095", "女"); } } Excel.OutToExcel(dt, GetTran("004172", "会员信息表"), new string[] { "Number=" + GetTran("000024", "编号"), "ExpectNum=" + GetTran("000045", "期数"), "StoreId=" + GetTran("000150", "店铺编号"), "Name=" + GetTran("000025", "姓名"), "PetName=" + GetTran("001400", "昵称"), "RegisterDate=" + GetTran("000057", "注册日期"), "Birthday=" + GetTran("000105", "生日"), "Sex=" + GetTran("000085", "性别"), "HomeTele=" + GetTran("000065", "家庭电话"), "OfficeTele=" + GetTran("000044", "办公电话"), "MobileTele=" + GetTran("000069", "移动电话"), "FaxTele=" + GetTran("000643", "传真"), "Country=" + GetTran("002157", "国家"), "Province=" + GetTran("000109", "省份"), "City=" + GetTran("000110", "城市"), "Address=" + GetTran("000072", "地址"), "PostalCode=" + GetTran("000073", "邮编"), "Email=" + GetTran("000330", "电子邮箱") }); ///弹出成功提示 msg = "<script language='javascript'>alert('" + GetTran("004097", "备份会员基本信息成功") + "!')</script>"; }
/// <summary> /// 绑定数据 /// </summary> protected void BackupDatabaseDataBind() { DataTable dt = DataBackupBLL.GetBackupDatabaseInfo(); gvBackupDatabase.DataSource = dt; gvBackupDatabase.DataBind(); Pager page = Page.FindControl("uclPager") as Pager; page.PageBind(0, 10, table, columns, condition, key, "gvBackupDatabase"); }
///<summary> ///根据日期范围备份专卖店购货商品明细表 ///</summary> ///<param name="beginDate">开始时间</param> ///<param name="endDate">结束时间</param> private void BackupOrderDetailsByDate(DateTime beginDate, DateTime endDate) { ///清空所有的店铺订货产品明细备份数据 DataBackupBLL.ClearAllBackupOrderDetail(); ///根据日期范围备份店铺订货产品明细信息 DataBackupBLL.AddBackupOrderDetailByDate(beginDate, endDate); ///获取所有的店铺订货产品明细备份数据 DataTable dt = DataBackupBLL.GetALLBackupOrderDetail(); Excel.OutToExcel(dt, GetTran("004143", "专卖店购货商品明细"), new string[] { "StoreOrderID=" + GetTran("000079", "订单号"), "StoreID=" + GetTran("000150", "店铺编号"), "ProductID=" + GetTran("000558", "产品编号"), "ExpectNum=" + GetTran("000045", "期数"), "Quantity=" + GetTran("000505", "数量"), "NeedNumber=" + GetTran("001681", "应补数量"), "DumpQuantity=" + GetTran("004149", "冲红数量"), "Price=" + GetTran("002054", "产品单价"), "Pv=" + GetTran("002057", "产品积分"), "Description=" + GetTran("001680", "描述") }); ///弹出成功提示 msg = "<script language='javascript'>alert('" + GetTran("004141", "备份卖店购货商品明细成功") + "!')</script>"; }
///<summary> ///根据期数备份专卖店购货商品明细表 ///</summary> ///<param name="expectNum">指定的期数</param> private void BackupOrderDetailByExpectNum(int expectNum) { ///删除指定期数店铺订货产品明细记录 DataBackupBLL.DelBackupOrderDetailByExpectNum(expectNum); ///备份指定期数店铺订货产品明细记录 DataBackupBLL.AddBackupOrderDetailByExpectNum(expectNum); ///获取所有的店铺订货产品明细备份数据 DataTable dt = DataBackupBLL.GetALLBackupOrderDetail(); Excel.OutToExcel(dt, GetTran("004143", "专卖店购货商品明细"), new string[] { "StoreOrderID=" + GetTran("000079", "订单号"), "StoreID=" + GetTran("000150", "店铺编号"), "ProductID=" + GetTran("000558", "产品编号"), "ExpectNum=" + GetTran("000045", "期数"), "Quantity=" + GetTran("000505", "数量"), "NeedNumber=" + GetTran("001681", "应补数量"), "DumpQuantity=" + GetTran("004149", "冲红数量"), "Price=" + GetTran("002054", "产品单价"), "Pv=" + GetTran("002057", "产品积分"), "Description=" + GetTran("001680", "描述") }); ///弹出成功提示 msg = "<script language='javascript'>alert('" + GetTran("004122", "备份专卖店购货商品明细成功") + "!')</script>"; }
///<summary> ///根据期数范围备份会员明细表 ///</summary> ///<param name="expectNum">指定的期数</param> private void BackupMemberDetailsByExpectNum(int expectNum) { ///根据期数删除会员备份报单产品明细数据 DataBackupBLL.DelBackupMemberDetailsByExpectNum(expectNum); ///根据期数删除会员备份报单产品明细数据 DataBackupBLL.AddBackupMemberDetailsByExpectNum(expectNum); //获取所有会员备份报单产品明细数据 DataTable dt = DataBackupBLL.GetALLBackupMemberDetails(); if (dt.Rows.Count < 0) { msg = "<script language='javascript'>alert('" + GetTran("004099", "备份会员明细成功") + "!')</script>"; return; } else { for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["OrderID"] = " " + dt.Rows[i]["OrderID"].ToString(); } Excel.OutToExcel (OutToExcel_MemberDetails(dt), GetTran("004155", "会员明细"), new string[] { "Number=" + GetTran("000024", "编号"), "OrderID=" + GetTran("000079", "订单号"), "StoreID=" + GetTran("000150", "店铺编号"), "ProductID=" + GetTran("000558", "产品编号"), "Quantity=" + GetTran("000505", "数量"), "Price=" + GetTran("002084", "价格"), "Pv=" + GetTran("000414", "积分"), "ExpectNum=" + GetTran("000045", "期数"), "IsAgain=" + GetTran("004159", "是否复消"), "Remark=" + GetTran("000078", "备注"), "OrderDate=" + GetTran("000735", "订单日期") } ); ///弹出成功提示 msg = "<script language='javascript'>alert('" + GetTran("004099", "备份会员明细成功") + "!')</script>"; } }
protected void Page_Load(object sender, EventArgs e) { Permissions.ComRedirect(Page, Permissions.redirUrl); Response.Cache.SetExpires(DateTime.Now); Permissions.CheckManagePermission(EnumCompanyPermission.StoreOffView); if (!this.IsPostBack) { if (Session["Company"] != null) { string ManageID = Session["Company"].ToString(); txtOperatorNo.Text = ManageID; txtOperatorName.Text = DataBackupBLL.GetNameByAdminID(ManageID); } if (Request.QueryString["storeid"] != null) { this.txtStoreid.Text = Request.QueryString["storeid"].ToString(); } } Translations(); }
/// <summary> /// 绑定期数列表 /// </summary> private void BindExpectNumList() { int currentExpectNum = Convert.ToInt32(Session["nowqishu"]); DataTable dt; ///从结算表中获取期数 dt = DataBackupBLL.GetExpectNumFromConfig(); ddlExpectNum.DataSource = dt; ddlExpectNum.DataTextField = "ExpectNum"; ddlExpectNum.DataValueField = "ExpectNum"; ddlExpectNum.DataBind(); ddlExpectNum.SelectedIndex = -1; ///选中当前期数 foreach (ListItem item in ddlExpectNum.Items) { if (item.Value == currentExpectNum.ToString()) { item.Selected = true; break; } } }
protected void givTWmember_RowCommand(object sender, GridViewCommandEventArgs e) { string[] args = e.CommandArgument.ToString().Split(':'); if (args.Length != 3) { ScriptHelper.SetAlert(Page, GetTran("001089", "数据异常!")); return; } if (args[2].Trim() == "2") { ScriptHelper.SetAlert(Page, GetTran("000000", "服务机构已经恢复注销!")); return; } int id = Convert.ToInt32(args[0]); string storeid = args[1]; string Operator = Session["Company"].ToString(); string OperatorName = DataBackupBLL.GetNameByAdminID(Operator); if (e.CommandName == "OK") { int insertCon = StoreOffBLL.getUpdateStoreZX(storeid, CommonDataBLL.getMaxqishu(), id, DateTime.UtcNow, Operator, OperatorName); if (insertCon > 0) { ScriptHelper.SetAlert(Page, GetTran("001338", "确定完成")); } else { ScriptHelper.SetAlert(Page, GetTran("007132", "恢复注销失败")); } btnSeach_Click(null, null); } }
/// <summary> /// GridView排序事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvBackupDatabase_Sorting(object sender, GridViewSortEventArgs e) { ///按升序排还是按降序排 bool flag = true; DataView dv = new DataView(DataBackupBLL.GetBackupDatabaseInfo()); string sortString = e.SortExpression; switch (sortString.ToLower().Trim()) { case "databackupid": if (blDataBackupID) { dv.Sort = "DataBackupID desc"; flag = blDataBackupID = false; } else { dv.Sort = "DataBackupID asc"; flag = blDataBackupID = true; } break; case "databackuptime": if (blDataBackupTime) { dv.Sort = "DataBackupTime desc"; flag = blDataBackupTime = false; } else { dv.Sort = "DataBackupTime asc"; flag = blDataBackupTime = true; } break; case "pathfilename": if (blPathFileName) { dv.Sort = "PathFileName desc"; flag = blPathFileName = false; } else { dv.Sort = "PathFileName asc"; flag = blPathFileName = true; } break; case "operatornum": if (blOperatorNum) { dv.Sort = "OperatorNum desc"; flag = blOperatorNum = false; } else { dv.Sort = "OperatorNum asc"; flag = blOperatorNum = true; } break; } this.gvBackupDatabase.DataSource = dv; this.gvBackupDatabase.DataBind(); ///按关键字排序分页 Pager page = Page.FindControl("uclPager") as Pager; page.PagingSort(0, 10, table, columns, condition, sortString.ToLower().Trim(), flag, "gvBackupDatabase"); }