protected void btnAdd_Click(object sender, System.EventArgs e) { string Isuse = ""; try { Isuse = Shove._Web.Utility.FilteSqlInfusion(tbIsuse.Text.Trim()); } catch { } if (Isuse == "") { Shove._Web.JavaScript.Alert(this.Page, "期号不能为空!"); return; } DataTable dt = new DAL.Tables.T_Isuses().Open("[ID]", "[Name] = '" + Isuse + "' and LotteryID = " + Shove._Web.Utility.FilteSqlInfusion(tbLotteryID.Text), ""); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", "Admin_IsuseAdd"); return; } if (dt.Rows.Count > 0) { Shove._Web.JavaScript.Alert(this.Page, "期号已经存在,请不要输入重名期号!"); return; } System.DateTime StartTime, EndTime; object time = PF.ValidLotteryTime(tbStartTime.Text); if (time == null) { Shove._Web.JavaScript.Alert(this.Page, "开始时间格式输入错误!"); return; } StartTime = (DateTime)time; time = PF.ValidLotteryTime(tbEndTime.Text); if (time == null) { Shove._Web.JavaScript.Alert(this.Page, "截止时间格式输入错误!"); return; } EndTime = (DateTime)time; if (EndTime <= StartTime) { Shove._Web.JavaScript.Alert(this.Page, "截止时间应该在开始时间之后!"); return; } string AdditionasXml = ""; if ((tbLotteryID.Text == SLS.Lottery.SFC.sID || tbLotteryID.Text == SLS.Lottery.ZCSFC.sID || tbLotteryID.Text == SLS.Lottery.ZCRJC.sID) && (BuildAdditionasXmlForSFC(ref AdditionasXml) < 0)) { return; } if ((tbLotteryID.Text == SLS.Lottery.JQC.sID) && (BuildAdditionasXmlForJQC(ref AdditionasXml) < 0)) { return; } if ((tbLotteryID.Text == SLS.Lottery.LCBQC.sID) && (BuildAdditionasXmlForLCBQC(ref AdditionasXml) < 0)) { return; } if ((tbLotteryID.Text == SLS.Lottery.LCDC.sID) && (BuildAdditionasXmlForLCDC(ref AdditionasXml) < 0)) { return; } if ((tbLotteryID.Text == SLS.Lottery.ZCDC.sID) && (BuildAdditionasXmlForZCDC(ref AdditionasXml) < 0)) { return; } int LotteryID = int.Parse(tbLotteryID.Text); long NewIsuseID = -1; string ReturnDescription = ""; int Result = DAL.Procedures.P_IsuseAdd(LotteryID, Isuse, StartTime, EndTime, AdditionasXml, ref NewIsuseID, ref ReturnDescription); if (Result < 0) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", "Admin_IsuseAdd"); return; } if (NewIsuseID < 0) { PF.GoError(ErrorNumber.Unknow, ReturnDescription, "Admin_IsuseAdd"); return; } DAL.Tables.T_TotalMoney dtTotalMoney = new DAL.Tables.T_TotalMoney(); dtTotalMoney.IsuseID.Value = NewIsuseID; dtTotalMoney.TotalMoney.Value = this.tbMoney.Text; if (dtTotalMoney.Insert() < 0) { Shove._Web.JavaScript.Alert(this.Page, "添加奖池奖金失败!"); return; } if (cbAutoNext10Isuse.Visible && cbAutoNext10Isuse.Checked && (AdditionasXml == "")) { string IsuseYear = Isuse.Substring(0, Isuse.Length - 3); int IsuseNum = Shove._Convert.StrToInt(Isuse.Substring(Isuse.Length - 3, 3), 0); for (int i = 1; i <= 9; i++) { IsuseNum++; string NextIsuse = IsuseYear + IsuseNum.ToString().PadLeft(3, '0'); StartTime = StartTime.AddDays(1); EndTime = EndTime.AddDays(1); int Results = -1; Results = DAL.Procedures.P_IsuseAdd(LotteryID, NextIsuse, StartTime, EndTime, "", ref NewIsuseID, ref ReturnDescription); if (Result < 0) { break; } if (NewIsuseID < 0) { continue; } } } Shove._Web.Cache.ClearCache(CacheKey.LotteryCalendar); Shove._Web.Cache.ClearCache(DataCache.IsusesInfo + tbLotteryID.Text.Trim()); this.Response.Redirect("Isuse.aspx?LotteryID=" + tbLotteryID.Text, true); }
protected void btnMultiAdd_Click(object sender, System.EventArgs e) { int LotteryID = int.Parse(tbLotteryID.Text); string Isuse = ""; if (LotteryID != SLS.Lottery.SSQ.ID && LotteryID != SLS.Lottery.TCCJDLT.ID) { btnMultiAdd.Visible = false; btnMultiAdd.Enabled = false; return; } try { Isuse = Shove._Web.Utility.FilteSqlInfusion(tbIsuse.Text.Trim()); } catch { } if (Isuse == "") { Shove._Web.JavaScript.Alert(this.Page, "期号不能为空!"); return; } System.DateTime StartTime, EndTime; object time = PF.ValidLotteryTime(tbStartTime.Text); if (time == null) { Shove._Web.JavaScript.Alert(this.Page, "开始时间格式输入错误!"); return; } DayOfWeek dow = ((DateTime)time).DayOfWeek; switch (LotteryID) { case SLS.Lottery.TCCJDLT.ID: if (dow != DayOfWeek.Monday && dow != DayOfWeek.Wednesday && dow != DayOfWeek.Saturday) { Shove._Web.JavaScript.Alert(this.Page, "开始时间输入不正确(周一、三、六)!"); return; } break; case SLS.Lottery.SSQ.ID: if (dow != DayOfWeek.Tuesday && dow != DayOfWeek.Thursday && dow != DayOfWeek.Sunday) { Shove._Web.JavaScript.Alert(this.Page, "开始时间输入不正确(周二、四、日)!"); return; } break; default: Shove._Web.JavaScript.Alert(this.Page, "开始时间输入不正确!"); return; } StartTime = (DateTime)time; EndTime = StartTime; switch (LotteryID) { case SLS.Lottery.TCCJDLT.ID: if (EndTime.DayOfWeek == DayOfWeek.Wednesday) { EndTime = EndTime.AddDays(3); } else { EndTime = EndTime.AddDays(2); } break; case SLS.Lottery.SSQ.ID: if (EndTime.DayOfWeek == DayOfWeek.Thursday) { EndTime = EndTime.AddDays(3); } else { EndTime = EndTime.AddDays(2); } break; } int x = 0; if (!int.TryParse(tbMultiDays.Text, out x)) { Shove._Web.JavaScript.Alert(this.Page, "增加天数格式输入错误!"); return; } long NewIsuseID = -1; string ReturnDescription = ""; DataTable dt; for (int i = 0; i < x; i++) { dt = new DAL.Tables.T_Isuses().Open("[ID]", "[Name] = '" + Isuse + "' and LotteryID = " + Shove._Web.Utility.FilteSqlInfusion(tbLotteryID.Text), ""); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", "Admin_IsuseAdd"); i = i - 1; } else if (dt.Rows.Count == 0) { int Result = DAL.Procedures.P_IsuseAdd(LotteryID, Isuse, StartTime, EndTime, "", ref NewIsuseID, ref ReturnDescription); if (Result < 0) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", "Admin_IsuseAdd"); return; } else if (NewIsuseID < 0) { PF.GoError(ErrorNumber.Unknow, ReturnDescription, "Admin_IsuseAdd"); return; } else { DAL.Tables.T_TotalMoney dtTotalMoney = new DAL.Tables.T_TotalMoney(); dtTotalMoney.IsuseID.Value = NewIsuseID; dtTotalMoney.TotalMoney.Value = ""; if (dtTotalMoney.Insert() < 0) { Shove._Web.JavaScript.Alert(this.Page, "添加奖池奖金失败!"); return; } } } Isuse = (int.Parse(Isuse) + 1).ToString(); StartTime = EndTime; switch (LotteryID) { case SLS.Lottery.TCCJDLT.ID: if (EndTime.DayOfWeek == DayOfWeek.Wednesday) { EndTime = EndTime.AddDays(1); } break; case SLS.Lottery.SSQ.ID: if (EndTime.DayOfWeek == DayOfWeek.Thursday) { EndTime = EndTime.AddDays(1); } break; } EndTime = EndTime.AddDays(2); NewIsuseID = -1; ReturnDescription = ""; } Shove._Web.Cache.ClearCache(CacheKey.LotteryCalendar); Shove._Web.Cache.ClearCache(DataCache.IsusesInfo + tbLotteryID.Text.Trim()); this.Response.Redirect("Isuse.aspx?LotteryID=" + tbLotteryID.Text, true); }
protected void btnEdit_Click(object sender, System.EventArgs e) { string Isuse = ""; try { Isuse = Shove._Web.Utility.FilteSqlInfusion(tbIsuse.Text.Trim()); } catch { } if (Isuse == "") { Shove._Web.JavaScript.Alert(this.Page, "期号不能为空!"); return; } DataTable dt = new DAL.Tables.T_Isuses().Open("[ID]", "[Name]='" + Isuse + "' and LotteryID=" + Shove._Web.Utility.FilteSqlInfusion(tbLotteryID.Text) + " and [ID] <> " + Shove._Web.Utility.FilteSqlInfusion(tbIsuseID.Text), ""); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName); return; } if (dt.Rows.Count > 0) { Shove._Web.JavaScript.Alert(this.Page, "期号已经存在,请不要输入重名期号!"); return; } System.DateTime StartTime, EndTime; object time = PF.ValidLotteryTime(tbStartTime.Text); if (time == null) { Shove._Web.JavaScript.Alert(this.Page, "开始时间格式输入错误!"); return; } StartTime = (DateTime)time; time = PF.ValidLotteryTime(tbEndTime.Text); if (time == null) { Shove._Web.JavaScript.Alert(this.Page, "截止时间格式输入错误!"); return; } EndTime = (DateTime)time; if (EndTime <= StartTime) { Shove._Web.JavaScript.Alert(this.Page, "截止时间应该在开始时间之后!"); return; } string AdditionasXml = ""; if ((tbLotteryID.Text == SLS.Lottery.SFC.sID || tbLotteryID.Text == SLS.Lottery.ZCSFC.sID || tbLotteryID.Text == SLS.Lottery.ZCRJC.sID) && (BuildAdditionasXmlForSFC(ref AdditionasXml) < 0)) { return; } if ((tbLotteryID.Text == SLS.Lottery.JQC.sID) && (BuildAdditionasXmlForJQC(ref AdditionasXml) < 0)) { return; } if ((tbLotteryID.Text == SLS.Lottery.LCBQC.sID) && (BuildAdditionasXmlForLCBQC(ref AdditionasXml) < 0)) { return; } if ((tbLotteryID.Text == SLS.Lottery.LCDC.sID) && (BuildAdditionasXmlForLCDC(ref AdditionasXml) < 0)) { return; } if ((tbLotteryID.Text == SLS.Lottery.ZCDC.sID) && (BuildAdditionasXmlForZCDC(ref AdditionasXml) < 0)) { return; } long IsuseID = long.Parse(tbIsuseID.Text); int ReturnValue = -1; string ReturnDescription = ""; int Result = DAL.Procedures.P_IsuseEdit(IsuseID, Isuse, StartTime, EndTime, AdditionasXml, ref ReturnValue, ref ReturnDescription); if (Result < 0) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName); return; } if (ReturnValue < 0) { PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.Page.GetType().BaseType.FullName); return; } if (tbTestNumber.Text.Trim() != "") { DAL.Tables.T_TestNumber t_TestNumber = new DAL.Tables.T_TestNumber(); t_TestNumber.TestNumber.Value = tbTestNumber.Text.Trim(); t_TestNumber.IsuseID.Value = IsuseID.ToString(); if (Shove._Convert.StrToLong(hidID.Value, 0) > 0) { t_TestNumber.Update("ID=" + hidID.Value); } else { t_TestNumber.Insert(); } } if (tbMoney.Text.Trim() != "") { DAL.Tables.T_TotalMoney t_TotalMoney = new DAL.Tables.T_TotalMoney(); t_TotalMoney.TotalMoney.Value = tbMoney.Text.Trim(); t_TotalMoney.IsuseID.Value = tbIsuseID.Text; if (Shove._Convert.StrToLong(moneyID.Value, 0) > 0) { t_TotalMoney.Update("ID=" + moneyID.Value); } else { t_TotalMoney.Insert(); } } Shove._Web.Cache.ClearCache(CacheKey.LotteryCalendar); Shove._Web.Cache.ClearCache(DataCache.IsusesInfo + tbLotteryID.Text.Trim()); this.Response.Redirect("Isuse.aspx?LotteryID=" + tbLotteryID.Text, true); }