protected void btnGO_Step1_Click(object sender, EventArgs e) { btnGO_Step1.AlertText = ""; if (ddlLottery.SelectedValue == SLS.Lottery.ZCDC.sID) { Shove._Web.JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。"); return; } tbWinNumber.Text = Shove._Convert.ToDBC(tbWinNumber.Text.Trim().Replace(" ", " ")).Trim(); if (!new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].AnalyseWinNumber(tbWinNumber.Text)) { Shove._Web.JavaScript.Alert(this.Page, "开奖号码不正确!"); return; } SystemOptions so = new SystemOptions(); bool isCompareWinMoneyNoWithFax = so["isCompareWinMoneyNoWithFax"].ToBoolean(true); string WinListXML = "<WinLists>"; double[] WinMoneyList = new double[g.Rows.Count * 2]; for (int i = 0; i < g.Rows.Count; i++) { WinMoneyList[i * 2] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0); WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0); if (WinMoneyList[i * 2] < 0) { Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项奖金输入错误!"); return; } if (WinMoneyList[i * 2] < WinMoneyList[i * 2 + 1]) { if (isCompareWinMoneyNoWithFax) { Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!"); return; } } WinListXML += "<WinList defaultMoney=\"" + WinMoneyList[i * 2].ToString() + "\" DefaultMoneyNoWithTax=\"" + WinMoneyList[i * 2 + 1].ToString() + "\"/>"; } WinListXML += "</WinLists>"; DataTable dtIsuseBonuses = new DAL.Tables.T_IsuseBonuses().Open("", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue), ""); if (dtIsuseBonuses == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } if (dtIsuseBonuses.Rows.Count < 1) { int ReturnValue = -1; string ReturnDescription = ""; int Result = DAL.Procedures.P_IsuseBonusesAdd(Shove._Convert.StrToLong(ddlIsuse.SelectedValue, 0), _User.ID, WinListXML, ref ReturnValue, ref ReturnDescription); if (Result < 0) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } if (ReturnValue < 0) { Shove._Web.JavaScript.Alert(this.Page, ReturnDescription); return; } Shove._Web.JavaScript.Alert(this.Page, "请下一位管理员继续开奖!"); return; } if (dtIsuseBonuses.Rows[0]["UserID"].ToString() == _User.ID.ToString()) { Shove._Web.JavaScript.Alert(this.Page, "请下一位管理员继续开奖!"); return; } for (int i = 0; i < dtIsuseBonuses.Rows.Count; i++) { if ((WinMoneyList[i * 2] != Shove._Convert.StrToDouble(dtIsuseBonuses.Rows[i]["defaultMoney"].ToString(), 0)) || (WinMoneyList[i * 2 + 1] != Shove._Convert.StrToDouble(dtIsuseBonuses.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0))) { DAL.Tables.T_IsuseBonuses T_IsuseBonuses = new DAL.Tables.T_IsuseBonuses(); T_IsuseBonuses.Delete("IsuseID = " + ddlIsuse.SelectedValue); Shove._Web.JavaScript.Alert(this.Page, "两次奖项输入不一致,请联系上一次开奖操作员!"); return; } } DataTable dt = new DAL.Tables.T_Schemes().Open("* ", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and isOpened = 0 and Buyed = 1", "[ID]"); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } StringBuilder sb = new StringBuilder(); string NoWinSchemeID = ""; for (int i = 0; i < dt.Rows.Count; i++) { string LotteryNumber = dt.Rows[i]["LotteryNumber"].ToString(); string Description = ""; double WinMoneyNoWithTax = 0; double WinMoney = 0; try { WinMoney = new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].ComputeWin(LotteryNumber, tbWinNumber.Text.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dt.Rows[i]["PlayTypeID"].ToString()), WinMoneyList); } catch { WinMoney = 0; new Log("System").Write("方案 ID:" + dt.Rows[i]["ID"].ToString() + " 算奖出现错误!"); } if (WinMoney == 0) { NoWinSchemeID += dt.Rows[i]["ID"].ToString() + ","; continue; } sb.Append("update T_Schemes set EditWinMoney = ").Append(WinMoney * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1)) .Append(", EditWinMoneyNoWithTax = ").Append(WinMoneyNoWithTax * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1)) .Append(", WinDescription = '").Append(Description).Append("'") .Append(" where [ID] = ").AppendLine(dt.Rows[i]["ID"].ToString()); } Shove.Database.MSSQL.ExecuteNonQuery(sb.ToString(), new Shove.Database.MSSQL.Parameter[0]); if (NoWinSchemeID.EndsWith(",")) { NoWinSchemeID = NoWinSchemeID.Substring(0, NoWinSchemeID.Length - 1); } if (!string.IsNullOrEmpty(NoWinSchemeID)) { StringBuilder sb1 = new StringBuilder(); sb1.Append("update T_Schemes set EditWinMoney = 0") .Append(", EditWinMoneyNoWithTax = 0, isOpened = 1 , OpenOperatorID=" + _User.ID.ToString()) .Append(", WinDescription = ''") .Append(" where [ID] in (" + NoWinSchemeID + ")"); Shove.Database.MSSQL.ExecuteNonQuery(sb1.ToString(), new Shove.Database.MSSQL.Parameter[0]); } dt = new DAL.Tables.T_Schemes().Open("top 1 * ", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and isOpened = 0 and Buyed = 1 and WinDescription is null", "[ID]"); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } Step1IsOpen = (dt.Rows.Count > 0); btnGO_Step1.Enabled = Step1IsOpen; btnGO_Step2.Enabled = (!Step1IsOpen); btnGO_Step3.Enabled = ((!Step1IsOpen) && (!Step2IsOpen)); string Message = "请再次执行第一步"; if (!Step1IsOpen) { Message = "开奖步骤一已经完成,请执行第二步."; } Shove._Web.JavaScript.Alert(this.Page, Message); }
protected void btnGO_Step1_Click(object sender, EventArgs e) { this.btnGO_Step1.AlertText = ""; if (this.ddlLottery.SelectedValue == "45") { JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。"); } else { this.tbWinNumber.Text = _Convert.ToDBC(this.tbWinNumber.Text.Trim().Replace(" ", " ")).Trim(); if (!new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].AnalyseWinNumber(this.tbWinNumber.Text)) { JavaScript.Alert(this.Page, "开奖号码不正确!"); } else { SystemOptions options = new SystemOptions(); bool flag = options["isCompareWinMoneyNoWithFax"].ToBoolean(true); string winListXML = "<WinLists>"; double[] winMoneyList = new double[this.g.Rows.Count * 2]; for (int i = 0; i < this.g.Rows.Count; i++) { winMoneyList[i * 2] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0.0); winMoneyList[(i * 2) + 1] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0.0); if (winMoneyList[i * 2] < 0.0) { JavaScript.Alert(this.Page, "第 " + ((i + 1)).ToString() + " 项奖金输入错误!"); return; } if ((winMoneyList[i * 2] < winMoneyList[(i * 2) + 1]) && flag) { JavaScript.Alert(this.Page, "第 " + ((i + 1)).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!"); return; } string str2 = winListXML; winListXML = str2 + "<WinList defaultMoney=\"" + winMoneyList[i * 2].ToString() + "\" DefaultMoneyNoWithTax=\"" + winMoneyList[(i * 2) + 1].ToString() + "\"/>"; } winListXML = winListXML + "</WinLists>"; DataTable table = new Tables.T_IsuseBonuses().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue), ""); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else if (table.Rows.Count < 1) { int returnValue = -1; string returnDescription = ""; if (Procedures.P_IsuseBonusesAdd(_Convert.StrToLong(this.ddlIsuse.SelectedValue, 0L), base._User.ID, winListXML, ref returnValue, ref returnDescription) < 0) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else if (returnValue < 0) { JavaScript.Alert(this.Page, returnDescription); } else { JavaScript.Alert(this.Page, "请让下一位开奖操作员继续下一步开奖操作!"); } } else if (table.Rows[0]["UserID"].ToString() == base._User.ID.ToString()) { JavaScript.Alert(this.Page, "请让下一位开奖操作员继续下一步开奖操作!"); } else { for (int j = 0; j < table.Rows.Count; j++) { if ((winMoneyList[j * 2] != _Convert.StrToDouble(table.Rows[j]["defaultMoney"].ToString(), 0.0)) || (winMoneyList[(j * 2) + 1] != _Convert.StrToDouble(table.Rows[j]["DefaultMoneyNoWithTax"].ToString(), 0.0))) { new Tables.T_IsuseBonuses().Delete("IsuseID = " + this.ddlIsuse.SelectedValue); JavaScript.Alert(this.Page, "两次奖项输入不一致,请联系上一次开奖操作员!"); return; } } DataTable table2 = new Tables.T_Schemes().Open("top 500 * ", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and isOpened = 0 and ID > " + Utility.FilteSqlInfusion(this.h_SchemeID.Value) + " and Buyed = 1", "[ID]"); if (table2 == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else { StringBuilder builder = new StringBuilder(); for (int k = 0; k < table2.Rows.Count; k++) { string number = table2.Rows[k]["LotteryNumber"].ToString(); string description = ""; double winMoneyNoWithTax = 0.0; double num10 = 0.0; try { num10 = new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].ComputeWin(number, this.tbWinNumber.Text.Trim(), ref description, ref winMoneyNoWithTax, int.Parse(table2.Rows[k]["PlayTypeID"].ToString()), winMoneyList); } catch { num10 = 0.0; new Log("System").Write("方案 ID:" + table2.Rows[k]["ID"].ToString() + " 算奖出现错误!"); PF.SendEmail(base._Site, "*****@*****.**", "方案 ID:" + table2.Rows[k]["ID"].ToString() + " 算奖出现错误!", "方案 ID:" + table2.Rows[k]["ID"].ToString() + " 算奖出现错误!"); PF.SendEmail(base._Site, "*****@*****.**", "方案 ID:" + table2.Rows[k]["ID"].ToString() + " 算奖出现错误!", "方案 ID:" + table2.Rows[k]["ID"].ToString() + " 算奖出现错误!"); } builder.Append("update T_Schemes set PreWinMoney = ").Append((double)(num10 * _Convert.StrToInt(table2.Rows[k]["Multiple"].ToString(), 1))).Append(", PreWinMoneyNoWithTax = ").Append((double)(winMoneyNoWithTax * _Convert.StrToInt(table2.Rows[k]["Multiple"].ToString(), 1))).Append(", EditWinMoney = ").Append((double)(num10 * _Convert.StrToInt(table2.Rows[k]["Multiple"].ToString(), 1))).Append(", EditWinMoneyNoWithTax = ").Append((double)(winMoneyNoWithTax * _Convert.StrToInt(table2.Rows[k]["Multiple"].ToString(), 1))).Append(", WinDescription = '").Append(description).Append("'").Append(" where [ID] = ").AppendLine(table2.Rows[k]["ID"].ToString()); } MSSQL.ExecuteNonQuery(builder.ToString(), new MSSQL.Parameter[0]); if (table2.Rows.Count > 1) { this.h_SchemeID.Value = table2.Rows[table2.Rows.Count - 1]["ID"].ToString(); } this.Step1IsOpen = table2.Rows.Count == 500; if (!this.Step1IsOpen) { table2 = new Tables.T_Schemes().Open("top 1 * ", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and isOpened = 0 and Buyed = 1 and WinMoney is null", "[ID]"); if (table2 == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); return; } this.Step1IsOpen = table2.Rows.Count > 0; } this.btnGO_Step1.Enabled = this.Step1IsOpen; this.btnGO_Step2.Enabled = !this.Step1IsOpen; this.btnGO_Step3.Enabled = !this.Step1IsOpen && !this.Step2IsOpen; string msg = "请再次执行第一步"; if (!this.Step1IsOpen) { msg = "开奖步骤一已经完成,请执行第二步."; } JavaScript.Alert(this.Page, msg); } } } } }