Esempio n. 1
0
 private static void Run(int LotteryId, string IssueNum)
 {
     try
     {
         YouleCheck.list.Clear();
         DataTable dataTable = LotteryDAL.GetDataTable(LotteryId.ToString(), IssueNum);
         if (dataTable.Rows.Count > 0)
         {
             DataTable lotteryCheck = LotteryDAL.GetLotteryCheck(LotteryId);
             if (LotteryDAL.GetCurRealGet(LotteryId) < Convert.ToDecimal(lotteryCheck.Rows[0]["CheckPer"]))
             {
                 int      int32_1  = Convert.ToInt32(lotteryCheck.Rows[0]["CheckNum"]);
                 string[] strArray = new string[20];
                 int      num1     = 0;
                 string[] code20;
                 do
                 {
                     Decimal num2 = new Decimal(0);
                     Decimal num3 = new Decimal(0);
                     Decimal num4 = new Decimal(0);
                     code20 = NumberCode.CreateCode20();
                     string LotteryNumber = ((Convert.ToInt32(code20[0]) + Convert.ToInt32(code20[1]) + Convert.ToInt32(code20[2]) + Convert.ToInt32(code20[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(code20[4]) + Convert.ToInt32(code20[5]) + Convert.ToInt32(code20[6]) + Convert.ToInt32(code20[7])) % 10) + "," + (object)((Convert.ToInt32(code20[8]) + Convert.ToInt32(code20[9]) + Convert.ToInt32(code20[10]) + Convert.ToInt32(code20[11])) % 10) + "," + (object)((Convert.ToInt32(code20[12]) + Convert.ToInt32(code20[13]) + Convert.ToInt32(code20[14]) + Convert.ToInt32(code20[15])) % 10) + "," + (object)((Convert.ToInt32(code20[16]) + Convert.ToInt32(code20[17]) + Convert.ToInt32(code20[18]) + Convert.ToInt32(code20[19])) % 10);
                     for (int index = 0; index < dataTable.Rows.Count; ++index)
                     {
                         DataRow row         = dataTable.Rows[index];
                         int     int32_2     = Convert.ToInt32(row["Id"]);
                         int     int32_3     = Convert.ToInt32(row["UserId"]);
                         string  sType       = row["PlayCode"].ToString();
                         string  CheckNumber = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(row["STime2"]).ToString("yyyyMMdd"), int32_3.ToString(), int32_2.ToString());
                         if (string.IsNullOrEmpty(CheckNumber))
                         {
                             CheckNumber = "";
                         }
                         string  Pos  = row["Pos"].ToString();
                         Decimal num5 = Convert.ToDecimal(row["SingleMoney"]);
                         Decimal num6 = Convert.ToDecimal(row["Bonus"]);
                         Decimal num7 = Convert.ToDecimal(row["PointMoney"]);
                         Decimal num8 = Convert.ToDecimal(row["Times"]);
                         Decimal num9 = Convert.ToDecimal(row["Total"]);
                         num3 += num9 * num8;
                         int num10 = CheckPlay.Check(LotteryNumber, CheckNumber, Pos, sType);
                         num4 += num6 * num8 * num5 * (Decimal)num10 / new Decimal(2) + num7;
                     }
                     Decimal num11 = num3 - num4;
                     if (num11 > new Decimal(0))
                     {
                         num1 = int32_1;
                     }
                     YouleCheck.list.Add(new KeyValue()
                     {
                         tKey   = LotteryNumber,
                         tValue = num11
                     });
                     ++num1;
                 }while (num1 < int32_1);
                 List <KeyValue> list = YouleCheck.list.OrderByDescending <KeyValue, Decimal>((Func <KeyValue, Decimal>)(a => a.tValue)).ToList <KeyValue>();
                 if (new LotteryDataDAL().Exists(LotteryId, IssueNum))
                 {
                     return;
                 }
                 new LotteryDataDAL().AddYoule(LotteryId, IssueNum, list[0].tKey, DateTime.Now.ToString(), string.Join(",", code20));
                 LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, list[0].tKey);
                 YouleCheck.SetOpenListJson(LotteryId);
             }
             else
             {
                 string[] code20 = NumberCode.CreateCode20();
                 string   Number = ((Convert.ToInt32(code20[0]) + Convert.ToInt32(code20[1]) + Convert.ToInt32(code20[2]) + Convert.ToInt32(code20[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(code20[4]) + Convert.ToInt32(code20[5]) + Convert.ToInt32(code20[6]) + Convert.ToInt32(code20[7])) % 10) + "," + (object)((Convert.ToInt32(code20[8]) + Convert.ToInt32(code20[9]) + Convert.ToInt32(code20[10]) + Convert.ToInt32(code20[11])) % 10) + "," + (object)((Convert.ToInt32(code20[12]) + Convert.ToInt32(code20[13]) + Convert.ToInt32(code20[14]) + Convert.ToInt32(code20[15])) % 10) + "," + (object)((Convert.ToInt32(code20[16]) + Convert.ToInt32(code20[17]) + Convert.ToInt32(code20[18]) + Convert.ToInt32(code20[19])) % 10);
                 if (new LotteryDataDAL().Exists(LotteryId, IssueNum))
                 {
                     return;
                 }
                 new LotteryDataDAL().AddYoule(LotteryId, IssueNum, Number, DateTime.Now.ToString(), string.Join(",", code20));
                 LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, Number);
                 YouleCheck.SetOpenListJson(LotteryId);
             }
         }
         else
         {
             string[] code20 = NumberCode.CreateCode20();
             string   Number = ((Convert.ToInt32(code20[0]) + Convert.ToInt32(code20[1]) + Convert.ToInt32(code20[2]) + Convert.ToInt32(code20[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(code20[4]) + Convert.ToInt32(code20[5]) + Convert.ToInt32(code20[6]) + Convert.ToInt32(code20[7])) % 10) + "," + (object)((Convert.ToInt32(code20[8]) + Convert.ToInt32(code20[9]) + Convert.ToInt32(code20[10]) + Convert.ToInt32(code20[11])) % 10) + "," + (object)((Convert.ToInt32(code20[12]) + Convert.ToInt32(code20[13]) + Convert.ToInt32(code20[14]) + Convert.ToInt32(code20[15])) % 10) + "," + (object)((Convert.ToInt32(code20[16]) + Convert.ToInt32(code20[17]) + Convert.ToInt32(code20[18]) + Convert.ToInt32(code20[19])) % 10);
             if (new LotteryDataDAL().Exists(LotteryId, IssueNum))
             {
                 return;
             }
             new LotteryDataDAL().AddYoule(LotteryId, IssueNum, Number, DateTime.Now.ToString(), string.Join(",", code20));
             LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, Number);
             YouleCheck.SetOpenListJson(LotteryId);
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("派奖异常", ex.Message);
     }
 }
Esempio n. 2
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);
        }
Esempio n. 3
0
 private static void Run(int LotteryId, string IssueNum)
 {
     try
     {
         Youle11x5Check.list.Clear();
         DataTable dataTable = LotteryDAL.GetDataTable(LotteryId.ToString(), IssueNum);
         if (dataTable.Rows.Count > 0)
         {
             DataTable lotteryCheck = LotteryDAL.GetLotteryCheck(LotteryId);
             decimal   curRealGet   = LotteryDAL.GetCurRealGet(LotteryId);
             if (curRealGet < Convert.ToDecimal(lotteryCheck.Rows[0]["CheckPer"]))
             {
                 int    num  = Convert.ToInt32(lotteryCheck.Rows[0]["CheckNum"]);
                 int    num2 = 0;
                 string text;
                 do
                 {
                     decimal d    = 0m;
                     decimal num3 = 0m;
                     text = NumberCode.CreateCode11X5(5);
                     for (int i = 0; i < dataTable.Rows.Count; i++)
                     {
                         DataRow dataRow = dataTable.Rows[i];
                         int     num4    = Convert.ToInt32(dataRow["Id"]);
                         int     num5    = Convert.ToInt32(dataRow["UserId"]);
                         string  sType   = dataRow["PlayCode"].ToString();
                         string  text2   = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(dataRow["STime2"]).ToString("yyyyMMdd"), num5.ToString(), num4.ToString());
                         if (string.IsNullOrEmpty(text2))
                         {
                             text2 = "";
                         }
                         string  pos = dataRow["Pos"].ToString();
                         decimal d2  = Convert.ToDecimal(dataRow["SingleMoney"]);
                         decimal d3  = Convert.ToDecimal(dataRow["Bonus"]);
                         decimal d4  = Convert.ToDecimal(dataRow["PointMoney"]);
                         decimal d5  = Convert.ToDecimal(dataRow["Times"]);
                         decimal d6  = Convert.ToDecimal(dataRow["Total"]);
                         d += d6 * d5;
                         int value = CheckPlay.Check(text, text2, pos, sType);
                         num3 += d3 * d5 * d2 * value / 2m + d4;
                     }
                     decimal num6 = d - num3;
                     if (num6 > 0m)
                     {
                         num2 = num;
                     }
                     KeyValue keyValue = new KeyValue();
                     keyValue.tKey   = text;
                     keyValue.tValue = num6;
                     Youle11x5Check.list.Add(keyValue);
                     num2++;
                 }while (num2 < num);
                 IOrderedEnumerable <KeyValue> source = from a in Youle11x5Check.list
                                                        orderby a.tValue descending
                                                        select a;
                 List <KeyValue> list = source.ToList <KeyValue>();
                 if (!new LotteryDataDAL().Exists(LotteryId, IssueNum))
                 {
                     new LotteryDataDAL().AddYoule(LotteryId, IssueNum, list[0].tKey, DateTime.Now.ToString(), text);
                     LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, list[0].tKey);
                     Youle11x5Check.SetOpenListJson(LotteryId);
                 }
             }
             else
             {
                 string text3 = NumberCode.CreateCode11X5(5);
                 if (!new LotteryDataDAL().Exists(LotteryId, IssueNum))
                 {
                     new LotteryDataDAL().AddYoule(LotteryId, IssueNum, text3, DateTime.Now.ToString(), text3);
                     LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, text3);
                     Youle11x5Check.SetOpenListJson(LotteryId);
                 }
             }
         }
         else
         {
             string text4 = NumberCode.CreateCode11X5(5);
             if (!new LotteryDataDAL().Exists(LotteryId, IssueNum))
             {
                 new LotteryDataDAL().AddYoule(LotteryId, IssueNum, text4, DateTime.Now.ToString(), text4);
                 LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, text4);
                 Youle11x5Check.SetOpenListJson(LotteryId);
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("派奖异常", ex.Message);
     }
 }
