Example #1
0
        /// <summary>
        /// 组装公共记录
        /// </summary>
        /// <param name="data"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private string AppendCommonResult(DataTable data, SCCLottery type)
        {
            List <GPCSSCHistoryLotteryViewEntity> res = new List <GPCSSCHistoryLotteryViewEntity>();

            if (data.Rows.Count > 0)
            {
                //总共球个数
                int total = type.GetEnumText().TryToInt32();

                for (int j = 0; j < data.Rows.Count; j++)
                {
                    //开奖号集合
                    List <int>    openCodeList = new List <int>();
                    StringBuilder builder      = new StringBuilder();

                    for (int i = 1; i <= total; i++)
                    {
                        int openCode = data.Rows[j]["OpenCode" + i].TryToInt32();
                        openCodeList.Add(openCode);
                    }
                    builder.Append(GetOpenCodeTemplate(type, openCodeList));

                    res.Add(new GPCSSCHistoryLotteryViewEntity
                    {
                        Term           = data.Rows[j]["Term"].ToStringEx(),
                        OpenTime       = data.Rows[j]["OpenTime"].TryToDateTimeToString("yyyy-MM-dd HH:mm:ss"),
                        NormalOpenCode = builder.ToString(),
                        Span           = LotteryUtils.GetSpan(openCodeList).ToString(),
                        SumValue       = LotteryUtils.GetSum(openCodeList, GetSumNumberCount(type)).ToString(),
                    });
                }
            }

            return(res.ToJson());
        }
Example #2
0
        /// <summary>
        /// 组装华东15选记录
        /// </summary>
        /// <param name="data"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private string AppendHD15X5Result(DataTable data, SCCLottery type)
        {
            List <DFCHD15X5HistoryLotteryViewEntity> res = new List <DFCHD15X5HistoryLotteryViewEntity>();

            if (data.Rows.Count > 0)
            {
                //总共球个数
                int total = type.GetEnumText().TryToInt32();

                for (int j = 0; j < data.Rows.Count; j++)
                {
                    //开奖号集合
                    List <int>    openCodeList    = new List <int>();
                    List <string> openCodeListStr = new List <string>();
                    StringBuilder builder         = new StringBuilder();

                    for (int i = 1; i <= total; i++)
                    {
                        int openCode = data.Rows[j]["OpenCode" + i].TryToInt32();
                        openCodeList.Add(openCode);
                        openCodeListStr.Add(openCode.ToString());
                    }
                    builder.Append(GetOpenCodeTemplate(type, openCodeList));

                    string ac;
                    try
                    {
                        ac = LotteryUtils.GetAC(openCodeListStr.ToArray()).ToString();
                    }
                    catch (Exception)
                    {
                        ac = "";
                    }

                    res.Add(new DFCHD15X5HistoryLotteryViewEntity
                    {
                        Term           = data.Rows[j]["Term"].ToStringEx(),
                        OpenTime       = data.Rows[j]["OpenTime"].TryToDateTimeToString("yyyy-MM-dd"),
                        NormalOpenCode = builder.ToString(),
                        Parity         = LotteryUtils.GetJOString(openCodeList, "双", "单"),
                        TheSum         = LotteryUtils.GetTheSum(openCodeList, GetSizeRatioSplitNumber(type), GetSumNumberCount(type)),
                        Size           = LotteryUtils.GetDXString(openCodeList, 5),
                        ThreeZoneRatio = LotteryUtils.Hd15x5SanQu(openCodeList),
                        SizeRatio      = LotteryUtils.GetProportionOfDX(openCodeList, 6),
                        ParityRatio    = LotteryUtils.GetProportionOfJO(openCodeList),
                        RatioOf012     = LotteryUtils.GetProportionOf012(openCodeList),
                        Span           = LotteryUtils.GetSpan(openCodeList).ToString(),
                        AC             = ac
                    });
                }
            }

            return(res.ToJson());
        }
Example #3
0
        /// <summary>
        /// 组装公共记录
        /// </summary>
        /// <param name="data"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private string AppendCommonResult(DataTable data, SCCLottery type)
        {
            List <GPC11X5HistoryLotteryViewEntity> res = new List <GPC11X5HistoryLotteryViewEntity>();

            if (data.Rows.Count > 0)
            {
                //总共球个数
                int total = type.GetEnumText().TryToInt32();

                for (int j = 0; j < data.Rows.Count; j++)
                {
                    //开奖号集合
                    List <int>    openCodeList = new List <int>();
                    StringBuilder builder      = new StringBuilder();

                    for (int i = 1; i <= total; i++)
                    {
                        int openCode = data.Rows[j]["OpenCode" + i].TryToInt32();
                        openCodeList.Add(openCode);
                    }
                    builder.Append(GetOpenCodeTemplate(type, openCodeList));

                    res.Add(new GPC11X5HistoryLotteryViewEntity
                    {
                        Term           = data.Rows[j]["Term"].ToStringEx(),
                        OpenTime       = data.Rows[j]["OpenTime"].TryToDateTimeToString("yyyy-MM-dd HH:mm:ss"),
                        NormalOpenCode = builder.ToString(),
                        Parity         = LotteryUtils.GetJOString(openCodeList, "双", "单"),
                        TheSum         = LotteryUtils.GetTheSum(openCodeList, 30, GetSumNumberCount(type)),
                        Size           = LotteryUtils.GetDXString(openCodeList, 5),
                        SizeRatio      = LotteryUtils.GetProportionOfDX(openCodeList, 6),
                        ParityRatio    = LotteryUtils.GetProportionOfJO(openCodeList),
                        RatioOf012     = LotteryUtils.GetProportionOf012(openCodeList),
                        Span           = LotteryUtils.GetSpan(openCodeList).ToString(),
                    });
                }
            }

            return(res.ToJson());
        }
Example #4
0
        public static Tuple <bool, string> SingleValue_KDItem <TEntity>(TEntity entity, int indexStart, int indexEnd) where TEntity : LotteryOpenCode
        {
            if (entity.OpenCode.Contains(-1))
            {
                return(new Tuple <bool, string>(false, "开奖号码错误!"));
            }

            IList <int> list = new List <int>(entity.OpenCode);

            if (-1 != indexEnd)
            {
                for (int i = list.Count - 1; i >= indexEnd; i--)
                {
                    list.RemoveAt(i);
                }
            }
            for (int i = 0; i < indexStart; i++)
            {
                list.RemoveAt(0);
            }

            return(new Tuple <bool, string>(true, LotteryUtils.GetSpan(list).ToString()));
        }