コード例 #1
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var wins  = checker.WinNumbers.Skip(TotalNumber - BallNumber).ToArray();
            var isWin = false;

            if ((AnteCodeNumbers[0].Contains(wins[0]) && AnteCodeNumbers[1].Contains(wins[1])) ||
                (AnteCodeNumbers[1].Contains(wins[0]) && AnteCodeNumbers[0].Contains(wins[1])))
            {
                isWin = true;
            }
            var bonusLevelList = new List <int>();

            if (isWin)
            {
                bonusLevelList.Add(0);
            }
            return(bonusLevelList);
        }
コード例 #2
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var bonusLevelList = new List <int>();
            var wins           = checker.WinNumbers.Skip(TotalNumber - BallNumber).ToArray();
            var groupWin       = wins.GroupBy(a => a);

            if (groupWin.Count() == wins.Length)
            {
                if (IsWin(wins, AnteCodeNumbers))
                {
                    bonusLevelList.Add(0);
                }
            }
            return(bonusLevelList);
        }
コード例 #3
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            AnalyzeAnteCode(antecode);

            string msg;
            var    checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            List <string[]> rlt = new List <string[]>();

            for (var i = 0; i < AnteCodeNumbers.Length; i++)
            {
                rlt.Add(AnteCodeNumbers[i].Split(' '));
            }
            var bonusLevelList = new List <int>();
            var c = new ArrayCombination();

            c.Calculate(rlt.ToArray(), (item) =>
            {
                if (item.Distinct().Count() == BallNumber)
                {
                    if (IsWin(item, checker.WinNumbers))
                    {
                        bonusLevelList.Add(0);
                    }
                }
            });
            return(bonusLevelList);
        }
コード例 #4
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var bonusLevelList = new List <int>();

            if (IsRed)    // 选一红投
            {
                var win = int.Parse(checker.WinNumbers[0]);
                if (win >= MinNumber && win <= MaxNumber)
                {
                    bonusLevelList.Add(0);
                }
            }
            else    // 选一数投
            {
                if (AnteCodeNumbers.Contains(checker.WinNumbers[0]))
                {
                    bonusLevelList.Add(0);
                }
            }
            return(bonusLevelList);
        }
コード例 #5
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }

            var bonusLevelList = new List <int>();

            switch (GameType)
            {
            case "2BTH":
                new Combination().Calculate(AnteCodeNumbers, 2, (a) =>
                {
                    if (checker.WinNumbers.Contains(a[0]) && checker.WinNumbers.Contains(a[1]))
                    {
                        bonusLevelList.Add(0);
                    }
                });
                break;

            case "2BTHDT":
                antecode = antecode.Replace("|", "#");
                var array = antecode.Split('#');
                if (array.Length != 2)
                {
                    throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - 胆拖应是以#分隔的两部分");
                }
                var a1 = array[0].Split(',');
                if (a1.Length != 1)
                {
                    throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - 以#分隔的第一部分必须为一位数字");
                }

                var a11 = a1[0];
                var a2  = array[1].Split(',');
                foreach (var item in a2)
                {
                    if (checker.WinNumbers.Contains(a11) && checker.WinNumbers.Contains(item))
                    {
                        bonusLevelList.Add(0);
                    }
                }

                break;

            default:
                break;
            }

            return(bonusLevelList);
        }
コード例 #6
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var bonusLevelList = new List <int>();

            switch (GameType)
            {
            case "T14C":
                CaculateBonus_14C(checker, bonusLevelList);
                break;

            case "TR9":
                CaculateBonus_R9(checker, bonusLevelList);
                break;

            default:
                CaculateBonus(checker, bonusLevelList);
                break;
            }
            return(bonusLevelList);
        }
コード例 #7
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var wins   = checker.WinNumbers.Skip(TotalNumber - BallNumber).ToArray();
            var sum    = int.Parse(antecode);
            int target = 0;

            foreach (var num in wins)
            {
                target += int.Parse(num);
            }
            var bonusLevelList = new List <int>();

            if (target == sum)
            {
                bonusLevelList.Add(GetBonusGrade(wins));
            }
            return(bonusLevelList);
        }
コード例 #8
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var bonusLevelList = new List <int>();

            // 判断大小单双
            string[] s_10 = GetCodeStatus(checker.WinNumbers[3]);
            string[] s_01 = GetCodeStatus(checker.WinNumbers[4]);
            if (s_10.Contains(AnteCodeNumbers[0]) && s_01.Contains(AnteCodeNumbers[1]))
            {
                bonusLevelList.Add(0);
            }
            return(bonusLevelList);
        }
