Example #1
0
        /// <summary>
        /// [多值多列]设置值通用方法
        /// </summary>
        /// <typeparam name="TEntity">泛型实体</typeparam>
        /// <param name="entity">实体</param>
        /// <param name="indexStart">开奖号开始</param>
        /// <param name="indexEnd">开奖号结束</param>
        /// <param name="count">项中列的个数</param>
        /// <param name="minNum">项最小值</param>
        /// <param name="maxNum">项最大值</param>
        /// <param name="index">项索引</param>
        /// <param name="missNumber">遗漏值</param>
        /// <param name="lastMiss">上期遗漏</param>
        /// <param name="maxMiss">最大遗漏</param>
        /// <param name="times">遗漏次数</param>
        /// <param name="avgMiss">平均遗漏</param>
        /// <param name="recordCount"></param>
        private static void GetMultiValue <TEntity>(TEntity entity, int indexStart, int indexEnd, int minNum, int maxNum, int[] index, int[] missNumber, int[] lastMiss, int[] maxMiss, int[] times, int[] avgMiss, int recordCount) where TEntity : LotteryOpenCode
        {
            IList <int> list = LotteryUtils.GetOpenCodeList <TEntity>(entity, indexStart, indexEnd);

            for (int i = maxNum; i >= minNum; i--)
            {
                missNumber[i - minNum]++;
                if (list.Contains(i))
                {
                    index[i - minNum]++;
                    if (null != lastMiss)
                    {
                        lastMiss[i - minNum] = missNumber[i - minNum];//上期遗漏
                    }
                    missNumber[i - minNum] = 0;
                    if (null != times)
                    {
                        times[i - minNum]++;
                    }
                }
                //最大遗漏
                if (null != maxMiss)
                {
                    if (missNumber[i - minNum] > maxMiss[i - minNum])
                    {
                        maxMiss[i - minNum] = missNumber[i - minNum];
                    }
                }
                // avgMiss[i - minNum] = maxMiss[i - minNum] / (times[i - minNum] + 1);//计算平均遗漏
                if (null != avgMiss && null != times)
                {
                    avgMiss[i - minNum] = (recordCount - times[i - minNum]) / (times[i - minNum] + 1);//计算平均遗漏
                }
            }
        }
Example #2
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 #3
0
        private void ajaxLotteryTime23()
        {
            string text  = base.q("lid");
            string text2 = "{\"name\": \"名称\",\"lotteryid\": \"彩种类别\",\"ordertime\": \"倒计时\",\"closetime\": \"封单时间\",\"nestsn\": \"下期期号\",\"cursn\": \"当前期号\",\"curnumber\": \"开奖号码\"}";

            text2 = text2.Replace("名称", LotteryUtils.LotteryTitle(Convert.ToInt32(text))).Replace("彩种类别", text);
            DateTime now      = DateTime.Now;
            DateTime dateTime = base.GetDateTime();
            string   text3    = dateTime.ToString("yyyyMMdd");
            string   text4    = dateTime.ToString("HH:mm:ss");
            string   text5    = dateTime.ToString("yyyy-MM-dd");

            this.doh.Reset();
            this.doh.SqlCmd = "select dbo.f_GetCloseTime(" + text + ") as closetime";
            DataTable dataTable = this.doh.GetDataTable();

            text2 = text2.Replace("封单时间", dataTable.Rows[0]["closetime"].ToString());
            TimeSpan timeSpan = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59") - DateTime.Now;
            string   newValue = string.Concat(timeSpan.Days * 24 * 60 * 60 + timeSpan.Hours * 60 * 60 + timeSpan.Minutes * 60 + timeSpan.Seconds);

            text2 = text2.Replace("倒计时", newValue);
            this.doh.Reset();
            this.doh.SqlCmd = "SELECT TOP 1 [Title],[Number] FROM [Sys_LotteryData] with(nolock) where UserId=" + this.AdminId + " order by Id desc";
            DataTable dataTable2 = this.doh.GetDataTable();

            if (dataTable2.Rows.Count > 0)
            {
                string  newValue2 = (dataTable2.Rows.Count > 0) ? dataTable2.Rows[0]["title"].ToString() : "您还未投注";
                decimal t         = Convert.ToDecimal(dataTable2.Rows[0]["title"].ToString());

                string newValue3 = (dataTable2.Rows.Count > 0) ? string.Concat(++t) : (DateTime.Now.ToString("yyyyMMdd") + "00001");
                text2 = text2.Replace("下期期号", newValue3).Replace("当前期号", newValue2);
                string[] array = dataTable2.Rows[0]["Number"].ToString().Split(new char[]
                {
                    ','
                });
                string text6 = "<p class='hm'>";
                for (int i = 0; i < array.Length; i++)
                {
                    text6 = text6 + "<span>" + array[i] + "</span>";
                }
                text6 += "</p>";
                text2  = text2.Replace("开奖号码", text6);
            }
            else
            {
                string newValue2 = "您还未投注";
                string newValue3 = DateTime.Now.ToString("yyyyMMdd") + "00001";
                text2 = text2.Replace("下期期号", newValue3).Replace("当前期号", newValue2);
                string text6 = "<p class='hm'>";
                text6 += "请您先投注";
                text6 += "</p>";
                text2  = text2.Replace("开奖号码", text6);
            }
            this._response = text2;
        }
Example #4
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 #5
0
        public static void SetEbtxtItemValue <TEntity>(TEntity entity, int indexStart, int indexEnd, int count, int minNum, int maxNum,
                                                       ref int[] index, ref int[] missNumber, ref int[] lastMiss, ref int[] maxMiss, ref int[] times, ref int[] avgMiss, int recordCount, string[] itemString) where TEntity : LotteryOpenCode
        {
            IList <int> list = LotteryUtils.GetOpenCodeList <TEntity>(entity, indexStart, indexEnd);

            int[] k3s = new int[list.Count];
            for (int i = 0; i < list.Count; i++)
            {
                k3s[i] = list[i];
            }
            Array.Sort(k3s);
            List <string> results = new List <string>();

            //modified by djp 2016-06-29:change ‘||’ to ‘&&’
            if (k3s[0] != k3s[1] && k3s[1] != k3s[2] && k3s[0] != k3s[2])
            {
                results.Add("二不同");
            }
            if (k3s[0] == k3s[1] || k3s[1] == k3s[2] || k3s[0] == k3s[2])
            {
                results.Add("二同");
            }
            for (int i = maxNum; i >= minNum; i--)
            {
                missNumber[i - minNum]++;
                if (results.Contains(itemString[i]))
                {
                    index[i - minNum]++;
                    if (null != lastMiss)
                    {
                        lastMiss[i - minNum] = missNumber[i - minNum];//上期遗漏
                    }
                    missNumber[i - minNum] = 0;
                    if (null != times)
                    {
                        times[i - minNum]++;
                    }
                }
                //最大遗漏
                if (null != maxMiss)
                {
                    if (missNumber[i - minNum] > maxMiss[i - minNum])
                    {
                        maxMiss[i - minNum] = missNumber[i - minNum];
                    }
                }
                // avgMiss[i - minNum] = maxMiss[i - minNum] / (times[i - minNum] + 1);//计算平均遗漏
                if (null != avgMiss && null != times)
                {
                    avgMiss[i - minNum] = (recordCount - times[i - minNum]) / (times[i - minNum] + 1);//计算平均遗漏
                }
            }
        }
Example #6
0
        public static void SpecialValue_TCDLT_ChuHaoPL <TEntity>(TEntity entity, int indexStart, int indexEnd, int count,
                                                                 int minNum, int maxNum, ref int[] index, ref int[] itemIndex) where TEntity : LotteryOpenCode
        {
            IList <int> list = LotteryUtils.GetOpenCodeList <TEntity>(entity, indexStart, indexEnd);

            for (int i = maxNum; i >= minNum; i--)
            {
                if (list.Contains(i))
                {
                    itemIndex[i - minNum]++;
                }
            }
        }
        private void ajaxGetListPlay()
        {
            string str1 = this.q("lid");
            string str2 = this.q("d1");
            string str3 = this.q("d2");
            string str4 = this.q("u");
            int    num1 = this.Int_ThisPage();
            int    num2 = this.Str2Int(this.q("pagesize"), 20);

            this.Str2Int(this.q("flag"), 0);
            if (str2.Trim().Length == 0)
            {
                str2 = Convert.ToDateTime(this.StartTime).ToString("yyyy-MM-dd");
            }
            if (str3.Trim().Length == 0)
            {
                DateTime dateTime = Convert.ToDateTime(this.EndTime);
                dateTime = dateTime.AddDays(1.0);
                str3     = dateTime.ToString("yyyy-MM-dd");
            }
            if (Convert.ToDateTime(str2) > Convert.ToDateTime(str3))
            {
                str2 = str3;
            }
            string str5     = "";
            string whereStr = "STime2 >='" + str2 + "' and STime2 <'" + str3 + "' and state>1";

            if (!string.IsNullOrEmpty(str1))
            {
                whereStr = whereStr + " and LotteryId = " + str1;
            }
            if (!string.IsNullOrEmpty(str4))
            {
                whereStr = whereStr + " and Title = '" + str4 + "'";
            }
            this.doh.Reset();
            this.doh.SqlCmd = "select PlayId FROM [N_UserBet] where " + whereStr + " group by PlayId";
            int    count = this.doh.GetDataTable().Rows.Count;
            string str6  = !string.IsNullOrEmpty(str1) ? LotteryUtils.LotteryTitle(Convert.ToInt32(str1)) : "全部游戏";
            string str7  = str5 + " SELECT '99999' as rowNember,'-1' as [LotteryId],'全部合计' as [LotteryName],'999' as PlayId,'' as Title,\r\n            cast(round(isnull(sum(Total*Times),0),4) as numeric(18,4)) as Bet ,isnull(sum(WinBonus),0) as Win,\r\n            isnull(sum(num),0) as Num,isnull(sum(winnum),0) as WinNum,\r\n            cast(round(CONVERT(float,isnull(sum(WinBonus),0))*100/CONVERT(float,isnull(sum(Total*Times),1)) ,4) as numeric(9,4)) as Per,\r\n            isnull(sum(PointMoney),0) as Point,isnull(sum(-RealGet),0) as total FROM [N_UserBet] where " + whereStr + " union all " + SqlHelp.GetSqlRow("'" + str1 + "' as LotteryId,'" + str6 + "' as LotteryName,PlayId,(select titleName from Sys_PlaySmallType where Id=PlayId) as Title,cast(round(isnull(sum(Total*Times),0),4) as numeric(18,4)) as Bet ,isnull(sum(WinBonus),0) as Win,isnull(sum(num),0) as Num,isnull(sum(winnum),0) as WinNum,cast(round(CONVERT(float,isnull(sum(WinBonus),0))*100/CONVERT(float,isnull(sum(Total*Times),1)) ,4) as numeric(9,4)) as Per,isnull(sum(PointMoney),0) as Point,isnull(sum(-RealGet),0) as total", "N_UserBet", "PlayId", num2, num1, "asc", whereStr, "PlayId");

            this.doh.Reset();
            this.doh.SqlCmd = str7;
            DataTable dataTable = this.doh.GetDataTable();

            this._response = "{\"result\" :\"1\",\"returnval\" :\"操作成功\",\"pagebar\" :\"" + PageBar.GetPageBar(3, "js", 2, count, num2, num1, "javascript:ajaxList(<#page#>);") + "\"," + dtHelp.DT2JSON(dataTable) + "}";
            dataTable.Clear();
            dataTable.Dispose();
        }
Example #8
0
        public static void SetK3ebtItemValue <TEntity>(TEntity entity, int indexStart, int indexEnd, int count, int minNum, int maxNum,
                                                       ref int[] index, ref int[] missNumber, ref int[] lastMiss, ref int[] maxMiss, ref int[] times, ref int[] avgMiss, int recordCount, string[] itemString) where TEntity : LotteryOpenCode
        {
            IList <int> list = LotteryUtils.GetOpenCodeList <TEntity>(entity, indexStart, indexEnd);

            int[] k3s = new int[list.Count];
            for (int i = 0; i < list.Count; i++)
            {
                k3s[i] = list[i];
            }
            Array.Sort(k3s);
            string[] results = new string[3];
            results[0] = k3s[0].ToString() + k3s[1].ToString();
            results[1] = k3s[0].ToString() + k3s[2].ToString();
            results[2] = k3s[1].ToString() + k3s[2].ToString();
            for (int i = maxNum; i >= minNum; i--)
            {
                missNumber[i - minNum]++;
                if (results.Contains(itemString[i]))
                {
                    index[i - minNum]++;
                    if (null != lastMiss)
                    {
                        lastMiss[i - minNum] = missNumber[i - minNum];//上期遗漏
                    }
                    missNumber[i - minNum] = 0;
                    if (null != times)
                    {
                        times[i - minNum]++;
                    }
                }
                //最大遗漏
                if (null != maxMiss)
                {
                    if (missNumber[i - minNum] > maxMiss[i - minNum])
                    {
                        maxMiss[i - minNum] = missNumber[i - minNum];
                    }
                }
                // avgMiss[i - minNum] = maxMiss[i - minNum] / (times[i - minNum] + 1);//计算平均遗漏
                if (null != avgMiss && null != times)
                {
                    avgMiss[i - minNum] = (recordCount - times[i - minNum]) / (times[i - minNum] + 1);//计算平均遗漏
                }
            }
        }
Example #9
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 #10
0
        /// <summary>
        /// 组装快乐扑克3记录
        /// </summary>
        /// <param name="data"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private string AppendShanDongKLPK3Result(DataTable data, SCCLottery type)
        {
            //山东快乐扑克3号码规则:号码形如211(红心J),第一位是花色(1为方片,2为红心,3为梅花,4为黑桃),后两位是号码(A为1,J为11,Q为12,K为13)

            List <GPCKLPK3HistoryLotteryViewEntity> res = new List <GPCKLPK3HistoryLotteryViewEntity>();

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

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

                    for (int i = 1; i <= total; i++)
                    {
                        int openCode1 = data.Rows[j]["OpenCode" + i].ToString().Substring(1, 2).TryToInt32();
                        openCodeList1.Add(openCode1);

                        int openCode2 = data.Rows[j]["OpenCode" + i].ToString().TryToInt32();
                        openCodeList2.Add(openCode2);
                    }
                    builder.Append(GetOpenCodeTemplate(type, openCodeList2));

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

            return(res.ToJson());
        }
Example #11
0
        /// <summary>
        /// 组装FC3D记录
        /// </summary>
        /// <param name="data"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private string AppendFC3DResult(DataTable data, SCCLottery type)
        {
            List <FC3DHistoryLotteryViewEntity> res = new List <FC3DHistoryLotteryViewEntity>();

            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 FC3DHistoryLotteryViewEntity
                    {
                        Term           = data.Rows[j]["Term"].ToStringEx(),
                        OpenTime       = data.Rows[j]["OpenTime"].TryToDateTimeToString("yyyy-MM-dd"),
                        NormalOpenCode = builder.ToString(),
                        ShiJiHao       = data.Rows[j]["ShiJiHao"].ToStringEx(),
                        KaiJiHao       = data.Rows[j]["KaiJiHao"].ToStringEx(),
                        ParityRatio    = LotteryUtils.GetProportionOfJO(openCodeList),
                        SizeRatio      = LotteryUtils.GetProportionOfDX(openCodeList, 4),
                        Parity         = LotteryUtils.GetJOString(openCodeList),
                        TheSum         = LotteryUtils.GetTheSum(openCodeList, 14, GetSumNumberCount(type))
                    });
                }
            }

            return(res.ToJson());
        }
