예제 #1
0
        public static void SaveTendencyDigit1(List <LotteryModel> ltData)
        {
            LotteryModel minData = ltData[ltData.Count - 1];

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

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

            if (prePperiod > 0)
            {
                preTendency1 = MysqlHelper.QueryTendencyDigit1(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;

                if (tm.Sno == "0186")
                {
                    Console.WriteLine("");
                }

                tm.Num0 = At.ExistBeforeAfterTwo(lm, 0) ? 0 : preTendency1.Num0 + 1;
                tm.Num1 = At.ExistBeforeAfterTwo(lm, 1) ? 0 : preTendency1.Num1 + 1;
                tm.Num2 = At.ExistBeforeAfterTwo(lm, 2) ? 0 : preTendency1.Num2 + 1;
                tm.Num3 = At.ExistBeforeAfterTwo(lm, 3) ? 0 : preTendency1.Num3 + 1;
                tm.Num4 = At.ExistBeforeAfterTwo(lm, 4) ? 0 : preTendency1.Num4 + 1;
                tm.Num5 = At.ExistBeforeAfterTwo(lm, 5) ? 0 : preTendency1.Num5 + 1;
                tm.Num6 = At.ExistBeforeAfterTwo(lm, 6) ? 0 : preTendency1.Num6 + 1;
                tm.Num7 = At.ExistBeforeAfterTwo(lm, 7) ? 0 : preTendency1.Num7 + 1;
                tm.Num8 = At.ExistBeforeAfterTwo(lm, 8) ? 0 : preTendency1.Num8 + 1;
                tm.Num9 = At.ExistBeforeAfterTwo(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.SaveTendencyDigit1(ltTendency);
        }