コード例 #9
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var isWin = true;

            for (int i = 0; i < BallNumber; i++)
            {
                if (!AnteCodeNumbers.Contains(checker.WinNumbers[i]))
                {
                    isWin = false;
                    break;
                }
            }
            var bonusLevelList = new List <int>();

            if (isWin)
            {
                bonusLevelList.Add(0);
            }
            return(bonusLevelList);
        }
コード例 #10
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            // 江西时时彩四星单选特殊处理奖等
            if (GameCode == "JXSSC" && BallNumber == 4)
            {
                return(Caculate_JXSSC_4XDX(AnteCodeNumbers, checker.WinNumbers));
            }
            else
            {
                var bonusLevelList = new List <int>();
                for (var i = TotalNumber - BallNumber; i < TotalNumber; i++)
                {
                    if (!AnteCodeNumbers[i].Contains(checker.WinNumbers[i]))
                    {
                        return(bonusLevelList);
                    }
                }
                bonusLevelList.Add(0);
                return(bonusLevelList);
            }
        }
コード例 #11
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var bonusLevelList = new List <int>();
            var sum            = int.Parse(antecode);
            int target         = 0;

            for (int i = 1; i <= BallNumber; i++)
            {
                target += int.Parse(checker.WinNumbers[TotalNumber - i]);
            }
            if (target == sum)
            {
                bonusLevelList.Add(0);
            }
            return(bonusLevelList);
        }
コード例 #12
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }

            var f_number    = AnteCodeNumbers.Select(p => int.Parse(p)).ToArray();
            var f_winNumber = checker.WinNumbers.Select(p => int.Parse(p.Substring(1))).Distinct().ToArray();

            var bonusLevelList = new List <int>();

            //var c = new Combination();
            //c.Calculate(f_number, BallNumber, (n) =>
            //{
            //    var hitCount = GetHitCount(f_winNumber, n);
            //    if (hitCount == f_winNumber.Length)
            //        bonusLevelList.Add(0);
            //});

            //return bonusLevelList;

            if (BallNumber <= TotalNumber)     // 任选的数量小于等于总号码数。如:任选一、任选二、任选三
            {
                var p = new Combination();
                p.Calculate(f_number, BallNumber, (n) =>
                {
                    var hitCount = GetHitCount(f_winNumber, n);
                    if (hitCount == BallNumber)
                    {
                        bonusLevelList.Add(0);
                    }
                });

                return(bonusLevelList);
            }
            else    // 任选的数量大于等于总号码数。如:任选四、任选五、任选六
            {
                var p = new Combination();
                p.Calculate(f_number, BallNumber, (n) =>
                {
                    var hitCount = GetHitCount(f_winNumber, n);
                    if (hitCount == f_winNumber.Length)
                    {
                        bonusLevelList.Add(0);
                    }
                });

                return(bonusLevelList);
            }
            //return bonusLevelList;
        }
コード例 #13
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var bonusLevelList = new List <int>();

            if (BallNumber == 1)    // 任选一,定位到中奖号码的第一位进行比较
            {
                if (AnteCodeNumbers.Contains(checker.WinNumbers[0]))
                {
                    bonusLevelList.Add(0);
                }
            }
            else if (BallNumber <= TotalNumber)     // 任选的数量小于等于总号码数。如:任选四、任选五
            {
                var p = new Combination();
                p.Calculate(AnteCodeNumbers, BallNumber, (num) =>
                {
                    if (IsWin_Less(checker.WinNumbers, num))
                    {
                        bonusLevelList.Add(0);
                    }
                });
            }
            else    // 任选的数量大于等于总号码数。如:任选七
            {
                var winTime = 0;
                foreach (var item in checker.WinNumbers)
                {
                    if (AnteCodeNumbers.Contains(item))
                    {
                        winTime++;
                    }
                }
                if (winTime == TotalNumber)
                {
                    var p = new Combination();
                    p.Calculate(AnteCodeNumbers.Take(AnteCodeNumbers.Length - 5).ToArray(), BallNumber - 5, (item) =>
                    {
                        bonusLevelList.Add(0);
                    });
                }
            }
            return(bonusLevelList);
        }
