public bool UpdateBetNumber(int type, string title) { using (DbOperHandler dbOperHandler = new ComData().Doh()) { dbOperHandler.Reset(); dbOperHandler.SqlCmd = "select top 1 Type,Title,Number from Sys_LotteryData where Id=" + title; DataTable dataTable = dbOperHandler.GetDataTable(); if (dataTable.Rows.Count > 0) { LotteryCheck.AdminRunOper(Convert.ToInt32(dataTable.Rows[0]["Type"].ToString()), dataTable.Rows[0]["Title"].ToString(), dataTable.Rows[0]["Number"].ToString()); return(true); } } return(false); }
public bool UpdateAllBetNumber(int type) { using (DbOperHandler dbOperHandler = new ComData().Doh()) { dbOperHandler.Reset(); dbOperHandler.SqlCmd = "select top 1 Type,Title,Number from Sys_LotteryData where Type=" + (object)type + " order by Title desc"; DataTable dataTable = dbOperHandler.GetDataTable(); if (dataTable.Rows.Count > 0) { for (int index = 0; index < dataTable.Rows.Count; ++index) { LotteryCheck.AdminRunOper(Convert.ToInt32(dataTable.Rows[index]["Type"].ToString()), dataTable.Rows[index]["Title"].ToString(), dataTable.Rows[index]["Number"].ToString()); } } } return(true); }
public static void GroupDataRows(IEnumerable <DataRow> source, List <DataTable> destination, string[] groupByFields, int fieldIndex, DataTable schema) { if (fieldIndex >= groupByFields.Length || fieldIndex < 0) { DataTable dataTable = schema.Clone(); foreach (DataRow dataRow in source) { DataRow row = dataTable.NewRow(); row.ItemArray = dataRow.ItemArray; dataTable.Rows.Add(row); } destination.Add(dataTable); } else { foreach (IEnumerable <DataRow> source1 in source.GroupBy <DataRow, object>((Func <DataRow, object>)(o => o[groupByFields[fieldIndex]]))) { LotteryCheck.GroupDataRows(source1, destination, groupByFields, fieldIndex + 1, schema); } ++fieldIndex; } }
public static void GroupDataRows(IEnumerable <DataRow> source, List <DataTable> destination, string[] groupByFields, int fieldIndex, DataTable schema) { if (fieldIndex >= groupByFields.Length || fieldIndex < 0) { DataTable dataTable = schema.Clone(); foreach (DataRow current in source) { DataRow dataRow = dataTable.NewRow(); dataRow.ItemArray = current.ItemArray; dataTable.Rows.Add(dataRow); } destination.Add(dataTable); return; } IEnumerable <IGrouping <object, DataRow> > enumerable = from o in source group o by o[groupByFields[fieldIndex]]; foreach (IGrouping <object, DataRow> current2 in enumerable) { LotteryCheck.GroupDataRows(current2, destination, groupByFields, fieldIndex + 1, schema); } fieldIndex++; }
public static string RunOper(int Type, string Title) { string result = ""; using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString)) { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = sqlConnection; SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(); sqlDataAdapter.SelectCommand = sqlCommand; try { sqlDataAdapter.SelectCommand.CommandType = CommandType.Text; sqlDataAdapter.SelectCommand.CommandText = string.Format("select top 1 Type,Title,Number from Sys_LotteryData where Type={0} and Title='{1}'", Type, Title); DataTable dataTable = new DataTable(); sqlDataAdapter.Fill(dataTable); if (dataTable.Rows.Count > 0) { string lotteryNumber = dataTable.Rows[0]["Number"].ToString(); sqlDataAdapter.SelectCommand.CommandType = CommandType.Text; sqlDataAdapter.SelectCommand.CommandText = string.Format("select b.username,b.point as uPoint,a.* \r\n From N_UserBet a with(nolock) left join N_User b on a.UserId=b.Id \r\n where a.State=0 and LotteryId={0} and IssueNum='{1}'", dataTable.Rows[0]["Type"].ToString(), dataTable.Rows[0]["Title"].ToString()); DataTable dataTable2 = new DataTable("N_UserBet"); sqlDataAdapter.Fill(dataTable2); if (dataTable2.Rows.Count > 0) { foreach (DataRow dataRow in dataTable2.Rows) { if (Convert.ToInt32(dataRow["State"].ToString()) == 0) { CheckOperation.Checking(dataRow, lotteryNumber, sqlCommand); } } foreach (DataRow dataRow2 in dataTable2.Rows) { string userName = dataRow2["UserName"].ToString(); int userPoint = Convert.ToInt32(dataRow2["uPoint"]); int betId = Convert.ToInt32(dataRow2["Id"]); string ssId = dataRow2["SsId"].ToString(); int userId = Convert.ToInt32(dataRow2["UserId"]); int lotteryId = Convert.ToInt32(dataRow2["LotteryId"]); int playId = Convert.ToInt32(dataRow2["PlayId"]); decimal d = Convert.ToDecimal(dataRow2["Total"]); decimal d2 = Convert.ToDecimal(dataRow2["Times"]); CheckOperation.AgencyPoint(ssId, userId, userName, userPoint, lotteryId, playId, betId, Convert.ToDecimal(d * d2), sqlCommand); } sqlDataAdapter.SelectCommand.CommandType = CommandType.Text; sqlDataAdapter.SelectCommand.CommandText = string.Format("select UserId,sum(times*total) as bet,sum(WinBonus) as win,sum(RealGet) as RealGet From N_UserBet with(nolock) \r\n where lotteryId={0} and IssueNum='{1}' group by UserId", Type, Title); DataTable dataTable3 = new DataTable(); sqlDataAdapter.Fill(dataTable3); foreach (DataRow dataRow3 in dataTable3.Rows) { string userId2 = dataRow3["UserId"].ToString(); string str = LotteryUtils.LotteryTitle(Type); string str2 = Convert.ToDecimal(dataRow3["bet"]).ToString("0.0000"); string str3 = Convert.ToDecimal(dataRow3["win"]).ToString("0.0000"); string str4 = Convert.ToDecimal(dataRow3["RealGet"]).ToString("0.0000"); string text = "投注彩种 " + str + "<br/>"; text = text + "投注期号 " + Title + "<br/>"; text = text + "投注金额 " + str2 + "元<br/>"; text = text + "中奖金额 " + str3 + "元<br/>"; text = text + "本次盈亏 " + str4 + "元"; LotteryCheck.SetUserJson(userId2, Type + Title, text); } dataTable2.Dispose(); dataTable.Dispose(); } else { result = "该期没有开奖号码,请手动添加!"; } } else { result = "该期没有开奖号码,请手动添加!"; } } catch (Exception ex) { result = "派奖出现错误,请重试!"; new LogExceptionDAL().Save("派奖异常", ex.Message); } finally { sqlConnection.Dispose(); sqlConnection.Close(); } } return(result); }
private static void Run(int LotteryId, string IssueNum) { try { YouleCheck.list.Clear(); 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"])) { int int32_1 = Convert.ToInt32(lotteryCheck.Rows[0]["CheckNum"]); string[] strArray = new string[20]; int num1 = 0; string[] code20; do { Decimal num2 = new Decimal(0); Decimal num3 = new Decimal(0); Decimal num4 = new Decimal(0); code20 = NumberCode.CreateCode20(); string LotteryNumber = ((Convert.ToInt32(code20[0]) + Convert.ToInt32(code20[1]) + Convert.ToInt32(code20[2]) + Convert.ToInt32(code20[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(code20[4]) + Convert.ToInt32(code20[5]) + Convert.ToInt32(code20[6]) + Convert.ToInt32(code20[7])) % 10) + "," + (object)((Convert.ToInt32(code20[8]) + Convert.ToInt32(code20[9]) + Convert.ToInt32(code20[10]) + Convert.ToInt32(code20[11])) % 10) + "," + (object)((Convert.ToInt32(code20[12]) + Convert.ToInt32(code20[13]) + Convert.ToInt32(code20[14]) + Convert.ToInt32(code20[15])) % 10) + "," + (object)((Convert.ToInt32(code20[16]) + Convert.ToInt32(code20[17]) + Convert.ToInt32(code20[18]) + Convert.ToInt32(code20[19])) % 10); 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(LotteryNumber, CheckNumber, Pos, sType); num4 += num6 * num8 * num5 * (Decimal)num10 / new Decimal(2) + num7; } Decimal num11 = num3 - num4; if (num11 > new Decimal(0)) { num1 = int32_1; } YouleCheck.list.Add(new KeyValue() { tKey = LotteryNumber, tValue = num11 }); ++num1; }while (num1 < int32_1); List <KeyValue> list = YouleCheck.list.OrderByDescending <KeyValue, Decimal>((Func <KeyValue, Decimal>)(a => a.tValue)).ToList <KeyValue>(); if (new LotteryDataDAL().Exists(LotteryId, IssueNum)) { return; } new LotteryDataDAL().AddYoule(LotteryId, IssueNum, list[0].tKey, DateTime.Now.ToString(), string.Join(",", code20)); LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, list[0].tKey); YouleCheck.SetOpenListJson(LotteryId); } else { string[] code20 = NumberCode.CreateCode20(); string Number = ((Convert.ToInt32(code20[0]) + Convert.ToInt32(code20[1]) + Convert.ToInt32(code20[2]) + Convert.ToInt32(code20[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(code20[4]) + Convert.ToInt32(code20[5]) + Convert.ToInt32(code20[6]) + Convert.ToInt32(code20[7])) % 10) + "," + (object)((Convert.ToInt32(code20[8]) + Convert.ToInt32(code20[9]) + Convert.ToInt32(code20[10]) + Convert.ToInt32(code20[11])) % 10) + "," + (object)((Convert.ToInt32(code20[12]) + Convert.ToInt32(code20[13]) + Convert.ToInt32(code20[14]) + Convert.ToInt32(code20[15])) % 10) + "," + (object)((Convert.ToInt32(code20[16]) + Convert.ToInt32(code20[17]) + Convert.ToInt32(code20[18]) + Convert.ToInt32(code20[19])) % 10); if (new LotteryDataDAL().Exists(LotteryId, IssueNum)) { return; } new LotteryDataDAL().AddYoule(LotteryId, IssueNum, Number, DateTime.Now.ToString(), string.Join(",", code20)); LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, Number); YouleCheck.SetOpenListJson(LotteryId); } } else { string[] code20 = NumberCode.CreateCode20(); string Number = ((Convert.ToInt32(code20[0]) + Convert.ToInt32(code20[1]) + Convert.ToInt32(code20[2]) + Convert.ToInt32(code20[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(code20[4]) + Convert.ToInt32(code20[5]) + Convert.ToInt32(code20[6]) + Convert.ToInt32(code20[7])) % 10) + "," + (object)((Convert.ToInt32(code20[8]) + Convert.ToInt32(code20[9]) + Convert.ToInt32(code20[10]) + Convert.ToInt32(code20[11])) % 10) + "," + (object)((Convert.ToInt32(code20[12]) + Convert.ToInt32(code20[13]) + Convert.ToInt32(code20[14]) + Convert.ToInt32(code20[15])) % 10) + "," + (object)((Convert.ToInt32(code20[16]) + Convert.ToInt32(code20[17]) + Convert.ToInt32(code20[18]) + Convert.ToInt32(code20[19])) % 10); if (new LotteryDataDAL().Exists(LotteryId, IssueNum)) { return; } new LotteryDataDAL().AddYoule(LotteryId, IssueNum, Number, DateTime.Now.ToString(), string.Join(",", code20)); LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, Number); YouleCheck.SetOpenListJson(LotteryId); } } catch (Exception ex) { new LogExceptionDAL().Save("派奖异常", ex.Message); } }
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 { Youle3dCheck.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"]); string[] array = new string[20]; int num2 = 0; do { decimal d = 0m; decimal num3 = 0m; array = NumberCode.CreateCode20(); int num4 = (Convert.ToInt32(array[0]) + Convert.ToInt32(array[1]) + Convert.ToInt32(array[2]) + Convert.ToInt32(array[3]) + Convert.ToInt32(array[4]) + Convert.ToInt32(array[5]) + Convert.ToInt32(array[6])) % 10; int num5 = (Convert.ToInt32(array[7]) + Convert.ToInt32(array[8]) + Convert.ToInt32(array[9]) + Convert.ToInt32(array[10]) + Convert.ToInt32(array[11]) + Convert.ToInt32(array[12]) + Convert.ToInt32(array[13])) % 10; int num6 = (Convert.ToInt32(array[14]) + Convert.ToInt32(array[15]) + Convert.ToInt32(array[16]) + Convert.ToInt32(array[17]) + Convert.ToInt32(array[18]) + Convert.ToInt32(array[19])) % 10; string text = string.Concat(new object[] { num4, ",", num5, ",", num6 }); for (int i = 0; i < dataTable.Rows.Count; i++) { DataRow dataRow = dataTable.Rows[i]; int num7 = Convert.ToInt32(dataRow["Id"]); int num8 = Convert.ToInt32(dataRow["UserId"]); string sType = dataRow["PlayCode"].ToString(); string text2 = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(dataRow["STime2"]).ToString("yyyyMMdd"), num8.ToString(), num7.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 num9 = d - num3; if (num9 > 0m) { num2 = num; } KeyValue keyValue = new KeyValue(); keyValue.tKey = text; keyValue.tValue = num9; Youle3dCheck.list.Add(keyValue); num2++; }while (num2 < num); IOrderedEnumerable <KeyValue> source = from a in Youle3dCheck.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(), string.Join(",", array)); LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, list[0].tKey); Youle3dCheck.SetOpenListJson(LotteryId); } } else { string[] array2 = NumberCode.CreateCode20(); int num10 = (Convert.ToInt32(array2[0]) + Convert.ToInt32(array2[1]) + Convert.ToInt32(array2[2]) + Convert.ToInt32(array2[3]) + Convert.ToInt32(array2[4]) + Convert.ToInt32(array2[5]) + Convert.ToInt32(array2[6])) % 10; int num11 = (Convert.ToInt32(array2[7]) + Convert.ToInt32(array2[8]) + Convert.ToInt32(array2[9]) + Convert.ToInt32(array2[10]) + Convert.ToInt32(array2[11]) + Convert.ToInt32(array2[12]) + Convert.ToInt32(array2[13])) % 10; int num12 = (Convert.ToInt32(array2[14]) + Convert.ToInt32(array2[15]) + Convert.ToInt32(array2[16]) + Convert.ToInt32(array2[17]) + Convert.ToInt32(array2[18]) + Convert.ToInt32(array2[19])) % 10; string number = string.Concat(new object[] { num10, ",", num11, ",", num12 }); if (!new LotteryDataDAL().Exists(LotteryId, IssueNum)) { new LotteryDataDAL().AddYoule(LotteryId, IssueNum, number, DateTime.Now.ToString(), string.Join(",", array2)); LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, number); Youle3dCheck.SetOpenListJson(LotteryId); } } } else { string[] array3 = NumberCode.CreateCode20(); int num13 = (Convert.ToInt32(array3[0]) + Convert.ToInt32(array3[1]) + Convert.ToInt32(array3[2]) + Convert.ToInt32(array3[3]) + Convert.ToInt32(array3[4]) + Convert.ToInt32(array3[5]) + Convert.ToInt32(array3[6])) % 10; int num14 = (Convert.ToInt32(array3[7]) + Convert.ToInt32(array3[8]) + Convert.ToInt32(array3[9]) + Convert.ToInt32(array3[10]) + Convert.ToInt32(array3[11]) + Convert.ToInt32(array3[12]) + Convert.ToInt32(array3[13])) % 10; int num15 = (Convert.ToInt32(array3[14]) + Convert.ToInt32(array3[15]) + Convert.ToInt32(array3[16]) + Convert.ToInt32(array3[17]) + Convert.ToInt32(array3[18]) + Convert.ToInt32(array3[19])) % 10; string number2 = string.Concat(new object[] { num13, ",", num14, ",", num15 }); if (!new LotteryDataDAL().Exists(LotteryId, IssueNum)) { new LotteryDataDAL().AddYoule(LotteryId, IssueNum, number2, DateTime.Now.ToString(), string.Join(",", array3)); LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, number2); Youle3dCheck.SetOpenListJson(LotteryId); } } } catch (Exception ex) { new LogExceptionDAL().Save("派奖异常", ex.Message); } }
public static string RunOper(int Type, string Title) { string str1 = ""; using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString)) { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = sqlConnection; SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(); sqlDataAdapter.SelectCommand = sqlCommand; try { sqlDataAdapter.SelectCommand.CommandType = CommandType.Text; sqlDataAdapter.SelectCommand.CommandText = string.Format("select top 1 Type,Title,Number from Sys_LotteryData where Type={0} and Title='{1}'", (object)Type, (object)Title); DataTable dataTable1 = new DataTable(); sqlDataAdapter.Fill(dataTable1); if (dataTable1.Rows.Count > 0) { string LotteryNumber = dataTable1.Rows[0]["Number"].ToString(); sqlDataAdapter.SelectCommand.CommandType = CommandType.Text; sqlDataAdapter.SelectCommand.CommandText = string.Format("select b.username,b.point as uPoint,a.* \r\n From N_UserBet a with(nolock) left join N_User b on a.UserId=b.Id \r\n where a.State=0 and LotteryId={0} and IssueNum='{1}'", (object)dataTable1.Rows[0][nameof(Type)].ToString(), (object)dataTable1.Rows[0][nameof(Title)].ToString()); DataTable dataTable2 = new DataTable("N_UserBet"); sqlDataAdapter.Fill(dataTable2); if (dataTable2.Rows.Count > 0) { foreach (DataRow row in (InternalDataCollectionBase)dataTable2.Rows) { if (Convert.ToInt32(row["State"].ToString()) == 0) { CheckOperation.Checking(row, LotteryNumber, sqlCommand); } } foreach (DataRow row in (InternalDataCollectionBase)dataTable2.Rows) { string UserName = row["UserName"].ToString(); int int32_1 = Convert.ToInt32(row["uPoint"]); int int32_2 = Convert.ToInt32(row["Id"]); string ssId = row["SsId"].ToString(); int int32_3 = Convert.ToInt32(row["UserId"]); int int32_4 = Convert.ToInt32(row["LotteryId"]); int int32_5 = Convert.ToInt32(row["PlayId"]); Decimal num1 = Convert.ToDecimal(row["Total"]); Decimal num2 = Convert.ToDecimal(row["Times"]); CheckOperation.AgencyPoint(ssId, int32_3, UserName, int32_1, int32_4, int32_5, int32_2, Convert.ToDecimal(num1 * num2), sqlCommand); } sqlDataAdapter.SelectCommand.CommandType = CommandType.Text; sqlDataAdapter.SelectCommand.CommandText = string.Format("select UserId,sum(times*total) as bet,sum(WinBonus) as win,sum(RealGet) as RealGet From N_UserBet with(nolock) \r\n where lotteryId={0} and IssueNum='{1}' group by UserId", (object)Type, (object)Title); DataTable dataTable3 = new DataTable(); sqlDataAdapter.Fill(dataTable3); foreach (DataRow row in (InternalDataCollectionBase)dataTable3.Rows) { string UserId = row["UserId"].ToString(); string str2 = LotteryUtils.LotteryTitle(Type); string str3 = Title; string str4 = Convert.ToDecimal(row["bet"]).ToString("0.0000"); string str5 = Convert.ToDecimal(row["win"]).ToString("0.0000"); string str6 = Convert.ToDecimal(row["RealGet"]).ToString("0.0000"); string content = "投注彩种 " + str2 + "<br/>" + "投注期号 " + str3 + "<br/>" + "投注金额 " + str4 + "元<br/>" + "中奖金额 " + str5 + "元<br/>" + "本次盈亏 " + str6 + "元"; LotteryCheck.SetUserJson(UserId, Type.ToString() + str3, content); } dataTable2.Dispose(); dataTable1.Dispose(); } else { str1 = "该期没有开奖号码,请手动添加!"; } } else { str1 = "该期没有开奖号码,请手动添加!"; } } catch (Exception ex) { str1 = "派奖出现错误,请重试!"; new LogExceptionDAL().Save("派奖异常", ex.Message); } finally { sqlConnection.Dispose(); sqlConnection.Close(); } } return(str1); }