Exemplo n.º 1
0
    private DataTable GetLotteryNumberAnalyse_Save(DataTable dtScheme)
    {
        if (dtScheme == null)
        {
            return(null);
        }
        try
        {
            dtScheme.Columns.Add("BetCount", Type.GetType("System.String"));
            dtScheme.Columns.Add("BetWay", Type.GetType("System.String"));
        }
        catch { }
        foreach (DataRow dr in dtScheme.Rows)
        {
            string LotteryNumber = "";

            int    BetCount = 0;  // 投注场次
            string Odds     = ""; // 投注赔率
            try
            {
                LotteryNumber = dr["LotteryNumber"].ToString();
                Odds          = dr["Odds"].ToString();
            }
            catch
            {
                continue;
            }
            string LotteryNumberResult = "";    // 处理后的结果

            if (String.IsNullOrEmpty(LotteryNumber))
            {
                continue;
            }
            if (LotteryNumber.Split(';').Length != 3)
            {
                continue;
            }

            string PlayType, Content, Way = "";

            try
            {
                PlayType = LotteryNumber.Split(';')[0];
                Content  = LotteryNumber.Split(';')[1];
                Way      = LotteryNumber.Split(';')[2];
            }
            catch
            {
                continue;
            }

            // 解析Content
            string[] MatchsAndResult = Content.Substring(1, Content.Length - 1).Split('|');
            // MatchID
            string MatchIDs = "";
            // 胜平负
            string result = "";
            // 周一001
            string MatchNumber = "";

            foreach (string val in MatchsAndResult)
            {
                MatchIDs += val.Split('(')[0] + ",";
                // 去掉尾部')'
                result += val.Split('(')[1].Substring(0, val.Split('(')[1].Length - 1) + ",";
            }

            if (MatchIDs.EndsWith(","))
            {
                MatchIDs = MatchIDs.Substring(0, MatchIDs.Length - 1);
            }
            if (result.EndsWith(","))
            {
                result = result.Substring(0, result.Length - 1);
            }
            if (result.EndsWith(")"))
            {
                result = result.Substring(0, result.Length - 1);
            }

            if (string.IsNullOrEmpty(MatchIDs))
            {
                continue;
            }


            // 通过MatchID 查找内容

            DataTable dtMatch = new DAL.Tables.T_Match().Open("StopSellingTime , MatchNumber", "id in (" + MatchIDs + ")", "");
            if (dtMatch == null)
            {
                continue;
            }
            if (dtMatch.Rows.Count < 1)
            {
                continue;
            }

            foreach (DataRow mdr in dtMatch.Rows)
            {
                if (mdr["MatchNumber"] != null)
                {
                    MatchNumber += mdr["MatchNumber"].ToString() + ",";
                }
                dr["EndTime"] = mdr["StopSellingTime"].ToString();
            }

            if (MatchNumber.EndsWith(","))
            {
                MatchNumber = MatchNumber.Substring(0, MatchNumber.Length - 1);
            }

            // 得到投注场次
            BetCount = MatchIDs.Split(',').Length;

            // 拼接LotteryNumber
            for (int x = 0; x < MatchIDs.Split(',').Length; x++)
            {
                string m = MatchNumber.Split(',')[x];
                string r = GetResult(result.Split(',')[x], PlayType);
                string o = Odds.Split('|')[x];

                LotteryNumberResult += (m + "[" + r + "]" + o + "  ");
            }

            Way                 = Way.Split(']')[0].Substring(1);
            Way                 = Way.Substring(0, Way.Length - 1);
            dr["BetWay"]        = GetWay(Way);
            dr["LotteryNumber"] = LotteryNumberResult;
            dr["BetCount"]      = BetCount + "";
            string day = Shove._Convert.StrToDateTime(dr["DateTime"].ToString(), DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")).ToString("yyyy-MM-dd hh:mm:ss");

            dr["DateTime"] = day + "";
            //dr["score"] = Convert.ToInt32(dr["score"]);
        }
        return(dtScheme);
    }
Exemplo n.º 2
0
        public void ClearanceStatistics_Challenge_Save()
        {
            // 查询擂台方案表
            DataTable dt1 = new DAL.Tables.T_ChallengeSaveScheme().Open(ConnectionString, "ID, LotteryNumber,SchemeNumber,InitiateUserID,PlayTypeID,1 as Multiple", " not exists(select ID from T_BuyWays where T_ChallengeSaveScheme.ID = T_BuyWays.SchemeID and Type = 3)", "");
            if (dt1 == null)
            {
                new Log("System").Write("T_Schemes表繁忙,请稍候再读");


                return;
            }

            if (dt1.Rows.Count < 1)
            {
                return;
            }

            string InitiateUserID = "";
            string LotteryNumber = "";
            string SchemeNumber = "";
            int SchemeLength = 0;
            int PlayTypeID = 0;
            string BuyWays = "";

            DataTable dtMatch1 = null;
            DataRow[] drMatch1 = null;

            foreach (DataRow dr in dt1.Rows)
            {
                LotteryNumber = dr["LotteryNumber"].ToString();

                PlayTypeID = Shove._Convert.StrToInt(dr["PlayTypeID"].ToString(), 7201);

                SchemeNumber = dr["SchemeNumber"].ToString();

                SchemeLength = LotteryNumber.Split(';').Length;

                if (SchemeLength < 3)
                {
                    new Log("System").Write("方案内容错误");//写错误日志

                    continue;
                }

                BuyWays = GetPassWay(LotteryNumber);

                string BuyNumber = LotteryNumber.Trim().Split(';')[1].ToString();

                string Numbers = BuyNumber.Substring(1, BuyNumber.Length - 1).Substring(0, BuyNumber.Length - 2).ToString().Trim();

                int GamesNumber = Numbers.Split('|').Length;    //选择场次

                string Locate = "";
                string[] Matchs = new string[GamesNumber];
                string[] BuyResutl = new string[GamesNumber];
                string Matchids1 = "";
                string Result1 = "";
                int GamesNumber1 = 0;

                for (int i = 0; i < GamesNumber; i++)
                {
                    Locate = Numbers.Split('|')[i];

                    Matchs[i] = Locate.Substring(0, Locate.IndexOf('('));
                    BuyResutl[i] = Locate.Substring(Locate.IndexOf('(') + 1, (Locate.IndexOf(')') - Locate.IndexOf('(') - 1));

                    Matchids1 += Locate.Substring(0, Locate.IndexOf('(')) + ",";
                }

                if (Matchids1.EndsWith(","))
                {
                    Matchids1 = Matchids1.Substring(0, Matchids1.Length - 1);
                }

                if (string.IsNullOrEmpty(Matchids1))
                {
                    continue;
                }

                dtMatch1 = new DAL.Tables.T_Match().Open(ConnectionString, "ID,SPFResult, BQCResult, ZJQSResult, ZQBFResult", "id in (" + Matchids1 + ") and isnull(SPFResult, '') <> '' and IsOpened = 1", ""); // 查询字段

                if (dtMatch1 == null)
                {
                    new Log("System").Write("T_Match表繁忙,请稍候再读");// 写日志

                    continue;
                }

                if (dtMatch1.Rows.Count < 1)
                {
                    new Log("System").Write("T_Match表没数据");

                    // 写日志
                    continue;
                }

                if (dtMatch1.Rows.Count != Matchids1.Split(',').Length)
                {
                    continue;
                }

                string MatchResult = " ";

                #region 循环比较赛果
                for (int j = 0; j < Matchs.Length; j++)
                {
                    drMatch1 = dtMatch1.Select("ID=" + Matchs[j]);

                    if (drMatch1.Length < 1)
                    {
                        continue;
                    }

                    switch (PlayTypeID)
                    {
                        case 7201:
                            Result1 = drMatch1[0]["SPFResult"].ToString();
                            MatchResult = Get7201(Result1);
                            break;
                        case 7204:
                            Result1 = drMatch1[0]["BQCResult"].ToString();
                            MatchResult = Get7204(Result1);
                            break;
                        case 7203:
                            Result1 = drMatch1[0]["ZJQSResult"].ToString();
                            MatchResult = Get7203(Result1);
                            break;
                        case 7202:
                            Result1 = drMatch1[0]["ZQBFResult"].ToString();
                            MatchResult = Get7202(Result1);
                            break;
                        default:
                            break;
                    }

                    if (BuyResutl[j].Contains(MatchResult))
                    {
                        GamesNumber1++;  //命中场次
                    }

                    // 比较赛果
                }
                #endregion

                string CanonicalNumber = "";
                int count1 = 0;
                DataTable dtMatch2 = null;
                DataRow[] drMatch2 = null;
                string Result2 = "";
                int num = 0;
                int count2 = 0;
                string Locate2 = "";
                string Matchids2 = "";

                double WinMoney = 0;
                double T_WinMoney = 0;

                string[] strs = LotteryNumber.Split('\r');
                string[] LotteryNumbers = null;

                if (strs.Length < 1)
                {
                    continue;
                }

                foreach (string str in strs)
                {
                    if (string.IsNullOrEmpty(str.Replace("\n", "").Replace("\r", "")))
                    {
                        continue;
                    }

                    LotteryNumbers = new Lottery()[72].ToSingle(str, ref CanonicalNumber, PlayTypeID);

                    if (LotteryNumbers.Length < 1)
                    {
                        continue;
                    }

                    bool IsWin = true;

                    count1 = LotteryNumbers.Length;  //注数

                    for (int k = 0; k < count1; k++)
                    {
                        IsWin = true;

                        num = LotteryNumbers[k].Split('|').Length;

                        string[] Screenings = new string[num];

                        string[] LocateBuyResult = new string[num];

                        Matchids2 = " ";

                        for (int l = 0; l < num; l++)
                        {
                            Locate2 = LotteryNumbers[k].Split(';')[1].Substring(1, LotteryNumbers[k].Split(';')[1].Length - 2).Split('|')[l];

                            Screenings[l] = Locate2.Substring(0, Locate2.IndexOf('('));


                            LocateBuyResult[l] = Locate2.Substring(Locate2.IndexOf('(') + 1, (Locate2.IndexOf(')') - Locate2.IndexOf('(') - 1));

                            Matchids2 += Locate2.Substring(0, Locate2.IndexOf('(')) + ",";
                        }

                        if (Matchids2.EndsWith(","))
                        {
                            Matchids2 = Matchids2.Substring(0, Matchids2.Length - 1);
                        }

                        if (string.IsNullOrEmpty(Matchids2))
                        {
                            continue;
                        }

                        dtMatch2 = new DAL.Tables.T_Match().Open(ConnectionString, "ID,SPFResult, BQCResult, ZJQSResult, ZQBFResult, SPFBonus, BQCBonus, ZJQSBonus, ZQBFBonus", "id in (" + Matchids2 + ")", ""); // 查询字段

                        if (dtMatch2 == null)
                        {
                            new Log("System").Write("T_Match表繁忙,请稍候再读");// 写日志

                            continue;
                        }

                        if (dtMatch2.Rows.Count < 1)
                        {
                            new Log("System").Write("T_Match表没数据");// 写日志

                            continue;
                        }
                        string MatchResult2 = "";

                        for (int m = 0; m < Screenings.Length; m++)
                        {
                            drMatch2 = dtMatch2.Select("ID=" + Screenings[m]);

                            if (drMatch2.Length < 1)
                            {
                                continue;
                            }

                            switch (PlayTypeID)
                            {
                                case 7201:
                                    Result2 = drMatch2[0]["SPFResult"].ToString();
                                    MatchResult2 = Get7201(Result2);
                                    T_WinMoney = Shove._Convert.StrToDouble(drMatch2[0]["SPFBonus"].ToString(), 0);
                                    break;
                                case 7204:
                                    Result2 = drMatch2[0]["BQCResult"].ToString();
                                    MatchResult2 = Get7204(Result2);
                                    T_WinMoney = Shove._Convert.StrToDouble(drMatch2[0]["BQCBonus"].ToString(), 0);
                                    break;
                                case 7203:
                                    Result2 = drMatch2[0]["ZJQSResult"].ToString();
                                    MatchResult2 = Get7203(Result2);
                                    T_WinMoney = Shove._Convert.StrToDouble(drMatch2[0]["ZJQSBonus"].ToString(), 0);
                                    break;
                                case 7202:
                                    Result2 = drMatch2[0]["ZQBFResult"].ToString();
                                    MatchResult2 = Get7202(Result2);
                                    T_WinMoney = Shove._Convert.StrToDouble(drMatch2[0]["ZQBFBonus"].ToString(), 0);
                                    break;
                                default:
                                    break;
                            }

                            if (!LocateBuyResult[m].Equals(MatchResult2))
                            {
                                IsWin = false;
                                continue;
                            }
                            else if (BuyWays.Equals("单关"))
                            {
                                WinMoney += T_WinMoney * Shove._Convert.StrToInt(dr["Multiple"].ToString(), 1);
                            }
                        }

                        if (IsWin)
                        {
                            count2++;  //中奖注数
                        }
                    }
                }

                InitiateUserID = dr["InitiateUserID"].ToString();

                DataTable users = new DAL.Tables.T_Users().Open(ConnectionString, "Name", "ID =" + InitiateUserID, "");

                if (users == null)
                {
                    new Log("System").Write("T_Users表繁忙,请稍候再读");

                    return;
                }

                if (users.Rows.Count < 1)
                {
                    new Log("System").Write("T_Users表没数据");

                    continue;
                }

                string Name = users.Rows[0]["Name"].ToString();


                DAL.Tables.T_BuyWays bw = new DAL.Tables.T_BuyWays();
                bw.SchemeID.Value = Shove._Convert.StrToLong(dr["ID"].ToString(), 0);
                bw.SchemeNumber.Value = SchemeNumber;
                bw.Name.Value = Name;
                bw.PlayTypeID.Value = PlayTypeID;
                bw.Count1.Value = count1;
                bw.BuyWays.Value = BuyWays;
                bw.Count2.Value = count2;
                bw.GameNumber.Value = GamesNumber;
                bw.GameNumber2.Value = GamesNumber1;
                bw.Rate.Value = GamesNumber1 * 1.00 / GamesNumber * 1.00;
                bw.UserID.Value = InitiateUserID;
                bw.Type.Value = 3;

                long Result = bw.Insert(ConnectionString);

                if (Result < 0)
                {
                    new Log("System").Write("BuyWays数据表插入数据不成功");
                }
            }
        }
Exemplo n.º 3
0
    private void Bind(long SchemeID)
    {
        string LotteryNumber = "";

        string[] LotteryNumbers = null;

        string CacheKey = "JCZC_Scheme_Bind";

        DataTable dtMatch = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (SchemeID < 0)
        {
            string FileName = Request.Cookies["ASP.NET_SessionId"].Value;

            try
            {
                LotteryNumber = File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + FileName + ".txt");
            }
            catch { }

            if (string.IsNullOrEmpty(LotteryNumber))
            {
                Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

                return;
            }

            LotteryNumbers = LotteryNumber.Replace("\r", "").Split('\n');

            if (dtMatch == null)
            {
                dtMatch = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "", "");
            }
        }

        if (string.IsNullOrEmpty(LotteryNumber))
        {
            string SchemeInfo = "";

            try
            {
                SchemeInfo = File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "SchemeInfo\\" + SchemeID.ToString() + ".txt");
            }
            catch { }

            if (string.IsNullOrEmpty(SchemeInfo))
            {
                DataTable dt = new DAL.Tables.T_Schemes().Open("", "ID=" + SchemeID.ToString(), "");

                if (dt == null)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

                    return;
                }

                if (dt.Rows.Count < 1)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

                    return;
                }

                LotteryNumber = dt.Rows[0]["LotteryNumber"].ToString();

                ArrayList al = new ArrayList();

                string[] strs = LotteryNumber.Split('\n');

                if (strs == null)
                {
                    return;
                }
                if (strs.Length == 0)
                {
                    return;
                }

                string CanonicalNumber = "";
                int    PlayTypeID      = Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), 7201);

                string CacheKeyNumbers = "Home_Web_DownloadSchemeFile_" + SchemeID.ToString();

                LotteryNumbers = Shove._Web.Cache.GetCacheAsString(CacheKeyNumbers, "").Split('\n');
                string[] strNumbers = null;

                if (LotteryNumbers.Length < 2)
                {
                    for (int i = 0; i < strs.Length; i++)
                    {
                        if (string.IsNullOrEmpty(strs[i]))
                        {
                            continue;
                        }

                        strNumbers = new SLS.Lottery()[Shove._Convert.StrToInt(PlayTypeID.ToString().Substring(0, PlayTypeID.ToString().Length - 2), 72)].ToSingle(strs[i], ref CanonicalNumber, PlayTypeID);

                        if (strNumbers == null)
                        {
                            continue;
                        }

                        for (int j = 0; j < strNumbers.Length; j++)
                        {
                            al.Add(strNumbers[j]);
                        }
                    }

                    LotteryNumbers = new string[al.Count];

                    StringBuilder sbLotteryNumbers = new StringBuilder();

                    for (int i = 0; i < al.Count; i++)
                    {
                        if (i == al.Count)
                        {
                            sbLotteryNumbers.Append(al[i].ToString());
                        }
                        else
                        {
                            sbLotteryNumbers.Append(al[i].ToString() + "\n");
                        }

                        LotteryNumbers[i] = al[i].ToString();
                    }

                    Shove._Web.Cache.SetCache(CacheKeyNumbers, sbLotteryNumbers.ToString(), 3600);
                }

                if (dtMatch == null)
                {
                    dtMatch = new DAL.Tables.T_Match().Open("ID as MatchID, MatchNumber, StopSellingTime as StopSellTime", "", "");
                }
            }
            else
            {
                LotteryNumber = SchemeInfo.Substring(0, SchemeInfo.LastIndexOf('$') - 1);

                LotteryNumbers = LotteryNumber.Replace("\r", "").Split('\n');

                if (dtMatch == null)
                {
                    dtMatch = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "MatchID in (" + SchemeInfo.Substring(SchemeInfo.LastIndexOf('$')) + ")", "");
                }
            }
        }

        if (dtMatch == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

            return;
        }

        if (dtMatch.Rows.Count < 1)
        {
            return;
        }

        Shove._Web.Cache.SetCache(CacheKey, dtMatch, 3600);

        StringBuilder sb = new StringBuilder();

        sb.Append("<table width=\"60%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"1\" class=\"BgBlue\">");
        sb.Append("<tr align=\"center\" bgcolor=\"#FFFFFF\" class=\"BlueLightBg WhiteWords\">");
        sb.Append("<td width=\"8%\"><strong>序号</strong></td>");
        sb.Append("<td><strong>过关场次</strong></td>");
        sb.Append("<td width=\"10%\"><strong>过关方式</strong></td>");
        sb.Append("<td width=\"10%\"><strong>注数</strong></td>");
        sb.Append("<td width=\"10%\"><strong>投注金额(元)</strong></td></tr>");

        string Number  = "";
        int    No      = 0;
        string BuyWays = "";

        int Multiple = 0;

        int LotID  = 0;
        int PlayID = 0;

        PlayID = Shove._Convert.StrToInt(LotteryNumbers[0].Split(';')[0], 7201);
        LotID  = Shove._Convert.StrToInt(PlayID.ToString().Substring(0, 2), 72);

        DateTime EndTime = DateTime.Now;

        int pageindex = 1;

        if (!string.IsNullOrEmpty(Shove._Web.Utility.GetRequest("p")))
        {
            pageindex = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("p").ToString(), 1);
        }

        int perPageRowCount = 30;

        if (pageindex < 1)
        {
            pageindex = 1;
        }

        foreach (string str in LotteryNumbers)
        {
            if (string.IsNullOrEmpty(str))
            {
                continue;
            }

            No++;

            if (str.Split(';').Length < 3)
            {
                continue;
            }

            try
            {
                Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2), 1);
            }
            catch
            { }

            if ((No < (pageindex - 1) * perPageRowCount) || No > (pageindex) * perPageRowCount)
            {
                continue;
            }

            sb.Append("<tr align=\"center\" class=\"" + ((No % 2 == 0) ? "BlueWord WhiteBg" : "BlueLightBg2 BlueWord") + "\">");
            sb.Append("<td>" + No.ToString() + "</td>");

            Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2);
            string[] Numbers = Number.Split('|');

            if (Numbers.Length < 2)
            {
                continue;
            }

            sb.Append("<td height=\"20\">");

            BuyWays = Numbers.Length.ToString() + "串1";

            long MatchID = 0;

            for (int i = 0; i < Numbers.Length; i++)
            {
                if (Numbers[i].IndexOf("(") < 0)
                {
                    continue;
                }

                MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1);

                DataRow[] dr = dtMatch.Select("MatchID=" + MatchID.ToString());

                if (dr.Length < 1)
                {
                    continue;
                }

                sb.Append(dr[0]["MatchNumber"].ToString() + "->" + PF.Getesult(PlayID.ToString(), Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ";");
            }

            sb.Append("</td>");
            sb.Append("<td height=\"20\">" + BuyWays + "</td>");
            sb.Append("<td>1</td>");
            sb.Append("<td>" + (2 * Multiple).ToString() + "</td></tr>");
        }

        sb.Append("</table>");
        labLotteryNumber.Text = sb.ToString();

        StringBuilder sbpage = new StringBuilder();

        int rowCount  = No;
        int pageCount = rowCount % perPageRowCount == 0 ? rowCount / perPageRowCount : rowCount / perPageRowCount + 1;

        if (SchemeID < 0)
        {
            sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"Scheme.aspx\">首页</a></span>");

            if (pageindex == 1)
            {
                sbpage.Append("<span class=\"disabled\">« 上一页</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>");
            }

            for (int i = 0; i < pageCount; i++)
            {
                if (i == pageindex - 1)
                {
                    sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>");

                    continue;
                }

                if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10))
                {
                    sbpage.Append("<a href=\"Scheme.aspx?p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>");
                }
            }

            if (pageindex == pageCount)
            {
                sbpage.Append("<span class=\"disabled\">下一页 »</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>");
            }

            sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"Scheme.aspx?p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>");
        }
        else
        {
            sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "\">首页</a></span>");

            if (pageindex == 1)
            {
                sbpage.Append("<span class=\"disabled\">« 上一页</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>");
            }

            for (int i = 0; i < pageCount; i++)
            {
                if (i == pageindex - 1)
                {
                    sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>");

                    continue;
                }

                if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10))
                {
                    sbpage.Append("<a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>");
                }
            }

            if (pageindex == pageCount)
            {
                sbpage.Append("<span class=\"disabled\">下一页 »</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>");
            }

            sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>");
        }

        labLotteryNumber.Text += sbpage.ToString();
    }