コード例 #14
0
        public void ImportWinNumber(string issuseNumber, string winNumber)
        {
            if (string.IsNullOrEmpty(issuseNumber))
            {
                return;
            }
            if (string.IsNullOrEmpty(winNumber))
            {
                return;
            }


            var msg = string.Empty;

            AnalyzerFactory.GetWinNumberAnalyzer(this.CurrentGameCode).CheckWinNumber(winNumber, out msg);
            if (!string.IsNullOrEmpty(msg))
            {
                throw new Exception(msg);
            }

            //开启事务
            using (LottertDataDB)
            {
                LottertDataDB.Begin();

                this.ClearGameChartCache("QueryDLT_JiBenZouSi_Info");
                this.ClearGameChartCache("QueryDLT_DX_Info");
                this.ClearGameChartCache("QueryDLT_JiOu_Info");
                this.ClearGameChartCache("QueryDLT_ZhiHe_Info");
                this.ClearGameChartCache("QueryDLT_HeZhi_Info");
                this.ClearGameChartCache("QueryDLT_Chu3_Info");
                this.ClearGameChartCache("QueryDLT_KuaDu_SW_Info");
                this.ClearGameChartCache("QueryDLT_KuaDu_12_Info");
                this.ClearGameChartCache("QueryDLT_KuaDu_23_Info");
                this.ClearGameChartCache("QueryDLT_KuaDu_34_Info");
                this.ClearGameChartCache("QueryDLT_KuaDu_45_Info");
                this.ClearNewWinNumberCache("QueryDLT_GameWinNumber");

                Import_JBZS(issuseNumber, winNumber);
                Import_DX(issuseNumber, winNumber);
                Import_JiOu(issuseNumber, winNumber);
                Import_ZhiHe(issuseNumber, winNumber);
                Import_DLT_HeZhi(issuseNumber, winNumber);
                Import_DLT_Chu3(issuseNumber, winNumber);
                Import_DLT_KuaDu_SW(issuseNumber, winNumber);
                Import_DLT_KuaDu_12(issuseNumber, winNumber);
                Import_DLT_KuaDu_23(issuseNumber, winNumber);
                Import_DLT_KuaDu_34(issuseNumber, winNumber);
                Import_DLT_KuaDu_45(issuseNumber, winNumber);
                Add_GameWinNumber(issuseNumber, winNumber);

                LottertDataDB.Commit();
            }
        }
コード例 #15
0
        public void ImportWinNumber(string issuseNumber, string winNumber)
        {
            if (string.IsNullOrEmpty(issuseNumber))
            {
                return;
            }
            if (string.IsNullOrEmpty(winNumber))
            {
                return;
            }

            var msg = string.Empty;

            AnalyzerFactory.GetWinNumberAnalyzer(this.CurrentGameCode).CheckWinNumber(winNumber, out msg);
            if (!string.IsNullOrEmpty(msg))
            {
                throw new Exception(msg);
            }

            //开启事务
            using (LottertDataDB)
            {
                LottertDataDB.Begin();

                this.ClearGameChartCache("QuerySDKLPK3_JBZS_Info");
                this.ClearGameChartCache("QuerySDKLPK3_ZHXZS_Info");
                this.ClearGameChartCache("QuerySDKLPK3_HSZS_Info");
                this.ClearGameChartCache("QuerySDKLPK3_DXZS_Info");
                this.ClearGameChartCache("QuerySDKLPK3_JOZS_Info");
                this.ClearGameChartCache("QuerySDKLPK3_ZHZS_Info");
                this.ClearGameChartCache("QuerySDKLPK3_C3YZS_Info");
                this.ClearGameChartCache("QuerySDKLPK3_HZZS_Info");
                this.ClearGameChartCache("QuerySDKLPK3_LXZS_Info");
                this.ClearNewWinNumberCache("QuerySDKLPK3_GameWinNumber");

                Import_JBZS(issuseNumber, winNumber);
                Import_ZHXZS(issuseNumber, winNumber);
                Import_HSZS(issuseNumber, winNumber);
                Import_DXZS(issuseNumber, winNumber);
                Import_JOZS(issuseNumber, winNumber);
                Import_ZHZS(issuseNumber, winNumber);
                Import_C3YZS(issuseNumber, winNumber);
                Import_HZZS(issuseNumber, winNumber);
                Import_LXZS(issuseNumber, winNumber);
                Add_GameWinNumber(issuseNumber, winNumber);

                LottertDataDB.Commit();
            }
        }
