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 void AgencyPoint(string ssId, int UserId, string UserName, int UserPoint, int LotteryId, int PlayId, int BetId, decimal BetMoney, SqlCommand cmd) { cmd.CommandType = CommandType.Text; cmd.CommandText = "select ParentId from N_User with(nolock) where Id=" + UserId.ToString(); int num = Convert.ToInt32(cmd.ExecuteScalar()); if (num != 0) { cmd.CommandType = CommandType.Text; cmd.CommandText = "select Point from N_User with(nolock) where Id=" + num.ToString(); object obj = cmd.ExecuteScalar(); if (!string.IsNullOrEmpty(string.Concat(obj))) { int num2 = Convert.ToInt32(obj); if (num2 < 133 && num2 >= UserPoint) { decimal money = BetMoney * Convert.ToDecimal(num2 - UserPoint) / 1000m; if (Convert.ToDecimal(money.ToString("0.0000")) > 0m) { new UserTotalTran().MoneyOpers(ssId, num.ToString(), money, LotteryId, PlayId, BetId, 4, 99, "", "", UserName + " 游戏返点", ""); } CheckOperation.AgencyPoint(ssId, num, UserName, num2, LotteryId, PlayId, BetId, BetMoney, cmd); } } } }
public static void AgencyPoint(string ssId, int UserId, string UserName, int UserPoint, int LotteryId, int PlayId, int BetId, Decimal BetMoney, SqlCommand cmd) { cmd.CommandType = CommandType.Text; cmd.CommandText = "select ParentId from N_User with(nolock) where Id=" + UserId.ToString(); int int32_1 = Convert.ToInt32(cmd.ExecuteScalar()); if (int32_1 == 0) { return; } cmd.CommandType = CommandType.Text; cmd.CommandText = "select Point from N_User with(nolock) where Id=" + int32_1.ToString(); object obj = cmd.ExecuteScalar(); if (string.IsNullOrEmpty(string.Concat(obj))) { return; } int int32_2 = Convert.ToInt32(obj); if (int32_2 >= 133 || int32_2 < UserPoint) { return; } Decimal Money = BetMoney * Convert.ToDecimal(int32_2 - UserPoint) / new Decimal(1000); if (Convert.ToDecimal(Money.ToString("0.0000")) > new Decimal(0)) { new UserTotalTran().MoneyOpers(ssId, int32_1.ToString(), Money, LotteryId, PlayId, BetId, 4, 99, "", "", UserName + " 游戏返点", ""); } CheckOperation.AgencyPoint(ssId, int32_1, UserName, int32_2, LotteryId, PlayId, BetId, BetMoney, cmd); }
public static string AdminRunOper(int LotteryId, string IssueNum, string Number) { string str = ""; 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 = "select b.username,b.point as uPoint,* From N_UserBet a with(nolock) left join N_User b on a.UserId=b.Id where State=0 and LotteryId=" + (object)LotteryId + " and IssueNum='" + IssueNum + "'"; DataTable dataTable = new DataTable("N_UserBet"); sqlDataAdapter.Fill(dataTable); if (dataTable.Rows.Count > 0) { foreach (DataRow row in (InternalDataCollectionBase)dataTable.Rows) { string LotteryNumber = Number; if (Convert.ToInt32(row["State"].ToString()) == 0) { CheckOperation.Checking(row, LotteryNumber, sqlCommand); } } foreach (DataRow row in (InternalDataCollectionBase)dataTable.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["PlayId"]); Decimal num1 = Convert.ToDecimal(row["Total"]); Decimal num2 = Convert.ToDecimal(row["Times"]); CheckOperation.AgencyPoint(ssId, int32_3, UserName, int32_1, LotteryId, int32_4, int32_2, Convert.ToDecimal(num1 * num2), sqlCommand); } dataTable.Dispose(); } else { str = "该期没有开奖号码,请手动添加!"; } } catch (Exception ex) { str = "派奖出现错误,请重试!"; new LogExceptionDAL().Save("派奖异常", ex.Message); } finally { sqlConnection.Dispose(); sqlConnection.Close(); } } return(str); }
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); } }
public static bool AdminCancelToNO(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(); decimal d = Convert.ToDecimal(dataRow["Total"]); decimal d2 = Convert.ToDecimal(dataRow["Times"]); decimal num3 = Convert.ToDecimal(dataRow["WinBonus"]); sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = "update N_UserBet set State=0,WinNum=0,WinBonus=0,RealGet=0 where Id=" + BetId.ToString(); sqlCommand.ExecuteNonQuery(); if (num3 > 0m) { new UserTotalTran().MoneyOpers(ssId, userId.ToString(), num3, num, num2, BetId, 6, 99, "", "", "撤到未开奖", dataRow["STime"].ToString()); } 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 * d2), sqlCommand); } dataTable.Dispose(); result = true; } catch (Exception ex) { new LogExceptionDAL().Save("程序异常", "派奖过程中出现异常:" + ex.Message); result = false; } return(result); }
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); }
public static string AdminRunOper(int LotteryId, string IssueNum, string Number) { 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.Concat(new object[] { "select b.username,b.point as uPoint,* From N_UserBet a with(nolock) left join N_User b on a.UserId=b.Id where State=0 and LotteryId=", LotteryId, " and IssueNum='", IssueNum, "'" }); DataTable dataTable = new DataTable("N_UserBet"); sqlDataAdapter.Fill(dataTable); if (dataTable.Rows.Count > 0) { foreach (DataRow dataRow in dataTable.Rows) { if (Convert.ToInt32(dataRow["State"].ToString()) == 0) { CheckOperation.Checking(dataRow, Number, sqlCommand); } } foreach (DataRow dataRow2 in dataTable.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 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); } dataTable.Dispose(); } else { result = "该期没有开奖号码,请手动添加!"; } } catch (Exception ex) { result = "派奖出现错误,请重试!"; new LogExceptionDAL().Save("派奖异常", ex.Message); } finally { sqlConnection.Dispose(); sqlConnection.Close(); } } return(result); }
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); }