Пример #1
0
        public static void SaveTendencyAllDigit(List <LotteryModel> ltData)
        {
            LotteryModel minData = ltData[ltData.Count - 1];

            //上一期趋势
            Tendency1Model preTendency1 = null;

            //本次上一次开奖趋势,除非最后一期
            int prePperiod = int.Parse(minData.Sno) - 1;

            if (prePperiod > 0)
            {
                preTendency1 = MysqlHelper.QueryAllTendencyDigit1(minData.Ymd, prePperiod.ToString().PadLeft(4, '0'));
            }

            if (preTendency1 == null)
            {
                preTendency1 = new Tendency1Model();
            }
            AnalyzeTendency       At         = new AnalyzeTendency();
            List <Tendency1Model> ltTendency = new List <Tendency1Model>();

            for (int i = ltData.Count - 1; i >= 0; i--)
            {
                LotteryModel   lm = ltData[i];
                Tendency1Model tm = new Tendency1Model();
                tm.Ymd     = lm.Ymd;
                tm.Lottery = lm.Lottery;
                tm.Sno     = lm.Sno;

                tm.Num0 = At.ExistDigit(lm, 0) ? 0 : preTendency1.Num0 + 1;
                tm.Num1 = At.ExistDigit(lm, 1) ? 0 : preTendency1.Num1 + 1;
                tm.Num2 = At.ExistDigit(lm, 2) ? 0 : preTendency1.Num2 + 1;
                tm.Num3 = At.ExistDigit(lm, 3) ? 0 : preTendency1.Num3 + 1;
                tm.Num4 = At.ExistDigit(lm, 4) ? 0 : preTendency1.Num4 + 1;
                tm.Num5 = At.ExistDigit(lm, 5) ? 0 : preTendency1.Num5 + 1;
                tm.Num6 = At.ExistDigit(lm, 6) ? 0 : preTendency1.Num6 + 1;
                tm.Num7 = At.ExistDigit(lm, 7) ? 0 : preTendency1.Num7 + 1;
                tm.Num8 = At.ExistDigit(lm, 8) ? 0 : preTendency1.Num8 + 1;
                tm.Num9 = At.ExistDigit(lm, 9) ? 0 : preTendency1.Num9 + 1;

                tm.Dtime = lm.Dtime;
                ltTendency.Add(tm);

                prePperiod = int.Parse(lm.Sno);
                if (prePperiod == 1380)
                {
                    preTendency1 = new Tendency1Model();
                }
                else
                {
                    preTendency1 = tm;
                }
            }

            MysqlHelper.SaveAllTendencyDigit1(ltTendency);
        }