コード例 #16
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var bonusLevelList = new List <int>();

            bool[] matchArr = new bool[5];
            for (int i = 0; i < 5; i++)
            {
                matchArr[i] = AnteCodeNumbers[i] == checker.WinNumbers[i];
            }
            if (matchArr[0] && matchArr[1] && matchArr[2] && matchArr[3] && matchArr[4])
            {
                // 全中
                bonusLevelList.Add(1);
            }
            if (matchArr[0] && matchArr[1] && matchArr[2])
            {
                // 前三
                bonusLevelList.Add(2);
            }
            if (matchArr[2] && matchArr[3] && matchArr[4])
            {
                // 后三
                bonusLevelList.Add(2);
            }
            if (matchArr[0] && matchArr[1])
            {
                // 前二
                bonusLevelList.Add(3);
            }
            if (matchArr[3] && matchArr[4])
            {
                // 后二
                bonusLevelList.Add(3);
            }
            return(bonusLevelList);
        }
コード例 #17
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            winNumber = string.Join(string.Empty, checker.WinNumbers);
            var bonusLevelList = new List <int>();

            switch (GameType)
            {
            case "3THDX":
                if (winNumber == antecode)
                {
                    bonusLevelList.Add(0);
                }
                break;

            case "3THTX":
                var thdx = new string[] { "111", "222", "333", "444", "555", "666" };
                if (thdx.Contains(winNumber))
                {
                    bonusLevelList.Add(0);
                }
                break;

            case "3LHTX":
                if (int.Parse(checker.WinNumbers[2]) - int.Parse(checker.WinNumbers[1]) == 1 && int.Parse(checker.WinNumbers[1]) - int.Parse(checker.WinNumbers[0]) == 1)
                {
                    bonusLevelList.Add(0);
                }
                break;

            default:
                break;
            }

            return(bonusLevelList);
        }
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var bonusLevelList = new List <int>();

            switch (GameType)
            {
            case "2THFX":
                foreach (var item in antecode.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
                {
                    var one = item.Substring(0, 1);
                    if (checker.WinNumbers.Count(c => c == one) >= 2)
                    {
                        bonusLevelList.Add(0);
                        break;
                    }
                }
                break;

            case "2THDX":
                var array = antecode.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var array1 in array[0].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
                {
                    foreach (var array2 in array[1].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        if (checker.WinNumbers.Count(c => c == array1.Substring(0, 1)) == 2 &&
                            checker.WinNumbers.Count(c => c == array2) == 1)
                        {
                            bonusLevelList.Add(0);
                        }
                    }
                }
                break;
            }
            return(bonusLevelList);
        }
コード例 #19
0
        public void ImportWinNumber(string issuseNumber, string winNumber)
        {
            if (string.IsNullOrEmpty(issuseNumber))
            {
                return;
            }
            if (string.IsNullOrEmpty(winNumber))
            {
                return;
            }

            var msg = string.Empty;

            AnalyzerFactory.GetWinNumberAnalyzer(this.CurrentGameCode).CheckWinNumber(winNumber, out msg);
            if (!string.IsNullOrEmpty(msg))
            {
                throw new Exception(msg);
            }

            //开启事务
            using (LottertDataDB)
            {
                LottertDataDB.Begin();

                this.ClearGameChartCache("QuerySDQYH_RXJO_Info");
                this.ClearGameChartCache("QuerySDQYH_RXZH_Info");
                this.ClearGameChartCache("QuerySDQYH_RXDX_Info");
                this.ClearGameChartCache("QuerySDQYH_Chu3_Info");
                this.ClearGameChartCache("QuerySDQYH_SX1_Info");
                this.ClearGameChartCache("QuerySDQYH_SX2_Info");
                this.ClearGameChartCache("QuerySDQYH_SX3_Info");
                this.ClearNewWinNumberCache("QuerySDQYH_GameWinNumber");

                Import_RXJO(issuseNumber, winNumber);
                Import_RXZH(issuseNumber, winNumber);
                Import_RXDX(issuseNumber, winNumber);
                Import_RXChu3(issuseNumber, winNumber);
                Import_SX1(issuseNumber, winNumber);
                Import_SX2(issuseNumber, winNumber);
                Import_SX3(issuseNumber, winNumber);
                Add_GameWinNumber(issuseNumber, winNumber);

                LottertDataDB.Commit();
            }
        }
