public string UpdateLotteryNumber(string id, string content, int Money) { DataTable dt = new DAL.Tables.T_Schemes().Open("", "id=" + id, ""); if (dt == null) { return(""); } if (dt.Rows.Count != 1) { return(""); } string Share = dt.Rows[0]["Share"].ToString(); string Schedule = dt.Rows[0]["Schedule"].ToString(); DAL.Tables.T_Schemes s = new DAL.Tables.T_Schemes(); s.LotteryNumber.Value = content; s.Money.Value = Money; s.Share.Value = Money; if (s.Update("ID=" + id) < 0) { return("修改方案号码失败!"); } return("上传成功!"); }
protected void btnGO_Click(object sender, System.EventArgs e) { 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; } 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; } } DAL.Tables.T_Schemes T_Schemes = new DAL.Tables.T_Schemes(); DataTable dt = T_Schemes.Open("", "IsuseID = " + ddlIsuse.SelectedValue + " and isOpened = 1", ""); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } for (int i = 0; i < dt.Rows.Count; i++) { string LotteryNumber = dt.Rows[i]["LotteryNumber"].ToString(); string Description = ""; double WinMoneyNoWithTax = 0; double 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); int Multiple = Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1); T_Schemes.WinDescription.Value = Description; T_Schemes.Update("[ID] = " + dt.Rows[i]["ID"].ToString()); } //tbWinNumber.Text = ""; Shove._Web.JavaScript.Alert(this.Page, "重构中奖描述成功。"); }
public void ClearanceStatistics() { DataTable dt1 = new DAL.Tables.T_Schemes().Open(ConnectionString, "ID, LotteryNumber,SchemeNumber,InitiateUserID,PlayTypeID, Multiple", "Buyed = 1 and not exists(select ID from T_BuyWays where T_Schemes.ID = T_BuyWays.SchemeID and Type = 1) and PlayTypeID between 7200 and 7300", ""); if (dt1 == null) { new Log("System").Write("T_Schemes表繁忙,请稍候再读"); return; } if (dt1.Rows.Count < 1) { return; } string InitiateUserID = ""; string LotteryNumber = ""; string SchemeNumber = ""; int SchemeLength = 0; int PlayTypeID = 0; string BuyWays = ""; DataTable dtMatch1 = null; DataRow[] drMatch1 = null; foreach (DataRow dr in dt1.Rows) { LotteryNumber = dr["LotteryNumber"].ToString(); PlayTypeID = Shove._Convert.StrToInt(dr["PlayTypeID"].ToString(), 7201); SchemeNumber = dr["SchemeNumber"].ToString(); SchemeLength = LotteryNumber.Split(';').Length; if (SchemeLength < 3) { new Log("System").Write("方案内容错误");//写错误日志 continue; } BuyWays = GetPassWay(LotteryNumber); string BuyNumber = LotteryNumber.Trim().Split(';')[1].ToString(); string Numbers = BuyNumber.Substring(1, BuyNumber.Length - 1).Substring(0, BuyNumber.Length - 2).ToString().Trim(); int GamesNumber = Numbers.Split('|').Length; //选择场次 string Locate = ""; string[] Matchs = new string[GamesNumber]; string[] BuyResutl = new string[GamesNumber]; string Matchids1 = ""; string Result1 = ""; int GamesNumber1 = 0; for (int i = 0; i < GamesNumber; i++) { Locate = Numbers.Split('|')[i]; Matchs[i] = Locate.Substring(0, Locate.IndexOf('(')); BuyResutl[i] = Locate.Substring(Locate.IndexOf('(') + 1, (Locate.IndexOf(')') - Locate.IndexOf('(') - 1)); Matchids1 += Locate.Substring(0, Locate.IndexOf('(')) + ","; } if (Matchids1.EndsWith(",")) { Matchids1 = Matchids1.Substring(0, Matchids1.Length - 1); } if (string.IsNullOrEmpty(Matchids1)) { continue; } dtMatch1 = new DAL.Tables.T_Match().Open(ConnectionString, "ID,SPFResult, BQCResult, ZJQSResult, ZQBFResult", "id in (" + Matchids1 + ") and isnull(SPFResult, '') <> '' and IsOpened = 1", ""); // 查询字段 if (dtMatch1 == null) { new Log("System").Write("T_Match表繁忙,请稍候再读");// 写日志 continue; } if (dtMatch1.Rows.Count < 1) { new Log("System").Write("T_Match表没数据"); // 写日志 continue; } if (dtMatch1.Rows.Count != Matchids1.Split(',').Length) { continue; } string MatchResult = " "; #region 循环比较赛果 for (int j = 0; j < Matchs.Length; j++) { drMatch1 = dtMatch1.Select("ID=" + Matchs[j]); if (drMatch1.Length < 1) { continue; } switch (PlayTypeID) { case 7201: Result1 = drMatch1[0]["SPFResult"].ToString(); MatchResult = Get7201(Result1); break; case 7204: Result1 = drMatch1[0]["BQCResult"].ToString(); MatchResult = Get7204(Result1); break; case 7203: Result1 = drMatch1[0]["ZJQSResult"].ToString(); MatchResult = Get7203(Result1); break; case 7202: Result1 = drMatch1[0]["ZQBFResult"].ToString(); MatchResult = Get7202(Result1); break; default: break; } if (BuyResutl[j].Contains(MatchResult)) { GamesNumber1++; //命中场次 } // 比较赛果 } #endregion string CanonicalNumber = ""; int count1 = 0; DataTable dtMatch2 = null; DataRow[] drMatch2 = null; string Result2 = ""; int num = 0; int count2 = 0; string Locate2 = ""; string Matchids2 = ""; double WinMoney = 0; double T_WinMoney = 0; string[] strs = LotteryNumber.Split('\r'); string[] LotteryNumbers = null; if (strs.Length < 1) { continue; } foreach (string str in strs) { if (string.IsNullOrEmpty(str.Replace("\n", "").Replace("\r", ""))) { continue; } LotteryNumbers = new Lottery()[72].ToSingle(str, ref CanonicalNumber, PlayTypeID); if (LotteryNumbers.Length < 1) { continue; } bool IsWin = true; count1 = LotteryNumbers.Length; //注数 for (int k = 0; k < count1; k++) { IsWin = true; num = LotteryNumbers[k].Split('|').Length; string[] Screenings = new string[num]; string[] LocateBuyResult = new string[num]; Matchids2 = " "; for (int l = 0; l < num; l++) { Locate2 = LotteryNumbers[k].Split(';')[1].Substring(1, LotteryNumbers[k].Split(';')[1].Length - 2).Split('|')[l]; Screenings[l] = Locate2.Substring(0, Locate2.IndexOf('(')); LocateBuyResult[l] = Locate2.Substring(Locate2.IndexOf('(') + 1, (Locate2.IndexOf(')') - Locate2.IndexOf('(') - 1)); Matchids2 += Locate2.Substring(0, Locate2.IndexOf('(')) + ","; } if (Matchids2.EndsWith(",")) { Matchids2 = Matchids2.Substring(0, Matchids2.Length - 1); } if (string.IsNullOrEmpty(Matchids2)) { continue; } dtMatch2 = new DAL.Tables.T_Match().Open(ConnectionString, "ID,SPFResult, BQCResult, ZJQSResult, ZQBFResult, SPFBonus, BQCBonus, ZJQSBonus, ZQBFBonus", "id in (" + Matchids2 + ")", ""); // 查询字段 if (dtMatch2 == null) { new Log("System").Write("T_Match表繁忙,请稍候再读");// 写日志 continue; } if (dtMatch2.Rows.Count < 1) { new Log("System").Write("T_Match表没数据");// 写日志 continue; } string MatchResult2 = ""; for (int m = 0; m < Screenings.Length; m++) { drMatch2 = dtMatch2.Select("ID=" + Screenings[m]); if (drMatch2.Length < 1) { continue; } switch (PlayTypeID) { case 7201: Result2 = drMatch2[0]["SPFResult"].ToString(); MatchResult2 = Get7201(Result2); T_WinMoney = Shove._Convert.StrToDouble(drMatch2[0]["SPFBonus"].ToString(), 0); break; case 7204: Result2 = drMatch2[0]["BQCResult"].ToString(); MatchResult2 = Get7204(Result2); T_WinMoney = Shove._Convert.StrToDouble(drMatch2[0]["BQCBonus"].ToString(), 0); break; case 7203: Result2 = drMatch2[0]["ZJQSResult"].ToString(); MatchResult2 = Get7203(Result2); T_WinMoney = Shove._Convert.StrToDouble(drMatch2[0]["ZJQSBonus"].ToString(), 0); break; case 7202: Result2 = drMatch2[0]["ZQBFResult"].ToString(); MatchResult2 = Get7202(Result2); T_WinMoney = Shove._Convert.StrToDouble(drMatch2[0]["ZQBFBonus"].ToString(), 0); break; default: break; } if (!LocateBuyResult[m].Equals(MatchResult2)) { IsWin = false; continue; } else if (BuyWays.Equals("单关")) { WinMoney += T_WinMoney * Shove._Convert.StrToInt(dr["Multiple"].ToString(), 1); } } if (IsWin) { count2++; //中奖注数 } } } InitiateUserID = dr["InitiateUserID"].ToString(); DataTable users = new DAL.Tables.T_Users().Open(ConnectionString, "Name", "ID =" + InitiateUserID, ""); if (users == null) { new Log("System").Write("T_Users表繁忙,请稍候再读"); return; } if (users.Rows.Count < 1) { new Log("System").Write("T_Users表没数据"); continue; } string Name = users.Rows[0]["Name"].ToString(); DAL.Tables.T_BuyWays bw = new DAL.Tables.T_BuyWays(); bw.SchemeID.Value = Shove._Convert.StrToLong(dr["ID"].ToString(), 0); bw.SchemeNumber.Value = SchemeNumber; bw.Name.Value = Name; bw.PlayTypeID.Value = PlayTypeID; bw.Count1.Value = count1; bw.BuyWays.Value = BuyWays; bw.Count2.Value = count2; bw.GameNumber.Value = GamesNumber; bw.GameNumber2.Value = GamesNumber1; bw.Rate.Value = GamesNumber1 * 1.00 / GamesNumber * 1.00; bw.UserID.Value = InitiateUserID; bw.Type.Value = 1; long Result = bw.Insert(ConnectionString); if (Result < 0) { new Log("System").Write("BuyWays数据表插入数据不成功"); } if (WinMoney > 0) { DAL.Tables.T_Schemes t_Schemes = new DAL.Tables.T_Schemes(); t_Schemes.WinMoney.Value = WinMoney; t_Schemes.WinMoneyNoWithTax.Value = WinMoney; t_Schemes.WinDescription.Value = "中奖奖金:" + WinMoney.ToString(); Result = t_Schemes.Update(ConnectionString, "id=" + dr["ID"].ToString()); if (Result < 0) { new Log("System").Write("单关自动开奖出现错误,方案ID:" + Shove._Convert.StrToLong(dr["ID"].ToString(), 0).ToString()); } } else if (count2 < 1) { DAL.Tables.T_Schemes t_Schemes = new DAL.Tables.T_Schemes(); t_Schemes.WinMoney.Value = WinMoney; t_Schemes.WinMoneyNoWithTax.Value = WinMoney; t_Schemes.WinDescription.Value = ""; t_Schemes.isOpened.Value = true; Result = t_Schemes.Update(ConnectionString, "id=" + dr["ID"].ToString()); if (Result < 0) { new Log("System").Write("单关自动开奖出现错误,方案ID:" + Shove._Convert.StrToLong(dr["ID"].ToString(), 0).ToString()); } } } }