Example #12
0
        /// <summary>
        /// [多值多列]设置值快乐扑克3方法
        /// </summary>
        /// <typeparam name="TEntity">泛型实体</typeparam>
        /// <param name="entity">实体</param>
        /// <param name="indexStart">开奖号开始</param>
        /// <param name="indexEnd">开奖号结束</param>
        /// <param name="count">项中列的个数</param>
        /// <param name="minNum">项最小值</param>
        /// <param name="maxNum">项最大值</param>
        /// <param name="index">项索引</param>
        /// <param name="missNumber">遗漏值</param>
        /// <param name="lastMiss">上期遗漏</param>
        /// <param name="maxMiss">最大遗漏</param>
        /// <param name="times">遗漏次数</param>
        /// <param name="avgMiss">平均遗漏</param>
        /// <param name="recordCount"></param>
        private static void GetMultiKLPK3Value <TEntity>(TEntity entity, int indexStart, int indexEnd, int minNum, int maxNum, int[] index, int[] missNumber, int[] lastMiss, int[] maxMiss, int[] times, int[] avgMiss, int recordCount) where TEntity : GP_KLPK3_ShanDong
        {
            IList <int> list = LotteryUtils.GetOpenCodeList <TEntity>(entity, indexStart, indexEnd);

            //var pkchars = new string[] { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" };
            for (int i = maxNum; i >= minNum; i--)
            {
                missNumber[i - minNum]++;
                var n = list.Count(p => (p % 100 - 1) == i);
                if (n > 0)
                //if(list.Any(p=>(p%100-1)==i))
                //if (list.Contains(i))
                {
                    index[i - minNum] += n;
                    if (null != lastMiss)
                    {
                        lastMiss[i - minNum] = missNumber[i - minNum];//上期遗漏
                    }
                    missNumber[i - minNum] = 0;
                    if (null != times)
                    {
                        times[i - minNum]++;
                    }
                }
                //最大遗漏
                if (null != maxMiss)
                {
                    if (missNumber[i - minNum] > maxMiss[i - minNum])
                    {
                        maxMiss[i - minNum] = missNumber[i - minNum];
                    }
                }
                // avgMiss[i - minNum] = maxMiss[i - minNum] / (times[i - minNum] + 1);//计算平均遗漏
                if (null != avgMiss && null != times)
                {
                    avgMiss[i - minNum] = (recordCount - times[i - minNum]) / (times[i - minNum] + 1);//计算平均遗漏
                }
            }
        }
Example #13
0
        public static Tuple <bool, string> SingleValue_Sum <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.GetSum(list).ToString()));
        }
Example #14
0
        public ActionResult PluginsLottery(Guid Id, string t, string OpenID)
        {
            try
            {
                if (Id == Guid.Empty)
                {
                    Log4NetImpl.Write("PluginsLottery:ajax-ERR_ArgNotExist");
                    return(Json(new { isOK = false, error_code = "ERR_ArgNotExist" }));
                }

                Plugin plugin = _pluginService.GetById(Id);
                if (plugin == null)
                {
                    return(Json(new { isOK = false, error_code = "ERR_PluginNotExits" }));
                }

                //设置布局页
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(plugin.Value);
                XmlNode pluginNode = xmlDoc.SelectSingleNode("plugin");
                GetDataToViewData(pluginNode);
                if (ViewBag.Cst_Plugin_Title == null)
                {
                    return(Json(new { isOK = false, error_code = "ERR_PluginNotExits" }));// message = "对不起,您还未配置或配置错误,请到插件中心进行配置下!" });
                }
                if (!string.IsNullOrEmpty(ViewBag.Cst_Plugin_StartDate))
                {
                    DateTime startDate = TypeConverter.StrToDateTime(ViewBag.Cst_Plugin_StartDate.ToString());
                    if (startDate > DateTime.Now)
                    {
                        return(Json(new { isOK = false, error_code = "ERR_PluginNotStart" }));// message = "对不起,抽奖还未开始!" });
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(ViewBag.Cst_Plugin_EndDate))
                        {
                            DateTime endDate = TypeConverter.StrToDateTime(ViewBag.Cst_Plugin_EndDate.ToString());
                            if (endDate < DateTime.Now)
                            {
                                return(Json(new { isOK = false, error_code = "ERR_PluginIsEnd" }));// message = "对不起,抽奖已经结束!" });
                            }
                        }
                    }
                }

                XYPluginUser xyPluginUser = _xyPluginUserService.GetUnique("from XYPluginUser where OpenId='" + OpenID + "'");
                if (xyPluginUser == null)
                {
                    Log4NetImpl.Write("PluginsLottery:ajax-ERR_UserNotVerify");
                    return(Json(new { isOK = false, isVertfy = true, error_code = "ERR_UserNotVerify" }));
                }

                if (xyPluginUser.LeftCount <= 0)
                {
                    Log4NetImpl.Write("PluginsLottery:ajax-ERR_UserUseOutChance");
                    return(Json(new { isOK = false, error_code = "ERR_UserUseOutChance" }));
                }


                int prizeCount     = TypeConverter.StrToInt(ViewBag.Cst_Plugin_PrizeCount, 12);
                int prizeItemCount = TypeConverter.StrToInt(ViewBag.Cst_Plugin_Items_Count, 1);
                if (prizeCount != prizeItemCount)
                {
                    Log4NetImpl.Write("PluginsLottery:ajax-奖项设置不正确");
                    return(Json(new { isOK = false, error_code = "ERR_ArgNotExist" }));
                }
                IList <PrizeGift> prizeGift      = new List <PrizeGift>(prizeItemCount);
                IList <Double>    prizeItems     = new List <Double>(prizeItemCount);
                IList <string>    prizeItemsName = new List <string>(prizeCount);
                IList <int>       prizeAngle     = new List <int>(12);
                prizeItemsName.Add("一");
                prizeItemsName.Add("二");
                prizeItemsName.Add("三");
                prizeItemsName.Add("四");
                prizeItemsName.Add("五");
                prizeItemsName.Add("六");
                prizeItemsName.Add("七");
                prizeItemsName.Add("八");
                prizeItemsName.Add("九");
                prizeItemsName.Add("十");
                prizeItemsName.Add("十一");
                prizeItemsName.Add("十二");
                for (int i = 0; i < prizeItemCount; i++)
                {
                    PrizeGift gift = new PrizeGift();
                    gift.ID         = i;
                    gift.Name       = ViewData.GetString("Cst_Plugin_Items_PrizeName" + i.ToString());
                    gift.Alias_Name = ViewData.GetString("Cst_Plugin_Items_PrizeAliasName" + i.ToString());
                    gift.Odds       = ViewData.GetDouble("Cst_Plugin_Items_PrizePercent" + i.ToString(), 0.00) / 100.00;
                    gift.Pic        = ViewData.GetString("Cst_Plugin_Items_PrizePic" + i.ToString());
                    gift.Quantity   = ViewData.GetInt("Cst_Plugin_Items_PrizeNum" + i.ToString());
                    if (ViewData["Cst_Plugin_Items_PrizeUsedNum" + i.ToString()] != null)
                    {
                        gift.Leavings_Quantity = ViewData.GetInt("Cst_Plugin_Items_PrizeUsedNum" + i.ToString());
                    }
                    else
                    {
                        gift.Leavings_Quantity = gift.Quantity;
                    }
                    gift.Angle = ViewData.GetInt("Cst_Plugin_Items_PrizeAngle" + i.ToString());
                    prizeAngle.Add(gift.Angle);
                    gift.Prize_Name = prizeItemsName[i] + "等奖";
                    if (!string.IsNullOrEmpty(gift.Alias_Name))
                    {
                        gift.Prize_Name = gift.Alias_Name;
                    }
                    gift.Has_Gift  = ViewData.GetInt("Cst_Plugin_Items_Has_Gift" + i.ToString());//>1为奖品,2为刮刮卡
                    gift.Users     = ViewData.GetString("Cst_Plugin_Items_SiteUsers" + i.ToString());
                    gift.UsersName = ViewData.GetString("Cst_Plugin_Items_SiteUsersName" + i.ToString());
                    prizeItems.Add(gift.Odds);
                    prizeGift.Add(gift);
                }
                int averageAngle = 360 / prizeCount;

                prizeItems.OrderBy(d => d);

                int result = -1;

                xyPluginUser.LeftCount = xyPluginUser.LeftCount - 1;
                _xyPluginUserService.Update(xyPluginUser);

                int count = _pluginSceneResultService.GetCount("from SceneResult where pluginId='" + Id.ToString() + "' and MpUserId='" + xyPluginUser.Id + "'");
                if (ViewData.GetInt("Cst_Plugin_ZeroPrize") == 1 && count > 0)
                {
                    Log4NetImpl.Write("PluginsLottery:ajax-ERR_RunOutOfGift");
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));
                }
                if (prizeGift.Where(g => g.Has_Gift > 1 && g.Leavings_Quantity > 0).Count() == 0)
                {
                    Log4NetImpl.Write("PluginsLottery:ajax-ERR_RunOutOfGift");
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));
                }

                result = LotteryUtils.Lottery(prizeItems, prizeGift, prizeCount, xyPluginUser.Id, Id);


                if (result == -1)
                {
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));
                }
                else if (result == -2)
                {
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));// Json(new PrizeGift() { ID = -2, Name = "未中奖", Odds = 0.00d, Pic = "", Quantity = 100000, Angle = 180, Prize_Name = "继续加油" });
                }
                else if (result == -3)
                {
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));// Json(new PrizeGift() { ID = -2, Name = "未中奖", Odds = 0.00d, Pic = "", Quantity = 100000, Angle = 180, Prize_Name = "继续加油" });
                }
                else
                {
                    PrizeGift hasPrizeGift = prizeGift[result];

                    hasPrizeGift.Alias_Name = hasPrizeGift.Alias_Name ?? "";
                    if (hasPrizeGift.Has_Gift > 0 && hasPrizeGift.Leavings_Quantity > 0)
                    {
                        //中奖业务处理
                        PluginSceneResult pluginSceneResult = new PluginSceneResult();
                        pluginSceneResult.Address     = "";
                        pluginSceneResult.CreateDate  = DateTime.Now;
                        pluginSceneResult.Email       = "";
                        pluginSceneResult.IsUse       = 0;
                        pluginSceneResult.MobilePhone = "";
                        pluginSceneResult.Name        = "";
                        pluginSceneResult.Phone       = "";
                        pluginSceneResult.PluginId    = Id;
                        pluginSceneResult.MpUserId    = xyPluginUser.Id;
                        pluginSceneResult.SN          = "";
                        pluginSceneResult.UserName    = (string.IsNullOrEmpty(this.Name) ? this.NickName : this.Name);

                        if (hasPrizeGift.Has_Gift == 2)//刮刮卡
                        {
                            xyPluginUser.GuaGuaKa = 1;
                            _xyPluginUserService.Update(xyPluginUser);
                        }

                        if (this.MpUserArr != null)
                        {
                            pluginSceneResult.Summary = "恭喜用户[" + (string.IsNullOrEmpty(this.Name) ? this.NickName : this.Name) + "]获得" + hasPrizeGift.Prize_Name + "[" + hasPrizeGift.Name + "]";
                        }
                        else
                        {
                            pluginSceneResult.Summary = "恭喜匿名用户获得" + hasPrizeGift.Prize_Name + "[" + hasPrizeGift.Name + "]";
                        }
                        pluginSceneResult.Value = "<?xml version=\"1.0\" encoding=\"utf-8\"?><PluginSubmit><Cst_Plugin_ItemIndex>" + result.ToString() + "</Cst_Plugin_ItemIndex><Cst_Plugin_PrizeLevel>" + hasPrizeGift.Prize_Name + "</Cst_Plugin_PrizeLevel><Cst_Plugin_PrizeName>" + hasPrizeGift.Name + "</Cst_Plugin_PrizeName></PluginSubmit>";

                        #region 更新中奖数量
                        XmlNode itemsNode = pluginNode.SelectSingleNode("Cst_Plugin_Items");
                        XmlNode node      = itemsNode.SelectSingleNode("Cst_Plugin_Items_PrizeUsedNum" + result.ToString());
                        if (node == null)
                        {
                            node           = xmlDoc.CreateElement("Cst_Plugin_Items_PrizeUsedNum" + result.ToString());
                            node.InnerText = (hasPrizeGift.Quantity - 1).ToString();
                            itemsNode.AppendChild(node);
                        }
                        else
                        {
                            node.InnerText = (hasPrizeGift.Leavings_Quantity - 1).ToString();
                        }
                        StringWriter  sw = new StringWriter();
                        XmlTextWriter tx = new XmlTextWriter(sw);
                        xmlDoc.WriteTo(tx);
                        string strXmlText = sw.ToString();
                        plugin.Value = strXmlText;
                        _pluginService.Update(plugin);
                        #endregion

                        _pluginSceneResultService.Insert(pluginSceneResult);
                        hasPrizeGift.ResultID = pluginSceneResult.Id;
                    }

                    return(Content(JsonConvert.SerializeObject(hasPrizeGift), "text/javascript"));
                }
            }
            catch (Exception ex)
            {
                throw new OceanException(ex.Message, ex);
            }
        }