コード例 #20
0
        public void ImportWinNumber(string issuseNumber, string winNumber)
        {
            if (string.IsNullOrEmpty(issuseNumber))
            {
                return;
            }
            if (string.IsNullOrEmpty(winNumber))
            {
                return;
            }

            var msg = string.Empty;

            AnalyzerFactory.GetWinNumberAnalyzer(this.CurrentGameCode).CheckWinNumber(winNumber, out msg);
            if (!string.IsNullOrEmpty(msg))
            {
                throw new Exception(msg);
            }

            //开启事务
            using (LottertDataDB)
            {
                LottertDataDB.Begin();

                this.ClearGameChartCache("QueryPL5_JBZS");
                this.ClearGameChartCache("QueryPL5_DX");
                this.ClearGameChartCache("QueryPL5_JO");
                this.ClearGameChartCache("QueryPL5_ZH");
                this.ClearGameChartCache("QueryPL5_Chu3");
                this.ClearGameChartCache("QueryPL5_HZ");
                this.ClearNewWinNumberCache("QueryPL5_GameWinNumber");

                Import_JBZS(issuseNumber, winNumber);
                Import_DX(issuseNumber, winNumber);
                Import_JO(issuseNumber, winNumber);
                Import_ZH(issuseNumber, winNumber);
                Import_Chu3(issuseNumber, winNumber);
                Import_HZ(issuseNumber, winNumber);
                Add_GameWinNumber(issuseNumber, winNumber);

                LottertDataDB.Commit();
            }
        }
コード例 #21
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var wins  = checker.WinNumbers.Skip(TotalNumber - BallNumber).ToArray();
            var isWin = true;
            // 分组,以去除号码中的重复项
            var group = wins.GroupBy(c => c);

            if (group.Count() != wins.Length)
            {
                isWin = false;
            }
            else
            {
                foreach (var code in wins)
                {
                    if (!AnteCodeNumbers.Contains(code))
                    {
                        isWin = false;
                        break;
                    }
                }
            }
            var bonusLevelList = new List <int>();

            if (isWin)
            {
                bonusLevelList.Add(0);
            }
            return(bonusLevelList);
        }
コード例 #22
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var  tmp   = checker.WinNumbers.Skip(TotalNumber - BallNumber).ToArray();
            var  wins  = new List <string>(tmp);
            var  codes = AnteCodeNumbers.ToList();
            bool isWin = true;

            for (int i = codes.Count - 1; i >= 0; i--)
            {
                var index = wins.IndexOf(codes[i]);
                if (index < 0)
                {
                    isWin = false;
                    break;
                }
                else
                {
                    wins.RemoveAt(index);
                    codes.RemoveAt(i);
                    //i -= codes.RemoveAll((item) => item.Equals(codes[i]));
                }
            }
            var bonusLevelList = new List <int>();

            if (isWin)
            {
                bonusLevelList.Add(GetBonusGrade(tmp));
            }
            return(bonusLevelList);
        }
コード例 #23
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var bonusLevelList = new List <int>();

            if (IsLast)    // 直选好运特  任意选择1个数字竞猜开奖号码的最后一位(后一),投注号码与开奖号码最后一位相同即中奖
            {
                if (AnteCodeNumbers.Contains(checker.WinNumbers.Last()))
                {
                    bonusLevelList.Add(0);
                }
            }
            else if (BallNumber <= TotalNumber)     // 任选的数量小于等于总号码数。如:任选四、任选五
            {
                var p = new Combination();
                p.Calculate(AnteCodeNumbers, BallNumber, (num) =>
                {
                    if (IsWin_Less(checker.WinNumbers, num))
                    {
                        bonusLevelList.Add(0);
                    }
                });
            }
            else
            {
                throw new ArgumentOutOfRangeException("直选好运不支持的玩法 - 选" + BallNumber);
            }
            return(bonusLevelList.OrderBy((i) => i).ToList());
        }
