Beispiel #1
0
 public void CancelToNoOfTitle(string lotteryId, string title)
 {
     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 * From N_UserBet with(nolock)  where lotteryId=" + lotteryId + " and (state<>0 and state<>1) and IssueNum='" + title + "' order by id asc";
             DataTable dataTable = new DataTable();
             sqlDataAdapter.Fill(dataTable);
             foreach (DataRow row in (InternalDataCollectionBase)dataTable.Rows)
             {
                 int int32 = Convert.ToInt32(row["id"].ToString());
                 Convert.ToInt32(row["UserId"].ToString());
                 CheckOperation.AdminCancelToNO(int32, sqlCommand);
             }
         }
         catch (Exception ex)
         {
             new LogExceptionDAL().Save("程序异常", ex.Message);
         }
         finally
         {
             if (sqlConnection != null)
             {
                 sqlConnection.Close();
             }
         }
     }
 }
Beispiel #2
0
        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);
                    }
                }
            }
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
 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);
     }
 }
Beispiel #7
0
        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);
        }
Beispiel #8
0
 public void Cancel(int LotteryId, string title, int state)
 {
     using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString))
     {
         sqlConnection.Open();
         SqlCommand sqlCommand = new SqlCommand();
         sqlCommand.Connection = sqlConnection;
         SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
         sqlDataAdapter.SelectCommand = sqlCommand;
         try
         {
             string str = LotteryUtils.LotteryTitle(LotteryId);
             if (state == 0)
             {
                 sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                 sqlDataAdapter.SelectCommand.CommandText = "select * From N_UserBet with(nolock)  where state=0 and LotteryId='" + LotteryId.ToString() + "' and IssueNum='" + title + "' order by id asc";
             }
             else
             {
                 sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                 sqlDataAdapter.SelectCommand.CommandText = "select * From N_UserBet with(nolock)  where (state<>0 and state<>1) and LotteryId='" + LotteryId.ToString() + "' and IssueNum='" + title + "' order by id asc";
             }
             DataTable dataTable = new DataTable();
             sqlDataAdapter.Fill(dataTable);
             foreach (DataRow row in (InternalDataCollectionBase)dataTable.Rows)
             {
                 int int32 = Convert.ToInt32(row["id"].ToString());
                 Convert.ToInt32(row["UserId"].ToString());
                 if (!CheckOperation.AdminCancel(int32, sqlCommand))
                 {
                     new LogExceptionDAL().Save("派奖异常", str + " 投注ID:" + (object)int32 + "撤单");
                 }
             }
         }
         catch (Exception ex)
         {
             new LogExceptionDAL().Save("程序异常", ex.Message);
         }
         finally
         {
             if (sqlConnection != null)
             {
                 sqlConnection.Close();
             }
         }
     }
 }
Beispiel #9
0
 public void CancelOfBetId(string betId)
 {
     using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString))
     {
         sqlConnection.Open();
         SqlCommand sqlCommand = new SqlCommand();
         sqlCommand.Connection = sqlConnection;
         try
         {
             CheckOperation.AdminCancel(Convert.ToInt32(betId), sqlCommand);
         }
         catch (Exception ex)
         {
             new LogExceptionDAL().Save("程序异常", ex.Message);
         }
         finally
         {
             if (sqlConnection != null)
             {
                 sqlConnection.Close();
             }
         }
     }
 }
Beispiel #10
0
 public void Cancel(int LotteryId, string title, int state)
 {
     using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString))
     {
         sqlConnection.Open();
         SqlCommand sqlCommand = new SqlCommand();
         sqlCommand.Connection = sqlConnection;
         SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
         sqlDataAdapter.SelectCommand = sqlCommand;
         try
         {
             string text = LotteryUtils.LotteryTitle(LotteryId);
             if (state == 0)
             {
                 sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                 sqlDataAdapter.SelectCommand.CommandText = string.Concat(new string[]
                 {
                     "select * From N_UserBet with(nolock)  where state=0 and LotteryId='",
                     LotteryId.ToString(),
                     "' and IssueNum='",
                     title,
                     "' order by id asc"
                 });
             }
             else
             {
                 sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                 sqlDataAdapter.SelectCommand.CommandText = string.Concat(new string[]
                 {
                     "select * From N_UserBet with(nolock)  where (state<>0 and state<>1) and LotteryId='",
                     LotteryId.ToString(),
                     "' and IssueNum='",
                     title,
                     "' order by id asc"
                 });
             }
             DataTable dataTable = new DataTable();
             sqlDataAdapter.Fill(dataTable);
             foreach (DataRow dataRow in dataTable.Rows)
             {
                 int num = Convert.ToInt32(dataRow["id"].ToString());
                 Convert.ToInt32(dataRow["UserId"].ToString());
                 if (!CheckOperation.AdminCancel(num, sqlCommand))
                 {
                     new LogExceptionDAL().Save("派奖异常", string.Concat(new object[]
                     {
                         text,
                         " 投注ID:",
                         num,
                         "撤单"
                     }));
                 }
             }
         }
         catch (Exception ex)
         {
             new LogExceptionDAL().Save("程序异常", ex.Message);
         }
         finally
         {
             if (sqlConnection != null)
             {
                 sqlConnection.Close();
             }
         }
     }
 }
Beispiel #11
0
        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);
        }
Beispiel #12
0
        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);
        }
Beispiel #13
0
        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);
        }
Beispiel #14
0
        /// <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);
            }
        }
Beispiel #15
0
        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);
        }