Example #15
0
        public ActionResult PluginsLottery(Guid Id, string t)
        {
            try
            {
                //Log4NetImpl.Write("抽奖开始:1");
                if (Id == Guid.Empty)
                {
                    return(Json(new { isOK = false, error_code = "ERR_ArgNotExist" })); //message = "参数有误,请检查!" });
                }

                if (MpUserID == Guid.Empty)
                {
                    string rawUrl = "http://wx.ssrcb.com/pluginsScene/PluginsLottery?id=" + WebHelper.GetGuid("Id", Guid.Empty);
                    if (string.IsNullOrEmpty(RQuery["openid"]))
                    {
                        return(Json(new { isOK = false, isLogin = true, error_code = "ERR_NotLogin", message = string.Format("https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri=http://wx.ssrcb.com/mpuser/autologin?refUrl={1}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect", MpCenterCache.AppID, rawUrl) }));
                    }
                }

                Plugin plugin = _pluginService.GetById(Id);
                if (plugin == null)
                {
                    return(Json(new { isOK = false, error_code = "ERR_PluginNotExits" }));//message = "对不起,不存在该插件或未开通,请检查!" });
                }

                //设置布局页
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(plugin.Value);
                XmlNode pluginNode = xmlDoc.SelectSingleNode("plugin");
                GetDataToViewData(pluginNode);
                if (ViewBag.Cst_Plugin_Title == null)
                {
                    return(Json(new { isOK = false, error_code = "ERR_PluginNotExits" }));// message = "对不起,您还未配置或配置错误,请到插件中心进行配置下!" });
                }
                if (!string.IsNullOrEmpty(ViewBag.Cst_Plugin_StartDate))
                {
                    DateTime startDate = TypeConverter.StrToDateTime(ViewBag.Cst_Plugin_StartDate.ToString());
                    if (startDate > DateTime.Now)
                    {
                        return(Json(new { isOK = false, error_code = "ERR_PluginNotStart" }));// message = "对不起,抽奖还未开始!" });
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(ViewBag.Cst_Plugin_EndDate))
                        {
                            DateTime endDate = TypeConverter.StrToDateTime(ViewBag.Cst_Plugin_EndDate.ToString());
                            if (endDate < DateTime.Now)
                            {
                                return(Json(new { isOK = false, error_code = "ERR_PluginIsEnd" }));// message = "对不起,抽奖已经结束!" });
                            }
                        }
                    }
                }

                //PluginSceneVerifyCodeDetail verifyCodeDetail = _pluginSceneVerifyCodeDetailService.GetUnique("from SceneVerifyCodeDetail where ClientMPID='" + this.MpUserID.ToString() + "' and convert(char(10),(CreateDate),120) = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'");
                PluginSceneVerifyCodeDetail verifyCodeDetail = _pluginSceneVerifyCodeDetailService.GetUnique("from SceneVerifyCodeDetail where ClientMPID='" + this.MpUserID.ToString() + "' and cast(DATEPART(YEAR, CreateDate) as varchar(4))+'-'+ cast(DATEPART(MONTH, CreateDate) as varchar(2)) = '" + DateTime.Now.ToString("yyyy-MM") + "'");

                if (verifyCodeDetail == null)
                {
                    return(Json(new { isOK = false, isVertfy = true, error_code = "ERR_UserNotVerify" }));
                }

                if (verifyCodeDetail.LeaveCount <= 0)
                {
                    return(Json(new { isOK = false, error_code = "ERR_UserUseOutChance" }));
                }


                int prizeCount     = TypeConverter.StrToInt(ViewBag.Cst_Plugin_PrizeCount, 12);
                int prizeItemCount = TypeConverter.StrToInt(ViewBag.Cst_Plugin_Items_Count, 1);
                if (prizeCount != prizeItemCount)
                {
                    Log4NetImpl.Write("奖项设置不正确");
                    return(Json(new { isOK = false, error_code = "ERR_ArgNotExist" }));
                }
                IList <PrizeGift> prizeGift      = new List <PrizeGift>(prizeItemCount);
                IList <Double>    prizeItems     = new List <Double>(prizeItemCount);
                IList <string>    prizeItemsName = new List <string>(prizeCount);
                IList <int>       prizeAngle     = new List <int>(12);
                prizeItemsName.Add("一");
                prizeItemsName.Add("二");
                prizeItemsName.Add("三");
                prizeItemsName.Add("四");
                prizeItemsName.Add("五");
                prizeItemsName.Add("六");
                prizeItemsName.Add("七");
                prizeItemsName.Add("八");
                prizeItemsName.Add("九");
                prizeItemsName.Add("十");
                prizeItemsName.Add("十一");
                prizeItemsName.Add("十二");
                for (int i = 0; i < prizeItemCount; i++)
                {
                    PrizeGift gift = new PrizeGift();
                    gift.ID         = i;
                    gift.Name       = ViewData.GetString("Cst_Plugin_Items_PrizeName" + i.ToString());
                    gift.Alias_Name = ViewData.GetString("Cst_Plugin_Items_PrizeAliasName" + i.ToString());
                    gift.Odds       = ViewData.GetDouble("Cst_Plugin_Items_PrizePercent" + i.ToString(), 0.00) / 100.00;
                    gift.Pic        = ViewData.GetString("Cst_Plugin_Items_PrizePic" + i.ToString());
                    gift.Quantity   = ViewData.GetInt("Cst_Plugin_Items_PrizeNum" + i.ToString());
                    if (ViewData["Cst_Plugin_Items_PrizeUsedNum" + i.ToString()] != null)
                    {
                        gift.Leavings_Quantity = ViewData.GetInt("Cst_Plugin_Items_PrizeUsedNum" + i.ToString());
                    }
                    else
                    {
                        gift.Leavings_Quantity = gift.Quantity;
                    }
                    gift.Angle = ViewData.GetInt("Cst_Plugin_Items_PrizeAngle" + i.ToString());
                    prizeAngle.Add(gift.Angle);
                    gift.Prize_Name = prizeItemsName[i] + "等奖";
                    if (!string.IsNullOrEmpty(gift.Alias_Name))
                    {
                        gift.Prize_Name = gift.Alias_Name;
                    }
                    gift.Has_Gift  = ViewData.GetInt("Cst_Plugin_Items_Has_Gift" + i.ToString());
                    gift.Users     = ViewData.GetString("Cst_Plugin_Items_SiteUsers" + i.ToString());
                    gift.UsersName = ViewData.GetString("Cst_Plugin_Items_SiteUsersName" + i.ToString());
                    prizeItems.Add(gift.Odds);
                    prizeGift.Add(gift);
                }
                int averageAngle = 360 / prizeCount;

                prizeItems.OrderBy(d => d);

                int    result    = -1;
                string resultStr = "";

                verifyCodeDetail.LeaveCount = verifyCodeDetail.LeaveCount - 1;
                verifyCodeDetail.UseDate    = DateTime.Now;
                _pluginSceneVerifyCodeDetailService.Update(verifyCodeDetail);

                int count = _pluginSceneResultService.GetCount("from SceneResult where pluginId='" + Id.ToString() + "' and MpUserId='" + this.MpUserID.ToString() + "' and cast(DATEPART(YEAR, CreateDate) as varchar(4))+'-'+ cast(DATEPART(MONTH, CreateDate) as varchar(2)) = '" + DateTime.Now.ToString("yyyy-MM") + "'");
                if (ViewData.GetInt("Cst_Plugin_ZeroPrize") == 1 && count > 0)
                {
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));
                }
                if (prizeGift.Where(g => g.Has_Gift == 1 && g.Leavings_Quantity > 0).Count() == 0)
                {
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));//new PrizeGift() { ID = -1, Name = "未中奖", Odds = 0.00d, Pic = "", Quantity = 100000, Angle = 300, Prize_Name = "继续加油" });
                }

                result = LotteryUtils.Lottery(prizeItems, prizeGift, prizeCount, this.MpUserID, Id);


                if (result == -1)
                {
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));//Json(new PrizeGift() { ID = -1, Name = "未中奖", Odds = 0.00d, Pic = "", Quantity = 100000, Angle = 240, Prize_Name = "继续加油" });
                }
                else if (result == -2)
                {
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));// Json(new PrizeGift() { ID = -2, Name = "未中奖", Odds = 0.00d, Pic = "", Quantity = 100000, Angle = 180, Prize_Name = "继续加油" });
                }
                else if (result == -3)
                {
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));// Json(new PrizeGift() { ID = -2, Name = "未中奖", Odds = 0.00d, Pic = "", Quantity = 100000, Angle = 180, Prize_Name = "继续加油" });
                }
                else
                {
                    PrizeGift hasPrizeGift = prizeGift[result];

                    hasPrizeGift.Alias_Name = hasPrizeGift.Alias_Name ?? "";
                    if (hasPrizeGift.Has_Gift == 1 && hasPrizeGift.Leavings_Quantity > 0)
                    {
                        //中奖业务处理
                        PluginSceneResult pluginSceneResult = new PluginSceneResult();
                        pluginSceneResult.Address     = "";
                        pluginSceneResult.CreateDate  = DateTime.Now;
                        pluginSceneResult.Email       = "";
                        pluginSceneResult.IsUse       = 0;
                        pluginSceneResult.MobilePhone = "";
                        pluginSceneResult.Name        = "";
                        pluginSceneResult.Phone       = "";
                        pluginSceneResult.PluginId    = Id;
                        pluginSceneResult.MpUserId    = this.MpUserID;
                        pluginSceneResult.SN          = "";
                        pluginSceneResult.UserName    = (string.IsNullOrEmpty(this.Name) ? this.NickName : this.Name);



                        if (this.MpUserArr != null)
                        {
                            pluginSceneResult.Summary = "恭喜用户[" + (string.IsNullOrEmpty(this.Name) ? this.NickName : this.Name) + "]获得" + hasPrizeGift.Prize_Name + "[" + hasPrizeGift.Name + "]";
                        }
                        else
                        {
                            pluginSceneResult.Summary = "恭喜匿名用户获得" + hasPrizeGift.Prize_Name + "[" + hasPrizeGift.Name + "]";
                        }
                        pluginSceneResult.Value = "<?xml version=\"1.0\" encoding=\"utf-8\"?><PluginSubmit><Cst_Plugin_ItemIndex>" + result.ToString() + "</Cst_Plugin_ItemIndex><Cst_Plugin_PrizeLevel>" + hasPrizeGift.Prize_Name + "</Cst_Plugin_PrizeLevel><Cst_Plugin_PrizeName>" + hasPrizeGift.Name + "</Cst_Plugin_PrizeName></PluginSubmit>";

                        #region 更新中奖数量
                        XmlNode itemsNode = pluginNode.SelectSingleNode("Cst_Plugin_Items");
                        XmlNode node      = itemsNode.SelectSingleNode("Cst_Plugin_Items_PrizeUsedNum" + result.ToString());
                        if (node == null)
                        {
                            node           = xmlDoc.CreateElement("Cst_Plugin_Items_PrizeUsedNum" + result.ToString());
                            node.InnerText = (hasPrizeGift.Quantity - 1).ToString();
                            itemsNode.AppendChild(node);
                        }
                        else
                        {
                            node.InnerText = (hasPrizeGift.Leavings_Quantity - 1).ToString();
                        }
                        StringWriter  sw = new StringWriter();
                        XmlTextWriter tx = new XmlTextWriter(sw);
                        xmlDoc.WriteTo(tx);
                        string strXmlText = sw.ToString();
                        plugin.Value = strXmlText;
                        _pluginService.Update(plugin);
                        #endregion

                        _pluginSceneResultService.Insert(pluginSceneResult);
                        hasPrizeGift.ResultID = pluginSceneResult.Id;
                    }

                    return(Content(JsonConvert.SerializeObject(hasPrizeGift), "text/javascript"));
                }
            }
            catch (Exception ex)
            {
                throw new OceanException(ex.Message, ex);
            }
        }
Example #16
0
        private void ajaxLotteryTime23()
        {
            string   newValue1 = this.q("lid");
            string   str1      = "{\"name\": \"名称\",\"lotteryid\": \"彩种类别\",\"ordertime\": \"倒计时\",\"closetime\": \"封单时间\",\"nestsn\": \"下期期号\",\"cursn\": \"当前期号\",\"curnumber\": \"开奖号码\"}".Replace("名称", LotteryUtils.LotteryTitle(Convert.ToInt32(newValue1))).Replace("彩种类别", newValue1);
            DateTime now       = DateTime.Now;
            DateTime dateTime  = this.GetDateTime();

            dateTime.ToString("yyyyMMdd");
            dateTime.ToString("HH:mm:ss");
            dateTime.ToString("yyyy-MM-dd");
            this.doh.Reset();
            this.doh.SqlCmd = "select dbo.f_GetCloseTime(" + newValue1 + ") as closetime";
            DataTable dataTable1 = this.doh.GetDataTable();
            string    str2       = str1.Replace("封单时间", dataTable1.Rows[0]["closetime"].ToString());
            TimeSpan  timeSpan   = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59") - DateTime.Now;
            string    newValue2  = string.Concat((object)(timeSpan.Days * 24 * 60 * 60 + timeSpan.Hours * 60 * 60 + timeSpan.Minutes * 60 + timeSpan.Seconds));
            string    str3       = str2.Replace("倒计时", newValue2);

            this.doh.Reset();
            this.doh.SqlCmd = "SELECT TOP 1 [Title],[Number] FROM [Sys_LotteryData] with(nolock) where UserId=" + this.AdminId + " order by Id desc";
            DataTable dataTable2 = this.doh.GetDataTable();
            string    str4;

            if (dataTable2.Rows.Count > 0)
            {
                string   newValue3 = dataTable2.Rows.Count > 0 ? dataTable2.Rows[0]["title"].ToString() : "您还未投注";
                string   newValue4 = dataTable2.Rows.Count > 0 ? string.Concat((object)(Convert.ToDecimal(dataTable2.Rows[0]["title"].ToString()) + 1)) : DateTime.Now.ToString("yyyyMMdd") + "00001";
                string   str5      = str3.Replace("下期期号", newValue4).Replace("当前期号", newValue3);
                string[] strArray  = dataTable2.Rows[0]["Number"].ToString().Split(',');
                string   str6      = "<p class='hm'>";
                for (int index = 0; index < strArray.Length; ++index)
                {
                    str6 = str6 + "<span>" + strArray[index] + "</span>";
                }
                string newValue5 = str6 + "</p>";
                str4 = str5.Replace("开奖号码", newValue5);
            }
            else
            {
                string newValue3 = "您还未投注";
                string newValue4 = DateTime.Now.ToString("yyyyMMdd") + "00001";
                str4 = str3.Replace("下期期号", newValue4).Replace("当前期号", newValue3).Replace("开奖号码", "<p class='hm'>" + "请您先投注" + "</p>");
            }
            this._response = str4;
        }
Example #17
0
        private void ajaxGetListPlay()
        {
            string text     = base.q("lid");
            string text2    = base.q("d1");
            string text3    = base.q("d2");
            string text4    = base.q("u");
            int    num      = base.Int_ThisPage();
            int    pageSize = base.Str2Int(base.q("pagesize"), 20);
            int    num2     = base.Str2Int(base.q("flag"), 0);

            if (text2.Trim().Length == 0)
            {
                text2 = Convert.ToDateTime(this.StartTime).ToString("yyyy-MM-dd");
            }
            if (text3.Trim().Length == 0)
            {
                text3 = Convert.ToDateTime(this.EndTime).AddDays(1.0).ToString("yyyy-MM-dd");
            }
            if (Convert.ToDateTime(text2) > Convert.ToDateTime(text3))
            {
                text2 = text3;
            }
            string text5 = "";
            string text6 = string.Concat(new string[]
            {
                "STime2 >='",
                text2,
                "' and STime2 <'",
                text3,
                "' and state>1"
            });

            if (!string.IsNullOrEmpty(text))
            {
                text6 = text6 + " and LotteryId = " + text;
            }
            if (!string.IsNullOrEmpty(text4))
            {
                text6 = text6 + " and Title = '" + text4 + "'";
            }
            this.doh.Reset();
            this.doh.SqlCmd = "select PlayId FROM [N_UserBet] where " + text6 + " group by PlayId";
            DataTable dataTable = this.doh.GetDataTable();
            int       count     = dataTable.Rows.Count;
            string    text7     = (!string.IsNullOrEmpty(text)) ? LotteryUtils.LotteryTitle(Convert.ToInt32(text)) : "全部游戏";

            text5  = text5 + " SELECT '99999' as rowNember,'-1' as [LotteryId],'全部合计' as [LotteryName],'999' as PlayId,'' as Title,\r\n            cast(round(isnull(sum(Total*Times),0),4) as numeric(18,4)) as Bet ,isnull(sum(WinBonus),0) as Win,\r\n            isnull(sum(num),0) as Num,isnull(sum(winnum),0) as WinNum,\r\n            cast(round(CONVERT(float,isnull(sum(WinBonus),0))*100/CONVERT(float,isnull(sum(Total*Times),1)) ,4) as numeric(9,4)) as Per,\r\n            isnull(sum(PointMoney),0) as Point,isnull(sum(-RealGet),0) as total FROM [N_UserBet] where " + text6;
            text5 += " union all ";
            text5 += SqlHelp.GetSqlRow(string.Concat(new string[]
            {
                "'",
                text,
                "' as LotteryId,'",
                text7,
                "' as LotteryName,PlayId,(select titleName from Sys_PlaySmallType where Id=PlayId) as Title,cast(round(isnull(sum(Total*Times),0),4) as numeric(18,4)) as Bet ,isnull(sum(WinBonus),0) as Win,isnull(sum(num),0) as Num,isnull(sum(winnum),0) as WinNum,cast(round(CONVERT(float,isnull(sum(WinBonus),0))*100/CONVERT(float,isnull(sum(Total*Times),1)) ,4) as numeric(9,4)) as Per,isnull(sum(PointMoney),0) as Point,isnull(sum(-RealGet),0) as total"
            }), "N_UserBet", "PlayId", pageSize, num, "asc", text6, "PlayId");
            this.doh.Reset();
            this.doh.SqlCmd = text5;
            DataTable dataTable2 = this.doh.GetDataTable();

            this._response = string.Concat(new string[]
            {
                "{\"result\" :\"1\",\"returnval\" :\"操作成功\",\"pagebar\" :\"",
                PageBar.GetPageBar(3, "js", 2, count, pageSize, num, "javascript:ajaxList(<#page#>);"),
                "\",",
                dtHelp.DT2JSON(dataTable2),
                "}"
            });
            dataTable2.Clear();
            dataTable2.Dispose();
        }