Esempio n. 4
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);
            }
        }
 private static void Run(int LotteryId, string IssueNum)
 {
     try
     {
         DataTable dataTable = LotteryDAL.GetDataTable(LotteryId.ToString(), IssueNum);
         if (dataTable.Rows.Count > 0)
         {
             DataTable lotteryCheck = LotteryDAL.GetLotteryCheck(LotteryId);
             if (LotteryDAL.GetCurRealGet(LotteryId) < Convert.ToDecimal(lotteryCheck.Rows[0]["CheckPer"]))
             {
                 List <KeyValue> source  = new List <KeyValue>();
                 int             int32_1 = Convert.ToInt32(lotteryCheck.Rows[0]["CheckNum"]);
                 int             num1    = 0;
                 do
                 {
                     Decimal num2     = new Decimal(0);
                     Decimal num3     = new Decimal(0);
                     Decimal num4     = new Decimal(0);
                     string  code11X5 = NumberCode.CreateCode11X5(5);
                     for (int index = 0; index < dataTable.Rows.Count; ++index)
                     {
                         DataRow row         = dataTable.Rows[index];
                         int     int32_2     = Convert.ToInt32(row["Id"]);
                         int     int32_3     = Convert.ToInt32(row["UserId"]);
                         string  sType       = row["PlayCode"].ToString();
                         string  CheckNumber = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(row["STime2"]).ToString("yyyyMMdd"), int32_3.ToString(), int32_2.ToString());
                         if (string.IsNullOrEmpty(CheckNumber))
                         {
                             CheckNumber = "";
                         }
                         string  Pos  = row["Pos"].ToString();
                         Decimal num5 = Convert.ToDecimal(row["SingleMoney"]);
                         Decimal num6 = Convert.ToDecimal(row["Bonus"]);
                         Decimal num7 = Convert.ToDecimal(row["PointMoney"]);
                         Decimal num8 = Convert.ToDecimal(row["Times"]);
                         Decimal num9 = Convert.ToDecimal(row["Total"]);
                         num3 += num9 * num8;
                         int num10 = CheckPlay.Check(code11X5, CheckNumber, Pos, sType);
                         num4 += num6 * num8 * num5 * (Decimal)num10 / new Decimal(2) + num7 * num8;
                     }
                     Decimal num11 = num3 - num4;
                     if (num11 > new Decimal(0))
                     {
                         num1 = int32_1;
                     }
                     source.Add(new KeyValue()
                     {
                         tKey   = code11X5,
                         tValue = num11
                     });
                     ++num1;
                 }while (num1 < int32_1);
                 List <KeyValue> list = source.OrderByDescending <KeyValue, Decimal>((Func <KeyValue, Decimal>)(a => a.tValue)).ToList <KeyValue>();
                 GYoule11x5Check.SetOpenListJson(LotteryId, IssueNum, list[0].tKey, DateTime.Now.ToString(), string.Concat((object)list[0].tValue));
             }
             else
             {
                 string code11X5 = NumberCode.CreateCode11X5(5);
                 GYoule11x5Check.SetOpenListJson(LotteryId, IssueNum, code11X5, DateTime.Now.ToString(), "0");
             }
         }
         else
         {
             string code11X5 = NumberCode.CreateCode11X5(5);
             GYoule11x5Check.SetOpenListJson(LotteryId, IssueNum, code11X5, DateTime.Now.ToString(), "0");
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("派奖异常", ex.Message);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 生成并检查杀中率
        /// </summary>
        public void GenerateCheck()
        {
            //本期下注数据
            DataTable dataTable = LotteryDAL.GetDataTable(this.Id.ToString(), this.ExpectNo);

            this.CheckList = new List <CheckLotteryModel>();

            if (dataTable.Rows.Count > 0)
            {
                //奖种中奖率
                DataTable lotteryCheck = LotteryDAL.GetLotteryCheck(this.Id);

                //CheckPer: 杀数比
                decimal checkPer = Convert.ToDecimal(lotteryCheck.Rows[0]["CheckPer"]);
                if (LotteryDAL.GetCurRealGet(this.Id) < checkPer)
                {
                    int num1 = 0;
                    //杀数个数
                    int checkNum = Convert.ToInt32(lotteryCheck.Rows[0]["CheckNum"]);

                    Log.DebugFormat("控制杀数比{0}: {1}, {2}", this.Name, checkPer, checkNum);

                    do
                    {
                        Decimal num2 = new Decimal(0);
                        Decimal num3 = new Decimal(0);
                        Decimal num4 = new Decimal(0);

                        Generate(); //生成开奖号码

                        for (int index = 0; index < dataTable.Rows.Count; ++index)
                        {
                            DataRow row      = dataTable.Rows[index];
                            int     betId    = Convert.ToInt32(row["Id"]);     //下注Id
                            int     userId   = Convert.ToInt32(row["UserId"]); //用户Id
                            string  playCode = row["PlayCode"].ToString();     //玩法
                            string  betDate  = Convert.ToDateTime(row["STime2"]).ToString("yyyyMMdd");

                            //下注号码
                            string betNumber = FlexDal.BetDetailDAL.GetBetDetail2(betDate, userId.ToString(), betId.ToString());
                            if (string.IsNullOrEmpty(betNumber))
                            {
                                betNumber = "";
                            }

                            string  Pos  = row["Pos"].ToString();
                            Decimal num5 = Convert.ToDecimal(row["SingleMoney"]);
                            Decimal num6 = Convert.ToDecimal(row["Bonus"]);
                            Decimal num7 = Convert.ToDecimal(row["PointMoney"]);
                            Decimal num8 = Convert.ToDecimal(row["Times"]);
                            Decimal num9 = Convert.ToDecimal(row["Total"]);
                            num3 += num9 * num8; //本期下注总金额

                            int num10 = CheckPlay.Check(this.Number, betNumber, Pos, playCode);

                            num4 += num6 * num8 * num5 * (Decimal)num10 / new Decimal(2) + num7; //本期中奖总金额
                        }
                        Decimal num11 = num3 - num4;

                        if (num11 > new Decimal(0))
                        {
                            num1 = checkNum; //杀数个数
                        }
                        //中奖号码
                        this.CheckList.Add(new CheckLotteryModel()
                        {
                            Number    = this.Number,
                            NumberAll = this.NumberAll,
                            Income    = num11
                        });

                        ++num1;
                    } while (num1 < checkNum); //中奖数大于杀数个数,重新开奖

                    CheckLotteryModel lottery = this.CheckList.OrderByDescending(i => i.Income).First();
                    this.Number    = lottery.Number;
                    this.NumberAll = lottery.NumberAll;
                }
                else
                {
                    Log.DebugFormat("正常开奖{0}", this.Name);
                    Generate(); //生成开奖号码
                }
            }
            else
            {
                Log.DebugFormat("正常开奖{0}", this.Name);
                Generate(); //生成开奖号码
            }

            Log.DebugFormat("开奖号码{0}: {1}, {2}", this.Name, this.Number, this.NumberAll);
        }
Esempio n. 7
0
 private static void Run(int LotteryId, string IssueNum)
 {
     try
     {
         DataTable dataTable = LotteryDAL.GetDataTable(LotteryId.ToString(), IssueNum);
         if (dataTable.Rows.Count > 0)
         {
             DataTable lotteryCheck = LotteryDAL.GetLotteryCheck(LotteryId);
             decimal   curRealGet   = LotteryDAL.GetCurRealGet(LotteryId);
             if (curRealGet < Convert.ToDecimal(lotteryCheck.Rows[0]["CheckPer"]))
             {
                 List <KeyValue> list  = new List <KeyValue>();
                 int             num   = Convert.ToInt32(lotteryCheck.Rows[0]["CheckNum"]);
                 string[]        array = new string[20];
                 int             num2  = 0;
                 do
                 {
                     decimal d    = 0m;
                     decimal num3 = 0m;
                     array = NumberCode.CreateCode20();
                     int    num4          = (Convert.ToInt32(array[0]) + Convert.ToInt32(array[1]) + Convert.ToInt32(array[2]) + Convert.ToInt32(array[3]) + Convert.ToInt32(array[4]) + Convert.ToInt32(array[5]) + Convert.ToInt32(array[6])) % 10;
                     int    num5          = (Convert.ToInt32(array[7]) + Convert.ToInt32(array[8]) + Convert.ToInt32(array[9]) + Convert.ToInt32(array[10]) + Convert.ToInt32(array[11]) + Convert.ToInt32(array[12]) + Convert.ToInt32(array[13])) % 10;
                     int    num6          = (Convert.ToInt32(array[14]) + Convert.ToInt32(array[15]) + Convert.ToInt32(array[16]) + Convert.ToInt32(array[17]) + Convert.ToInt32(array[18]) + Convert.ToInt32(array[19])) % 10;
                     string lotteryNumber = string.Concat(new object[]
                     {
                         num4,
                         ",",
                         num5,
                         ",",
                         num6
                     });
                     for (int i = 0; i < dataTable.Rows.Count; i++)
                     {
                         DataRow dataRow = dataTable.Rows[i];
                         int     num7    = Convert.ToInt32(dataRow["Id"]);
                         int     num8    = Convert.ToInt32(dataRow["UserId"]);
                         string  sType   = dataRow["PlayCode"].ToString();
                         string  text    = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(dataRow["STime2"]).ToString("yyyyMMdd"), num8.ToString(), num7.ToString());
                         if (string.IsNullOrEmpty(text))
                         {
                             text = "";
                         }
                         string  pos = dataRow["Pos"].ToString();
                         decimal d2  = Convert.ToDecimal(dataRow["SingleMoney"]);
                         decimal d3  = Convert.ToDecimal(dataRow["Bonus"]);
                         decimal d4  = Convert.ToDecimal(dataRow["PointMoney"]);
                         decimal d5  = Convert.ToDecimal(dataRow["Times"]);
                         decimal d6  = Convert.ToDecimal(dataRow["Total"]);
                         d += d6 * d5;
                         int value = CheckPlay.Check(lotteryNumber, text, pos, sType);
                         num3 += d3 * d5 * d2 * value / 2m + d4 * d5;
                     }
                     decimal num9 = d - num3;
                     if (num9 > 0m)
                     {
                         num2 = num;
                     }
                     list.Add(new KeyValue
                     {
                         tKey   = string.Join(",", array),
                         tValue = num9
                     });
                     num2++;
                 }while (num2 < num);
                 IOrderedEnumerable <KeyValue> source = from a in list
                                                        orderby a.tValue descending
                                                        select a;
                 List <KeyValue> list2 = source.ToList <KeyValue>();
                 GYoule3dCheck.SetOpenListJson(LotteryId, IssueNum, list2[0].tKey, DateTime.Now.ToString(), string.Concat(list2[0].tValue));
             }
             else
             {
                 string[] value2 = NumberCode.CreateCode20();
                 GYoule3dCheck.SetOpenListJson(LotteryId, IssueNum, string.Join(",", value2), DateTime.Now.ToString(), "0");
             }
         }
         else
         {
             string[] value3 = NumberCode.CreateCode20();
             GYoule3dCheck.SetOpenListJson(LotteryId, IssueNum, string.Join(",", value3), DateTime.Now.ToString(), "0");
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("派奖异常", ex.Message);
     }
 }
Esempio n. 8
0
 private static void Run(int LotteryId, string IssueNum)
 {
     try
     {
         YouleCheck.list.Clear();
         DataTable dataTable = LotteryDAL.GetDataTable(LotteryId.ToString(), IssueNum);
         if (dataTable.Rows.Count > 0)
         {
             DataTable lotteryCheck = LotteryDAL.GetLotteryCheck(LotteryId);
             decimal   curRealGet   = LotteryDAL.GetCurRealGet(LotteryId);
             if (curRealGet < Convert.ToDecimal(lotteryCheck.Rows[0]["CheckPer"]))
             {
                 int      num   = Convert.ToInt32(lotteryCheck.Rows[0]["CheckNum"]);
                 string[] array = new string[20];
                 int      num2  = 0;
                 do
                 {
                     decimal d    = 0m;
                     decimal num3 = 0m;
                     array = NumberCode.CreateCode20();
                     int    num4 = (Convert.ToInt32(array[0]) + Convert.ToInt32(array[1]) + Convert.ToInt32(array[2]) + Convert.ToInt32(array[3])) % 10;
                     int    num5 = (Convert.ToInt32(array[4]) + Convert.ToInt32(array[5]) + Convert.ToInt32(array[6]) + Convert.ToInt32(array[7])) % 10;
                     int    num6 = (Convert.ToInt32(array[8]) + Convert.ToInt32(array[9]) + Convert.ToInt32(array[10]) + Convert.ToInt32(array[11])) % 10;
                     int    num7 = (Convert.ToInt32(array[12]) + Convert.ToInt32(array[13]) + Convert.ToInt32(array[14]) + Convert.ToInt32(array[15])) % 10;
                     int    num8 = (Convert.ToInt32(array[16]) + Convert.ToInt32(array[17]) + Convert.ToInt32(array[18]) + Convert.ToInt32(array[19])) % 10;
                     string text = string.Concat(new object[]
                     {
                         num4,
                         ",",
                         num5,
                         ",",
                         num6,
                         ",",
                         num7,
                         ",",
                         num8
                     });
                     for (int i = 0; i < dataTable.Rows.Count; i++)
                     {
                         DataRow dataRow = dataTable.Rows[i];
                         int     num9    = Convert.ToInt32(dataRow["Id"]);
                         int     num10   = Convert.ToInt32(dataRow["UserId"]);
                         string  sType   = dataRow["PlayCode"].ToString();
                         string  text2   = BetDetailDAL.GetBetDetail2(Convert.ToDateTime(dataRow["STime2"]).ToString("yyyyMMdd"), num10.ToString(), num9.ToString());
                         if (string.IsNullOrEmpty(text2))
                         {
                             text2 = "";
                         }
                         string  pos = dataRow["Pos"].ToString();
                         decimal d2  = Convert.ToDecimal(dataRow["SingleMoney"]);
                         decimal d3  = Convert.ToDecimal(dataRow["Bonus"]);
                         decimal d4  = Convert.ToDecimal(dataRow["PointMoney"]);
                         decimal d5  = Convert.ToDecimal(dataRow["Times"]);
                         decimal d6  = Convert.ToDecimal(dataRow["Total"]);
                         d += d6 * d5;
                         int value = CheckPlay.Check(text, text2, pos, sType);
                         num3 += d3 * d5 * d2 * value / 2m + d4;
                     }
                     decimal num11 = d - num3;
                     if (num11 > 0m)
                     {
                         num2 = num;
                     }
                     KeyValue keyValue = new KeyValue();
                     keyValue.tKey   = text;
                     keyValue.tValue = num11;
                     YouleCheck.list.Add(keyValue);
                     num2++;
                 }while (num2 < num);
                 IOrderedEnumerable <KeyValue> source = from a in YouleCheck.list
                                                        orderby a.tValue descending
                                                        select a;
                 List <KeyValue> list = source.ToList <KeyValue>();
                 if (!new LotteryDataDAL().Exists(LotteryId, IssueNum))
                 {
                     new LotteryDataDAL().AddYoule(LotteryId, IssueNum, list[0].tKey, DateTime.Now.ToString(), string.Join(",", array));
                     LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, list[0].tKey);
                     YouleCheck.SetOpenListJson(LotteryId);
                 }
             }
             else
             {
                 string[] array2 = NumberCode.CreateCode20();
                 int      num12  = (Convert.ToInt32(array2[0]) + Convert.ToInt32(array2[1]) + Convert.ToInt32(array2[2]) + Convert.ToInt32(array2[3])) % 10;
                 int      num13  = (Convert.ToInt32(array2[4]) + Convert.ToInt32(array2[5]) + Convert.ToInt32(array2[6]) + Convert.ToInt32(array2[7])) % 10;
                 int      num14  = (Convert.ToInt32(array2[8]) + Convert.ToInt32(array2[9]) + Convert.ToInt32(array2[10]) + Convert.ToInt32(array2[11])) % 10;
                 int      num15  = (Convert.ToInt32(array2[12]) + Convert.ToInt32(array2[13]) + Convert.ToInt32(array2[14]) + Convert.ToInt32(array2[15])) % 10;
                 int      num16  = (Convert.ToInt32(array2[16]) + Convert.ToInt32(array2[17]) + Convert.ToInt32(array2[18]) + Convert.ToInt32(array2[19])) % 10;
                 string   number = string.Concat(new object[]
                 {
                     num12,
                     ",",
                     num13,
                     ",",
                     num14,
                     ",",
                     num15,
                     ",",
                     num16
                 });
                 if (!new LotteryDataDAL().Exists(LotteryId, IssueNum))
                 {
                     new LotteryDataDAL().AddYoule(LotteryId, IssueNum, number, DateTime.Now.ToString(), string.Join(",", array2));
                     LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, number);
                     YouleCheck.SetOpenListJson(LotteryId);
                 }
             }
         }
         else
         {
             string[] array3  = NumberCode.CreateCode20();
             int      num17   = (Convert.ToInt32(array3[0]) + Convert.ToInt32(array3[1]) + Convert.ToInt32(array3[2]) + Convert.ToInt32(array3[3])) % 10;
             int      num18   = (Convert.ToInt32(array3[4]) + Convert.ToInt32(array3[5]) + Convert.ToInt32(array3[6]) + Convert.ToInt32(array3[7])) % 10;
             int      num19   = (Convert.ToInt32(array3[8]) + Convert.ToInt32(array3[9]) + Convert.ToInt32(array3[10]) + Convert.ToInt32(array3[11])) % 10;
             int      num20   = (Convert.ToInt32(array3[12]) + Convert.ToInt32(array3[13]) + Convert.ToInt32(array3[14]) + Convert.ToInt32(array3[15])) % 10;
             int      num21   = (Convert.ToInt32(array3[16]) + Convert.ToInt32(array3[17]) + Convert.ToInt32(array3[18]) + Convert.ToInt32(array3[19])) % 10;
             string   number2 = string.Concat(new object[]
             {
                 num17,
                 ",",
                 num18,
                 ",",
                 num19,
                 ",",
                 num20,
                 ",",
                 num21
             });
             if (!new LotteryDataDAL().Exists(LotteryId, IssueNum))
             {
                 new LotteryDataDAL().AddYoule(LotteryId, IssueNum, number2, DateTime.Now.ToString(), string.Join(",", array3));
                 LotteryCheck.RunYouleOfIssueNum(LotteryId, IssueNum, number2);
                 YouleCheck.SetOpenListJson(LotteryId);
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("派奖异常", ex.Message);
     }
 }