private static void Run(int LotteryId, string IssueNum) { try { Youle11x5Check.list.Clear(); DataTable dataTable = LotteryDAL.GetDataTable(LotteryId.ToString(), IssueNum); if (dataTable.Rows.Count > 0) { DataTable lotteryCheck = LotteryDAL.GetLotteryCheck(LotteryId); decimal curRealGet = LotteryDAL.GetCurRealGet(LotteryId); if (curRealGet < Convert.ToDecimal(lotteryCheck.Rows[0]["CheckPer"])) { int num = Convert.ToInt32(lotteryCheck.Rows[0]["CheckNum"]); int num2 = 0; string text; do { decimal d = 0m; decimal num3 = 0m; text = NumberCode.CreateCode11X5(5); for (int i = 0; i < dataTable.Rows.Count; i++) { DataRow dataRow = dataTable.Rows[i]; int num4 = Convert.ToInt32(dataRow["Id"]); int num5 = Convert.ToInt32(dataRow["UserId"]); string sType = dataRow["PlayCode"].ToString(); string text2 = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(dataRow["STime2"]).ToString("yyyyMMdd"), num5.ToString(), num4.ToString()); if (string.IsNullOrEmpty(text2)) { text2 = ""; } string pos = dataRow["Pos"].ToString(); decimal d2 = Convert.ToDecimal(dataRow["SingleMoney"]); decimal d3 = Convert.ToDecimal(dataRow["Bonus"]); decimal d4 = Convert.ToDecimal(dataRow["PointMoney"]); decimal d5 = Convert.ToDecimal(dataRow["Times"]); decimal d6 = Convert.ToDecimal(dataRow["Total"]); d += d6 * d5; int value = CheckPlay.Check(text, text2, pos, sType); num3 += d3 * d5 * d2 * value / 2m + d4; } decimal num6 = d - num3; if (num6 > 0m) { num2 = num; } KeyValue keyValue = new KeyValue(); keyValue.tKey = text; keyValue.tValue = num6; Youle11x5Check.list.Add(keyValue); num2++; }while (num2 < num); IOrderedEnumerable <KeyValue> source = from a in Youle11x5Check.list orderby a.tValue descending select a; List <KeyValue> list = source.ToList <KeyValue>(); if (!new LotteryDataDAL().Exists(LotteryId, IssueNum)) { new LotteryDataDAL().AddYoule(LotteryId, IssueNum, list[0].tKey, DateTime.Now.ToString(), text); LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, list[0].tKey); Youle11x5Check.SetOpenListJson(LotteryId); } } else { string text3 = NumberCode.CreateCode11X5(5); if (!new LotteryDataDAL().Exists(LotteryId, IssueNum)) { new LotteryDataDAL().AddYoule(LotteryId, IssueNum, text3, DateTime.Now.ToString(), text3); LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, text3); Youle11x5Check.SetOpenListJson(LotteryId); } } } else { string text4 = NumberCode.CreateCode11X5(5); if (!new LotteryDataDAL().Exists(LotteryId, IssueNum)) { new LotteryDataDAL().AddYoule(LotteryId, IssueNum, text4, DateTime.Now.ToString(), text4); LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, text4); Youle11x5Check.SetOpenListJson(LotteryId); } } } catch (Exception ex) { new LogExceptionDAL().Save("派奖异常", ex.Message); } }
private static void Run(int LotteryId, string IssueNum) { try { DataTable dataTable = LotteryDAL.GetDataTable(LotteryId.ToString(), IssueNum); if (dataTable.Rows.Count > 0) { DataTable lotteryCheck = LotteryDAL.GetLotteryCheck(LotteryId); if (LotteryDAL.GetCurRealGet(LotteryId) < Convert.ToDecimal(lotteryCheck.Rows[0]["CheckPer"])) { List <KeyValue> source = new List <KeyValue>(); int int32_1 = Convert.ToInt32(lotteryCheck.Rows[0]["CheckNum"]); int num1 = 0; do { Decimal num2 = new Decimal(0); Decimal num3 = new Decimal(0); Decimal num4 = new Decimal(0); string code11X5 = NumberCode.CreateCode11X5(5); for (int index = 0; index < dataTable.Rows.Count; ++index) { DataRow row = dataTable.Rows[index]; int int32_2 = Convert.ToInt32(row["Id"]); int int32_3 = Convert.ToInt32(row["UserId"]); string sType = row["PlayCode"].ToString(); string CheckNumber = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(row["STime2"]).ToString("yyyyMMdd"), int32_3.ToString(), int32_2.ToString()); if (string.IsNullOrEmpty(CheckNumber)) { CheckNumber = ""; } string Pos = row["Pos"].ToString(); Decimal num5 = Convert.ToDecimal(row["SingleMoney"]); Decimal num6 = Convert.ToDecimal(row["Bonus"]); Decimal num7 = Convert.ToDecimal(row["PointMoney"]); Decimal num8 = Convert.ToDecimal(row["Times"]); Decimal num9 = Convert.ToDecimal(row["Total"]); num3 += num9 * num8; int num10 = CheckPlay.Check(code11X5, CheckNumber, Pos, sType); num4 += num6 * num8 * num5 * (Decimal)num10 / new Decimal(2) + num7 * num8; } Decimal num11 = num3 - num4; if (num11 > new Decimal(0)) { num1 = int32_1; } source.Add(new KeyValue() { tKey = code11X5, tValue = num11 }); ++num1; }while (num1 < int32_1); List <KeyValue> list = source.OrderByDescending <KeyValue, Decimal>((Func <KeyValue, Decimal>)(a => a.tValue)).ToList <KeyValue>(); GYoule11x5Check.SetOpenListJson(LotteryId, IssueNum, list[0].tKey, DateTime.Now.ToString(), string.Concat((object)list[0].tValue)); } else { string code11X5 = NumberCode.CreateCode11X5(5); GYoule11x5Check.SetOpenListJson(LotteryId, IssueNum, code11X5, DateTime.Now.ToString(), "0"); } } else { string code11X5 = NumberCode.CreateCode11X5(5); GYoule11x5Check.SetOpenListJson(LotteryId, IssueNum, code11X5, DateTime.Now.ToString(), "0"); } } catch (Exception ex) { new LogExceptionDAL().Save("派奖异常", ex.Message); } }