Example #18
0
        private void ajaxLotteryTime()
        {
            string   str1      = this.q("lid");
            string   str2      = "{\"name\": \"名称\",\"lotteryid\": \"彩种类别\",\"ordertime\": \"倒计时\",\"closetime\": \"封单时间\",\"nestsn\": \"下期期号\",\"cursn\": \"当前期号\"}".Replace("名称", LotteryUtils.LotteryTitle(Convert.ToInt32(str1))).Replace("彩种类别", str1);
            DateTime dateTime1 = DateTime.Now;
            DateTime dateTime2 = this.GetDateTime();
            string   str3      = dateTime2.ToString("yyyyMMdd");
            string   str4      = dateTime2.ToString("HH:mm:ss");

            dateTime2.ToString("yyyy-MM-dd");
            this.doh.Reset();
            this.doh.SqlCmd = "select dbo.f_GetCloseTime(" + str1 + ") as closetime";
            DataTable dataTable = this.doh.GetDataTable();
            string    str5      = str2.Replace("封单时间", dataTable.Rows[0]["closetime"].ToString());
            string    newValue1;
            string    newValue2;
            TimeSpan  timeSpan;

            if (str1 == "3002" || str1 == "3003")
            {
                int      year      = dateTime2.Year;
                DateTime dateTime3 = Convert.ToDateTime(year.ToString() + "-01-01 20:30:00");
                this.doh.Reset();
                this.doh.SqlCmd = "select datediff(d,'" + dateTime3.ToString("yyyy-MM-dd HH:mm:ss") + "','" + dateTime2.ToString("yyyy-MM-dd HH:mm:ss") + "') as d";
                int      Num       = Convert.ToInt32(this.doh.GetDataTable().Rows[0]["d"]) - 7 + 1;
                DateTime dateTime4 = dateTime2.AddDays(-1.0);
                string   str6      = dateTime4.ToString("yyyy-MM-dd") + " 20:30:00";
                string   str7      = dateTime2.ToString("yyyy-MM-dd") + " 20:30:00";
                if (dateTime2 > Convert.ToDateTime(dateTime2.ToString(" 20:30:00")))
                {
                    dateTime4 = dateTime2.AddDays(1.0);
                    str7      = dateTime4.ToString("yyyy-MM-dd") + " 20:30:00";
                }
                else
                {
                    --Num;
                }
                year      = dateTime2.Year;
                newValue1 = year.ToString() + Func.AddZero(Num, 3);
                year      = dateTime2.Year;
                newValue2 = year.ToString() + Func.AddZero(Num + 1, 3);
                timeSpan  = Convert.ToDateTime(str7) - Convert.ToDateTime(str4);
            }
            else
            {
                if (UserCenterSession.LotteryTime == null)
                {
                    UserCenterSession.LotteryTime = new LotteryTimeDAL().GetTable();
                }
                DataRow[] dataRowArray1 = UserCenterSession.LotteryTime.Select("Time >'" + str4 + "' and LotteryId=" + str1, "Time asc");
                if (dataRowArray1.Length == 0)
                {
                    dataRowArray1 = UserCenterSession.LotteryTime.Select("Time <='" + str4 + "' and LotteryId=" + str1, "Time asc");
                    newValue2     = dateTime2.AddDays(1.0).ToString("yyyyMMdd") + "-" + dataRowArray1[0]["Sn"].ToString();
                }
                else
                {
                    newValue2 = str3 + "-" + dataRowArray1[0]["Sn"].ToString();
                    dateTime1 = Convert.ToDateTime(dataRowArray1[0]["Time"].ToString());
                    if (dateTime2 > Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 00:00:00") && dateTime2 < Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 10:00:01") && str1 == "1003")
                    {
                        newValue2 = dateTime2.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray1[0]["Sn"].ToString();
                    }
                }
                if (Convert.ToDateTime(dataRowArray1[0]["Time"].ToString()) < Convert.ToDateTime(str4))
                {
                    dateTime1 = Convert.ToDateTime(dateTime2.AddDays(1.0).ToString("yyyy-MM-dd") + " " + dataRowArray1[0]["Time"].ToString());
                }
                timeSpan = dateTime1 - Convert.ToDateTime(str4);
                DataRow[] dataRowArray2 = UserCenterSession.LotteryTime.Select("Time <'" + str4 + "' and LotteryId=" + str1, "Time desc");
                if (dataRowArray2.Length == 0)
                {
                    dataRowArray2 = UserCenterSession.LotteryTime.Select("LotteryId=" + str1, "Time desc");
                    newValue1     = dateTime2.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray2[0]["Sn"].ToString();
                }
                else
                {
                    newValue1 = str3 + "-" + dataRowArray2[0]["Sn"].ToString();
                    if (dateTime2 > Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 00:00:00") && dateTime2 < Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 10:00:01") && str1 == "1003")
                    {
                        newValue1 = dateTime2.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray2[0]["Sn"].ToString();
                    }
                }
                if (str1 == "1010" || str1 == "1017" || str1 == "3004")
                {
                    newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(str1) + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString())));
                    newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1));
                }
                if (str1 == "1012")
                {
                    newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("1012") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString())));
                    newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1));
                }
                if (str1 == "1013")
                {
                    newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("1013") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString())));
                    newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1));
                }
                if (str1 == "1014" || str1 == "1015" || str1 == "1016")
                {
                    newValue1 = newValue1.Replace("-", "");
                    newValue2 = newValue2.Replace("-", "");
                }
                if (str1 == "1011" || str1 == "3005")
                {
                    newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("1011") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString())));
                    newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1));
                }
                if (str1 == "4001")
                {
                    newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("4001") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString())));
                    newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1));
                }
                if (str1 == "1005")
                {
                    string str6 = string.Concat((object)(Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()) - 1));
                    if (str6.Length == 1)
                    {
                        str6 = "000" + str6;
                    }
                    if (str6.Length == 2)
                    {
                        str6 = "00" + str6;
                    }
                    if (str6.Length == 3)
                    {
                        str6 = "0" + str6;
                    }
                    string str7 = string.Concat((object)Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()));
                    if (str7.Length == 1)
                    {
                        str7 = "000" + str7;
                    }
                    if (str7.Length == 2)
                    {
                        str7 = "00" + str7;
                    }
                    if (str7.Length == 3)
                    {
                        str7 = "0" + str7;
                    }
                    newValue1 = dateTime2.ToString("yyyyMMdd") + "-" + str6;
                    newValue2 = dateTime2.ToString("yyyyMMdd") + "-" + str7;
                }
            }
            string newValue3 = string.Concat((object)(timeSpan.Days * 24 * 60 * 60 + timeSpan.Hours * 60 * 60 + timeSpan.Minutes * 60 + timeSpan.Seconds));

            this._response = str5.Replace("下期期号", newValue2).Replace("当前期号", newValue1).Replace("倒计时", newValue3);
        }
Example #19
0
        private void ajaxIndexLottery()
        {
            string str1 = "";

            this.doh.Reset();
            this.doh.SqlCmd = "select row_number() over (order by Sort asc) as rowid,* from [Sys_Lottery] where IsOpen=0 and Id in (1001,1004,1009,1016,2001,3002) order by Sort asc";
            DataTable dataTable = this.doh.GetDataTable();

            if (dataTable.Rows.Count > 0)
            {
                for (int index = 0; index < dataTable.Rows.Count; ++index)
                {
                    string   newValue1 = dataTable.Rows[index]["Id"].ToString();
                    string   str2      = "{\"rowid\": \"排序Id\",\"tid\": \"类别Id\",\"id\": \"彩种Id\",\"name\": \"名称\",\"ordertime\": \"倒计时\",\"remark\": \"说明\"}".Replace("名称", LotteryUtils.LotteryTitle(Convert.ToInt32(newValue1))).Replace("排序Id", dataTable.Rows[index]["rowid"].ToString()).Replace("类别Id", dataTable.Rows[index]["LType"].ToString()).Replace("彩种Id", newValue1).Replace("说明", dataTable.Rows[index]["IphoneRemark"].ToString());
                    DateTime now       = DateTime.Now;
                    DateTime dateTime1 = this.GetDateTime();
                    dateTime1.ToString("yyyyMMdd");
                    string str3 = dateTime1.ToString("HH:mm:ss");
                    dateTime1.ToString("yyyy-MM-dd");
                    DateTime dateTime2;
                    TimeSpan timeSpan;
                    if (newValue1 == "3002" || newValue1 == "3003")
                    {
                        string str4 = dateTime1.ToString("yyyy-MM-dd") + " 20:30:00";
                        if (dateTime1 > Convert.ToDateTime(dateTime1.ToString("yyyy-MM-dd") + " 20:30:00"))
                        {
                            dateTime2 = dateTime1.AddDays(1.0);
                            str4      = dateTime2.ToString("yyyy-MM-dd") + " 20:30:00";
                        }
                        timeSpan = Convert.ToDateTime(str4) - dateTime1;
                    }
                    else
                    {
                        if (UserCenterSession.LotteryTime == null)
                        {
                            UserCenterSession.LotteryTime = new LotteryTimeDAL().GetTable();
                        }
                        DataRow[] dataRowArray = UserCenterSession.LotteryTime.Select("Time >'" + str3 + "' and LotteryId=" + newValue1, "Time asc");
                        if (dataRowArray.Length == 0)
                        {
                            dataRowArray = UserCenterSession.LotteryTime.Select("Time <='" + str3 + "' and LotteryId=" + newValue1, "Time asc");
                        }
                        DateTime dateTime3 = Convert.ToDateTime(dateTime1.ToString("yyyy-MM-dd") + " " + dataRowArray[0]["Time"].ToString());
                        if (Convert.ToDateTime(dataRowArray[0]["Time"].ToString()) < Convert.ToDateTime(str3))
                        {
                            dateTime2 = dateTime1.AddDays(1.0);
                            dateTime3 = Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " " + dataRowArray[0]["Time"].ToString());
                        }
                        timeSpan = dateTime3 - Convert.ToDateTime(str3);
                    }
                    string newValue2 = string.Concat((object)((timeSpan.Days * 24 * 60 * 60 + timeSpan.Hours * 60 * 60 + timeSpan.Minutes * 60 + timeSpan.Seconds) * 1000));
                    string str5      = str2.Replace("倒计时", newValue2);
                    str1 = str1 + str5 + ",";
                }
                this._response = "{\"result\":\"1\",\"table\": [" + str1.Substring(0, str1.Length - 1) + "]}";
            }
            else
            {
                this._response = "{\"result\":\"0\",\"table\": []}";
            }
        }
Example #20
0
        /// <summary>
        /// 获取开奖号模板
        /// </summary>
        /// <param name="type"></param>
        /// <param name="openCodeList">开奖号集合</param>
        /// <returns></returns>
        protected string GetOpenCodeTemplate(SCCLottery type, List <int> openCodeList)
        {
            StringBuilder res          = new StringBuilder();
            string        blueTemplate = "<span class='ball-list blue'>{0}</span>";
            string        redTemplate  = "<span class='ball-list red'>{0}</span>";

            //快乐扑克3为特殊彩种
            if (type == SCCLottery.ShanDongKLPK3)
            {
                return(GetKLPK3OpenCodeTemplate(openCodeList));
            }

            #region 如果当前彩种最大开奖号大于10,则小于10的开奖号需要在前面加0
            //取出当前最大开奖号
            //TODO 此做法欠妥,如果当前彩种开奖号取值在0-20之间,有可能某一期开奖号全部都小于10
            int max = openCodeList.Max();
            //是否需要添加0
            bool hasAppendZero = (type != SCCLottery.ShanDongKLPK3 && max >= 10) || type == SCCLottery.GuangDongHC1;
            #endregion

            //其他彩
            string typeCode = type.ToString();
            if (LotteryBallTypeDict.ContainsKey(typeCode))
            {
                int[] codeArr = LotteryBallTypeDict[typeCode];
                //正常球个数
                int normal = codeArr[0];
                //蓝球个数
                int blue = codeArr[1];
                //生肖球个数
                int zodiac = codeArr[2];
                //季节球个数
                int season = codeArr[3];
                //方位球个数
                int position = codeArr[4];

                #region 正常球
                if (normal > 0)
                {
                    for (int i = 1; i <= normal; i++)
                    {
                        int openCode = openCodeList[i - 1].TryToInt32();

                        res.Append(string.Format(redTemplate, hasAppendZero ? openCode.RepairZero() : openCode.ToString()));
                    }
                }
                #endregion

                #region 蓝球
                if (blue > 0)
                {
                    int index = normal;
                    //for (int i = blue; i >= 1; i--)
                    for (int i = 1; i <= blue; i++)
                    {
                        int openCode = openCodeList[index + i - 1].TryToInt32();

                        res.Append(string.Format(blueTemplate, hasAppendZero ? openCode.RepairZero() : openCode.ToString()));
                    }
                }
                #endregion

                #region 生肖球
                if (zodiac > 0)
                {
                    int index = normal + blue;
                    for (int i = zodiac; i >= 1; i--)
                    {
                        int openCode = openCodeList[index + i - 1].TryToInt32();
                        res.Append(string.Format(blueTemplate, LotteryUtils.GetZodiacByOpenCode(openCode)));
                    }
                }
                #endregion

                #region 季节球
                if (season > 0)
                {
                    int index = normal + blue + zodiac;
                    for (int i = season; i >= 1; i--)
                    {
                        int openCode = openCodeList[index + i - 1].TryToInt32();
                        res.Append(string.Format(blueTemplate, LotteryUtils.GetSeasonByOpenCode(openCode)));
                    }
                }
                #endregion

                #region 方位球
                if (position > 0)
                {
                    int index = normal + blue + zodiac + season;
                    for (int i = position; i >= 1; i--)
                    {
                        int openCode = openCodeList[index + i - 1].TryToInt32();
                        res.Append(string.Format(blueTemplate, LotteryUtils.GetPositionByOpenCode(openCode)));
                    }
                }
                #endregion
            }
            else
            {
                //总共球个数
                int total = type.GetEnumText().TryToInt32();
                for (int i = 1; i <= total; i++)
                {
                    int openCode = openCodeList[i - 1].TryToInt32();
                    res.Append(string.Format(redTemplate, hasAppendZero ? openCode.RepairZero() : openCode.ToString()));
                }
            }

            return(res.ToString());
        }