コード例 #24
0
        /// <summary>
        /// 获取中奖注数
        /// </summary>
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            //验证格式
            string msg;
            var    checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }

            //计算中奖等级
            var bonusLevelList = new List <int>();
            var anteCodeArray  = antecode.ToUpper().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var code in anteCodeArray)
            {
                if (!CheckAntecode(code, out msg))
                {
                    throw new AntecodeFormatException(GameCode, GameType, code, "投注号码格式错误 - " + msg);
                }

                switch (GameType)
                {
                case "TH":
                    //同花
                    var th = GetWinNumber_TH(checker.WinNumbers);
                    if (string.IsNullOrEmpty(th))
                    {
                        break;
                    }

                    //是同花状态
                    if (code == th)
                    {
                        //选中中一等奖
                        bonusLevelList.Add(1);
                        continue;
                    }
                    if (code == "THX")
                    {
                        //包选中二等奖
                        bonusLevelList.Add(2);
                        continue;
                    }
                    break;

                case "SZ":
                    //顺子
                    var sz = GetWinNumber_SZ(checker.WinNumbers);
                    if (string.IsNullOrEmpty(sz))
                    {
                        break;
                    }

                    //是顺子状态
                    if (code == sz)
                    {
                        //选中中一等奖
                        bonusLevelList.Add(1);
                        continue;
                    }
                    if (code == "SZX")
                    {
                        //包选中二等奖
                        bonusLevelList.Add(2);
                        continue;
                    }
                    break;

                case "THS":
                    //同花顺
                    var ths = GetWinNumber_THS(checker.WinNumbers);
                    if (string.IsNullOrEmpty(ths))
                    {
                        break;
                    }

                    //是同花顺状态
                    if (code == ths)
                    {
                        //选中中一等奖
                        bonusLevelList.Add(1);
                        continue;
                    }
                    if (code == "THSX")
                    {
                        //包选中二等奖
                        bonusLevelList.Add(2);
                        continue;
                    }
                    break;

                case "DZ":
                    //对子
                    var dz = GetWinNumber_DZ(checker.WinNumbers);
                    if (string.IsNullOrEmpty(dz))
                    {
                        break;
                    }

                    //是对子状态
                    if (code == dz)
                    {
                        //选中中一等奖
                        bonusLevelList.Add(1);
                        continue;
                    }
                    if (code == "DZX")
                    {
                        //包选中二等奖
                        bonusLevelList.Add(2);
                        continue;
                    }
                    break;

                case "BZ":
                    //豹子
                    var bz = GetWinNumber_BZ(checker.WinNumbers);
                    if (string.IsNullOrEmpty(bz))
                    {
                        break;
                    }

                    //是豹子状态
                    if (code == bz)
                    {
                        //选中中一等奖
                        bonusLevelList.Add(1);
                        continue;
                    }
                    if (code == "BZX")
                    {
                        //包选中二等奖
                        bonusLevelList.Add(2);
                        continue;
                    }
                    break;

                default:
                    break;
                }
            }

            return(bonusLevelList);
        }
コード例 #25
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var bonusLevelList = new List <int>();

            if (BallNumber == 3)
            {
                var p = new Combination();
                p.Calculate(AnteCodeNumbers, BallNumber, (num) =>
                {
                    if (IsWin_Less(checker.WinNumbers, num))
                    {
                        bonusLevelList.Add(1);
                    }
                    else
                    {
                        p.Calculate(num, BallNumber - 1, (item) =>
                        {
                            if (IsWin_Less(checker.WinNumbers, item))
                            {
                                bonusLevelList.Add(2);
                                return(false);
                            }
                            return(true);
                        });
                    }
                });
            }
            else if (BallNumber == 4 || BallNumber == 5)
            {
                var p = new Combination();
                p.Calculate(AnteCodeNumbers, BallNumber, (num) =>
                {
                    if (IsWin_Less(checker.WinNumbers, num))
                    {
                        bonusLevelList.Add(1);
                    }
                    else
                    {
                        var isWin = false;
                        p.Calculate(num, BallNumber - 1, (item) =>
                        {
                            if (IsWin_Less(checker.WinNumbers, item))
                            {
                                isWin = true;
                                bonusLevelList.Add(2);
                                return(false);
                            }
                            return(true);
                        });
                        if (!isWin)
                        {
                            p.Calculate(num, BallNumber - 2, (item) =>
                            {
                                if (IsWin_Less(checker.WinNumbers, item))
                                {
                                    bonusLevelList.Add(3);
                                    return(false);
                                }
                                return(true);
                            });
                        }
                    }
                });
            }
            else
            {
                throw new ArgumentOutOfRangeException("通选好运不支持的玩法 - 选" + BallNumber);
            }
            return(bonusLevelList.OrderBy((i) => i).ToList());
        }
コード例 #26
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var bonusLevelList = new List <int>();
            var sum            = int.Parse(antecode);
            int target         = 0;

            for (int i = 1; i <= BallNumber; i++)
            {
                target += int.Parse(checker.WinNumbers[TotalNumber - i]);
            }
            if (target == sum)
            {
                switch (sum)
                {
                case 3:
                case 18:
                    bonusLevelList.Add(1);
                    break;

                case 4:
                case 17:
                    bonusLevelList.Add(2);
                    break;

                case 5:
                case 16:
                    bonusLevelList.Add(3);
                    break;

                case 6:
                case 15:
                    bonusLevelList.Add(4);
                    break;

                case 7:
                case 14:
                    bonusLevelList.Add(5);
                    break;

                case 8:
                case 13:
                    bonusLevelList.Add(6);
                    break;

                case 9:
                case 12:
                    bonusLevelList.Add(7);
                    break;

                case 10:
                case 11:
                    bonusLevelList.Add(8);
                    break;
                }
            }
            return(bonusLevelList);
        }
