//执行 protected void btnWork_Click(object sender, EventArgs e) { ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get(); ShowShop.BLL.Member.UserInfoNote noteBll = new ShowShop.BLL.Member.UserInfoNote(); ShowShop.Model.Member.UserInfoNote noteModel = new ShowShop.Model.Member.UserInfoNote(); ShowShop.Model.Member.MemberAccount account = memberBll.GetModel(Convert.ToInt32(ViewState["uid"])); noteModel.NoteName = adminInfo.AdminName; noteModel.NoteDate = Convert.ToDateTime(System.DateTime.Now.ToShortDateString()); noteModel.Causation = this.txtQuestion.Text.Trim().ToString(); noteModel.BosomNote = this.txtLog.Text.Trim().ToString(); TimeSpan oldtime=new TimeSpan(Convert.ToDateTime(account.PeriodOfValidity).Ticks); if (Convert.ToDateTime(this.txtManageTime.Text) > Convert.ToDateTime(account.PeriodOfValidity)) { if (Convert.ToDecimal(account.Capital) > Convert.ToDecimal(this.txtCapital.Text)) { memberBll.Amend(account.UID, "PeriodOfValidity", this.txtManageTime.Text); memberBll.Amend(account.UID, "Capital", Convert.ToDecimal(account.Capital) - Convert.ToDecimal(this.txtCapital.Text)); noteModel.UserID = Convert.ToInt32(account.UID); noteModel.Username = account.UserId; TimeSpan newtime = new TimeSpan(Convert.ToDateTime(this.txtManageTime.Text).Ticks); TimeSpan tag = oldtime.Subtract(newtime).Duration(); //记录有效期 noteModel.BuckleOrAdd = 0; noteModel.NoteType = 2; noteModel.TicketCount = Convert.ToDecimal(tag.Days); noteBll.Add(noteModel); //记录资金支出 noteModel.BuckleOrAdd = 1; noteModel.NoteType = 1; noteModel.TicketCount = Convert.ToDecimal(this.txtCapital.Text); noteBll.Add(noteModel); this.ltlMsg.Text = "兑换有效期成功"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; return; } else { this.ltlMsg.Text = "你帐户金额小于支付的金额,请您冲值。"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } } else { this.ltlMsg.Text = "你兑换的日期小于系统记录的日期"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } }
//执行 protected void btnSave_Click(object sender, EventArgs e) { ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get(); ShowShop.BLL.Member.UserInfoNote noteBll = new ShowShop.BLL.Member.UserInfoNote(); ShowShop.Model.Member.UserInfoNote noteModel = new ShowShop.Model.Member.UserInfoNote(); ShowShop.Model.Member.MemberAccount model = memberBll.GetModel(Convert.ToInt32(ViewState["uid"])); noteModel.NoteName = adminInfo.AdminName; noteModel.NoteDate = Convert.ToDateTime(System.DateTime.Now.ToShortDateString()); noteModel.Causation = this.txtWhy.Text.Trim().ToString(); noteModel.BosomNote = this.txtLog.Text.Trim().ToString(); if (Convert.ToDecimal(model.Capital) > Convert.ToDecimal(this.txtCapital.Text)) { memberBll.Amend(model.UID, "Coupons", Convert.ToDecimal(model.Coupons) + Convert.ToDecimal(this.txtCoupons.Text)); memberBll.Amend(model.UID, "Capital", Convert.ToDecimal(model.Capital) - Convert.ToDecimal(this.txtCapital.Text)); noteModel.UserID = Convert.ToInt32(model.UID); noteModel.Username = model.UserId; //记录点卷 noteModel.NoteType = 0; noteModel.TicketCount = Convert.ToDecimal(this.txtCoupons.Text); noteModel.BuckleOrAdd=0; noteBll.Add(noteModel); //记录资金 noteModel.NoteType = 1; noteModel.TicketCount = Convert.ToDecimal(this.txtCapital.Text); noteModel.BuckleOrAdd = 1; noteBll.Add(noteModel); this.ltlMsg.Text = "兑换点卷成功!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } else { this.ltlMsg.Text = "兑换点卷的资金不足,请您冲值!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } }
protected void BtnWork_Click(object sender, EventArgs e) { ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get(); ShowShop.BLL.Member.UserInfoNote noteBll = new ShowShop.BLL.Member.UserInfoNote(); ShowShop.Model.Member.UserInfoNote noteModel = new ShowShop.Model.Member.UserInfoNote(); ShowShop.Model.Member.MemberAccount model = memberBll.GetModel(Convert.ToInt32(ViewState["uid"])); noteModel.NoteName = adminInfo.AdminName; noteModel.NoteType = 1;//资金 noteModel.NoteDate = Convert.ToDateTime(System.DateTime.Now.ToShortDateString()); noteModel.Causation = this.txtWhy.Text.Trim().ToString(); noteModel.BosomNote = this.txtLog.Text.Trim().ToString(); noteModel.BuckleOrAdd = 0; decimal Capital = 0; if (model != null) { Capital = Convert.ToDecimal(model.Capital) + Convert.ToDecimal(this.txtCapital.Text); } else { this.ltlMsg.Text = "请输入数字作为金额!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } noteModel.UserID = Convert.ToInt32(model.UID); noteModel.Username = model.UserId; noteModel.TicketCount = Convert.ToDecimal(this.txtCapital.Text); /* 修改人:YX 修改时间:2009-9-15 */ if (memberBll.Amend(Convert.ToInt32(ViewState["uid"]), "Capital", Capital) != 0) { int count = noteBll.Add(noteModel); if (count > 0) { this.ltlMsg.Text = "添加其他收入成功!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } else { this.ltlMsg.Text = "添加其他收入失败!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } } }
//批量事件(添加与减少) protected void BtnWork_Click(object sender, EventArgs e) { ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get(); ShowShop.BLL.Member.MemberAccount memberBll = new ShowShop.BLL.Member.MemberAccount(); ShowShop.BLL.Member.UserInfoNote noteBll = new ShowShop.BLL.Member.UserInfoNote(); ShowShop.Model.Member.UserInfoNote noteModel = new ShowShop.Model.Member.UserInfoNote(); if (ViewState["Opreate"].ToString().Equals("add")) { noteModel.BuckleOrAdd = 0; //添加 } else { noteModel.BuckleOrAdd = 1; //减少 } noteModel.NoteName = adminInfo.AdminName; noteModel.NoteType = 2; noteModel.NoteDate = Convert.ToDateTime(System.DateTime.Now.ToShortDateString()); noteModel.Causation = this.txtWhy.Text.Trim().ToString(); noteModel.BosomNote = this.txtLog.Text.Trim().ToString(); //所有会员 if (ViewState["M"].ToString() == "1") { List <ShowShop.Model.Member.MemberAccount> accountList= memberBll.GetAll(""); foreach (ShowShop.Model.Member.MemberAccount item in accountList) { TimeSpan oldtime = new TimeSpan(Convert.ToDateTime(item.PeriodOfValidity).Ticks); if (ViewState["time"].ToString() == "4") { switch (ViewState["Opreate"].ToString()) { case "add": if (Convert.ToDateTime(this.txtManageTime.Text) > Convert.ToDateTime(item.PeriodOfValidity)) { item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text); } else { this.ltlMsg.Text = "添加的有效期小于系统记录的有效期!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } break; case "allay": if (Convert.ToDateTime(this.txtManageTime.Text) < Convert.ToDateTime(item.PeriodOfValidity)) { item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text); } else { this.ltlMsg.Text = "减少的有效期大于系统记录的有效期!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } break; default: break; } } else { //归0 item.PeriodOfValidity = Convert.ToDateTime(System.DateTime.Now.ToShortDateString()); } memberBll.Update(item); TimeSpan newtime=new TimeSpan(Convert.ToDateTime(this.txtManageTime.Text).Ticks); TimeSpan gap=oldtime.Subtract(newtime).Duration(); noteModel.TicketCount=Convert.ToDecimal(gap.Days); noteModel.UserID = Convert.ToInt32(item.UID); noteModel.Username = item.UserId; noteBll.Add(noteModel); } } //指定会员组 if (ViewState["M"].ToString() == "2") { //获取会员类型 string typeId = this.cbxlMemberRank.SelectedValue; List<ShowShop.Model.Member.MemberAccount> accountList = merberBll.GetAll("UserGroup="+typeId); foreach (ShowShop.Model.Member.MemberAccount item in accountList) { TimeSpan oldtime = new TimeSpan(Convert.ToDateTime(item.PeriodOfValidity).Ticks); if (ViewState["time"].ToString() == "4") { switch (ViewState["Opreate"].ToString()) { case "add": if (Convert.ToDateTime(this.txtManageTime.Text) > Convert.ToDateTime(item.PeriodOfValidity)) { item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text); } else { this.ltlMsg.Text = "添加的有效期小于系统记录的有效期!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } break; case "allay": if (Convert.ToDateTime(this.txtManageTime.Text) < Convert.ToDateTime(item.PeriodOfValidity)) { item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text); } else { this.ltlMsg.Text = "减少的有效期大于系统记录的有效期!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } break; default: break; } } else { //归0 item.PeriodOfValidity = Convert.ToDateTime(System.DateTime.Now.ToShortDateString()); } memberBll.Update(item); TimeSpan newtime = new TimeSpan(Convert.ToDateTime(this.txtManageTime.Text).Ticks); TimeSpan gap = oldtime.Subtract(newtime).Duration(); noteModel.TicketCount = Convert.ToDecimal(gap.Days); noteModel.UserID = Convert.ToInt32(item.UID); noteModel.Username = item.UserId; noteBll.Add(noteModel); } } //指定用户 if(ViewState["M"].ToString() =="3") { string assigner= this.txtName.Text.Trim(); String[] name = assigner.Split(','); int con = name.Length; for (int i = 0; i < con; i++) { string userName = name[i].ToString(); List<ShowShop.Model.Member.MemberAccount> accountList = memberBll.GetAll("UserId = '" + userName + "'"); foreach (ShowShop.Model.Member.MemberAccount item in accountList) { TimeSpan oldtime = new TimeSpan(Convert.ToDateTime(item.PeriodOfValidity).Ticks); if (ViewState["time"].ToString() == "4") { switch (ViewState["Opreate"].ToString()) { case "add": if (Convert.ToDateTime(this.txtManageTime.Text) > Convert.ToDateTime(item.PeriodOfValidity)) { item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text); } else { this.ltlMsg.Text = "添加的有效期小于系统记录的有效期!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } break; case "allay": if (Convert.ToDateTime(this.txtManageTime.Text) < Convert.ToDateTime(item.PeriodOfValidity)) { item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text); } else { this.ltlMsg.Text = "减少的有效期大于系统记录的有效期!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } break; default: break; } } else { //归0 item.PeriodOfValidity = Convert.ToDateTime(System.DateTime.Now.ToShortDateString()); } memberBll.Update(item); TimeSpan newtime = new TimeSpan(Convert.ToDateTime(this.txtManageTime.Text).Ticks); TimeSpan gap = oldtime.Subtract(newtime).Duration(); noteModel.TicketCount = Convert.ToDecimal(gap.Days); noteModel.UserID = Convert.ToInt32(item.UID); noteModel.Username = item.UserId; noteBll.Add(noteModel); } } } this.ltlMsg.Text = "编辑有效期成功!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; }
//执行操作 protected void btnOk_Click(object sender, EventArgs e) { ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get(); ShowShop.BLL.Member.UserInfoNote noteBll = new ShowShop.BLL.Member.UserInfoNote(); ShowShop.Model.Member.UserInfoNote noteModel = new ShowShop.Model.Member.UserInfoNote(); ShowShop.Model.Member.MemberAccount account = memberBll.GetModel(Convert.ToInt32(ViewState["uid"])); TimeSpan oldtime = new TimeSpan(Convert.ToDateTime(account.PeriodOfValidity).Ticks); //记录旧日期 noteModel.NoteName = adminInfo.AdminName; noteModel.NoteType = 2; noteModel.NoteDate = Convert.ToDateTime(System.DateTime.Now.ToShortDateString()); noteModel.Causation = this.txtQuestion.Text.Trim().ToString(); noteModel.BosomNote = this.txtLog.Text.Trim().ToString(); DateTime periodOfValidity=System.DateTime.Now; if (ViewState["time"].ToString() == "4") { if (ViewState["Opreate"].ToString() == "add") { noteModel.BuckleOrAdd = 0; //添加 if (Convert.ToDateTime(this.txtManageTime.Text) > Convert.ToDateTime(account.PeriodOfValidity)) { periodOfValidity = Convert.ToDateTime(this.txtManageTime.Text); } else { this.ltlMsg.Text = "增加的有效期小于系统记录的有效期!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } } else { noteModel.BuckleOrAdd = 1; //减少 if (Convert.ToDateTime(this.txtManageTime.Text) < Convert.ToDateTime(account.PeriodOfValidity)) { periodOfValidity= Convert.ToDateTime(this.txtManageTime.Text); } else { this.ltlMsg.Text = "减少的有效期大于系统记录的有效期!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } } } else { //有效期归0 periodOfValidity = Convert.ToDateTime(System.DateTime.Now.ToShortDateString()); } memberBll.Amend(account.UID, "PeriodOfValidity", periodOfValidity); TimeSpan newtime = new TimeSpan(Convert.ToDateTime(account.PeriodOfValidity).Ticks); TimeSpan gap = oldtime.Subtract(newtime).Duration(); noteModel.TicketCount = Convert.ToInt32(gap.Days); noteModel.UserID = Convert.ToInt32(account.UID); noteModel.Username = account.UserId; int count=noteBll.Add(noteModel); if (count > 0) { this.ltlMsg.Text = "编辑有效期成功!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } else { this.ltlMsg.Text = "编辑有效期失败!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } }
protected void BtnWork_Click(object sender, EventArgs e) { ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get(); ShowShop.BLL.Member.MemberAccount memberBll = new ShowShop.BLL.Member.MemberAccount(); ShowShop.BLL.Member.UserInfoNote noteBll = new ShowShop.BLL.Member.UserInfoNote(); ShowShop.Model.Member.UserInfoNote noteModel = new ShowShop.Model.Member.UserInfoNote(); if (ViewState["Opreate"].ToString().Equals("add")) { noteModel.BuckleOrAdd = 0; //添加 } else { noteModel.BuckleOrAdd = 1; //减 } noteModel.NoteName = adminInfo.AdminName; noteModel.NoteType = 0;//点卷 noteModel.NoteDate = Convert.ToDateTime(System.DateTime.Now); noteModel.Causation = this.txtWhy.Text.Trim().ToString(); noteModel.BosomNote = this.txtLog.Text.Trim().ToString(); //全部用户 if (ViewState["M"].ToString() == "1") { List<ShowShop.Model.Member.MemberAccount> accountList = memberBll.GetAll(""); foreach (ShowShop.Model.Member.MemberAccount item in accountList) { switch (ViewState["Opreate"].ToString()) { case "add": item.Coupons = Convert.ToDecimal(item.Coupons) + Convert.ToDecimal(this.txtWrap.Text.Trim()); break; case "allay": if (Convert.ToDecimal(this.txtWrap.Text.Trim())<Convert.ToDecimal(item.Coupons) ) { item.Coupons = Convert.ToDecimal(item.Coupons)-Convert.ToDecimal(this.txtWrap.Text.Trim()); } else { this.ltlMsg.Text = "减少的点卷数量大于系统记录的数量!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } break; default: break; } memberBll.Update(item); noteModel.UserID = Convert.ToInt32(item.UID); noteModel.Username = item.UserId; noteModel.TicketCount = Convert.ToDecimal(this.txtWrap.Text.Trim()); noteBll.Add(noteModel); } } //指定用户组 if (ViewState["M"].ToString() == "2") { //获取会员类型 string typeId = this.cbxlMemberRank.SelectedValue; List<ShowShop.Model.Member.MemberAccount> accountList = merberBll.GetAll("UserGroup=" + typeId); foreach (ShowShop.Model.Member.MemberAccount item in accountList) { switch (ViewState["Opreate"].ToString()) { case "add": item.Coupons = Convert.ToDecimal(item.Coupons) + Convert.ToDecimal(this.txtWrap.Text.Trim()); break; case "allay": if (Convert.ToDecimal(this.txtWrap.Text.Trim()) < Convert.ToDecimal(item.Coupons)) { item.Coupons = Convert.ToDecimal(item.Coupons) - Convert.ToDecimal(this.txtWrap.Text.Trim()); } else { this.ltlMsg.Text = "减少的点卷数量大于系统记录的数量!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } break; default: break; } memberBll.Update(item); noteModel.UserID = Convert.ToInt32(item.UID); noteModel.Username = item.UserId; noteModel.TicketCount = Convert.ToDecimal(this.txtWrap.Text.Trim()); noteBll.Add(noteModel); } } //指定用户 if (ViewState["M"].ToString() == "3") { string assigner= this.txtName.Text.Trim(); String[] name = assigner.Split(','); int con = name.Length; for (int i = 0; i < con; i++) { string userName = name[i].ToString(); List<ShowShop.Model.Member.MemberAccount> accountList = memberBll.GetAll("UserId = '" + userName + "'"); foreach (ShowShop.Model.Member.MemberAccount item in accountList) { switch (ViewState["Opreate"].ToString()) { case "add": item.Coupons = Convert.ToDecimal(item.Coupons) + Convert.ToDecimal(this.txtWrap.Text.Trim()); break; case "allay": if (Convert.ToDecimal(this.txtWrap.Text.Trim()) < Convert.ToDecimal(item.Coupons)) { item.Coupons = Convert.ToDecimal(item.Coupons) - Convert.ToDecimal(this.txtWrap.Text.Trim()); } else { this.ltlMsg.Text = "减少的点卷数量大于系统记录的数量!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionErr"; return; } break; default: break; } memberBll.Update(item); noteModel.UserID = Convert.ToInt32(item.UID); noteModel.Username = item.UserId; noteModel.TicketCount = Convert.ToDecimal(this.txtWrap.Text.Trim()); noteBll.Add(noteModel); } } } this.ltlMsg.Text = "编辑点卷成功!"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; }