Example #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Request.QueryString["id"] != null)
            {
                this.lotteryId = this.Request.QueryString["id"].ToString();
            }
            this.LName        = LotteryUtils.LotteryTitle(Convert.ToInt32(this.lotteryId));
            this.LotteryLines = "";
            if (this.IsPostBack)
            {
                return;
            }
            int top = 50;

            if (this.Request["n"] != null)
            {
                top = Convert.ToInt32(this.Request["n"]);
            }
            DataTable listDataTable = new LotteryDataDAL().GetListDataTable(Convert.ToInt32(this.lotteryId), top);

            string[,] strArray1;
            if (this.lotteryId.Substring(0, 1) == "1")
            {
                this.count       = 10;
                int[,] numArray1 = new int[5, 10];
                int[,] numArray2 = new int[5, 10];
                int[,] numArray3 = new int[5, 10];
                int[,] numArray4 = new int[5, 10];
                int[,] numArray5 = new int[5, 10];
                strArray1        = new string[5, 10];
                for (int index1 = 0; index1 < listDataTable.Rows.Count; ++index1)
                {
                    DataRow  row       = listDataTable.Rows[index1];
                    string   str1      = row["Title"].ToString();
                    string   str2      = row["Number"].ToString();
                    string[] strArray2 = str2.Split(',');
                    string   str3      = "<tr>" + "<td rowspan=\"2\" style=\"width:100px;\">期号</td>" + "<td rowspan=\"2\" style=\"width:100px;\">开奖号码</td>" + "<td colspan=\"10\">万位</td>" + "<td colspan=\"10\">千位</td>" + "<td colspan=\"10\">百位</td>" + "<td colspan=\"10\">十位</td>" + "<td colspan=\"10\">个位</td>" + "</tr>" + "<tr>";
                    for (int index2 = 0; index2 < strArray2.Length; ++index2)
                    {
                        for (int index3 = 0; index3 < 10; ++index3)
                        {
                            str3 = str3 + "<td>" + (object)index3 + "</td>";
                        }
                    }
                    this.LotteryHeadLines = str3 + "</tr>";
                    string str4 = "<tr>" + "<td class=\"issue\">" + str1 + "</td>" + "<td align=\"center\" class=\"tdwth\">" + str2 + "</td>";
                    for (int index2 = 0; index2 < strArray2.Length; ++index2)
                    {
                        for (int index3 = 0; index3 <= 9; ++index3)
                        {
                            if (index3 == Convert.ToInt32(strArray2[index2]))
                            {
                                ++numArray1[index2, index3];
                                numArray2[index2, index3] = -1;
                                ++numArray4[index2, index3];
                                if (numArray3[index2, index3] < numArray4[index2, index3])
                                {
                                    numArray3[index2, index3] = numArray4[index2, index3];
                                }
                            }
                            else
                            {
                                numArray4[index2, index3] = 0;
                                ++numArray2[index2, index3];
                                if (numArray5[index2, index3] < numArray2[index2, index3])
                                {
                                    numArray5[index2, index3] = numArray2[index2, index3];
                                }
                            }
                            if (index3 == Convert.ToInt32(strArray2[index2]))
                            {
                                str4 = index2 % 2 != 0 ? str4 + "<td class=\"charball td1\"><div class=\"ball01\">" + strArray2[index2] + "</div></td>" : str4 + "<td class=\"charball td0\"><div class=\"ball01\">" + strArray2[index2] + "</div></td>";
                                ++numArray2[index2, index3];
                            }
                            else if (index2 % 2 == 0)
                            {
                                str4 = str4 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray2[index2, index3] + "</div></td>";
                            }
                            else
                            {
                                str4 = str4 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray2[index2, index3] + "</div></td>";
                            }
                        }
                    }
                    this.LotteryLines += str4 + "</tr>";
                }
                string str5 = "<tr>" + "<td colspan=\"2\">" + "当前最大连开" + "</td>";
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    for (int index2 = 0; index2 <= 9; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str5 = str5 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray3[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str5 = str5 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray3[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str6 = str5 + "</tr>";
                string str7 = "<tr>" + "<td colspan=\"2\">" + "当前最大遗漏" + "</td>";
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    for (int index2 = 0; index2 <= 9; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str7 = str7 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray5[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str7 = str7 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray5[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str8 = str7 + "</tr>";
                string str9 = "<tr>" + "<td colspan=\"2\">" + "当前出现次数" + "</td>";
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    for (int index2 = 0; index2 <= 9; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str9 = str9 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray1[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str9 = str9 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray1[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str10 = str9 + "</tr>";
                index  index = this;
                index.LotteryLines = index.LotteryLines + str10 + str6 + str8;
            }
            if (this.lotteryId.Substring(0, 1) == "2")
            {
                this.count       = 11;
                int[,] numArray1 = new int[5, 11];
                int[,] numArray2 = new int[5, 11];
                int[,] numArray3 = new int[5, 11];
                int[,] numArray4 = new int[5, 11];
                int[,] numArray5 = new int[5, 11];
                strArray1        = new string[5, 11];
                for (int index1 = 0; index1 < listDataTable.Rows.Count; ++index1)
                {
                    DataRow  row       = listDataTable.Rows[index1];
                    string   str1      = row["Title"].ToString();
                    string   str2      = row["Number"].ToString();
                    string[] strArray2 = str2.Split(',');
                    string   str3      = "<tr>" + "<td rowspan=\"2\" style=\"width:100px;\">期号</td>" + "<td rowspan=\"2\" style=\"width:100px;\">开奖号码</td>" + "<td colspan=\"11\">万位</td>" + "<td colspan=\"11\">千位</td>" + "<td colspan=\"11\">百位</td>" + "<td colspan=\"11\">十位</td>" + "<td colspan=\"11\">个位</td>" + "</tr>" + "<tr>";
                    for (int index2 = 0; index2 < strArray2.Length; ++index2)
                    {
                        for (int index3 = 1; index3 <= 11; ++index3)
                        {
                            str3 = str3 + "<td>" + (object)index3 + "</td>";
                        }
                    }
                    this.LotteryHeadLines = str3 + "</tr>";
                    string str4 = "<tr>" + "<td class=\"issue\">" + str1 + "</td>" + "<td align=\"center\" class=\"tdwth\">" + str2 + "</td>";
                    for (int index2 = 0; index2 < strArray2.Length; ++index2)
                    {
                        for (int index3 = 0; index3 <= 10; ++index3)
                        {
                            if (index3 + 1 == Convert.ToInt32(strArray2[index2]))
                            {
                                ++numArray1[index2, index3];
                                numArray2[index2, index3] = -1;
                                ++numArray4[index2, index3];
                                if (numArray3[index2, index3] < numArray4[index2, index3])
                                {
                                    numArray3[index2, index3] = numArray4[index2, index3];
                                }
                            }
                            else
                            {
                                numArray4[index2, index3] = 1;
                                ++numArray2[index2, index3];
                                if (numArray5[index2, index3] < numArray2[index2, index3])
                                {
                                    numArray5[index2, index3] = numArray2[index2, index3];
                                }
                            }
                            if (index3 + 1 == Convert.ToInt32(strArray2[index2]))
                            {
                                str4 = index2 % 2 != 0 ? str4 + "<td class=\"charball td1\"><div class=\"ball01\">" + strArray2[index2] + "</div></td>" : str4 + "<td class=\"charball td0\"><div class=\"ball01\">" + strArray2[index2] + "</div></td>";
                                ++numArray2[index2, index3];
                            }
                            else if (index2 % 2 == 0)
                            {
                                str4 = str4 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray2[index2, index3] + "</div></td>";
                            }
                            else
                            {
                                str4 = str4 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray2[index2, index3] + "</div></td>";
                            }
                        }
                    }
                    this.LotteryLines += str4 + "</tr>";
                }
                string str5 = "<tr>" + "<td colspan=\"2\">" + "当前最大连开" + "</td>";
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    for (int index2 = 0; index2 <= 10; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str5 = str5 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray3[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str5 = str5 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray3[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str6 = str5 + "</tr>";
                string str7 = "<tr>" + "<td colspan=\"2\">" + "当前最大遗漏" + "</td>";
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    for (int index2 = 0; index2 <= 10; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str7 = str7 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray5[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str7 = str7 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray5[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str8 = str7 + "</tr>";
                string str9 = "<tr>" + "<td colspan=\"2\">" + "当前出现次数" + "</td>";
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    for (int index2 = 0; index2 <= 10; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str9 = str9 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray1[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str9 = str9 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray1[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str10 = str9 + "</tr>";
                index  index = this;
                index.LotteryLines = index.LotteryLines + str10 + str6 + str8;
            }
            if (this.lotteryId.Substring(0, 1) == "3")
            {
                this.count       = 10;
                int[,] numArray1 = new int[3, 10];
                int[,] numArray2 = new int[3, 10];
                int[,] numArray3 = new int[3, 10];
                int[,] numArray4 = new int[3, 10];
                int[,] numArray5 = new int[3, 10];
                strArray1        = new string[3, 10];
                for (int index1 = 0; index1 < listDataTable.Rows.Count; ++index1)
                {
                    DataRow  row       = listDataTable.Rows[index1];
                    string   str1      = row["Title"].ToString();
                    string   str2      = row["Number"].ToString();
                    string[] strArray2 = str2.Split(',');
                    string   str3      = "<tr>" + "<td rowspan=\"2\" style=\"width:100px;\">期号</td>" + "<td rowspan=\"2\" style=\"width:100px;\">开奖号码</td>" + "<td colspan=\"10\">百位</td>" + "<td colspan=\"10\">十位</td>" + "<td colspan=\"10\">个位</td>" + "</tr>" + "<tr>";
                    for (int index2 = 0; index2 < strArray2.Length; ++index2)
                    {
                        for (int index3 = 0; index3 < 10; ++index3)
                        {
                            str3 = str3 + "<td>" + (object)index3 + "</td>";
                        }
                    }
                    this.LotteryHeadLines = str3 + "</tr>";
                    string str4 = "<tr>" + "<td class=\"issue\">" + str1 + "</td>" + "<td align=\"center\" class=\"tdwth\">" + str2 + "</td>";
                    for (int index2 = 0; index2 < strArray2.Length; ++index2)
                    {
                        for (int index3 = 0; index3 <= 9; ++index3)
                        {
                            if (index3 == Convert.ToInt32(strArray2[index2]))
                            {
                                ++numArray1[index2, index3];
                                numArray2[index2, index3] = -1;
                                ++numArray4[index2, index3];
                                if (numArray3[index2, index3] < numArray4[index2, index3])
                                {
                                    numArray3[index2, index3] = numArray4[index2, index3];
                                }
                            }
                            else
                            {
                                numArray4[index2, index3] = 0;
                                ++numArray2[index2, index3];
                                if (numArray5[index2, index3] < numArray2[index2, index3])
                                {
                                    numArray5[index2, index3] = numArray2[index2, index3];
                                }
                            }
                            if (index3 == Convert.ToInt32(strArray2[index2]))
                            {
                                str4 = index2 % 2 != 0 ? str4 + "<td class=\"charball td1\"><div class=\"ball01\">" + strArray2[index2] + "</div></td>" : str4 + "<td class=\"charball td0\"><div class=\"ball01\">" + strArray2[index2] + "</div></td>";
                                ++numArray2[index2, index3];
                            }
                            else if (index2 % 2 == 0)
                            {
                                str4 = str4 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray2[index2, index3] + "</div></td>";
                            }
                            else
                            {
                                str4 = str4 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray2[index2, index3] + "</div></td>";
                            }
                        }
                    }
                    this.LotteryLines += str4 + "</tr>";
                }
                string str5 = "<tr>" + "<td colspan=\"2\">" + "当前最大连开" + "</td>";
                for (int index1 = 0; index1 < 3; ++index1)
                {
                    for (int index2 = 0; index2 <= 9; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str5 = str5 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray3[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str5 = str5 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray3[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str6 = str5 + "</tr>";
                string str7 = "<tr>" + "<td colspan=\"2\">" + "当前最大遗漏" + "</td>";
                for (int index1 = 0; index1 < 3; ++index1)
                {
                    for (int index2 = 0; index2 <= 9; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str7 = str7 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray5[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str7 = str7 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray5[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str8 = str7 + "</tr>";
                string str9 = "<tr>" + "<td colspan=\"2\">" + "当前出现次数" + "</td>";
                for (int index1 = 0; index1 < 3; ++index1)
                {
                    for (int index2 = 0; index2 <= 9; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str9 = str9 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray1[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str9 = str9 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray1[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str10 = str9 + "</tr>";
                index  index = this;
                index.LotteryLines = index.LotteryLines + str10 + str6 + str8;
            }
            if (this.lotteryId.Substring(0, 1) == "4")
            {
                this.count       = 10;
                int[,] numArray1 = new int[10, 11];
                int[,] numArray2 = new int[10, 11];
                int[,] numArray3 = new int[10, 11];
                int[,] numArray4 = new int[10, 11];
                int[,] numArray5 = new int[10, 11];
                strArray1        = new string[10, 11];
                for (int index1 = 0; index1 < listDataTable.Rows.Count; ++index1)
                {
                    DataRow  row       = listDataTable.Rows[index1];
                    string   str1      = row["Title"].ToString();
                    string   str2      = row["Number"].ToString();
                    string[] strArray2 = str2.Split(',');
                    string   str3      = "<tr>" + "<td rowspan=\"2\" style=\"width:100px;\">期号</td>" + "<td rowspan=\"2\" style=\"width:100px;\">开奖号码</td>" + "<td colspan=\"10\">一</td>" + "<td colspan=\"10\">二</td>" + "<td colspan=\"10\">三</td>" + "<td colspan=\"10\">四</td>" + "<td colspan=\"10\">五</td>" + "<td colspan=\"10\">六</td>" + "<td colspan=\"10\">七</td>" + "<td colspan=\"10\">八</td>" + "<td colspan=\"10\">九</td>" + "<td colspan=\"10\">十</td>" + "</tr>" + "<tr>";
                    for (int index2 = 0; index2 < strArray2.Length; ++index2)
                    {
                        for (int index3 = 1; index3 <= 10; ++index3)
                        {
                            str3 = str3 + "<td>" + (object)index3 + "</td>";
                        }
                    }
                    this.LotteryHeadLines = str3 + "</tr>";
                    string str4 = "<tr>" + "<td class=\"issue\">" + str1 + "</td>" + "<td align=\"center\" class=\"tdwth\">" + str2 + "</td>";
                    for (int index2 = 0; index2 < strArray2.Length; ++index2)
                    {
                        for (int index3 = 0; index3 <= 9; ++index3)
                        {
                            if (index3 + 1 == Convert.ToInt32(strArray2[index2]))
                            {
                                ++numArray1[index2, index3];
                                numArray2[index2, index3] = -1;
                                ++numArray4[index2, index3];
                                if (numArray3[index2, index3] < numArray4[index2, index3])
                                {
                                    numArray3[index2, index3] = numArray4[index2, index3];
                                }
                            }
                            else
                            {
                                numArray4[index2, index3] = 1;
                                ++numArray2[index2, index3];
                                if (numArray5[index2, index3] < numArray2[index2, index3])
                                {
                                    numArray5[index2, index3] = numArray2[index2, index3];
                                }
                            }
                            if (index3 + 1 == Convert.ToInt32(strArray2[index2]))
                            {
                                str4 = index2 % 2 != 0 ? str4 + "<td class=\"charball td1\"><div class=\"ball01\">" + strArray2[index2] + "</div></td>" : str4 + "<td class=\"charball td0\"><div class=\"ball01\">" + strArray2[index2] + "</div></td>";
                                ++numArray2[index2, index3];
                            }
                            else if (index2 % 2 == 0)
                            {
                                str4 = str4 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray2[index2, index3] + "</div></td>";
                            }
                            else
                            {
                                str4 = str4 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray2[index2, index3] + "</div></td>";
                            }
                        }
                    }
                    this.LotteryLines += str4 + "</tr>";
                }
                string str5 = "<tr>" + "<td colspan=\"2\">" + "当前最大连开" + "</td>";
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    for (int index2 = 0; index2 <= 9; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str5 = str5 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray3[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str5 = str5 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray3[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str6 = str5 + "</tr>";
                string str7 = "<tr>" + "<td colspan=\"2\">" + "当前最大遗漏" + "</td>";
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    for (int index2 = 0; index2 <= 9; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str7 = str7 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray5[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str7 = str7 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray5[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str8 = str7 + "</tr>";
                string str9 = "<tr>" + "<td colspan=\"2\">" + "当前出现次数" + "</td>";
                for (int index1 = 0; index1 < 10; ++index1)
                {
                    for (int index2 = 0; index2 <= 9; ++index2)
                    {
                        if (index1 % 2 == 0)
                        {
                            str9 = str9 + "<td class=\"wdh td0\"><div class=\"ball14\">" + (object)numArray1[index1, index2] + "</div></td>";
                        }
                        else
                        {
                            str9 = str9 + "<td class=\"wdh td1\"><div class=\"ball14\">" + (object)numArray1[index1, index2] + "</div></td>";
                        }
                    }
                }
                string str10 = str9 + "</tr>";
                index  index = this;
                index.LotteryLines = index.LotteryLines + str10 + str6 + str8;
            }
        }
Example #22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (base.Request.QueryString["id"] != null)
     {
         this.lotteryId = base.Request.QueryString["id"].ToString();
     }
     this.LName        = LotteryUtils.LotteryTitle(Convert.ToInt32(this.lotteryId));
     this.LotteryLines = "";
     if (!base.IsPostBack)
     {
         int top = 50;
         if (base.Request["n"] != null)
         {
             top = Convert.ToInt32(base.Request["n"]);
         }
         DataTable listDataTable = new LotteryDataDAL().GetListDataTable(Convert.ToInt32(this.lotteryId), top);
         if (this.lotteryId.Substring(0, 1) == "1")
         {
             this.count       = 10;
             int[,] array     = new int[5, 10];
             int[,] array2    = new int[5, 10];
             int[,] array3    = new int[5, 10];
             int[,] array4    = new int[5, 10];
             int[,] array5    = new int[5, 10];
             string[,] array6 = new string[5, 10];
             for (int i = 0; i < listDataTable.Rows.Count; i++)
             {
                 DataRow  dataRow = listDataTable.Rows[i];
                 string   str     = dataRow["Title"].ToString();
                 string   text    = dataRow["Number"].ToString();
                 string[] array7  = text.Split(new char[]
                 {
                     ','
                 });
                 string text2 = "<tr>";
                 text2 += "<td rowspan=\"2\" style=\"width:100px;\">期号</td>";
                 text2 += "<td rowspan=\"2\" style=\"width:100px;\">开奖号码</td>";
                 text2 += "<td colspan=\"10\">万位</td>";
                 text2 += "<td colspan=\"10\">千位</td>";
                 text2 += "<td colspan=\"10\">百位</td>";
                 text2 += "<td colspan=\"10\">十位</td>";
                 text2 += "<td colspan=\"10\">个位</td>";
                 text2 += "</tr>";
                 text2 += "<tr>";
                 for (int j = 0; j < array7.Length; j++)
                 {
                     for (int k = 0; k < 10; k++)
                     {
                         object obj = text2;
                         text2 = string.Concat(new object[]
                         {
                             obj,
                             "<td>",
                             k,
                             "</td>"
                         });
                     }
                 }
                 text2 += "</tr>";
                 this.LotteryHeadLines = text2;
                 string text3 = "<tr>";
                 text3 += "<td class=\"issue\">";
                 text3 += str;
                 text3 += "</td>";
                 text3 += "<td align=\"center\" class=\"tdwth\">";
                 text3 += text;
                 text3 += "</td>";
                 for (int j = 0; j < array7.Length; j++)
                 {
                     for (int l = 0; l <= 9; l++)
                     {
                         if (l == Convert.ToInt32(array7[j]))
                         {
                             array[j, l]++;
                             array2[j, l] = -1;
                             array4[j, l]++;
                             if (array3[j, l] < array4[j, l])
                             {
                                 array3[j, l] = array4[j, l];
                             }
                         }
                         else
                         {
                             array4[j, l] = 0;
                             array2[j, l]++;
                             if (array5[j, l] < array2[j, l])
                             {
                                 array5[j, l] = array2[j, l];
                             }
                         }
                         if (l == Convert.ToInt32(array7[j]))
                         {
                             if (j % 2 == 0)
                             {
                                 text3 = text3 + "<td class=\"charball td0\"><div class=\"ball01\">" + array7[j] + "</div></td>";
                             }
                             else
                             {
                                 text3 = text3 + "<td class=\"charball td1\"><div class=\"ball01\">" + array7[j] + "</div></td>";
                             }
                             array2[j, l]++;
                         }
                         else if (j % 2 == 0)
                         {
                             object obj = text3;
                             text3 = string.Concat(new object[]
                             {
                                 obj,
                                 "<td class=\"wdh td0\"><div class=\"ball14\">",
                                 array2[j, l],
                                 "</div></td>"
                             });
                         }
                         else
                         {
                             object obj = text3;
                             text3 = string.Concat(new object[]
                             {
                                 obj,
                                 "<td class=\"wdh td1\"><div class=\"ball14\">",
                                 array2[j, l],
                                 "</div></td>"
                             });
                         }
                     }
                 }
                 text3             += "</tr>";
                 this.LotteryLines += text3;
             }
             string text4 = "<tr>";
             text4 += "<td colspan=\"2\">";
             text4 += "当前最大连开";
             text4 += "</td>";
             for (int j = 0; j < 5; j++)
             {
                 for (int l = 0; l <= 9; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text4;
                         text4 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array3[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text4;
                         text4 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array3[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text4 += "</tr>";
             string text5 = "<tr>";
             text5 += "<td colspan=\"2\">";
             text5 += "当前最大遗漏";
             text5 += "</td>";
             for (int j = 0; j < 5; j++)
             {
                 for (int l = 0; l <= 9; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text5;
                         text5 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array5[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text5;
                         text5 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array5[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text5 += "</tr>";
             string text6 = "<tr>";
             text6 += "<td colspan=\"2\">";
             text6 += "当前出现次数";
             text6 += "</td>";
             for (int j = 0; j < 5; j++)
             {
                 for (int l = 0; l <= 9; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text6;
                         text6 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text6;
                         text6 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text6            += "</tr>";
             this.LotteryLines = this.LotteryLines + text6 + text4 + text5;
         }
         if (this.lotteryId.Substring(0, 1) == "2")
         {
             this.count       = 11;
             int[,] array     = new int[5, 11];
             int[,] array2    = new int[5, 11];
             int[,] array3    = new int[5, 11];
             int[,] array4    = new int[5, 11];
             int[,] array5    = new int[5, 11];
             string[,] array6 = new string[5, 11];
             for (int i = 0; i < listDataTable.Rows.Count; i++)
             {
                 DataRow  dataRow = listDataTable.Rows[i];
                 string   str     = dataRow["Title"].ToString();
                 string   text    = dataRow["Number"].ToString();
                 string[] array7  = text.Split(new char[]
                 {
                     ','
                 });
                 string text2 = "<tr>";
                 text2 += "<td rowspan=\"2\" style=\"width:100px;\">期号</td>";
                 text2 += "<td rowspan=\"2\" style=\"width:100px;\">开奖号码</td>";
                 text2 += "<td colspan=\"11\">万位</td>";
                 text2 += "<td colspan=\"11\">千位</td>";
                 text2 += "<td colspan=\"11\">百位</td>";
                 text2 += "<td colspan=\"11\">十位</td>";
                 text2 += "<td colspan=\"11\">个位</td>";
                 text2 += "</tr>";
                 text2 += "<tr>";
                 for (int j = 0; j < array7.Length; j++)
                 {
                     for (int k = 1; k <= 11; k++)
                     {
                         object obj = text2;
                         text2 = string.Concat(new object[]
                         {
                             obj,
                             "<td>",
                             k,
                             "</td>"
                         });
                     }
                 }
                 text2 += "</tr>";
                 this.LotteryHeadLines = text2;
                 string text3 = "<tr>";
                 text3 += "<td class=\"issue\">";
                 text3 += str;
                 text3 += "</td>";
                 text3 += "<td align=\"center\" class=\"tdwth\">";
                 text3 += text;
                 text3 += "</td>";
                 for (int j = 0; j < array7.Length; j++)
                 {
                     for (int l = 0; l <= 10; l++)
                     {
                         if (l + 1 == Convert.ToInt32(array7[j]))
                         {
                             array[j, l]++;
                             array2[j, l] = -1;
                             array4[j, l]++;
                             if (array3[j, l] < array4[j, l])
                             {
                                 array3[j, l] = array4[j, l];
                             }
                         }
                         else
                         {
                             array4[j, l] = 1;
                             array2[j, l]++;
                             if (array5[j, l] < array2[j, l])
                             {
                                 array5[j, l] = array2[j, l];
                             }
                         }
                         if (l + 1 == Convert.ToInt32(array7[j]))
                         {
                             if (j % 2 == 0)
                             {
                                 text3 = text3 + "<td class=\"charball td0\"><div class=\"ball01\">" + array7[j] + "</div></td>";
                             }
                             else
                             {
                                 text3 = text3 + "<td class=\"charball td1\"><div class=\"ball01\">" + array7[j] + "</div></td>";
                             }
                             array2[j, l]++;
                         }
                         else if (j % 2 == 0)
                         {
                             object obj = text3;
                             text3 = string.Concat(new object[]
                             {
                                 obj,
                                 "<td class=\"wdh td0\"><div class=\"ball14\">",
                                 array2[j, l],
                                 "</div></td>"
                             });
                         }
                         else
                         {
                             object obj = text3;
                             text3 = string.Concat(new object[]
                             {
                                 obj,
                                 "<td class=\"wdh td1\"><div class=\"ball14\">",
                                 array2[j, l],
                                 "</div></td>"
                             });
                         }
                     }
                 }
                 text3             += "</tr>";
                 this.LotteryLines += text3;
             }
             string text4 = "<tr>";
             text4 += "<td colspan=\"2\">";
             text4 += "当前最大连开";
             text4 += "</td>";
             for (int j = 0; j < 5; j++)
             {
                 for (int l = 0; l <= 10; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text4;
                         text4 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array3[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text4;
                         text4 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array3[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text4 += "</tr>";
             string text5 = "<tr>";
             text5 += "<td colspan=\"2\">";
             text5 += "当前最大遗漏";
             text5 += "</td>";
             for (int j = 0; j < 5; j++)
             {
                 for (int l = 0; l <= 10; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text5;
                         text5 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array5[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text5;
                         text5 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array5[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text5 += "</tr>";
             string text6 = "<tr>";
             text6 += "<td colspan=\"2\">";
             text6 += "当前出现次数";
             text6 += "</td>";
             for (int j = 0; j < 5; j++)
             {
                 for (int l = 0; l <= 10; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text6;
                         text6 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text6;
                         text6 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text6            += "</tr>";
             this.LotteryLines = this.LotteryLines + text6 + text4 + text5;
         }
         if (this.lotteryId.Substring(0, 1) == "3")
         {
             this.count       = 10;
             int[,] array     = new int[3, 10];
             int[,] array2    = new int[3, 10];
             int[,] array3    = new int[3, 10];
             int[,] array4    = new int[3, 10];
             int[,] array5    = new int[3, 10];
             string[,] array6 = new string[3, 10];
             for (int i = 0; i < listDataTable.Rows.Count; i++)
             {
                 DataRow  dataRow = listDataTable.Rows[i];
                 string   str     = dataRow["Title"].ToString();
                 string   text    = dataRow["Number"].ToString();
                 string[] array7  = text.Split(new char[]
                 {
                     ','
                 });
                 string text2 = "<tr>";
                 text2 += "<td rowspan=\"2\" style=\"width:100px;\">期号</td>";
                 text2 += "<td rowspan=\"2\" style=\"width:100px;\">开奖号码</td>";
                 text2 += "<td colspan=\"10\">百位</td>";
                 text2 += "<td colspan=\"10\">十位</td>";
                 text2 += "<td colspan=\"10\">个位</td>";
                 text2 += "</tr>";
                 text2 += "<tr>";
                 for (int j = 0; j < array7.Length; j++)
                 {
                     for (int k = 0; k < 10; k++)
                     {
                         object obj = text2;
                         text2 = string.Concat(new object[]
                         {
                             obj,
                             "<td>",
                             k,
                             "</td>"
                         });
                     }
                 }
                 text2 += "</tr>";
                 this.LotteryHeadLines = text2;
                 string text3 = "<tr>";
                 text3 += "<td class=\"issue\">";
                 text3 += str;
                 text3 += "</td>";
                 text3 += "<td align=\"center\" class=\"tdwth\">";
                 text3 += text;
                 text3 += "</td>";
                 for (int j = 0; j < array7.Length; j++)
                 {
                     for (int l = 0; l <= 9; l++)
                     {
                         if (l == Convert.ToInt32(array7[j]))
                         {
                             array[j, l]++;
                             array2[j, l] = -1;
                             array4[j, l]++;
                             if (array3[j, l] < array4[j, l])
                             {
                                 array3[j, l] = array4[j, l];
                             }
                         }
                         else
                         {
                             array4[j, l] = 0;
                             array2[j, l]++;
                             if (array5[j, l] < array2[j, l])
                             {
                                 array5[j, l] = array2[j, l];
                             }
                         }
                         if (l == Convert.ToInt32(array7[j]))
                         {
                             if (j % 2 == 0)
                             {
                                 text3 = text3 + "<td class=\"charball td0\"><div class=\"ball01\">" + array7[j] + "</div></td>";
                             }
                             else
                             {
                                 text3 = text3 + "<td class=\"charball td1\"><div class=\"ball01\">" + array7[j] + "</div></td>";
                             }
                             array2[j, l]++;
                         }
                         else if (j % 2 == 0)
                         {
                             object obj = text3;
                             text3 = string.Concat(new object[]
                             {
                                 obj,
                                 "<td class=\"wdh td0\"><div class=\"ball14\">",
                                 array2[j, l],
                                 "</div></td>"
                             });
                         }
                         else
                         {
                             object obj = text3;
                             text3 = string.Concat(new object[]
                             {
                                 obj,
                                 "<td class=\"wdh td1\"><div class=\"ball14\">",
                                 array2[j, l],
                                 "</div></td>"
                             });
                         }
                     }
                 }
                 text3             += "</tr>";
                 this.LotteryLines += text3;
             }
             string text4 = "<tr>";
             text4 += "<td colspan=\"2\">";
             text4 += "当前最大连开";
             text4 += "</td>";
             for (int j = 0; j < 3; j++)
             {
                 for (int l = 0; l <= 9; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text4;
                         text4 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array3[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text4;
                         text4 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array3[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text4 += "</tr>";
             string text5 = "<tr>";
             text5 += "<td colspan=\"2\">";
             text5 += "当前最大遗漏";
             text5 += "</td>";
             for (int j = 0; j < 3; j++)
             {
                 for (int l = 0; l <= 9; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text5;
                         text5 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array5[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text5;
                         text5 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array5[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text5 += "</tr>";
             string text6 = "<tr>";
             text6 += "<td colspan=\"2\">";
             text6 += "当前出现次数";
             text6 += "</td>";
             for (int j = 0; j < 3; j++)
             {
                 for (int l = 0; l <= 9; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text6;
                         text6 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text6;
                         text6 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text6            += "</tr>";
             this.LotteryLines = this.LotteryLines + text6 + text4 + text5;
         }
         if (this.lotteryId.Substring(0, 1) == "4")
         {
             this.count       = 10;
             int[,] array     = new int[10, 11];
             int[,] array2    = new int[10, 11];
             int[,] array3    = new int[10, 11];
             int[,] array4    = new int[10, 11];
             int[,] array5    = new int[10, 11];
             string[,] array6 = new string[10, 11];
             for (int i = 0; i < listDataTable.Rows.Count; i++)
             {
                 DataRow  dataRow = listDataTable.Rows[i];
                 string   str     = dataRow["Title"].ToString();
                 string   text    = dataRow["Number"].ToString();
                 string[] array7  = text.Split(new char[]
                 {
                     ','
                 });
                 string text2 = "<tr>";
                 text2 += "<td rowspan=\"2\" style=\"width:100px;\">期号</td>";
                 text2 += "<td rowspan=\"2\" style=\"width:100px;\">开奖号码</td>";
                 text2 += "<td colspan=\"10\">一</td>";
                 text2 += "<td colspan=\"10\">二</td>";
                 text2 += "<td colspan=\"10\">三</td>";
                 text2 += "<td colspan=\"10\">四</td>";
                 text2 += "<td colspan=\"10\">五</td>";
                 text2 += "<td colspan=\"10\">六</td>";
                 text2 += "<td colspan=\"10\">七</td>";
                 text2 += "<td colspan=\"10\">八</td>";
                 text2 += "<td colspan=\"10\">九</td>";
                 text2 += "<td colspan=\"10\">十</td>";
                 text2 += "</tr>";
                 text2 += "<tr>";
                 for (int j = 0; j < array7.Length; j++)
                 {
                     for (int k = 1; k <= 10; k++)
                     {
                         object obj = text2;
                         text2 = string.Concat(new object[]
                         {
                             obj,
                             "<td>",
                             k,
                             "</td>"
                         });
                     }
                 }
                 text2 += "</tr>";
                 this.LotteryHeadLines = text2;
                 string text3 = "<tr>";
                 text3 += "<td class=\"issue\">";
                 text3 += str;
                 text3 += "</td>";
                 text3 += "<td align=\"center\" class=\"tdwth\">";
                 text3 += text;
                 text3 += "</td>";
                 for (int j = 0; j < array7.Length; j++)
                 {
                     for (int l = 0; l <= 9; l++)
                     {
                         if (l + 1 == Convert.ToInt32(array7[j]))
                         {
                             array[j, l]++;
                             array2[j, l] = -1;
                             array4[j, l]++;
                             if (array3[j, l] < array4[j, l])
                             {
                                 array3[j, l] = array4[j, l];
                             }
                         }
                         else
                         {
                             array4[j, l] = 1;
                             array2[j, l]++;
                             if (array5[j, l] < array2[j, l])
                             {
                                 array5[j, l] = array2[j, l];
                             }
                         }
                         if (l + 1 == Convert.ToInt32(array7[j]))
                         {
                             if (j % 2 == 0)
                             {
                                 text3 = text3 + "<td class=\"charball td0\"><div class=\"ball01\">" + array7[j] + "</div></td>";
                             }
                             else
                             {
                                 text3 = text3 + "<td class=\"charball td1\"><div class=\"ball01\">" + array7[j] + "</div></td>";
                             }
                             array2[j, l]++;
                         }
                         else if (j % 2 == 0)
                         {
                             object obj = text3;
                             text3 = string.Concat(new object[]
                             {
                                 obj,
                                 "<td class=\"wdh td0\"><div class=\"ball14\">",
                                 array2[j, l],
                                 "</div></td>"
                             });
                         }
                         else
                         {
                             object obj = text3;
                             text3 = string.Concat(new object[]
                             {
                                 obj,
                                 "<td class=\"wdh td1\"><div class=\"ball14\">",
                                 array2[j, l],
                                 "</div></td>"
                             });
                         }
                     }
                 }
                 text3             += "</tr>";
                 this.LotteryLines += text3;
             }
             string text4 = "<tr>";
             text4 += "<td colspan=\"2\">";
             text4 += "当前最大连开";
             text4 += "</td>";
             for (int j = 0; j < 10; j++)
             {
                 for (int l = 0; l <= 9; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text4;
                         text4 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array3[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text4;
                         text4 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array3[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text4 += "</tr>";
             string text5 = "<tr>";
             text5 += "<td colspan=\"2\">";
             text5 += "当前最大遗漏";
             text5 += "</td>";
             for (int j = 0; j < 10; j++)
             {
                 for (int l = 0; l <= 9; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text5;
                         text5 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array5[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text5;
                         text5 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array5[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text5 += "</tr>";
             string text6 = "<tr>";
             text6 += "<td colspan=\"2\">";
             text6 += "当前出现次数";
             text6 += "</td>";
             for (int j = 0; j < 10; j++)
             {
                 for (int l = 0; l <= 9; l++)
                 {
                     if (j % 2 == 0)
                     {
                         object obj = text6;
                         text6 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td0\"><div class=\"ball14\">",
                             array[j, l],
                             "</div></td>"
                         });
                     }
                     else
                     {
                         object obj = text6;
                         text6 = string.Concat(new object[]
                         {
                             obj,
                             "<td class=\"wdh td1\"><div class=\"ball14\">",
                             array[j, l],
                             "</div></td>"
                         });
                     }
                 }
             }
             text6            += "</tr>";
             this.LotteryLines = this.LotteryLines + text6 + text4 + text5;
         }
     }
 }
Example #23
0
        private void ajaxIndexLottery()
        {
            string text = "";

            this.doh.Reset();
            this.doh.SqlCmd = "select row_number() over (order by Sort asc) as rowid,* from [Sys_Lottery] where IsOpen=0 and Id in (1001,1004,1009,1016,2001,3002) order by Sort asc";
            DataTable dataTable = this.doh.GetDataTable();

            if (dataTable.Rows.Count > 0)
            {
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    string text2 = dataTable.Rows[i]["Id"].ToString();
                    string text3 = "{\"rowid\": \"排序Id\",\"tid\": \"类别Id\",\"id\": \"彩种Id\",\"name\": \"名称\",\"ordertime\": \"倒计时\",\"remark\": \"说明\"}";
                    text3 = text3.Replace("名称", LotteryUtils.LotteryTitle(Convert.ToInt32(text2))).Replace("排序Id", dataTable.Rows[i]["rowid"].ToString()).Replace("类别Id", dataTable.Rows[i]["LType"].ToString()).Replace("彩种Id", text2).Replace("说明", dataTable.Rows[i]["IphoneRemark"].ToString());
                    DateTime d        = DateTime.Now;
                    DateTime dateTime = base.GetDateTime();
                    string   text4    = dateTime.ToString("yyyyMMdd");
                    string   text5    = dateTime.ToString("HH:mm:ss");
                    string   text6    = dateTime.ToString("yyyy-MM-dd");
                    TimeSpan timeSpan;
                    if (text2 == "3002" || text2 == "3003")
                    {
                        string value = dateTime.ToString("yyyy-MM-dd") + " 20:30:00";
                        if (dateTime > Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " 20:30:00"))
                        {
                            value = dateTime.AddDays(1.0).ToString("yyyy-MM-dd") + " 20:30:00";
                        }
                        timeSpan = Convert.ToDateTime(value) - dateTime;
                    }
                    else
                    {
                        if (UserCenterSession.LotteryTime == null)
                        {
                            UserCenterSession.LotteryTime = new LotteryTimeDAL().GetTable();
                        }
                        DataRow[] array = UserCenterSession.LotteryTime.Select(string.Concat(new object[]
                        {
                            "Time >'",
                            text5,
                            "' and LotteryId=",
                            text2
                        }), "Time asc");
                        if (array.Length == 0)
                        {
                            array = UserCenterSession.LotteryTime.Select(string.Concat(new object[]
                            {
                                "Time <='",
                                text5,
                                "' and LotteryId=",
                                text2
                            }), "Time asc");
                        }
                        d = Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " " + array[0]["Time"].ToString());
                        if (Convert.ToDateTime(array[0]["Time"].ToString()) < Convert.ToDateTime(text5))
                        {
                            d = Convert.ToDateTime(dateTime.AddDays(1.0).ToString("yyyy-MM-dd") + " " + array[0]["Time"].ToString());
                        }
                        timeSpan = d - Convert.ToDateTime(text5);
                    }
                    string newValue = string.Concat((timeSpan.Days * 24 * 60 * 60 + timeSpan.Hours * 60 * 60 + timeSpan.Minutes * 60 + timeSpan.Seconds) * 1000);
                    text3 = text3.Replace("倒计时", newValue);
                    text  = text + text3 + ",";
                }
                this._response = "{\"result\":\"1\",\"table\": [" + text.Substring(0, text.Length - 1) + "]}";
            }
            else
            {
                this._response = "{\"result\":\"0\",\"table\": []}";
            }
        }
Example #24
0
        public ActionResult PluginsLottery(Guid Id, string t)
        {
            try
            {
                if (Id == Guid.Empty)
                {
                    Log4NetImpl.Write("ScoreSYS-PluginLottery:ID is NULL");
                    return(Json(new { isOK = false, error_code = "ERR_ArgNotExist" })); //message = "参数有误,请检查!" });
                }

                if (MpUserID == Guid.Empty)
                {
                    string rawUrl = "http://wx.ssrcb.com/ScoreSys/PluginLottery?id=" + WebHelper.GetGuid("Id", Guid.Empty);
                    if (string.IsNullOrEmpty(RQuery["openid"]))
                    {
                        Log4NetImpl.Write("ScoreSYS-PluginLottery:Redirect");
                        return(Json(new { isOK = false, isLogin = true, error_code = "ERR_NotLogin", message = string.Format("https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri=http://wx.ssrcb.com/mpuser/autologin?refUrl={1}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect", MpCenterCache.AppID, rawUrl) }));
                    }
                }

                string Score_Plugin_Title        = Request.Form["Score_Plugin_Title"];
                string Score_Plugin_StartDate    = Request.Form["Score_Plugin_StartDate"];
                string Score_Plugin_EndDate      = Request.Form["Score_Plugin_EndDate"];
                string Score_Plugin_UsePoint     = Request.Form["Score_Plugin_UsePoint"];
                string Score_Plugin_FailsTimes   = Request.Form["Score_Plugin_FailsTimes"];
                string Score_Plugin_FailsAddOdds = Request.Form["Score_Plugin_FailsAddOdds"];
                if (Score_Plugin_Title == "")
                {
                    return(Json(new { isOK = false, error_code = "ERR_PluginNotExits" }));
                }
                if (!string.IsNullOrEmpty(Score_Plugin_StartDate))
                {
                    DateTime startDate = TypeConverter.StrToDateTime(Score_Plugin_StartDate);
                    if (startDate > DateTime.Now)
                    {
                        return(Json(new { isOK = false, error_code = "ERR_PluginNotStart" }));
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(Score_Plugin_EndDate))
                        {
                            DateTime endDate = TypeConverter.StrToDateTime(Score_Plugin_EndDate);
                            if (endDate < DateTime.Now)
                            {
                                return(Json(new { isOK = false, error_code = "ERR_PluginIsEnd" }));// message = "对不起,抽奖已经结束!" });
                            }
                        }
                    }
                }

                IList <ScoreStoreItem> scoreStoreItems = _scoreStoreItemServiceService.GetList("from ScoreStoreItem where BaseId = '" + Id.ToString() + "'");
                scoreStoreItems.OrderBy(storeItems => storeItems.PluginName);
                ScoreUser scoreUser = _scoreUserService.GetUnique("from ScoreUser where (MpUserId ='" + this.MpUserID.ToString() + "')");

                if (scoreUser == null)
                {
                    return(Json(new { isOK = false, isVertfy = true, error_code = "ERR_UserNotVerify" }));
                }
                if (scoreUser.CurrentScore < ViewData.GetInt("Score_Plugin_UsePoint"))
                {
                    return(Json(new { isOK = false, error_code = "ERR_UserUseOutChance" }));
                }

                int prizeItemCount = scoreStoreItems.Count;// TypeConverter.StrToInt(ViewBag.Cst_Plugin_PrizeCount, 12);

                IList <PrizeGift> prizeGift      = new List <PrizeGift>(prizeItemCount);
                IList <Double>    prizeItems     = new List <Double>(prizeItemCount);
                IList <string>    prizeItemsName = new List <string>(prizeItemCount);
                IList <int>       prizeAngle     = new List <int>(prizeItemCount);
                prizeItemsName.Add("一");
                prizeItemsName.Add("二");
                prizeItemsName.Add("三");
                prizeItemsName.Add("四");
                prizeItemsName.Add("五");
                prizeItemsName.Add("六");
                prizeItemsName.Add("七");
                prizeItemsName.Add("八");
                prizeItemsName.Add("九");
                prizeItemsName.Add("十");
                prizeItemsName.Add("十一");
                prizeItemsName.Add("十二");
                for (int i = 0; i < prizeItemCount; i++)
                {
                    ScoreStoreItem storeItem = scoreStoreItems[i];
                    PrizeGift      gift      = new PrizeGift();
                    gift.ID                = i;
                    gift.Name              = storeItem.PluginName;
                    gift.Alias_Name        = storeItem.AliasName;
                    gift.Odds              = Convert.ToDouble(storeItem.PrizePercent) / 100;
                    gift.Pic               = storeItem.ItemPic;
                    gift.Quantity          = storeItem.TotalCount;
                    gift.Leavings_Quantity = storeItem.LeftCount;

                    gift.Angle = Convert.ToInt32(storeItem.PrizeAngle);
                    prizeAngle.Add(gift.Angle);
                    gift.Prize_Name = prizeItemsName[i] + "等奖";
                    if (!string.IsNullOrEmpty(gift.Alias_Name))
                    {
                        gift.Prize_Name = gift.Alias_Name;
                    }
                    gift.Has_Gift = 1;// ViewData.GetInt("Cst_Plugin_Items_Has_Gift" + i.ToString());
                    //gift.Users = ViewData.GetString("Cst_Plugin_Items_SiteUsers" + i.ToString());
                    //gift.UsersName = ViewData.GetString("Cst_Plugin_Items_SiteUsersName" + i.ToString());
                    prizeItems.Add(gift.Odds);
                    prizeGift.Add(gift);
                }

                prizeItems.OrderBy(d => d);


                //verifyCodeDetail.LeaveCount = verifyCodeDetail.LeaveCount - 1;
                //verifyCodeDetail.UseDate = DateTime.Now;
                //_pluginSceneVerifyCodeDetailService.Update(verifyCodeDetail);

                int count    = _scorePluginResultService.GetCount("from ScorePluginResult where pluginId='" + Id.ToString() + "' and MpUserId='" + this.MpUserID.ToString() + "'");
                int tryCount = _scoreConsumeInfoService.GetCount(" from ScoreConsumeInfo where ConsumeType = " + (int)ScoreConsume.Plugins + "");
                if (count == 0 &&  tryCount > Convert.ToInt32(Score_Plugin_FailsTimes))
                {
                    PrizeGift _lastGift = prizeGift.Last();

                    double finalOdds = _lastGift.Odds * (1 + Convert.ToInt32(Score_Plugin_FailsAddOdds));
                    _lastGift.Odds = finalOdds;
                    prizeItems.RemoveAt(prizeItems.Count - 1);
                    prizeItems.Add(finalOdds);
                }

                int result = -1;

                scoreUser.CurrentScore       = scoreUser.CurrentScore - Convert.ToInt32(Score_Plugin_UsePoint);// ViewData.GetInt("Score_Plugin_UsePoint");
                scoreUser.LastUpdateDateTime = DateTime.Now;
                _scoreUserService.Update(scoreUser);

                #region 更新积分消耗纪录
                ScoreConsumeInfo scoreConSumeInfo = new ScoreConsumeInfo();
                scoreConSumeInfo.ConsumeDateTime = scoreConSumeInfo.CreateDate = DateTime.Now;
                scoreConSumeInfo.MpUserId        = this.MpUserID;
                scoreConSumeInfo.ConsumeType     = (int)(ScoreConsume.Plugins);
                scoreConSumeInfo.ConsumePoints   = -Convert.ToInt32(Score_Plugin_UsePoint);
                scoreConSumeInfo.Summary         = "抽奖消耗了" + Convert.ToInt32(Score_Plugin_UsePoint) + "积分";
                _scoreConsumeInfoService.Insert(scoreConSumeInfo);
                #endregion
                result = LotteryUtils.Lottery(prizeItems, prizeGift, prizeItemCount, this.MpUserID, Id);


                if (result == -1)
                {
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));//Json(new PrizeGift() { ID = -1, Name = "未中奖", Odds = 0.00d, Pic = "", Quantity = 100000, Angle = 240, Prize_Name = "继续加油" });
                }
                else if (result == -2)
                {
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));// Json(new PrizeGift() { ID = -2, Name = "未中奖", Odds = 0.00d, Pic = "", Quantity = 100000, Angle = 180, Prize_Name = "继续加油" });
                }
                else if (result == -3)
                {
                    return(Json(new { isOK = true, error_code = "ERR_RunOutOfGift" }));// Json(new PrizeGift() { ID = -2, Name = "未中奖", Odds = 0.00d, Pic = "", Quantity = 100000, Angle = 180, Prize_Name = "继续加油" });
                }
                else
                {
                    PrizeGift      hasPrizeGift   = prizeGift[result];
                    ScoreStoreItem scoreStoreItem = scoreStoreItems[result];
                    //ScoreStoreItem scoreStoreItem = _scoreStoreItemServiceService.GetUnique("from ScoreStoreItem where (Id ='" + this.MpUserID.ToString() + "')");
                    //score
                    hasPrizeGift.Alias_Name = hasPrizeGift.Alias_Name ?? "";
                    if (scoreStoreItem.LeftCount > 0)
                    {
                        //中奖业务处理
                        ScorePluginResult pluginSceneResult = new ScorePluginResult();
                        pluginSceneResult.Address     = "";
                        pluginSceneResult.CreateDate  = DateTime.Now;
                        pluginSceneResult.Type        = 1;
                        pluginSceneResult.IsUse       = 0;
                        pluginSceneResult.MobilePhone = "";
                        pluginSceneResult.Name        = "";
                        pluginSceneResult.Phone       = "";
                        pluginSceneResult.PluginId    = Id;
                        pluginSceneResult.MpUserId    = this.MpUserID;
                        pluginSceneResult.SN          = "";
                        pluginSceneResult.UserName    = (string.IsNullOrEmpty(this.Name) ? this.NickName : this.Name);

                        if (this.MpUserArr != null)
                        {
                            pluginSceneResult.Summary = "恭喜用户[" + (string.IsNullOrEmpty(this.Name) ? this.NickName : this.Name) + "]获得" + hasPrizeGift.Prize_Name + "[" + hasPrizeGift.Name + "]";
                        }
                        else
                        {
                            pluginSceneResult.Summary = "恭喜匿名用户获得" + hasPrizeGift.Prize_Name + "[" + hasPrizeGift.Name + "]";
                        }
                        //pluginSceneResult.Value = "<?xml version=\"1.0\" encoding=\"utf-8\"?><PluginSubmit><Cst_Plugin_ItemIndex>" + result.ToString() + "</Cst_Plugin_ItemIndex><Cst_Plugin_PrizeLevel>" + hasPrizeGift.Prize_Name + "</Cst_Plugin_PrizeLevel><Cst_Plugin_PrizeName>" + hasPrizeGift.Name + "</Cst_Plugin_PrizeName></PluginSubmit>";
                        pluginSceneResult.Value = hasPrizeGift.Prize_Name + "++" + hasPrizeGift.Name;

                        #region 更新商城数量
                        scoreStoreItem.LeftCount -= 1;
                        _scoreStoreItemServiceService.Update(scoreStoreItem);
                        #endregion
                        #region 更新中奖纪录
                        _scorePluginResultService.Insert(pluginSceneResult);
                        #endregion
                        #region 更新虚拟积分纪录
                        if (scoreStoreItem.VirtualGift > 0)
                        {
                            scoreUser.CurrentScore += scoreStoreItem.VirtualGift;
                            _scoreUserService.Update(scoreUser);


                            ScoreConsumeInfo scoreConSumeInfo2 = new ScoreConsumeInfo();
                            scoreConSumeInfo2.ConsumeDateTime = scoreConSumeInfo.CreateDate = DateTime.Now;
                            scoreConSumeInfo2.MpUserId        = this.MpUserID;
                            scoreConSumeInfo2.ConsumeType     = (int)(ScoreConsume.Plugins);
                            scoreConSumeInfo2.ConsumePoints   = scoreStoreItem.VirtualGift;
                            scoreConSumeInfo2.Summary         = "抽奖中了" + scoreStoreItem.VirtualGift + "积分";
                            _scoreConsumeInfoService.Insert(scoreConSumeInfo2);
                        }
                        #endregion
                        hasPrizeGift.ResultID = pluginSceneResult.Id;
                    }

                    return(Content(JsonConvert.SerializeObject(hasPrizeGift), "text/javascript"));
                }
            }
            catch (Exception ex)
            {
                throw new OceanException(ex.Message, ex);
            }
        }
Example #25
0
        private void ajaxLotteryTime()
        {
            string text  = base.q("lid");
            string text2 = "{\"name\": \"名称\",\"lotteryid\": \"彩种类别\",\"ordertime\": \"倒计时\",\"closetime\": \"封单时间\",\"nestsn\": \"下期期号\",\"cursn\": \"当前期号\"}";

            text2 = text2.Replace("名称", LotteryUtils.LotteryTitle(Convert.ToInt32(text))).Replace("彩种类别", text);
            DateTime d        = DateTime.Now;
            DateTime dateTime = base.GetDateTime();
            string   str      = dateTime.ToString("yyyyMMdd");
            string   text3    = dateTime.ToString("HH:mm:ss");
            string   text4    = dateTime.ToString("yyyy-MM-dd");

            this.doh.Reset();
            this.doh.SqlCmd = "select dbo.f_GetCloseTime(" + text + ") as closetime";
            DataTable dataTable = this.doh.GetDataTable();

            text2 = text2.Replace("封单时间", dataTable.Rows[0]["closetime"].ToString());
            string   text6;
            string   text7;
            TimeSpan timeSpan;

            if (text == "3002" || text == "3003")
            {
                DateTime dateTime2 = Convert.ToDateTime(dateTime.Year.ToString() + "-01-01 20:30:00");
                this.doh.Reset();
                this.doh.SqlCmd = string.Concat(new string[]
                {
                    "select datediff(d,'",
                    dateTime2.ToString("yyyy-MM-dd HH:mm:ss"),
                    "','",
                    dateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    "') as d"
                });
                DataTable dataTable2 = this.doh.GetDataTable();
                int       num        = Convert.ToInt32(dataTable2.Rows[0]["d"]) - 7;
                num++;
                string text5 = dateTime.AddDays(-1.0).ToString("yyyy-MM-dd") + " 20:30:00";
                string value = dateTime.ToString("yyyy-MM-dd") + " 20:30:00";
                if (dateTime > Convert.ToDateTime(dateTime.ToString(" 20:30:00")))
                {
                    value = dateTime.AddDays(1.0).ToString("yyyy-MM-dd") + " 20:30:00";
                }
                else
                {
                    num--;
                }
                text6    = dateTime.Year.ToString() + Func.AddZero(num, 3);
                text7    = dateTime.Year.ToString() + Func.AddZero(num + 1, 3);
                timeSpan = Convert.ToDateTime(value) - Convert.ToDateTime(text3);
            }
            else
            {
                if (UserCenterSession.LotteryTime == null)
                {
                    UserCenterSession.LotteryTime = new LotteryTimeDAL().GetTable();
                }
                DataRow[] array = UserCenterSession.LotteryTime.Select(string.Concat(new object[]
                {
                    "Time >'",
                    text3,
                    "' and LotteryId=",
                    text
                }), "Time asc");
                if (array.Length == 0)
                {
                    array = UserCenterSession.LotteryTime.Select(string.Concat(new object[]
                    {
                        "Time <='",
                        text3,
                        "' and LotteryId=",
                        text
                    }), "Time asc");
                    text7 = dateTime.AddDays(1.0).ToString("yyyyMMdd") + "-" + array[0]["Sn"].ToString();
                }
                else
                {
                    text7 = str + "-" + array[0]["Sn"].ToString();
                    d     = Convert.ToDateTime(array[0]["Time"].ToString());
                    if (dateTime > Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " 00:00:00") && dateTime < Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " 10:00:01"))
                    {
                        if (text == "1003")
                        {
                            text7 = dateTime.AddDays(-1.0).ToString("yyyyMMdd") + "-" + array[0]["Sn"].ToString();
                        }
                    }
                }
                if (Convert.ToDateTime(array[0]["Time"].ToString()) < Convert.ToDateTime(text3))
                {
                    d = Convert.ToDateTime(dateTime.AddDays(1.0).ToString("yyyy-MM-dd") + " " + array[0]["Time"].ToString());
                }
                timeSpan = d - Convert.ToDateTime(text3);
                DataRow[] array2 = UserCenterSession.LotteryTime.Select(string.Concat(new object[]
                {
                    "Time <'",
                    text3,
                    "' and LotteryId=",
                    text
                }), "Time desc");
                if (array2.Length == 0)
                {
                    array2 = UserCenterSession.LotteryTime.Select(string.Concat(new object[]
                    {
                        "LotteryId=",
                        text
                    }), "Time desc");
                    text6 = dateTime.AddDays(-1.0).ToString("yyyyMMdd") + "-" + array2[0]["Sn"].ToString();
                }
                else
                {
                    text6 = str + "-" + array2[0]["Sn"].ToString();
                    if (dateTime > Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " 00:00:00") && dateTime < Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " 10:00:01"))
                    {
                        if (text == "1003")
                        {
                            text6 = dateTime.AddDays(-1.0).ToString("yyyyMMdd") + "-" + array2[0]["Sn"].ToString();
                        }
                    }
                }
                if (text == "1010" || text == "1017" || text == "3004")
                {
                    text6 = string.Concat(new LotteryTimeDAL().GetTsIssueNum(text) + Convert.ToInt32(array2[0]["Sn"].ToString()));
                    text7 = string.Concat(Convert.ToInt32(text6) + 1);
                }
                if (text == "1012")
                {
                    text6 = string.Concat(new LotteryTimeDAL().GetTsIssueNum("1012") + Convert.ToInt32(array2[0]["Sn"].ToString()));
                    text7 = string.Concat(Convert.ToInt32(text6) + 1);
                }
                if (text == "1013")
                {
                    text6 = string.Concat(new LotteryTimeDAL().GetTsIssueNum("1013") + Convert.ToInt32(array2[0]["Sn"].ToString()));
                    text7 = string.Concat(Convert.ToInt32(text6) + 1);
                }
                if (text == "1014" || text == "1015" || text == "1016")
                {
                    text6 = text6.Replace("-", "");
                    text7 = text7.Replace("-", "");
                }
                if (text == "1011" || text == "3005")
                {
                    text6 = string.Concat(new LotteryTimeDAL().GetTsIssueNum("1011") + Convert.ToInt32(array2[0]["Sn"].ToString()));
                    text7 = string.Concat(Convert.ToInt32(text6) + 1);
                }
                if (text == "4001")
                {
                    text6 = string.Concat(new LotteryTimeDAL().GetTsIssueNum("4001") + Convert.ToInt32(array2[0]["Sn"].ToString()));
                    text7 = string.Concat(Convert.ToInt32(text6) + 1);
                }
                if (text == "1005")
                {
                    string text8 = string.Concat(Convert.ToInt32(array2[0]["Sn"].ToString()) - 1);
                    if (text8.Length == 1)
                    {
                        text8 = "000" + text8;
                    }
                    if (text8.Length == 2)
                    {
                        text8 = "00" + text8;
                    }
                    if (text8.Length == 3)
                    {
                        text8 = "0" + text8;
                    }
                    string text9 = string.Concat(Convert.ToInt32(array2[0]["Sn"].ToString()));
                    if (text9.Length == 1)
                    {
                        text9 = "000" + text9;
                    }
                    if (text9.Length == 2)
                    {
                        text9 = "00" + text9;
                    }
                    if (text9.Length == 3)
                    {
                        text9 = "0" + text9;
                    }
                    text6 = dateTime.ToString("yyyyMMdd") + "-" + text8;
                    text7 = dateTime.ToString("yyyyMMdd") + "-" + text9;
                }
            }
            string newValue = string.Concat(timeSpan.Days * 24 * 60 * 60 + timeSpan.Hours * 60 * 60 + timeSpan.Minutes * 60 + timeSpan.Seconds);

            text2          = text2.Replace("下期期号", text7).Replace("当前期号", text6).Replace("倒计时", newValue);
            this._response = text2;
        }