コード例 #27
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }

            var bonusLevelList = new List <int>();

            if (checker.WinNumbers.Distinct().Count() != checker.WinNumbers.Length)
            {
                return(bonusLevelList);
            }
            switch (GameType)
            {
            case "3BTH":
                new Combination().Calculate(AnteCodeNumbers, 3, (a) =>
                {
                    var t = a.OrderBy(f => f);
                    if (string.Join(",", t.ToArray()) == winNumber)
                    {
                        bonusLevelList.Add(0);
                        return(false);
                    }
                    return(true);
                });
                break;

            case "3BTHDT":
                antecode = antecode.Replace("|", "#");
                var array = antecode.Split('#');
                if (array.Length != 2)
                {
                    throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - 胆拖应是以#分隔的两部分");
                }
                var a1 = array[0].Split(',');
                var a2 = array[1].Split(',');
                if (a1.Length == 2)
                {
                    var list = new List <string>();
                    foreach (var item in a1)
                    {
                        list.Add(item);
                    }
                    foreach (var item in a2)
                    {
                        var t = new List <string>();
                        t.AddRange(list);
                        t.Add(item);
                        var t1 = t.OrderBy(f => f);
                        if (string.Join(",", t1.ToArray()) == winNumber)
                        {
                            bonusLevelList.Add(0);
                        }
                    }
                }
                else if (a1.Length == 1)
                {
                    new Combination().Calculate(a2, 2, (s) =>
                    {
                        var list = new List <string>();
                        list.Add(a1[0]);
                        foreach (var item in s)
                        {
                            list.Add(item);
                        }
                        var t = list.OrderBy(f => f);
                        if (string.Join(",", t.ToArray()) == winNumber)
                        {
                            bonusLevelList.Add(0);
                            return(false);
                        }
                        return(true);
                    });
                }

                break;

            default:
                break;
            }

            return(bonusLevelList);
        }
コード例 #28
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var red_antecode   = AnteCodeNumbers[0].Split(Spliter_Level2);
            var blue_antecode  = AnteCodeNumbers[1].Split(Spliter_Level2);
            var red_winNumber  = checker.WinNumbers[0].Split(Spliter_Level2);
            var blue_winNumber = checker.WinNumbers[1].Split(Spliter_Level2);

            var list = new List <int>();
            var p    = new Combination();

            p.Calculate(red_antecode, BallNumber_First, (item_red) =>
            {
                p.Calculate(blue_antecode, BallNumber_Last, (item_blue) =>
                {
                    var redCount  = GetSameCodeCount(item_red, red_winNumber);
                    var blueCount = GetSameCodeCount(item_blue, blue_winNumber);

                    switch (GameCode)
                    {
                    case "SSQ":
                        if (redCount == 6 && blueCount == 1)
                        {
                            list.Add(1);
                        }
                        else if (redCount == 6 && blueCount == 0)
                        {
                            list.Add(2);
                        }
                        else if (redCount == 5 && blueCount == 1)
                        {
                            list.Add(3);
                        }
                        else if ((redCount == 5 && blueCount == 0) || (redCount == 4 && blueCount == 1))
                        {
                            list.Add(4);
                        }
                        else if ((redCount == 4 && blueCount == 0) || (redCount == 3 && blueCount == 1))
                        {
                            list.Add(5);
                        }
                        else if (blueCount == 1)
                        {
                            list.Add(6);
                        }
                        break;

                    case "DLT":
                        if (redCount == 5 && blueCount == 2)
                        {
                            list.Add(1);
                        }
                        else if (redCount == 5 && blueCount == 1)
                        {
                            list.Add(2);
                        }
                        else if ((redCount == 5 && blueCount == 0) || (redCount == 4 && blueCount == 2))
                        {
                            list.Add(3);
                        }
                        //else if (redCount == 4 && blueCount == 2)
                        //{
                        //    list.Add(4);
                        //}
                        else if ((redCount == 4 && blueCount == 1) || (redCount == 3 && blueCount == 2))
                        {
                            list.Add(4);
                        }
                        //else if ((redCount == 4 && blueCount == 0) || (redCount == 3 && blueCount == 2))
                        //{
                        //    list.Add(6);
                        //}
                        else if ((redCount == 4 && blueCount == 0) || (redCount == 3 && blueCount == 1) || (redCount == 2 && blueCount == 2))
                        {
                            list.Add(5);
                        }
                        else if ((redCount == 3 && blueCount == 0) || (redCount == 1 && blueCount == 2) || (redCount == 2 && blueCount == 1) || (redCount == 0 && blueCount == 2))
                        {
                            list.Add(6);
                        }
                        break;

                    default:
                        throw new ArgumentOutOfRangeException("不支持的彩种 - " + GameCode);
                    }
                });
            });
            return(list);
        }
