public static bool AdminCancel(int BetId, SqlCommand sqlCommand) { bool result; try { SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(); sqlDataAdapter.SelectCommand = sqlCommand; sqlDataAdapter.SelectCommand.CommandType = CommandType.Text; sqlDataAdapter.SelectCommand.CommandText = "select top 1 * From N_UserBet with(nolock) where Id=" + BetId.ToString(); DataTable dataTable = new DataTable(); sqlDataAdapter.Fill(dataTable); if (dataTable.Rows.Count > 0) { DataRow dataRow = dataTable.Rows[0]; string ssId = dataRow["ssId"].ToString(); int userId = Convert.ToInt32(dataRow["UserId"]); int num = Convert.ToInt32(dataRow["LotteryId"]); int num2 = Convert.ToInt32(dataRow["PlayId"]); dataRow["IssueNum"].ToString(); string betDetail = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(dataRow["STime2"]).ToString("yyyyMMdd"), userId.ToString(), BetId.ToString()); if (string.IsNullOrEmpty(betDetail)) { } decimal d = Convert.ToDecimal(dataRow["Total"]); Convert.ToDecimal(dataRow["point"]); decimal d2 = Convert.ToDecimal(dataRow["PointMoney"]); decimal num3 = Convert.ToDecimal(dataRow["Bonus"]); decimal d3 = Convert.ToDecimal(dataRow["Times"]); Convert.ToDecimal(dataRow["SingleMoney"]); dataRow["Pos"].ToString(); dataRow["PlayCode"].ToString(); string sTime = dataRow["STime"].ToString(); Convert.ToInt32(dataRow["IsCheat"]); num3 = d * d3 - d2 * d3; sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "update N_UserBet set State=1,WinNum=0,RealGet=0 where Id=" + BetId.ToString(); sqlCommand.ExecuteNonQuery(); if (num3 > 0m) { new UserTotalTran().MoneyOpers(ssId, userId.ToString(), num3, num, num2, BetId, 6, 99, "", "", "后台撤单", sTime); } sqlDataAdapter.SelectCommand.CommandType = CommandType.Text; sqlDataAdapter.SelectCommand.CommandText = "select top 1 UserName,Point from N_User with(nolock) where Id=" + userId.ToString(); DataTable dataTable2 = new DataTable(); sqlDataAdapter.Fill(dataTable2); string userName = dataTable2.Rows[0]["UserName"].ToString(); int userPoint = Convert.ToInt32(dataTable2.Rows[0]["Point"]); CheckOperation.AgencyPoint(ssId, userId, userName, userPoint, num, num2, BetId, -Convert.ToDecimal(d * d3), sqlCommand); } dataTable.Dispose(); result = true; } catch (Exception ex) { new LogExceptionDAL().Save("程序异常", "派奖过程中出现异常:" + ex.Message); result = false; } return(result); }
public static bool AdminCancel(int BetId, SqlCommand sqlCommand) { try { SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(); sqlDataAdapter.SelectCommand = sqlCommand; sqlDataAdapter.SelectCommand.CommandType = CommandType.Text; sqlDataAdapter.SelectCommand.CommandText = "select top 1 * From N_UserBet with(nolock) where Id=" + BetId.ToString(); DataTable dataTable1 = new DataTable(); sqlDataAdapter.Fill(dataTable1); if (dataTable1.Rows.Count > 0) { DataRow row = dataTable1.Rows[0]; string ssId = row["ssId"].ToString(); int int32_1 = Convert.ToInt32(row["UserId"]); int int32_2 = Convert.ToInt32(row["LotteryId"]); int int32_3 = Convert.ToInt32(row["PlayId"]); row["IssueNum"].ToString(); if (string.IsNullOrEmpty(BetDetailDAL.GetBetDetail2(Convert.ToDateTime(row["STime2"]).ToString("yyyyMMdd"), int32_1.ToString(), BetId.ToString()))) { ; } Decimal num1 = Convert.ToDecimal(row["Total"]); Convert.ToDecimal(row["point"]); Decimal num2 = Convert.ToDecimal(row["PointMoney"]); Convert.ToDecimal(row["Bonus"]); Decimal num3 = Convert.ToDecimal(row["Times"]); Convert.ToDecimal(row["SingleMoney"]); row["Pos"].ToString(); row["PlayCode"].ToString(); string STime2 = row["STime"].ToString(); Convert.ToInt32(row["IsCheat"]); Decimal Money = num1 * num3 - num2 * num3; sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "update N_UserBet set State=1,WinNum=0,RealGet=0 where Id=" + BetId.ToString(); sqlCommand.ExecuteNonQuery(); if (Money > new Decimal(0)) { new UserTotalTran().MoneyOpers(ssId, int32_1.ToString(), Money, int32_2, int32_3, BetId, 6, 99, "", "", "后台撤单", STime2); } sqlDataAdapter.SelectCommand.CommandType = CommandType.Text; sqlDataAdapter.SelectCommand.CommandText = "select top 1 UserName,Point from N_User with(nolock) where Id=" + int32_1.ToString(); DataTable dataTable2 = new DataTable(); sqlDataAdapter.Fill(dataTable2); string UserName = dataTable2.Rows[0]["UserName"].ToString(); int int32_4 = Convert.ToInt32(dataTable2.Rows[0]["Point"]); CheckOperation.AgencyPoint(ssId, int32_1, UserName, int32_4, int32_2, int32_3, BetId, -Convert.ToDecimal(num1 * num3), sqlCommand); } dataTable1.Dispose(); return(true); } catch (Exception ex) { new LogExceptionDAL().Save("程序异常", "派奖过程中出现异常:" + ex.Message); return(false); } }
protected void Page_Load(object sender, EventArgs e) { this.Admin_Load("", "html"); if (this.Page.IsPostBack) { return; } string BetId = this.Str2Str(this.q("id")); this.doh.Reset(); this.doh.SqlCmd = "select *,dbo.f_GetBetState(State) as StateName2 from V_UserBetZhDetail a where Id=" + BetId; DataTable dataTable = this.doh.GetDataTable(); if (dataTable.Rows.Count > 0) { DataRow row = dataTable.Rows[0]; this.UserName = row["UserName"].ToString(); this.L_Lottery = row["LotteryName"].ToString(); this.L_PlayType = row["PlayName"].ToString(); this.L_IssueNumber = row["IssueNum"].ToString(); this.L_SingleMoney = Convert.ToDecimal(row["SingleMoney"]).ToString("0.0000") + " 元"; Decimal num1 = Convert.ToDecimal(row["RealGet"]); this.L_RealGet = num1.ToString("0.0000") + " 元"; this.L_Times = dataTable.Rows[0]["Times"].ToString(); num1 = Convert.ToDecimal(Convert.ToDecimal(row["Total"])); this.L_Total = num1.ToString("0.0000"); Decimal num2 = Convert.ToDecimal(row["Point"]); Decimal num3 = Convert.ToDecimal(row["Bonus"]); num1 = Convert.ToDecimal(this.L_Total) * num2 / new Decimal(100); this.L_PointMoney = num1.ToString("0.0000") + " 元"; num1 = Convert.ToDecimal(row["WinBonus"]); this.L_Bonus = num1.ToString("0.0000") + " 元"; num1 = Convert.ToDecimal(num3); string str1 = num1.ToString("0.0000"); string str2 = "/"; num1 = Convert.ToDecimal(num2); string str3 = num1.ToString("0.0000"); string str4 = " %"; this.L_Point = str1 + str2 + str3 + str4; if (row["PlayCode"].ToString().Contains("3HX")) { string[] strArray1 = new string[6]; string[] strArray2 = strArray1; int index1 = 0; num1 = Convert.ToDecimal(num3 / new Decimal(2)); string str5 = num1.ToString("0.0000"); strArray2[index1] = str5; strArray1[1] = "/"; string[] strArray3 = strArray1; int index2 = 2; num1 = Convert.ToDecimal(num3); string str6 = num1.ToString("0.0000"); strArray3[index2] = str6; strArray1[3] = "/"; string[] strArray4 = strArray1; int index3 = 4; num1 = Convert.ToDecimal(num2); string str7 = num1.ToString("0.0000"); strArray4[index3] = str7; strArray1[5] = " %"; this.L_Point = string.Concat(strArray1); } this.L_Num = row["Num"].ToString(); int int32 = Convert.ToInt32(row["State"]); this.L_State = row["StateName2"].ToString(); this.L_STime = row["STime"].ToString(); this.L_STime2 = row["STime2"].ToString(); this.L_Pos = row["Pos"].ToString(); this.L_WinNum = row["WinNum"].ToString(); if (this.L_Pos != "") { string str5 = ""; string[] strArray = this.L_Pos.Split(','); for (int index = 0; index < strArray.Length; ++index) { if (Convert.ToInt32(strArray[index]) == 1) { str5 = str5 + "," + index.ToString(); } } this.L_Pos = "任选位数:" + str5.Substring(1).Replace("0", "万位").Replace("1", "千位").Replace("2", "百位").Replace("3", "十位").Replace("4", "个位") + "<br/>"; } this.L_Detail = this.L_Pos + BetDetailDAL.GetBetDetail(Convert.ToDateTime(row["STime2"]).ToString("yyyyMMdd"), row["UserId"].ToString(), BetId); if (string.IsNullOrEmpty(this.L_Detail)) { this.L_Detail = this.L_Pos + row["Detail"].ToString(); } this.NumberShow.Visible = false; if (int32 >= 2) { this.NumberShow.Visible = true; this.doh.Reset(); this.doh.ConditionExpress = "Type=@Type and Title=@Title"; this.doh.AddConditionParameter("@Type", (object)row["LotteryId"].ToString()); this.doh.AddConditionParameter("@Title", (object)this.L_IssueNumber); this.L_Number = string.Concat(this.doh.GetField("Sys_LotteryData", "Number")); } } else { this.Response.Write("参数错误"); this.Response.End(); } dataTable.Clear(); dataTable.Dispose(); }
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); } }
protected void Page_Load(object sender, EventArgs e) { base.Admin_Load("", "html"); if (!this.Page.IsPostBack) { string text = base.Str2Str(base.q("id")); string text2 = " Id=" + text; this.doh.Reset(); this.doh.ConditionExpress = text2; string sql = SqlHelp.GetSql0("Id,UserId,dbo.f_GetUserName(UserId) as UserName,dbo.f_GetUserCode(UserId) as UserCode,UserMoney,PlayId,dbo.f_GetPlayName(PlayId) as PlayName,PlayCode,LotteryId,dbo.f_GetLotteryName(LotteryId) as LotteryName,IssueNum,SingleMoney,Times,Num,Times*Total as Total,Point,PointMoney,Bonus,WinNum,WinBonus,RealGet,Pos,STime,STime2,IsOpen,State,dbo.f_GetBetState(State) as StateName,IsWin,Number", "N_UserBet", "STime2", 999, 1, "desc", text2); this.doh.Reset(); this.doh.SqlCmd = sql; DataTable dataTable = this.doh.GetDataTable(); if (dataTable.Rows.Count > 0) { DataRow dataRow = dataTable.Rows[0]; this.UserName = dataRow["UserName"].ToString(); this.L_Lottery = dataRow["LotteryName"].ToString(); this.L_PlayType = dataRow["PlayName"].ToString(); this.L_IssueNumber = dataRow["IssueNum"].ToString(); this.L_SingleMoney = Convert.ToDecimal(dataRow["SingleMoney"]).ToString("0.0000") + " 元"; this.L_RealGet = Convert.ToDecimal(dataRow["RealGet"]).ToString("0.0000") + " 元"; this.L_Times = dataRow["Times"].ToString(); this.L_Total = Convert.ToDecimal(dataRow["Total"]).ToString("0.0000"); decimal num = Convert.ToDecimal(dataRow["Point"]); this.L_PointMoney = (Convert.ToDecimal(this.L_Total) * num / 100m).ToString("0.0000") + " 元"; this.L_Bonus = Convert.ToDecimal(dataRow["WinBonus"]).ToString("0.0000") + " 元"; decimal num2 = Convert.ToDecimal(dataRow["Bonus"]); this.L_Point = Convert.ToDecimal(num2).ToString("0.0000") + "/" + Convert.ToDecimal(num).ToString("0.00") + " %"; if (dataRow["PlayCode"].ToString().Contains("3HX")) { this.L_Point = string.Concat(new string[] { Convert.ToDecimal(num2 / 2m).ToString("0.0000"), "/", Convert.ToDecimal(num2).ToString("0.0000"), "/", Convert.ToDecimal(num).ToString("0.0000"), " %" }); } this.L_Num = dataRow["Num"].ToString(); int num3 = Convert.ToInt32(dataRow["State"]); this.L_State = dataRow["StateName"].ToString(); this.L_STime = dataRow["STime"].ToString(); this.L_STime2 = dataRow["STime2"].ToString(); this.L_Detail = BetDetailDAL.GetBetDetail(Convert.ToDateTime(dataRow["STime2"]).ToString("yyyyMMdd"), dataRow["UserId"].ToString(), text); this.L_Pos = dataRow["Pos"].ToString(); this.L_WinNum = dataRow["WinNum"].ToString(); if (this.L_Pos != "") { string text3 = ""; string[] array = this.L_Pos.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { if (Convert.ToInt32(array[i]) == 1) { text3 = text3 + "," + i.ToString(); } } this.L_Pos = "任选位数:" + text3.Substring(1).Replace("0", "万位").Replace("1", "千位").Replace("2", "百位").Replace("3", "十位").Replace("4", "个位") + "\n"; } this.L_Detail = this.L_Pos + BetDetailDAL.GetBetDetail(Convert.ToDateTime(dataRow["STime2"]).ToString("yyyyMMdd"), dataRow["UserId"].ToString(), text); this.NumberShow.Visible = false; if (num3 >= 1) { this.NumberShow.Visible = true; this.doh.Reset(); this.doh.ConditionExpress = "Type=@Type and Title=@Title"; this.doh.AddConditionParameter("@Type", dataRow["LotteryId"].ToString()); this.doh.AddConditionParameter("@Title", this.L_IssueNumber); object field = this.doh.GetField("Sys_LotteryData", "Number"); this.L_Number = string.Concat(field); } } else { base.Response.Write("参数错误"); base.Response.End(); } dataTable.Clear(); dataTable.Dispose(); } }
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); } }
public static bool Checking(DataRow row, string LotteryNumber, SqlCommand sqlCommand) { bool result; try { if (Convert.ToInt32(row["State"]) != 0) { result = true; } else { int logSysId = Convert.ToInt32(row["Id"]); string ssId = row["SsId"].ToString(); int num = Convert.ToInt32(row["UserId"]); int num2 = Convert.ToInt32(row["LotteryId"]); int num3 = Convert.ToInt32(row["PlayId"]); int value = Convert.ToInt32(row["Num"]); string arg = row["IssueNum"].ToString(); string betDetail = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(row["STime2"]).ToString("yyyyMMdd"), num.ToString(), logSysId.ToString()); decimal d = Convert.ToDecimal(row["Total"]); decimal num4 = Convert.ToDecimal(row["point"]); decimal num5 = Convert.ToDecimal(row["PointMoney"]); decimal num6 = Convert.ToDecimal(row["Bonus"]); decimal d2 = Convert.ToDecimal(row["Times"]); decimal d3 = Convert.ToDecimal(row["SingleMoney"]); string pos = row["Pos"].ToString(); string text = row["PlayCode"].ToString(); Convert.ToInt32(row["IsCheat"]); Convert.ToInt32(row["IsDelay"]); int num7 = Convert.ToInt32(row["ZhId"]); string sTime = row["STime"].ToString(); string[] array = LotteryNumber.Split(new char[] { ',' }); if (text.Equals("P_5QJ3")) { string[] array2 = betDetail.Split(new char[] { ',' }); if (array2[0].IndexOf(CheckOperation.ReplaceStr(array[0])) == -1 || array2[1].IndexOf(CheckOperation.ReplaceStr(array[1])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = string.Concat(new object[] { "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=", num, ")-", num4, ") from Sys_PlaySmallType where title2='P_5QJ3'" }); num6 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); text = text.Replace("P_5QJ3", "P_5QJ3_2"); } else { text = text.Replace("P_5QJ3", "P_5QJ3_1"); } } if (text.Equals("P_4QJ3")) { string[] array3 = betDetail.Split(new char[] { ',' }); if (array3[0].IndexOf(CheckOperation.ReplaceStr(array[1])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = string.Concat(new object[] { "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=", num, ")-", num4, ") from Sys_PlaySmallType where title2='P_4QJ3'" }); num6 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); text = text.Replace("P_4QJ3", "P_4QJ3_2"); } else { text = text.Replace("P_4QJ3", "P_4QJ3_1"); } } if (text.Equals("P_3QJ2_L")) { string[] array4 = betDetail.Split(new char[] { ',' }); if (array4[0].IndexOf(CheckOperation.ReplaceStr(array[0])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = string.Concat(new object[] { "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=", num, ")-", num4, ") from Sys_PlaySmallType where title2='P_3QJ2_L'" }); num6 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); text = text.Replace("P_3QJ2_L", "P_3QJ2_L_2"); } else { text = text.Replace("P_3QJ2_L", "P_3QJ2_L_1"); } } if (text.Equals("P_3QJ2_R")) { string[] array5 = betDetail.Split(new char[] { ',' }); if (array5[0].IndexOf(CheckOperation.ReplaceStr(array[2])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = string.Concat(new object[] { "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=", num, ")-", num4, ") from Sys_PlaySmallType where title2='P_3QJ2_R'" }); num6 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); text = text.Replace("P_3QJ2_R", "P_3QJ2_R_2"); } else { text = text.Replace("P_3QJ2_R", "P_3QJ2_R_1"); } } if (text.Equals("P_5QW3")) { string[] array6 = betDetail.Split(new char[] { ',' }); if (array6[0].IndexOf(CheckOperation.ReplaceDX(array[0])) == -1 || array6[1].IndexOf(CheckOperation.ReplaceDX(array[1])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = string.Concat(new object[] { "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=", num, ")-", num4, ") from Sys_PlaySmallType where title2='P_5QW3'" }); num6 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); text = text.Replace("P_5QW3", "P_5QW3_2"); } else { text = text.Replace("P_5QW3", "P_5QW3_1"); } } if (text.Equals("P_4QW3")) { string[] array7 = betDetail.Split(new char[] { ',' }); if (array7[0].IndexOf(CheckOperation.ReplaceDX(array[1])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = string.Concat(new object[] { "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=", num, ")-", num4, ") from Sys_PlaySmallType where title2='P_4QW3'" }); num6 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); text = text.Replace("P_4QW3", "P_4QW3_2"); } else { text = text.Replace("P_4QW3", "P_4QW3_1"); } } if (text.Equals("P_3QW2_L")) { string[] array8 = betDetail.Split(new char[] { ',' }); if (array8[0].IndexOf(CheckOperation.ReplaceDX(array[0])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = string.Concat(new object[] { "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=", num, ")-", num4, ") from Sys_PlaySmallType where title2='P_3QW2_L'" }); num6 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); text = text.Replace("P_3QW2_L", "P_3QW2_L_2"); } else { text = text.Replace("P_3QW2_L", "P_3QW2_L_1"); } } if (text.Equals("P_3QW2_R")) { string[] array9 = betDetail.Split(new char[] { ',' }); if (array9[0].IndexOf(CheckOperation.ReplaceDX(array[2])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = string.Concat(new object[] { "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=", num, ")-", num4, ") from Sys_PlaySmallType where title2='P_3QW2_R'" }); num6 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); text = text.Replace("P_3QW2_R", "P_3QW2_R_2"); } else { text = text.Replace("P_3QW2_R", "P_3QW2_R_1"); } } if (text.Equals("P_3ZBD_L")) { if (array[0] == array[1] || array[1] == array[2] || array[0] == array[2]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[0] != array[1] && array[1] != array[2] && array[0] != array[2]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("P_3ZBD_C")) { if (array[1] == array[2] || array[2] == array[3] || array[1] == array[3]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[1] != array[2] && array[2] != array[3] && array[1] != array[3]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("P_3ZBD_R")) { if (array[2] == array[3] || array[3] == array[4] || array[2] == array[4]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[2] != array[3] && array[3] != array[4] && array[2] != array[4]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("R_3ZBD_WQB")) { if (array[0] == array[1] || array[1] == array[2] || array[0] == array[2]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[0] != array[1] && array[1] != array[2] && array[0] != array[2]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("R_3ZBD_WQS")) { if (array[0] == array[1] || array[1] == array[3] || array[0] == array[3]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[0] != array[1] && array[1] != array[3] && array[0] != array[3]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("R_3ZBD_WQG")) { if (array[0] == array[1] || array[1] == array[4] || array[0] == array[4]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[0] != array[1] && array[1] != array[4] && array[0] != array[4]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("R_3ZBD_WBS")) { if (array[0] == array[2] || array[2] == array[3] || array[0] == array[3]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[0] != array[2] && array[2] != array[3] && array[0] != array[3]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("R_3ZBD_WBG")) { if (array[0] == array[2] || array[2] == array[4] || array[0] == array[4]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[0] != array[2] && array[2] != array[4] && array[0] != array[4]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("R_3ZBD_WSG")) { if (array[0] == array[3] || array[3] == array[4] || array[0] == array[4]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[0] != array[3] && array[3] != array[4] && array[0] != array[4]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("R_3ZBD_QBS")) { if (array[1] == array[2] || array[2] == array[3] || array[1] == array[3]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[1] != array[2] && array[2] != array[3] && array[1] != array[3]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("R_3ZBD_QBG")) { if (array[1] == array[2] || array[2] == array[4] || array[1] == array[4]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[1] != array[2] && array[2] != array[4] && array[1] != array[4]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("R_3ZBD_QSG")) { if (array[1] == array[3] || array[3] == array[4] || array[1] == array[4]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[1] != array[3] && array[3] != array[4] && array[1] != array[4]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("R_3ZBD_BSG")) { if (array[2] == array[3] || array[3] == array[4] || array[2] == array[4]) { text = text.Replace("3ZBD", "3ZBDZ3"); } if (array[2] != array[3] && array[3] != array[4] && array[2] != array[4]) { num6 /= 2m; text = text.Replace("3ZBD", "3ZBDZ6"); } } if (text.Equals("P_3ZHE_L") && array[0] != array[1] && array[0] != array[2] && array[1] != array[2]) { num6 /= 2m; } if (text.Equals("P_3ZHE_C") && array[1] != array[2] && array[2] != array[3] && array[1] != array[3]) { num6 /= 2m; } if (text.Equals("P_3ZHE_R") && array[0] != array[1] && array[1] != array[2] && array[0] != array[2]) { num6 /= 2m; } if (text.Equals("P_3HX_L")) { if (array[0] == array[1] || array[1] == array[2] || array[0] == array[2]) { text = text.Replace("3HX", "3Z3_2"); } if (array[0] != array[1] && array[0] != array[2] && array[1] != array[2]) { num6 /= 2m; text = text.Replace("3HX", "3Z6_2"); } } if (text.Equals("P_3HX_C")) { if (array[1] == array[2] || array[2] == array[3] || array[1] == array[3]) { text = text.Replace("3HX", "3Z3_2"); } if (array[1] != array[2] && array[2] != array[3] && array[1] != array[3]) { num6 /= 2m; text = text.Replace("3HX", "3Z6_2"); } } if (text.Equals("P_3HX_R")) { if (array.Length == 3) { if (array[0] == array[1] || array[1] == array[2] || array[0] == array[2]) { text = text.Replace("3HX", "3Z3_2"); } if (array[0] != array[1] && array[1] != array[2] && array[0] != array[2]) { num6 /= 2m; text = text.Replace("3HX", "3Z6_2"); } } else { if (array[2] == array[3] || array[3] == array[4] || array[2] == array[4]) { text = text.Replace("3HX", "3Z3_2"); } if (array[2] != array[3] && array[3] != array[4] && array[2] != array[4]) { num6 /= 2m; text = text.Replace("3HX", "3Z6_2"); } } } if (text.Contains("R_3HX")) { if (array.Length == 3) { if (array[0] == array[1] || array[1] == array[2] || array[0] == array[2]) { text = text.Replace("3HX", "3Z3_2"); } if (array[0] != array[1] && array[1] != array[2] && array[0] != array[2]) { num6 /= 2m; text = text.Replace("3HX", "3Z6_2"); } } else { if (text.Equals("R_3HX_WQB") && array[0] != array[1] && array[1] != array[2] && array[0] != array[2]) { num6 /= 2m; } if (text.Equals("R_3HX_WQS") && array[0] != array[1] && array[1] != array[3] && array[0] != array[3]) { num6 /= 2m; } if (text.Equals("R_3HX_WQG") && array[0] != array[1] && array[1] != array[4] && array[0] != array[4]) { num6 /= 2m; } if (text.Equals("R_3HX_WBS") && array[0] != array[2] && array[2] != array[3] && array[0] != array[3]) { num6 /= 2m; } if (text.Equals("R_3HX_WBG") && array[0] != array[2] && array[2] != array[4] && array[0] != array[4]) { num6 /= 2m; } if (text.Equals("R_3HX_WSG") && array[0] != array[3] && array[3] != array[4] && array[0] != array[4]) { num6 /= 2m; } if (text.Equals("R_3HX_QBS") && array[1] != array[2] && array[2] != array[3] && array[1] != array[3]) { num6 /= 2m; } if (text.Equals("R_3HX_QBG") && array[1] != array[2] && array[2] != array[4] && array[1] != array[4]) { num6 /= 2m; } if (text.Equals("R_3HX_QSG") && array[1] != array[3] && array[3] != array[4] && array[1] != array[4]) { num6 /= 2m; } if (text.Equals("R_3HX_BSG") && array[2] != array[3] && array[3] != array[4] && array[2] != array[4]) { num6 /= 2m; } } } if (text.Contains("R_3ZHE")) { if (text.Equals("R_3ZHE_WQB") && array[0] != array[1] && array[1] != array[2] && array[0] != array[2]) { num6 /= 2m; } if (text.Equals("R_3ZHE_WQS") && array[0] != array[1] && array[1] != array[3] && array[0] != array[3]) { num6 /= 2m; } if (text.Equals("R_3ZHE_WQG") && array[0] != array[1] && array[1] != array[4] && array[0] != array[4]) { num6 /= 2m; } if (text.Equals("R_3ZHE_WBS") && array[0] != array[2] && array[2] != array[3] && array[0] != array[3]) { num6 /= 2m; } if (text.Equals("R_3ZHE_WBG") && array[0] != array[2] && array[2] != array[4] && array[0] != array[4]) { num6 /= 2m; } if (text.Equals("R_3ZHE_WSG") && array[0] != array[3] && array[3] != array[4] && array[0] != array[4]) { num6 /= 2m; } if (text.Equals("R_3ZHE_QBS") && array[1] != array[2] && array[2] != array[3] && array[1] != array[3]) { num6 /= 2m; } if (text.Equals("R_3ZHE_QBG") && array[1] != array[2] && array[2] != array[4] && array[1] != array[4]) { num6 /= 2m; } if (text.Equals("R_3ZHE_QSG") && array[1] != array[3] && array[3] != array[4] && array[1] != array[4]) { num6 /= 2m; } if (text.Equals("R_3ZHE_BSG") && array[2] != array[3] && array[3] != array[4] && array[2] != array[4]) { num6 /= 2m; } } int num8 = 0; int num9 = 0; if (text.Equals("P_LHH_WQ")) { num8 = Convert.ToInt32(array[0]); num9 = Convert.ToInt32(array[1]); } if (text.Equals("P_LHH_WB")) { num8 = Convert.ToInt32(array[0]); num9 = Convert.ToInt32(array[2]); } if (text.Equals("P_LHH_WS")) { num8 = Convert.ToInt32(array[0]); num9 = Convert.ToInt32(array[3]); } if (text.Equals("P_LHH_WG")) { num8 = Convert.ToInt32(array[0]); num9 = Convert.ToInt32(array[4]); } if (text.Equals("P_LHH_QB")) { num8 = Convert.ToInt32(array[1]); num9 = Convert.ToInt32(array[2]); } if (text.Equals("P_LHH_QS")) { num8 = Convert.ToInt32(array[1]); num9 = Convert.ToInt32(array[3]); } if (text.Equals("P_LHH_QG")) { num8 = Convert.ToInt32(array[1]); num9 = Convert.ToInt32(array[4]); } if (text.Equals("P_LHH_BS")) { num8 = Convert.ToInt32(array[2]); num9 = Convert.ToInt32(array[3]); } if (text.Equals("P_LHH_BG")) { num8 = Convert.ToInt32(array[2]); num9 = Convert.ToInt32(array[4]); } if (text.Equals("P_LHH_SG")) { num8 = Convert.ToInt32(array[3]); num9 = Convert.ToInt32(array[4]); } if (num8 != num9) { num6 = Convert.ToDecimal(num6 / Convert.ToDecimal(4.5)); } int num10 = CheckPlay.Check(LotteryNumber, betDetail, pos, text); num5 *= d2; int num11; if (num10 > 0) { num11 = 3; num6 = num6 * d2 * num10 * d3 / 2m; decimal num12 = 200000m; if (num6 > num12) { num6 = num12; } sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select top 1 MinNum from Sys_PlaySmallType where Id=" + num3; decimal num13 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); if (num13 == 0m) { if (num6 > d * d2 * 100m) { decimal num14 = 18000m; if (num6 > num14) { num6 = num14; } } } else if (value < num13) { decimal num15 = 18000m; if (num6 > num15) { num6 = num15; } } } else { num11 = 2; num6 = 0m; } decimal num16 = num6 + num5 - d * d2; sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = string.Concat(new string[] { "update N_UserBet set State=", num11.ToString(), ",WinNum=", num10.ToString(), ",WinBonus=", num6.ToString(), ",RealGet=", num16.ToString(), " where Id=", logSysId.ToString() }); sqlCommand.ExecuteNonQuery(); if (num6 > 0m) { new UserTotalTran().MoneyOpers(ssId, num.ToString(), num6, num2, num3, logSysId, 5, 99, "", "", "奖金派发", sTime); } if (num5 > 0m) { new UserTotalTran().MoneyOpers(ssId, num.ToString(), num5, num2, num3, logSysId, 4, 99, "", "", "返点派发", sTime); } if (num7 != 0) { string str = string.Format(" where LotteryId={0} and state=0 and zhid={1} and IssueNum>'{2}'", num2, num7, arg); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select count(Id) from N_UserBet" + str; if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0 && num10 > 0) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = string.Format("select count(Id) from N_UserZhBet with(nolock) where isstop=1 and Id={0}", num7); if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select isnull(sum(Total*Times),0) from N_UserBet " + str; decimal money = Convert.ToDecimal(string.Concat(sqlCommand.ExecuteScalar())); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "update N_UserBet set State=1 " + str; sqlCommand.ExecuteNonQuery(); new UserTotalTran().MoneyOpers(ssId, num.ToString(), money, num2, num3, logSysId, 6, 99, "", "", "终止追号", sTime); } } } result = true; } } catch (Exception ex) { new LogExceptionDAL().Save("程序异常", "派奖过程中出现异常:" + ex.Message); result = false; } return(result); }
/// <summary> /// /// </summary> /// <param name="row">投注信息</param> /// <param name="LotteryNumber">期号</param> /// <param name="sqlCommand"></param> /// <returns></returns> public static bool Checking(DataRow row, string LotteryNumber, SqlCommand sqlCommand) { try { if (Convert.ToInt32(row["State"]) != 0) { return(true); } int int32_1 = Convert.ToInt32(row["Id"]); string ssId = row["SsId"].ToString(); int int32_2 = Convert.ToInt32(row["UserId"]); int int32_3 = Convert.ToInt32(row["LotteryId"]); int int32_4 = Convert.ToInt32(row["PlayId"]); int int32_5 = Convert.ToInt32(row["Num"]); string str1 = row["IssueNum"].ToString(); string betDetail2 = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(row["STime2"]).ToString("yyyyMMdd"), int32_2.ToString(), int32_1.ToString()); Decimal num1 = Convert.ToDecimal(row["Total"]); Decimal num2 = Convert.ToDecimal(row["point"]); Decimal num3 = Convert.ToDecimal(row["PointMoney"]); Decimal num4 = Convert.ToDecimal(row["Bonus"]); Decimal num5 = Convert.ToDecimal(row["Times"]); Decimal num6 = Convert.ToDecimal(row["SingleMoney"]); string Pos = row["Pos"].ToString(); string sType = row["PlayCode"].ToString(); Convert.ToInt32(row["IsCheat"]); Convert.ToInt32(row["IsDelay"]); int int32_6 = Convert.ToInt32(row["ZhId"]); string STime2 = row["STime"].ToString(); string[] strArray1 = LotteryNumber.Split(','); if (sType.Equals("P_5QJ3")) { string[] strArray2 = betDetail2.Split(','); if (strArray2[0].IndexOf(CheckOperation.ReplaceStr(strArray1[0])) == -1 || strArray2[1].IndexOf(CheckOperation.ReplaceStr(strArray1[1])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=" + (object)int32_2 + ")-" + (object)num2 + ") from Sys_PlaySmallType where title2='P_5QJ3'"; num4 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); sType = sType.Replace("P_5QJ3", "P_5QJ3_2"); } else { sType = sType.Replace("P_5QJ3", "P_5QJ3_1"); } } if (sType.Equals("P_4QJ3")) { if (betDetail2.Split(',')[0].IndexOf(CheckOperation.ReplaceStr(strArray1[1])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=" + (object)int32_2 + ")-" + (object)num2 + ") from Sys_PlaySmallType where title2='P_4QJ3'"; num4 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); sType = sType.Replace("P_4QJ3", "P_4QJ3_2"); } else { sType = sType.Replace("P_4QJ3", "P_4QJ3_1"); } } if (sType.Equals("P_3QJ2_L")) { if (betDetail2.Split(',')[0].IndexOf(CheckOperation.ReplaceStr(strArray1[0])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=" + (object)int32_2 + ")-" + (object)num2 + ") from Sys_PlaySmallType where title2='P_3QJ2_L'"; num4 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); sType = sType.Replace("P_3QJ2_L", "P_3QJ2_L_2"); } else { sType = sType.Replace("P_3QJ2_L", "P_3QJ2_L_1"); } } if (sType.Equals("P_3QJ2_R")) { if (betDetail2.Split(',')[0].IndexOf(CheckOperation.ReplaceStr(strArray1[2])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=" + (object)int32_2 + ")-" + (object)num2 + ") from Sys_PlaySmallType where title2='P_3QJ2_R'"; num4 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); sType = sType.Replace("P_3QJ2_R", "P_3QJ2_R_2"); } else { sType = sType.Replace("P_3QJ2_R", "P_3QJ2_R_1"); } } if (sType.Equals("P_5QW3")) { string[] strArray2 = betDetail2.Split(','); if (strArray2[0].IndexOf(CheckOperation.ReplaceDX(strArray1[0])) == -1 || strArray2[1].IndexOf(CheckOperation.ReplaceDX(strArray1[1])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=" + (object)int32_2 + ")-" + (object)num2 + ") from Sys_PlaySmallType where title2='P_5QW3'"; num4 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); sType = sType.Replace("P_5QW3", "P_5QW3_2"); } else { sType = sType.Replace("P_5QW3", "P_5QW3_1"); } } if (sType.Equals("P_4QW3")) { if (betDetail2.Split(',')[0].IndexOf(CheckOperation.ReplaceDX(strArray1[1])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=" + (object)int32_2 + ")-" + (object)num2 + ") from Sys_PlaySmallType where title2='P_4QW3'"; num4 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); sType = sType.Replace("P_4QW3", "P_4QW3_2"); } else { sType = sType.Replace("P_4QW3", "P_4QW3_1"); } } if (sType.Equals("P_3QW2_L")) { if (betDetail2.Split(',')[0].IndexOf(CheckOperation.ReplaceDX(strArray1[0])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=" + (object)int32_2 + ")-" + (object)num2 + ") from Sys_PlaySmallType where title2='P_3QW2_L'"; num4 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); sType = sType.Replace("P_3QW2_L", "P_3QW2_L_2"); } else { sType = sType.Replace("P_3QW2_L", "P_3QW2_L_1"); } } if (sType.Equals("P_3QW2_R")) { if (betDetail2.Split(',')[0].IndexOf(CheckOperation.ReplaceDX(strArray1[2])) == -1) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select MinBonus2+20*PosBonus2*(0.1*(SELECT top 1 [Point] FROM [N_User] where Id=" + (object)int32_2 + ")-" + (object)num2 + ") from Sys_PlaySmallType where title2='P_3QW2_R'"; num4 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); sType = sType.Replace("P_3QW2_R", "P_3QW2_R_2"); } else { sType = sType.Replace("P_3QW2_R", "P_3QW2_R_1"); } } if (sType.Equals("P_3ZBD_L")) { if (strArray1[0] == strArray1[1] || strArray1[1] == strArray1[2] || strArray1[0] == strArray1[2]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[0] != strArray1[1] && strArray1[1] != strArray1[2] && strArray1[0] != strArray1[2]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("P_3ZBD_C")) { if (strArray1[1] == strArray1[2] || strArray1[2] == strArray1[3] || strArray1[1] == strArray1[3]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[1] != strArray1[2] && strArray1[2] != strArray1[3] && strArray1[1] != strArray1[3]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("P_3ZBD_R")) { if (strArray1[2] == strArray1[3] || strArray1[3] == strArray1[4] || strArray1[2] == strArray1[4]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[2] != strArray1[3] && strArray1[3] != strArray1[4] && strArray1[2] != strArray1[4]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("R_3ZBD_WQB")) { if (strArray1[0] == strArray1[1] || strArray1[1] == strArray1[2] || strArray1[0] == strArray1[2]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[0] != strArray1[1] && strArray1[1] != strArray1[2] && strArray1[0] != strArray1[2]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("R_3ZBD_WQS")) { if (strArray1[0] == strArray1[1] || strArray1[1] == strArray1[3] || strArray1[0] == strArray1[3]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[0] != strArray1[1] && strArray1[1] != strArray1[3] && strArray1[0] != strArray1[3]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("R_3ZBD_WQG")) { if (strArray1[0] == strArray1[1] || strArray1[1] == strArray1[4] || strArray1[0] == strArray1[4]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[0] != strArray1[1] && strArray1[1] != strArray1[4] && strArray1[0] != strArray1[4]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("R_3ZBD_WBS")) { if (strArray1[0] == strArray1[2] || strArray1[2] == strArray1[3] || strArray1[0] == strArray1[3]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[0] != strArray1[2] && strArray1[2] != strArray1[3] && strArray1[0] != strArray1[3]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("R_3ZBD_WBG")) { if (strArray1[0] == strArray1[2] || strArray1[2] == strArray1[4] || strArray1[0] == strArray1[4]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[0] != strArray1[2] && strArray1[2] != strArray1[4] && strArray1[0] != strArray1[4]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("R_3ZBD_WSG")) { if (strArray1[0] == strArray1[3] || strArray1[3] == strArray1[4] || strArray1[0] == strArray1[4]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[0] != strArray1[3] && strArray1[3] != strArray1[4] && strArray1[0] != strArray1[4]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("R_3ZBD_QBS")) { if (strArray1[1] == strArray1[2] || strArray1[2] == strArray1[3] || strArray1[1] == strArray1[3]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[1] != strArray1[2] && strArray1[2] != strArray1[3] && strArray1[1] != strArray1[3]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("R_3ZBD_QBG")) { if (strArray1[1] == strArray1[2] || strArray1[2] == strArray1[4] || strArray1[1] == strArray1[4]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[1] != strArray1[2] && strArray1[2] != strArray1[4] && strArray1[1] != strArray1[4]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("R_3ZBD_QSG")) { if (strArray1[1] == strArray1[3] || strArray1[3] == strArray1[4] || strArray1[1] == strArray1[4]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[1] != strArray1[3] && strArray1[3] != strArray1[4] && strArray1[1] != strArray1[4]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("R_3ZBD_BSG")) { if (strArray1[2] == strArray1[3] || strArray1[3] == strArray1[4] || strArray1[2] == strArray1[4]) { sType = sType.Replace("3ZBD", "3ZBDZ3"); } if (strArray1[2] != strArray1[3] && strArray1[3] != strArray1[4] && strArray1[2] != strArray1[4]) { num4 /= new Decimal(2); sType = sType.Replace("3ZBD", "3ZBDZ6"); } } if (sType.Equals("P_3ZHE_L") && strArray1[0] != strArray1[1] && (strArray1[0] != strArray1[2] && strArray1[1] != strArray1[2])) { num4 /= new Decimal(2); } if (sType.Equals("P_3ZHE_C") && strArray1[1] != strArray1[2] && (strArray1[2] != strArray1[3] && strArray1[1] != strArray1[3])) { num4 /= new Decimal(2); } if (sType.Equals("P_3ZHE_R") && strArray1[0] != strArray1[1] && (strArray1[1] != strArray1[2] && strArray1[0] != strArray1[2])) { num4 /= new Decimal(2); } if (sType.Equals("P_3HX_L")) { if (strArray1[0] == strArray1[1] || strArray1[1] == strArray1[2] || strArray1[0] == strArray1[2]) { sType = sType.Replace("3HX", "3Z3_2"); } if (strArray1[0] != strArray1[1] && strArray1[0] != strArray1[2] && strArray1[1] != strArray1[2]) { num4 /= new Decimal(2); sType = sType.Replace("3HX", "3Z6_2"); } } if (sType.Equals("P_3HX_C")) { if (strArray1[1] == strArray1[2] || strArray1[2] == strArray1[3] || strArray1[1] == strArray1[3]) { sType = sType.Replace("3HX", "3Z3_2"); } if (strArray1[1] != strArray1[2] && strArray1[2] != strArray1[3] && strArray1[1] != strArray1[3]) { num4 /= new Decimal(2); sType = sType.Replace("3HX", "3Z6_2"); } } if (sType.Equals("P_3HX_R")) { if (strArray1.Length == 3) { if (strArray1[0] == strArray1[1] || strArray1[1] == strArray1[2] || strArray1[0] == strArray1[2]) { sType = sType.Replace("3HX", "3Z3_2"); } if (strArray1[0] != strArray1[1] && strArray1[1] != strArray1[2] && strArray1[0] != strArray1[2]) { num4 /= new Decimal(2); sType = sType.Replace("3HX", "3Z6_2"); } } else { if (strArray1[2] == strArray1[3] || strArray1[3] == strArray1[4] || strArray1[2] == strArray1[4]) { sType = sType.Replace("3HX", "3Z3_2"); } if (strArray1[2] != strArray1[3] && strArray1[3] != strArray1[4] && strArray1[2] != strArray1[4]) { num4 /= new Decimal(2); sType = sType.Replace("3HX", "3Z6_2"); } } } if (sType.Contains("R_3HX")) { if (strArray1.Length == 3) { if (strArray1[0] == strArray1[1] || strArray1[1] == strArray1[2] || strArray1[0] == strArray1[2]) { sType = sType.Replace("3HX", "3Z3_2"); } if (strArray1[0] != strArray1[1] && strArray1[1] != strArray1[2] && strArray1[0] != strArray1[2]) { num4 /= new Decimal(2); sType = sType.Replace("3HX", "3Z6_2"); } } else { if (sType.Equals("R_3HX_WQB") && strArray1[0] != strArray1[1] && (strArray1[1] != strArray1[2] && strArray1[0] != strArray1[2])) { num4 /= new Decimal(2); } if (sType.Equals("R_3HX_WQS") && strArray1[0] != strArray1[1] && (strArray1[1] != strArray1[3] && strArray1[0] != strArray1[3])) { num4 /= new Decimal(2); } if (sType.Equals("R_3HX_WQG") && strArray1[0] != strArray1[1] && (strArray1[1] != strArray1[4] && strArray1[0] != strArray1[4])) { num4 /= new Decimal(2); } if (sType.Equals("R_3HX_WBS") && strArray1[0] != strArray1[2] && (strArray1[2] != strArray1[3] && strArray1[0] != strArray1[3])) { num4 /= new Decimal(2); } if (sType.Equals("R_3HX_WBG") && strArray1[0] != strArray1[2] && (strArray1[2] != strArray1[4] && strArray1[0] != strArray1[4])) { num4 /= new Decimal(2); } if (sType.Equals("R_3HX_WSG") && strArray1[0] != strArray1[3] && (strArray1[3] != strArray1[4] && strArray1[0] != strArray1[4])) { num4 /= new Decimal(2); } if (sType.Equals("R_3HX_QBS") && strArray1[1] != strArray1[2] && (strArray1[2] != strArray1[3] && strArray1[1] != strArray1[3])) { num4 /= new Decimal(2); } if (sType.Equals("R_3HX_QBG") && strArray1[1] != strArray1[2] && (strArray1[2] != strArray1[4] && strArray1[1] != strArray1[4])) { num4 /= new Decimal(2); } if (sType.Equals("R_3HX_QSG") && strArray1[1] != strArray1[3] && (strArray1[3] != strArray1[4] && strArray1[1] != strArray1[4])) { num4 /= new Decimal(2); } if (sType.Equals("R_3HX_BSG") && strArray1[2] != strArray1[3] && (strArray1[3] != strArray1[4] && strArray1[2] != strArray1[4])) { num4 /= new Decimal(2); } } } if (sType.Contains("R_3ZHE")) { if (sType.Equals("R_3ZHE_WQB") && strArray1[0] != strArray1[1] && (strArray1[1] != strArray1[2] && strArray1[0] != strArray1[2])) { num4 /= new Decimal(2); } if (sType.Equals("R_3ZHE_WQS") && strArray1[0] != strArray1[1] && (strArray1[1] != strArray1[3] && strArray1[0] != strArray1[3])) { num4 /= new Decimal(2); } if (sType.Equals("R_3ZHE_WQG") && strArray1[0] != strArray1[1] && (strArray1[1] != strArray1[4] && strArray1[0] != strArray1[4])) { num4 /= new Decimal(2); } if (sType.Equals("R_3ZHE_WBS") && strArray1[0] != strArray1[2] && (strArray1[2] != strArray1[3] && strArray1[0] != strArray1[3])) { num4 /= new Decimal(2); } if (sType.Equals("R_3ZHE_WBG") && strArray1[0] != strArray1[2] && (strArray1[2] != strArray1[4] && strArray1[0] != strArray1[4])) { num4 /= new Decimal(2); } if (sType.Equals("R_3ZHE_WSG") && strArray1[0] != strArray1[3] && (strArray1[3] != strArray1[4] && strArray1[0] != strArray1[4])) { num4 /= new Decimal(2); } if (sType.Equals("R_3ZHE_QBS") && strArray1[1] != strArray1[2] && (strArray1[2] != strArray1[3] && strArray1[1] != strArray1[3])) { num4 /= new Decimal(2); } if (sType.Equals("R_3ZHE_QBG") && strArray1[1] != strArray1[2] && (strArray1[2] != strArray1[4] && strArray1[1] != strArray1[4])) { num4 /= new Decimal(2); } if (sType.Equals("R_3ZHE_QSG") && strArray1[1] != strArray1[3] && (strArray1[3] != strArray1[4] && strArray1[1] != strArray1[4])) { num4 /= new Decimal(2); } if (sType.Equals("R_3ZHE_BSG") && strArray1[2] != strArray1[3] && (strArray1[3] != strArray1[4] && strArray1[2] != strArray1[4])) { num4 /= new Decimal(2); } } int num7 = 0; int num8 = 0; if (sType.Equals("P_LHH_WQ")) { num7 = Convert.ToInt32(strArray1[0]); num8 = Convert.ToInt32(strArray1[1]); } if (sType.Equals("P_LHH_WB")) { num7 = Convert.ToInt32(strArray1[0]); num8 = Convert.ToInt32(strArray1[2]); } if (sType.Equals("P_LHH_WS")) { num7 = Convert.ToInt32(strArray1[0]); num8 = Convert.ToInt32(strArray1[3]); } if (sType.Equals("P_LHH_WG")) { num7 = Convert.ToInt32(strArray1[0]); num8 = Convert.ToInt32(strArray1[4]); } if (sType.Equals("P_LHH_QB")) { num7 = Convert.ToInt32(strArray1[1]); num8 = Convert.ToInt32(strArray1[2]); } if (sType.Equals("P_LHH_QS")) { num7 = Convert.ToInt32(strArray1[1]); num8 = Convert.ToInt32(strArray1[3]); } if (sType.Equals("P_LHH_QG")) { num7 = Convert.ToInt32(strArray1[1]); num8 = Convert.ToInt32(strArray1[4]); } if (sType.Equals("P_LHH_BS")) { num7 = Convert.ToInt32(strArray1[2]); num8 = Convert.ToInt32(strArray1[3]); } if (sType.Equals("P_LHH_BG")) { num7 = Convert.ToInt32(strArray1[2]); num8 = Convert.ToInt32(strArray1[4]); } if (sType.Equals("P_LHH_SG")) { num7 = Convert.ToInt32(strArray1[3]); num8 = Convert.ToInt32(strArray1[4]); } if (num7 != num8) { num4 = Convert.ToDecimal(num4 / Convert.ToDecimal(4.5)); } int num9 = CheckPlay.Check(LotteryNumber, betDetail2, Pos, sType); Decimal Money1 = num3 * num5; int num10; Decimal Money2; if (num9 > 0) { num10 = 3; Money2 = num4 * num5 * (Decimal)num9 * num6 / new Decimal(2); Decimal num11 = new Decimal(200000); if (Money2 > num11) { Money2 = num11; } sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select top 1 MinNum from Sys_PlaySmallType where Id=" + (object)int32_4; Decimal num12 = Convert.ToDecimal(sqlCommand.ExecuteScalar().ToString()); if (num12 == new Decimal(0)) { if (Money2 > num1 * num5 * new Decimal(100)) { Decimal num13 = new Decimal(18000); if (Money2 > num13) { Money2 = num13; } } } else if ((Decimal)int32_5 < num12) { Decimal num13 = new Decimal(18000); if (Money2 > num13) { Money2 = num13; } } } else { num10 = 2; Money2 = new Decimal(0); } Decimal num14 = Money2 + Money1 - num1 * num5; sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "update N_UserBet set State=" + num10.ToString() + ",WinNum=" + num9.ToString() + ",WinBonus=" + Money2.ToString() + ",RealGet=" + num14.ToString() + " where Id=" + int32_1.ToString(); sqlCommand.ExecuteNonQuery(); if (Money2 > new Decimal(0)) { new UserTotalTran().MoneyOpers(ssId, int32_2.ToString(), Money2, int32_3, int32_4, int32_1, 5, 99, "", "", "奖金派发", STime2); } if (Money1 > new Decimal(0)) { new UserTotalTran().MoneyOpers(ssId, int32_2.ToString(), Money1, int32_3, int32_4, int32_1, 4, 99, "", "", "返点派发", STime2); } if (int32_6 != 0) { string str2 = string.Format(" where LotteryId={0} and state=0 and zhid={1} and IssueNum>'{2}'", (object)int32_3, (object)int32_6, (object)str1); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select count(Id) from N_UserBet" + str2; if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0 && num9 > 0) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = string.Format("select count(Id) from N_UserZhBet with(nolock) where isstop=1 and Id={0}", (object)int32_6); if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "select isnull(sum(Total*Times),0) from N_UserBet " + str2; Decimal Money3 = Convert.ToDecimal(string.Concat(sqlCommand.ExecuteScalar())); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "update N_UserBet set State=1 " + str2; sqlCommand.ExecuteNonQuery(); new UserTotalTran().MoneyOpers(ssId, int32_2.ToString(), Money3, int32_3, int32_4, int32_1, 6, 99, "", "", "终止追号", STime2); } } } return(true); } catch (Exception ex) { new LogExceptionDAL().Save("程序异常", "派奖过程中出现异常:" + ex.Message); return(false); } }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <param name="Source"></param> /// <returns></returns> public int InsertBetZH(FFModel.Account.UserBetModel model, string Source, DateTime STime, string userId, string playCode) { int logSysId = 0; int num1 = 0; DateTime STime2 = STime; FlexDAL.UserBetDAL betDal = new FlexDAL.UserBetDAL(); string[] issueTimeAndSn = betDal.GetIssueTimeAndSN(model.LotteryId); string issueNum = issueTimeAndSn[0]; using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString)) { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = sqlConnection; try { string str1 = ""; string str2 = ""; string str3 = ""; if (playCode == "P_5ZH") { str1 = "P_5ZH_WQBSG,P_5ZH_QBSG,P_5ZH_BSG,P_5ZH_SG,P_5ZH_G"; str2 = "1,10,100,1000,10000"; string[] strArray = model.Balls.Replace("_", "").Split(','); int num2 = 1; int num3 = 1; int num4 = 1; int num5 = 1; int num6 = 1; for (int index = 0; index < strArray.Length; ++index) { num2 *= strArray[index].Length; } for (int index = 1; index < strArray.Length; ++index) { num3 *= strArray[index].Length; } for (int index = 2; index < strArray.Length; ++index) { num4 *= strArray[index].Length; } for (int index = 3; index < strArray.Length; ++index) { num5 *= strArray[index].Length; } for (int index = 4; index < strArray.Length; ++index) { num6 *= strArray[index].Length; } str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4 + "," + (object)num5 + "," + (object)num6; } if (playCode == "P_4ZH_L") { str1 = "P_4ZH_L_WQBS,P_4ZH_L_QBS,P_4ZH_L_BS,P_4ZH_L_S"; str2 = "1,10,100,1000"; string[] strArray = model.Balls.Replace("_", "").Split(','); int num2 = 1; int num3 = 1; int num4 = 1; int num5 = 1; for (int index = 0; index < strArray.Length; ++index) { num2 *= strArray[index].Length; } for (int index = 1; index < strArray.Length; ++index) { num3 *= strArray[index].Length; } for (int index = 2; index < strArray.Length; ++index) { num4 *= strArray[index].Length; } for (int index = 3; index < strArray.Length; ++index) { num5 *= strArray[index].Length; } str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4 + "," + (object)num5; } if (playCode == "P_4ZH_R") { str1 = "P_4ZH_R_QBSG,P_4ZH_R_BSG,P_4ZH_R_SG,P_4ZH_R_G"; str2 = "1,10,100,1000"; string[] strArray = model.Balls.Replace("_", "").Split(','); int num2 = 1; int num3 = 1; int num4 = 1; int num5 = 1; for (int index = 0; index < strArray.Length; ++index) { num2 *= strArray[index].Length; } for (int index = 1; index < strArray.Length; ++index) { num3 *= strArray[index].Length; } for (int index = 2; index < strArray.Length; ++index) { num4 *= strArray[index].Length; } for (int index = 3; index < strArray.Length; ++index) { num5 *= strArray[index].Length; } str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4 + "," + (object)num5; } if (playCode == "P_3ZH_L") { str1 = "P_3ZH_L_WQB,P_3ZH_L_QB,P_3ZH_L_B"; str2 = "1,10,100"; string[] strArray = model.Balls.Replace("_", "").Split(','); int num2 = 1; int num3 = 1; int num4 = 1; for (int index = 0; index < strArray.Length; ++index) { num2 *= strArray[index].Length; } for (int index = 1; index < strArray.Length; ++index) { num3 *= strArray[index].Length; } for (int index = 2; index < strArray.Length; ++index) { num4 *= strArray[index].Length; } str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4; } if (playCode == "P_3ZH_C") { str1 = "P_3ZH_C_QBS,P_3ZH_C_BS,P_3ZH_C_S"; str2 = "1,10,100"; string[] strArray = model.Balls.Replace("_", "").Split(','); int num2 = 1; int num3 = 1; int num4 = 1; for (int index = 0; index < strArray.Length; ++index) { num2 *= strArray[index].Length; } for (int index = 1; index < strArray.Length; ++index) { num3 *= strArray[index].Length; } for (int index = 2; index < strArray.Length; ++index) { num4 *= strArray[index].Length; } str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4; } if (playCode == "P_3ZH_R") { str1 = "P_3ZH_R_BSG,P_3ZH_R_SG,P_3ZH_R_G"; str2 = "1,10,100"; string[] strArray = model.Balls.Replace("_", "").Split(','); int num2 = 1; int num3 = 1; int num4 = 1; for (int index = 0; index < strArray.Length; ++index) { num2 *= strArray[index].Length; } for (int index = 1; index < strArray.Length; ++index) { num3 *= strArray[index].Length; } for (int index = 2; index < strArray.Length; ++index) { num4 *= strArray[index].Length; } str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4; } string[] strArray1 = str1.Split(','); string[] strArray2 = str2.Split(','); string[] strArray3 = str3.Split(','); for (int index = 0; index < strArray1.Length; ++index) { if (Convert.ToInt32(strArray3[index]) > 0) { string bet = model.SsId; Decimal Money = Convert.ToDecimal(model.Price * (Decimal)Convert.ToInt32(strArray3[index]) * model.Times); if (new UserTotalTran().MoneyOpers(bet, userId, Money, model.LotteryId, model.PlayId, logSysId, 3, 99, string.Empty, string.Empty, "会员投注", "") > 0) { SqlParameter[] values = new SqlParameter[21] { new SqlParameter("@SsId", (object)bet), new SqlParameter("@UserId", (object)userId), //new SqlParameter("@UserMoney", (object) model.UserMoney), new SqlParameter("@UserMoney", (object)0), new SqlParameter("@LotteryId", (object)model.LotteryId), new SqlParameter("@PlayId", (object)model.PlayId), new SqlParameter("@IssueNum", (object)issueNum), new SqlParameter("@SingleMoney", (object)model.Price), new SqlParameter("@Num", (object)Convert.ToInt32(strArray3[index])), new SqlParameter("@Detail", (object)""), new SqlParameter("@Total", (object)(model.Price * (Decimal)Convert.ToInt32(strArray3[index]))), new SqlParameter("@Point", (object)model.Point), new SqlParameter("@PointMoney", (object)(model.Price * (Decimal)Convert.ToInt32(strArray3[index]) * model.Point / new Decimal(100))), new SqlParameter("@Bonus", (object)(model.SingelBouns / (Decimal)Convert.ToInt32(strArray2[index]))), new SqlParameter("@Pos", (object)""), new SqlParameter("@PlayCode", (object)strArray1[index]), new SqlParameter("@STime", (object)STime), new SqlParameter("@STime2", (object)STime2), //new SqlParameter("@IsDelay", (object) model.IsDelay), new SqlParameter("@IsDelay", (object)0), new SqlParameter("@Times", (object)model.Times), new SqlParameter("@ZhId", (object)"0"), new SqlParameter("@Source", (object)Source) }; sqlCommand.CommandText = "insert into N_UserBet(SsId,UserId,UserMoney,LotteryId,PlayId,IssueNum,SingleMoney,Num,Detail,Total\r\n ,Point,PointMoney,Bonus,Pos,PlayCode,STime,STime2,IsDelay,Times,ZhId,Source)\r\n values(@SsId,@UserId,@UserMoney,@LotteryId,@PlayId,@IssueNum,@SingleMoney,@Num,@Detail,@Total\r\n ,@Point,@PointMoney,@Bonus,@Pos,@PlayCode,@STime,@STime2,@IsDelay,@Times,@ZhId,@Source)"; sqlCommand.CommandText += " SELECT SCOPE_IDENTITY()"; sqlCommand.Parameters.AddRange(values); logSysId = Convert.ToInt32(sqlCommand.ExecuteScalar()); sqlCommand.Parameters.Clear(); ++num1; BetDetailDAL.SetBetDetail(STime2.ToString("yyyyMMdd"), userId.ToString(), logSysId.ToString(), model.Balls.Replace("|", "#")); } } } logSysId = num1 <= 0 ? 0 : 1; } catch (Exception ex) { new LogExceptionDAL().Save("系统异常", ex.Message); logSysId = 0; } } return(logSysId); }
/// <summary> /// 将投注信息存放到到数据库 /// </summary> /// <param name="model"></param> /// <param name="Source">来源:web端投注还是手机端</param> /// <returns></returns> public int InsertBet(FFModel.Account.UserBetModel model, string Source, DateTime STime, string userId, string playCode) { int logSysId = 0; using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString)) { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = sqlConnection; try { string bet = model.SsId; DateTime STime2 = STime; FlexDAL.UserBetDAL betDal = new FlexDAL.UserBetDAL(); string[] issueTimeAndSn = betDal.GetIssueTimeAndSN(model.LotteryId); string str1 = issueTimeAndSn[0]; Decimal Money = Convert.ToDecimal(model.SingelBouns * (Decimal)model.Num * model.Times); if (new UserTotalTran().MoneyOpers(bet, userId, Money, model.LotteryId, model.PlayId, logSysId, 3, 99, string.Empty, string.Empty, "会员投注", "") <= 0) { return(0); } SqlParameter[] values = new SqlParameter[21] { new SqlParameter("@SsId", (object)bet), new SqlParameter("@UserId", (object)userId), //new SqlParameter("@UserMoney", (object) model.UserMoney), new SqlParameter("@UserMoney", (object)0), new SqlParameter("@LotteryId", (object)model.LotteryId), new SqlParameter("@PlayId", (object)model.PlayId), new SqlParameter("@IssueNum", (object)str1), new SqlParameter("@SingleMoney", (object)model.Price), new SqlParameter("@Num", (object)model.Num), new SqlParameter("@Detail", (object)""), new SqlParameter("@Total", (object)(model.Price * (Decimal)model.Num)), new SqlParameter("@Point", (object)model.Point), new SqlParameter("@PointMoney", (object)(model.Price * (Decimal)model.Num * model.Point / new Decimal(100))), new SqlParameter("@Bonus", (object)model.SingelBouns), new SqlParameter("@Pos", (object)model.StrPos), new SqlParameter("@PlayCode", (object)playCode), //new SqlParameter("@STime", (object) model.STime), //new SqlParameter("@STime2", (object) model.STime2), new SqlParameter("@STime", (object)STime), new SqlParameter("@STime2", (object)STime2), //new SqlParameter("@IsDelay", (object) model.IsDelay), new SqlParameter("@IsDelay", (object)0), new SqlParameter("@Times", (object)model.Times), new SqlParameter("@ZhId", (object)"0"), new SqlParameter("@Source", (object)Source) }; sqlCommand.CommandText = "insert into N_UserBet(SsId,UserId,UserMoney,LotteryId,PlayId,IssueNum,SingleMoney,Num,Detail,Total\r\n ,Point,PointMoney,Bonus,Pos,PlayCode,STime,STime2,IsDelay,Times,ZhId,Source)\r\n values(@SsId,@UserId,@UserMoney,@LotteryId,@PlayId,@IssueNum,@SingleMoney,@Num,@Detail,@Total\r\n ,@Point,@PointMoney,@Bonus,@Pos,@PlayCode,@STime,@STime2,@IsDelay,@Times,@ZhId,@Source)"; sqlCommand.CommandText += " SELECT SCOPE_IDENTITY()"; sqlCommand.Parameters.AddRange(values); logSysId = Convert.ToInt32(sqlCommand.ExecuteScalar()); sqlCommand.Parameters.Clear(); BetDetailDAL.SetBetDetail(STime2.ToString("yyyyMMdd"), userId, logSysId.ToString(), model.Balls.Replace("|", "#")); } catch (Exception ex) { new LogExceptionDAL().Save("系统异常", ex.Message); logSysId = 0; } } return(logSysId); }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <param name="Source"></param> /// <returns></returns> public int InsertBetPos(FFModel.Account.UserBetModel model, string Source, DateTime STime, string userId, string playCode) { int logSysId = 0; int num = 0; DateTime STime2 = STime; FlexDAL.UserBetDAL betDal = new FlexDAL.UserBetDAL(); string[] issueTimeAndSn = betDal.GetIssueTimeAndSN(model.LotteryId); string issueNum = issueTimeAndSn[0]; using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString)) { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = sqlConnection; try { string str1 = ""; string[] strArray1 = model.StrPos.Split(','); string str2 = playCode + "_"; switch (playCode) { case "R_4FS": case "R_4DS": case "R_4ZX24": case "R_4ZX12": case "R_4ZX6": case "R_4ZX4": if (model.StrPos != "") { int count = Regex.Matches(model.StrPos, "1").Count; if (count == 4) { str1 = str1 + str2 + (strArray1[0].Equals("1") ? "W" : "") + (strArray1[1].Equals("1") ? "Q" : "") + (strArray1[2].Equals("1") ? "B" : "") + (strArray1[3].Equals("1") ? "S" : "") + (strArray1[4].Equals("1") ? "G" : "") + ","; } if (count == 5) { string[] strArray2 = "W,Q,B,S,G".Split(','); for (int index1 = 0; index1 < strArray2.Length; ++index1) { for (int index2 = index1 + 1; index2 < strArray2.Length; ++index2) { for (int index3 = index2 + 1; index3 < strArray2.Length; ++index3) { for (int index4 = index3 + 1; index4 < strArray2.Length; ++index4) { str1 = str1 + str2 + strArray2[index1] + strArray2[index2] + strArray2[index3] + strArray2[index4] + ","; } } } } break; } break; } break; case "R_3FS": case "R_3DS": case "R_3Z3": case "R_3Z6": case "R_3HX": case "R_3HE": case "R_3ZHE": case "R_3KD": case "R_3ZBD": case "R_3QTWS": case "R_3QTTS": case "R_3Z3DS": case "R_3Z6DS": if (model.StrPos != "") { int count = Regex.Matches(model.StrPos, "1").Count; if (count == 3) { str1 = str1 + str2 + (strArray1[0].Equals("1") ? "W" : "") + (strArray1[1].Equals("1") ? "Q" : "") + (strArray1[2].Equals("1") ? "B" : "") + (strArray1[3].Equals("1") ? "S" : "") + (strArray1[4].Equals("1") ? "G" : "") + ","; } if (count >= 4) { string str3 = "" + (strArray1[0].Equals("1") ? "W," : "") + (strArray1[1].Equals("1") ? "Q," : "") + (strArray1[2].Equals("1") ? "B," : "") + (strArray1[3].Equals("1") ? "S," : "") + (strArray1[4].Equals("1") ? "G," : ""); string[] strArray2 = str3.Substring(0, str3.Length - 1).Split(','); for (int index1 = 0; index1 < strArray2.Length; ++index1) { for (int index2 = index1 + 1; index2 < strArray2.Length; ++index2) { for (int index3 = index2 + 1; index3 < strArray2.Length; ++index3) { str1 = str1 + str2 + strArray2[index1] + strArray2[index2] + strArray2[index3] + ","; } } } break; } break; } break; case "R_2FS": case "R_2DS": case "R_2Z2": case "R_2HE": case "R_2ZHE": case "R_2ZDS": case "R_2KD": case "R_2ZBD": if (model.StrPos != "") { int count = Regex.Matches(model.StrPos, "1").Count; if (count == 2) { str1 = str1 + str2 + (strArray1[0].Equals("1") ? "W" : "") + (strArray1[1].Equals("1") ? "Q" : "") + (strArray1[2].Equals("1") ? "B" : "") + (strArray1[3].Equals("1") ? "S" : "") + (strArray1[4].Equals("1") ? "G" : "") + ","; } if (count >= 3) { string str3 = "" + (strArray1[0].Equals("1") ? "W," : "") + (strArray1[1].Equals("1") ? "Q," : "") + (strArray1[2].Equals("1") ? "B," : "") + (strArray1[3].Equals("1") ? "S," : "") + (strArray1[4].Equals("1") ? "G," : ""); string[] strArray2 = str3.Substring(0, str3.Length - 1).Split(','); for (int index1 = 0; index1 < strArray2.Length; ++index1) { for (int index2 = index1 + 1; index2 < strArray2.Length; ++index2) { str1 = str1 + str2 + strArray2[index1] + strArray2[index2] + ","; } } break; } break; } break; } string[] strArray3 = str1.Substring(0, str1.Length - 1).Split(','); for (int index = 0; index < strArray3.Length; ++index) { string bet = model.SsId; Decimal Money = Convert.ToDecimal(model.Price * (Decimal)model.Num * model.Times / (Decimal)strArray3.Length); if (new UserTotalTran().MoneyOpers(bet, userId, Money, model.LotteryId, model.PlayId, logSysId, 3, 99, string.Empty, string.Empty, "会员投注", "") > 0) { SqlParameter[] values = new SqlParameter[21] { new SqlParameter("@SsId", (object)bet), new SqlParameter("@UserId", (object)userId), //new SqlParameter("@UserMoney", (object) model.UserMoney), new SqlParameter("@UserMoney", (object)0), new SqlParameter("@LotteryId", (object)model.LotteryId), new SqlParameter("@PlayId", (object)model.PlayId), new SqlParameter("@IssueNum", (object)issueNum), new SqlParameter("@SingleMoney", (object)model.Price), new SqlParameter("@Num", (object)(model.Num / strArray3.Length)), new SqlParameter("@Detail", (object)""), new SqlParameter("@Total", (object)(model.Price * (Decimal)model.Num / (Decimal)strArray3.Length)), new SqlParameter("@Point", (object)model.Point), new SqlParameter("@PointMoney", (object)(model.Price * (Decimal)model.Num * model.Point / (Decimal)strArray3.Length / new Decimal(100))), new SqlParameter("@Bonus", (object)model.SingelBouns), new SqlParameter("@Pos", (object)""), new SqlParameter("@PlayCode", (object)strArray3[index]), new SqlParameter("@STime", (object)STime), new SqlParameter("@STime2", (object)STime2), //new SqlParameter("@IsDelay", (object) model.IsDelay), new SqlParameter("@IsDelay", (object)0), new SqlParameter("@Times", (object)model.Times), new SqlParameter("@ZhId", (object)"0"), new SqlParameter("@Source", (object)Source) }; sqlCommand.CommandText = "insert into N_UserBet(SsId,UserId,UserMoney,LotteryId,PlayId,IssueNum,SingleMoney,Num,Detail,Total\r\n ,Point,PointMoney,Bonus,Pos,PlayCode,STime,STime2,IsDelay,Times,ZhId,Source)\r\n values(@SsId,@UserId,@UserMoney,@LotteryId,@PlayId,@IssueNum,@SingleMoney,@Num,@Detail,@Total\r\n ,@Point,@PointMoney,@Bonus,@Pos,@PlayCode,@STime,@STime2,@IsDelay,@Times,@ZhId,@Source)"; sqlCommand.CommandText += " SELECT SCOPE_IDENTITY()"; sqlCommand.Parameters.AddRange(values); logSysId = Convert.ToInt32(sqlCommand.ExecuteScalar()); sqlCommand.Parameters.Clear(); ++num; BetDetailDAL.SetBetDetail(STime2.ToString("yyyyMMdd"), userId, logSysId.ToString(), model.Balls.Replace("|", "#")); } } logSysId = num < strArray3.Length ? 0 : 1; } catch (Exception ex) { new LogExceptionDAL().Save("系统异常", ex.Message); logSysId = 0; } } return(logSysId); }
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); } }
protected void Page_Load(object sender, EventArgs e) { base.Admin_Load("", "html"); if (!this.Page.IsPostBack) { string text = base.Str2Str(base.q("id")); this.doh.Reset(); this.doh.SqlCmd = "select *,dbo.f_GetBetState(State) as StateName2 from V_UserBetZhDetail a where Id=" + text; DataTable dataTable = this.doh.GetDataTable(); if (dataTable.Rows.Count > 0) { DataRow dataRow = dataTable.Rows[0]; this.UserName = dataRow["UserName"].ToString(); this.L_Lottery = dataRow["LotteryName"].ToString(); this.L_PlayType = dataRow["PlayName"].ToString(); this.L_IssueNumber = dataRow["IssueNum"].ToString(); this.L_SingleMoney = Convert.ToDecimal(dataRow["SingleMoney"]).ToString("0.0000") + " 元"; this.L_RealGet = Convert.ToDecimal(dataRow["RealGet"]).ToString("0.0000") + " 元"; this.L_Times = dataTable.Rows[0]["Times"].ToString(); this.L_Total = Convert.ToDecimal(Convert.ToDecimal(dataRow["Total"])).ToString("0.0000"); decimal num = Convert.ToDecimal(dataRow["Point"]); decimal num2 = Convert.ToDecimal(dataRow["Bonus"]); this.L_PointMoney = (Convert.ToDecimal(this.L_Total) * num / 100m).ToString("0.0000") + " 元"; this.L_Bonus = Convert.ToDecimal(dataRow["WinBonus"]).ToString("0.0000") + " 元"; this.L_Point = Convert.ToDecimal(num2).ToString("0.0000") + "/" + Convert.ToDecimal(num).ToString("0.0000") + " %"; if (dataRow["PlayCode"].ToString().Contains("3HX")) { this.L_Point = string.Concat(new string[] { Convert.ToDecimal(num2 / 2m).ToString("0.0000"), "/", Convert.ToDecimal(num2).ToString("0.0000"), "/", Convert.ToDecimal(num).ToString("0.0000"), " %" }); } this.L_Num = dataRow["Num"].ToString(); int num3 = Convert.ToInt32(dataRow["State"]); this.L_State = dataRow["StateName2"].ToString(); this.L_STime = dataRow["STime"].ToString(); this.L_STime2 = dataRow["STime2"].ToString(); this.L_Pos = dataRow["Pos"].ToString(); this.L_WinNum = dataRow["WinNum"].ToString(); if (this.L_Pos != "") { string text2 = ""; string[] array = this.L_Pos.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { if (Convert.ToInt32(array[i]) == 1) { text2 = text2 + "," + i.ToString(); } } this.L_Pos = "任选位数:" + text2.Substring(1).Replace("0", "万位").Replace("1", "千位").Replace("2", "百位").Replace("3", "十位").Replace("4", "个位") + "<br/>"; } this.L_Detail = this.L_Pos + BetDetailDAL.GetBetDetail(Convert.ToDateTime(dataRow["STime2"]).ToString("yyyyMMdd"), dataRow["UserId"].ToString(), text); if (string.IsNullOrEmpty(this.L_Detail)) { this.L_Detail = this.L_Pos + dataRow["Detail"].ToString(); } this.NumberShow.Visible = false; if (num3 >= 2) { this.NumberShow.Visible = true; this.doh.Reset(); this.doh.ConditionExpress = "Type=@Type and Title=@Title"; this.doh.AddConditionParameter("@Type", dataRow["LotteryId"].ToString()); this.doh.AddConditionParameter("@Title", this.L_IssueNumber); object field = this.doh.GetField("Sys_LotteryData", "Number"); this.L_Number = string.Concat(field); } } else { base.Response.Write("参数错误"); base.Response.End(); } dataTable.Clear(); dataTable.Dispose(); } }
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); decimal curRealGet = LotteryDAL.GetCurRealGet(LotteryId); if (curRealGet < Convert.ToDecimal(lotteryCheck.Rows[0]["CheckPer"])) { List <KeyValue> list = new List <KeyValue>(); 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 lotteryNumber = 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 text = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(dataRow["STime2"]).ToString("yyyyMMdd"), num8.ToString(), num7.ToString()); if (string.IsNullOrEmpty(text)) { text = ""; } 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(lotteryNumber, text, pos, sType); num3 += d3 * d5 * d2 * value / 2m + d4 * d5; } decimal num9 = d - num3; if (num9 > 0m) { num2 = num; } list.Add(new KeyValue { tKey = string.Join(",", array), tValue = num9 }); num2++; }while (num2 < num); IOrderedEnumerable <KeyValue> source = from a in list orderby a.tValue descending select a; List <KeyValue> list2 = source.ToList <KeyValue>(); GYoule3dCheck.SetOpenListJson(LotteryId, IssueNum, list2[0].tKey, DateTime.Now.ToString(), string.Concat(list2[0].tValue)); } else { string[] value2 = NumberCode.CreateCode20(); GYoule3dCheck.SetOpenListJson(LotteryId, IssueNum, string.Join(",", value2), DateTime.Now.ToString(), "0"); } } else { string[] value3 = NumberCode.CreateCode20(); GYoule3dCheck.SetOpenListJson(LotteryId, IssueNum, string.Join(",", value3), DateTime.Now.ToString(), "0"); } } catch (Exception ex) { new LogExceptionDAL().Save("派奖异常", ex.Message); } }
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); 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])) % 10; int num5 = (Convert.ToInt32(array[4]) + Convert.ToInt32(array[5]) + Convert.ToInt32(array[6]) + Convert.ToInt32(array[7])) % 10; int num6 = (Convert.ToInt32(array[8]) + Convert.ToInt32(array[9]) + Convert.ToInt32(array[10]) + Convert.ToInt32(array[11])) % 10; int num7 = (Convert.ToInt32(array[12]) + Convert.ToInt32(array[13]) + Convert.ToInt32(array[14]) + Convert.ToInt32(array[15])) % 10; int num8 = (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, ",", num7, ",", num8 }); for (int i = 0; i < dataTable.Rows.Count; i++) { DataRow dataRow = dataTable.Rows[i]; int num9 = Convert.ToInt32(dataRow["Id"]); int num10 = Convert.ToInt32(dataRow["UserId"]); string sType = dataRow["PlayCode"].ToString(); string text2 = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(dataRow["STime2"]).ToString("yyyyMMdd"), num10.ToString(), num9.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 num11 = d - num3; if (num11 > 0m) { num2 = num; } KeyValue keyValue = new KeyValue(); keyValue.tKey = text; keyValue.tValue = num11; YouleCheck.list.Add(keyValue); num2++; }while (num2 < num); IOrderedEnumerable <KeyValue> source = from a in YouleCheck.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); YouleCheck.SetOpenListJson(LotteryId); } } else { string[] array2 = NumberCode.CreateCode20(); int num12 = (Convert.ToInt32(array2[0]) + Convert.ToInt32(array2[1]) + Convert.ToInt32(array2[2]) + Convert.ToInt32(array2[3])) % 10; int num13 = (Convert.ToInt32(array2[4]) + Convert.ToInt32(array2[5]) + Convert.ToInt32(array2[6]) + Convert.ToInt32(array2[7])) % 10; int num14 = (Convert.ToInt32(array2[8]) + Convert.ToInt32(array2[9]) + Convert.ToInt32(array2[10]) + Convert.ToInt32(array2[11])) % 10; int num15 = (Convert.ToInt32(array2[12]) + Convert.ToInt32(array2[13]) + Convert.ToInt32(array2[14]) + Convert.ToInt32(array2[15])) % 10; int num16 = (Convert.ToInt32(array2[16]) + Convert.ToInt32(array2[17]) + Convert.ToInt32(array2[18]) + Convert.ToInt32(array2[19])) % 10; string number = string.Concat(new object[] { num12, ",", num13, ",", num14, ",", num15, ",", num16 }); if (!new LotteryDataDAL().Exists(LotteryId, IssueNum)) { new LotteryDataDAL().AddYoule(LotteryId, IssueNum, number, DateTime.Now.ToString(), string.Join(",", array2)); LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, number); YouleCheck.SetOpenListJson(LotteryId); } } } else { string[] array3 = NumberCode.CreateCode20(); int num17 = (Convert.ToInt32(array3[0]) + Convert.ToInt32(array3[1]) + Convert.ToInt32(array3[2]) + Convert.ToInt32(array3[3])) % 10; int num18 = (Convert.ToInt32(array3[4]) + Convert.ToInt32(array3[5]) + Convert.ToInt32(array3[6]) + Convert.ToInt32(array3[7])) % 10; int num19 = (Convert.ToInt32(array3[8]) + Convert.ToInt32(array3[9]) + Convert.ToInt32(array3[10]) + Convert.ToInt32(array3[11])) % 10; int num20 = (Convert.ToInt32(array3[12]) + Convert.ToInt32(array3[13]) + Convert.ToInt32(array3[14]) + Convert.ToInt32(array3[15])) % 10; int num21 = (Convert.ToInt32(array3[16]) + Convert.ToInt32(array3[17]) + Convert.ToInt32(array3[18]) + Convert.ToInt32(array3[19])) % 10; string number2 = string.Concat(new object[] { num17, ",", num18, ",", num19, ",", num20, ",", num21 }); if (!new LotteryDataDAL().Exists(LotteryId, IssueNum)) { new LotteryDataDAL().AddYoule(LotteryId, IssueNum, number2, DateTime.Now.ToString(), string.Join(",", array3)); LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, number2); YouleCheck.SetOpenListJson(LotteryId); } } } catch (Exception ex) { new LogExceptionDAL().Save("派奖异常", ex.Message); } }