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 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); }