コード例 #29
0
        public IList <int> CaculateBonus(string antecode, string winNumber)
        {
            string msg;

            if (!CheckAntecode(antecode, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, antecode, "投注号码格式错误 - " + msg);
            }
            var checker = AnalyzerFactory.GetWinNumberAnalyzer(GameCode, GameType);

            if (!checker.CheckWinNumber(winNumber, out msg))
            {
                throw new AntecodeFormatException(GameCode, GameType, winNumber, "中奖号码格式错误 - " + msg);
            }
            var red_dan = AnteCodeNumbers[0].Split(Spliter_Level2);
            var red_tuo = AnteCodeNumbers[1].Split(Spliter_Level2);

            string[] blue_dan, blue_tuo;
            if (NeedLastDan)
            {
                blue_dan = AnteCodeNumbers[2].Split(Spliter_Level2);
                blue_tuo = AnteCodeNumbers[3].Split(Spliter_Level2);
            }
            else
            {
                blue_dan = new string[0];
                blue_tuo = AnteCodeNumbers[2].Split(Spliter_Level2);
            }

            var red_winNumber  = checker.WinNumbers[0].Split(Spliter_Level2);
            var blue_winNumber = checker.WinNumbers[1].Split(Spliter_Level2);

            var list = new List <int>();
            var p    = new Combination();

            p.Calculate(red_tuo, BallNumber_First - red_dan.Length, (item_red) =>
            {
                p.Calculate(blue_tuo, BallNumber_Last - blue_dan.Length, (item_blue) =>
                {
                    var redList = new List <string>(red_dan);
                    redList.AddRange(item_red);
                    var count_red = GetSameCodeCount(redList.ToArray(), red_winNumber);

                    var blueList = new List <string>(blue_dan);
                    blueList.AddRange(item_blue);
                    var count_blue = GetSameCodeCount(blueList.ToArray(), blue_winNumber);

                    switch (GameCode)
                    {
                    case "SSQ":
                        if (count_red == 6 && count_blue == 1)
                        {
                            list.Add(1);
                        }
                        else if (count_red == 6 && count_blue == 0)
                        {
                            list.Add(2);
                        }
                        else if (count_red == 5 && count_blue == 1)
                        {
                            list.Add(3);
                        }
                        else if ((count_red == 5 && count_blue == 0) || (count_red == 4 && count_blue == 1))
                        {
                            list.Add(4);
                        }
                        else if ((count_red == 4 && count_blue == 0) || (count_red == 3 && count_blue == 1))
                        {
                            list.Add(5);
                        }
                        else if (count_blue == 1)
                        {
                            list.Add(6);
                        }
                        break;

                    case "DLT":
                        if (count_red == 5 && count_blue == 2)
                        {
                            list.Add(1);
                        }
                        else if (count_red == 5 && count_blue == 1)
                        {
                            list.Add(2);
                        }
                        else if ((count_red == 5 && count_blue == 0) || (count_red == 4 && count_blue == 2))
                        {
                            list.Add(3);
                        }
                        //else if (count_red == 4 && count_blue == 2)
                        //{
                        //    list.Add(4);
                        //}
                        else if ((count_red == 4 && count_blue == 1) || (count_red == 3 && count_blue == 2))
                        {
                            list.Add(4);
                        }
                        //else if ((count_red == 4 && count_blue == 0) || (count_red == 3 && count_blue == 2))
                        //{
                        //    list.Add(6);
                        //}
                        else if ((count_red == 4 && count_blue == 0) || (count_red == 3 && count_blue == 1) || (count_red == 2 && count_blue == 2))
                        {
                            list.Add(5);
                        }
                        else if ((count_red == 3 && count_blue == 0) || (count_red == 1 && count_blue == 2) || (count_red == 2 && count_blue == 1) || (count_red == 0 && count_blue == 2))
                        {
                            list.Add(6);
                        }
                        break;

                    default:
                        throw new ArgumentOutOfRangeException("不支持的彩种 - " + GameCode);
                    }
                });
            });
            return(list);
        }