Exemplo n.º 4
0
        public void GetLotteryOpenNumberAndOpenWin_SaveSchemes() // 获取开奖信息,并计算奖金对保存方案开奖
        {
            // 读取未开奖的擂台方案表
            DataTable dtSchemeChallenge = new DAL.Tables.T_ChallengeSaveScheme().Open(ConnectionString, "[ID],[InitiateUserID],[LotteryNumber],[Odds], PlayTypeID, Money", "IsOpened = 0 and DateTime < CONVERT(VARCHAR(24),GETDATE(),111)", "");

            if (dtSchemeChallenge == null)
            {
                new Log("SystemGetLotteryOpenNumber").Write("(保存)比拼擂台方案保存表,没有可开奖的数据。");

                return;
            }

            if (dtSchemeChallenge.Rows.Count < 1)
            {
                IsOpened = true;

                return;
            }

            string PlayTypeID = "";
            string SchemeID = "";
            string InitiateUserID = "";
            string LotteryNunber = "";
            string Content = "";
            string WaysNumber = "";
            string Matchs = "";

            // 遍历没有开奖的方案
            foreach (DataRow dr in dtSchemeChallenge.Rows)
            {
                //得到方案ID
                SchemeID = dr["ID"].ToString().Trim();

                //得到方案发起用户ID
                InitiateUserID = dr["InitiateUserID"].ToString().Trim();

                //得到投注号码
                LotteryNunber = dr["LotteryNumber"].ToString().Trim();

                PlayTypeID = dr["PlayTypeID"].ToString().Trim();

                #region 对投注号码进行分析,判断注数

                SLS.Lottery slsLottery = new SLS.Lottery();
                string[] t_lotterys = SplitLotteryNumber(LotteryNunber);

                if ((t_lotterys == null) || (t_lotterys.Length < 1))
                {
                    new Log("SystemGetLotteryOpenNumber").Write("(保存)投注号码出现异常,读取格式不正确:" + LotteryNunber);
                    return;
                }

                int ValidNum = 0;

                foreach (string str in t_lotterys)
                {
                    string Number = slsLottery[72].AnalyseScheme(str, Shove._Convert.StrToInt(PlayTypeID, 0));

                    if (string.IsNullOrEmpty(Number))
                    {
                        continue;
                    }

                    string[] str_s = Number.Split('|');

                    if (str_s == null || str_s.Length < 1)
                    {
                        continue;
                    }

                    ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
                }



                #endregion

                //解析投注号码
                Content = LotteryNunber.Trim().Split(';')[1].ToString(); // 得到投注内容
                WaysNumber = LotteryNunber.Trim().Split(';')[2].ToString(); // 得到过关玩法

                // 得到投注比赛ID、投注内容
                string[] Numbers = Content.Substring(1, Content.Length - 2).Split('|');

                Matchs = "";

                foreach (string Number in Numbers)
                {
                    Matchs += Number.Substring(0, Number.IndexOf('(')) + ",";
                }

                if (Matchs.EndsWith(","))
                {
                    Matchs = Matchs.Substring(0, Matchs.Length - 1);
                }

                if (string.IsNullOrEmpty(Matchs))
                {
                    continue;
                }

                //通过赛事ID 查找赛事结果
                DataTable dt = new DAL.Tables.T_Match().Open(ConnectionString, "[SPFResult], [ID]", "[ID] in (" + Matchs + ") and IsOpened = 1", "[ID]");

                if (dt == null)
                {
                    new Log("SystemGetLotteryOpenNumber").Write("(保存)读取 T_Match 数据时候出现异常");

                    continue;
                }

                if (dt.Rows.Count < 1)
                {
                    new Log("SystemGetLotteryOpenNumber").Write("(保存)MatchID:(" + Matchs + ")暂未开奖");

                    continue;
                }

                bool IsWin = true;
                string Result = "";
                int WinCoumt = 0;       // 命中场次
                int i = 0;
                string[] matchsId = Matchs.Split(',');

                foreach (string Number in Numbers)
                {
                    DataRow[] drs = dt.Select("ID = " + matchsId[i]);



                    if (drs.Length < 1)
                    {
                        IsWin = false;
                        break;
                    }
                    string ddx = Number.Substring(Number.IndexOf('(')).Substring(1);
                    if (ddx.EndsWith(")"))
                    {
                        ddx = ddx.Substring(0, ddx.Length - 1);
                    }

                    Result = GetResult(drs[0]["SPFResult"].ToString(), PlayTypeID);

                    if (!Result.Equals(ddx))
                    {
                        IsWin = false;
                    }
                    else
                    {
                        WinCoumt++;
                    }
                    i++;
                }

                string sql = "";
                int result = 0;

                // 计算命中场次  ==> WinCount

                if (!IsWin)
                {// 没有中奖
                    sql = "update T_ChallengeSaveScheme set IsOpened = 1, OpenOperateId = 1  where ID = " + SchemeID;

                    result = Shove.Database.MSSQL.ExecuteNonQuery(ConnectionString, sql);

                    if (result < 0)
                    {
                        new Log("SystemGetLotteryOpenNumber").Write("(保存)执行Sql语句失败:" + sql);

                        continue;
                    }


                    continue;
                }

                string Odds = dr["odds"].ToString();

                double WinMoney = 2;

                foreach (string Odd in Odds.Split('|'))
                {
                    WinMoney *= Shove._Convert.StrToDouble(Odd, 0);
                }

                // 修改方案的 IsOpen , WinMoney ,WinDescription
                sql = "update T_ChallengeSaveScheme set IsOpened = 1,WinMoney = " + WinMoney.ToString() + ",WinDescription='(保存)擂台中奖', OpenOperateId = 1 where ID = " + SchemeID;

                result = Shove.Database.MSSQL.ExecuteNonQuery(ConnectionString, sql);

                if (result < 0)
                {
                    new Log("SystemGetLotteryOpenNumber").Write("(保存)执行Sql语句失败:" + sql);

                    continue;
                }

                new Log("SystemGetLotteryOpenNumber").Write("(保存)开奖成功,SchemeID:" + SchemeID);
            }
        }