Пример #1
0
    private void BindData()
    {
        long SchemeID = Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("id"), -1);

        if (SchemeID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误", this.GetType().FullName);

            return;
        }

        DataTable dt = new DAL.Tables.T_Schemes().Open("InitiateUserID,LotteryNumber, PlayTypeID", "SiteID = " + _Site.ID.ToString() + " and [ID] = " + SchemeID.ToString(), "");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().FullName);

            return;
        }

        if (dt.Rows.Count < 1)
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误", this.GetType().FullName);

            return;
        }

        long InitiateUserID = Shove._Convert.StrToLong(dt.Rows[0]["InitiateUserID"].ToString(), -1);

        //既不是发起人,也不在招股对象之内
        if (_User != null && !_User.isCanViewSchemeContent(SchemeID))
        {
            PF.GoError(ErrorNumber.Unknow, "对不起,您不在此方案的招股对象之内。", this.GetType().FullName);

            return;
        }

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

        if (Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), -1) > 7200 && Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), -1) < 7300)
        {
            string CacheKey = "JCZC_Scheme_Bind";

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

            if (dtMatch == null)
            {
                dtMatch = new DAL.Tables.T_Match().Open("ID, MatchNumber, StopSellingTime", "", "");

                if (dtMatch == null)
                {
                    return;
                }

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

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

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

            ArrayList al = new ArrayList();

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

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

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

            string[] 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);
            }

            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\">");

                if (Numbers.Length == 1)
                {
                    BuyWays = "单关";
                }
                else
                {
                    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("ID=" + 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=\"DownloadSchemeFile.aspx\">首页</a></span>");

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

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

                sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"DownloadSchemeFile.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=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "\">首页</a></span>");

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

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

            labLotteryNumber.Text += sbpage.ToString();
        }
        else
        {
            LotteryNumber = PF.GetScriptResTable(LotteryNumber);

            if (LotteryNumber.IndexOf("table") < 0)
            {
                LotteryNumber = Shove._Convert.ToHtmlCode(LotteryNumber);
            }

            labLotteryNumber.Text = (LotteryNumber == "") ? "未找到相关数据。" : (LotteryNumber + "&nbsp;");
        }
    }
Пример #2
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();
    }
Пример #3
0
    private void BindBet()
    {
        long BuyID = Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("BuyID"), 0);

        string FileName = Request.Cookies["ASP.NET_SessionId"].Value;

        string LotteryNumber = "";

        DataTable dt = null;

        int    Multiple     = 0;
        double SumMoney     = 0;
        long   IsuseID      = 0;
        int    Count        = 0;
        int    LotID        = 0;
        int    PlayID       = 0;
        int    Share        = 1;
        int    BuyShare     = 1;
        double AssureMoney  = 0;
        short  SecrecyLevel = 0;

        if (BuyID > 0)
        {
            dt = new DAL.Tables.T_AlipayBuyTemp().Open("", "ID=" + BuyID.ToString(), "");

            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }

            hidBuyID.Value = BuyID.ToString();

            DataRow dr = dt.Rows[0];

            string HidIsuseID          = dr["IsuseID"].ToString();
            string playType            = dr["PlayTypeID"].ToString();
            string tb_Share            = dr["Share"].ToString();
            string tb_BuyShare         = dr["BuyShare"].ToString();
            string tb_AssureShare      = dr["AssureShare"].ToString();
            string tb_OpenUserList     = dr["OpenUsers"].ToString();
            string tb_Title            = dr["Title"].ToString();
            string tb_Description      = dr["Description"].ToString();
            string tbSecrecyLevel      = dr["SecrecyLevel"].ToString();
            string tb_LotteryNumber    = dr["LotteryNumber"].ToString();
            string tb_hide_SumMoney    = dr["SumMoney"].ToString();
            string tb_hide_AssureMoney = dr["AssureMoney"].ToString();
            string HidLotteryID        = dr["LotteryID"].ToString();
            string tb_Multiple         = dr["Multiple"].ToString();

            if (tb_Multiple == "")
            {
                tb_Multiple = "1";
            }

            try
            {
                Share        = int.Parse(tb_Share);
                BuyShare     = int.Parse(tb_BuyShare);
                AssureMoney  = double.Parse(tb_hide_AssureMoney);
                Multiple     = int.Parse(tb_Multiple);
                SecrecyLevel = short.Parse(tbSecrecyLevel);
                PlayID       = int.Parse(playType);
                LotID        = int.Parse(HidLotteryID);
                IsuseID      = long.Parse(HidIsuseID);
            }
            catch { }

            if ((BuyShare == Share) && (AssureMoney == 0))
            {
                Share    = 1;
                BuyShare = 1;
            }

            double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;

            LotteryNumber = tb_LotteryNumber;

            if (!string.IsNullOrEmpty(LotteryNumber) && LotteryNumber[LotteryNumber.Length - 1] == '\n')
            {
                LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
            }

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

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

            return;
        }

        dt = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "", "");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

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

        hidMatchID.Value = "";

        foreach (DataRow dr in dt.Rows)
        {
            hidMatchID.Value += dr["MatchID"].ToString() + ",";
        }

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

        StringBuilder sb = new StringBuilder();

        sb.Append("<table width=\"100%\" 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[] LotteryNumbers = LotteryNumber.Replace("\r", "").Split('\n');
        string   Number         = "";
        int      No             = 0;
        string   BuyWays        = "";

        StringBuilder sbMatchIDs = new StringBuilder();

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

        DateTime EndTime = DateTime.Now;

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

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

                if (No > 10)
                {
                    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 = PF.GetPassWay(str);

                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 = dt.Select("MatchID=" + MatchID.ToString());

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

                    sbMatchIDs.Append(Numbers[i].Substring(0, Numbers[i].IndexOf("(")) + ",");

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

                int ValidNum = 0;

                SLS.Lottery slsLottery  = new SLS.Lottery();
                string      temp_Number = slsLottery[LotID].AnalyseScheme(str, PlayID);

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

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

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

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

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

                SumMoney += 2 * Multiple * ValidNum;
                Count    += ValidNum;
            }

            sb.Append("</table>");
            labLotteryNumber.Text = sb.ToString();
        }
        else
        {
            foreach (string str in LotteryNumbers)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }

                No++;
                Count++;

                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
                { }

                SumMoney += 2 * Multiple;

                if (No > 10)
                {
                    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 = dt.Select("MatchID=" + MatchID.ToString());

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

                    sbMatchIDs.Append(Numbers[i].Substring(0, Numbers[i].IndexOf("(")) + ",");

                    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();
        }

        labShare.Text       = Share.ToString();
        labBuyShare.Text    = BuyShare.ToString();
        labAssureMoney.Text = AssureMoney.ToString();

        string MatchIDs = sbMatchIDs.ToString();

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

        DataRow[] drTime = dt.Select("MatchID in (" + MatchIDs + ")", "StopSellTime");

        if (drTime.Length > 0)
        {
            EndTime = Shove._Convert.StrToDateTime(drTime[0]["StopSellTime"].ToString(), DateTime.Now.AddHours(1).ToString());
        }

        labEndTime.Text       = EndTime.ToString("yyyy-MM-dd HH:mm:ss");
        HidIsuseEndTime.Value = EndTime.ToString();

        labMultiple.Text    = Multiple.ToString();
        labSchemeMoney.Text = SumMoney.ToString();
        labNum.Text         = Count.ToString();

        dt = new DAL.Tables.T_Isuses().Open("ID", "LotteryID= " + LotID.ToString(), "EndTime desc");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count < 1)
        {
            PF.GoError(ErrorNumber.NoIsuse, "请添加期号", this.GetType().BaseType.FullName);

            return;
        }

        IsuseID = Shove._Convert.StrToLong(dt.Rows[0]["ID"].ToString(), 0);

        hidSchemeMoney.Value = SumMoney.ToString();
        hidMultiple.Value    = Multiple.ToString();
        hidlotid.Value       = LotID.ToString();
        hidplayid.Value      = PlayID.ToString();
        hidSumNum.Value      = Count.ToString();
        hidisuseid.Value     = IsuseID.ToString();
    }
Пример #4
0
    private void BindBet()
    {
        long BuyID = Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("id"), 0);

        string type = Shove._Web.Utility.GetRequest("type").ToString();

        if (BuyID < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "获取数据失败请重新操作");
            return;
        }

        if (_User == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "请登陆后执行此操作");
            return;
        }

        DataTable dt = null;

        // 通过ID 获取擂台方案表中的相关数据
        if (type == "1")
        {
            dt = new DAL.Tables.T_ChallengeScheme().Open("ID,[DateTime],InitiateUserId,IsuseID,PlayTypeID,LotteryNumber,IsOpened", " ID = " + BuyID, "");
        }
        else
        {
            dt = Shove.Database.MSSQL.Select("select ID,[DateTime],InitiateUserId,IsuseID,PlayTypeID,LotteryNumber,IsOpened from T_ChallengeSaveScheme where ID = " + BuyID);
        }

        if (dt == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "对不起获取该方案失败,请重新操作");
            return;
        }

        if (dt.Rows.Count != 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "对不起获取该方案失败,请重新操作");
            return;
        }
        // 是否已经开过奖的
        if (dt.Rows[0]["IsOpened"].ToString().Equals("1"))
        {
            Shove._Web.JavaScript.Alert(this.Page, "对不起该方案内容已截至");
            return;
        }

        #region

        string LotteryNumber = "";

        int    Multiple = 0;
        double SumMoney = 0;
        long   IsuseID  = 0;
        int    Count    = 0;
        int    LotID    = 0;
        int    PlayID   = 0;

        // 购买ID
        hidBuyID.Value = BuyID.ToString();

        DataRow dr = dt.Rows[0];

        string HidIsuseID = dt.Rows[0]["IsuseID"].ToString();
        string playType   = dt.Rows[0]["PlayTypeID"].ToString();
        // Share  总分数 1
        string tb_Share = "1";
        // 购买分数 为 1
        string tb_BuyShare = "1";
        // 不保密
        string tbSecrecyLevel = "0";

        string tb_LotteryNumber = dr["LotteryNumber"].ToString();
        // 购买金额等于 总金额
        string tb_hide_AssureMoney = "2";
        // 没有
        string HidLotteryID = "72";
        // 倍数1倍
        string tb_Multiple = "1";

        if (tb_Multiple == "")
        {
            tb_Multiple = "1";
        }

        int    Share        = 0;
        int    BuyShare     = 0;
        double AssureMoney  = 0;
        short  SecrecyLevel = 0;

        try
        {
            Share        = int.Parse(tb_Share);
            BuyShare     = int.Parse(tb_BuyShare);
            AssureMoney  = double.Parse(tb_hide_AssureMoney);
            Multiple     = int.Parse(tb_Multiple);
            SecrecyLevel = short.Parse(tbSecrecyLevel);
            PlayID       = int.Parse(playType);
            LotID        = int.Parse(HidLotteryID);
            IsuseID      = long.Parse(HidIsuseID);
        }
        catch { }

        if ((BuyShare == Share) && (AssureMoney == 0))
        {
            Share    = 1;
            BuyShare = 1;
        }

        double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;

        LotteryNumber = tb_LotteryNumber;

        if (!string.IsNullOrEmpty(LotteryNumber) && LotteryNumber[LotteryNumber.Length - 1] == '\n')
        {
            LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
        }

        hidLotteryNumber.Value = LotteryNumber;

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

            return;
        }

        dt = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "", "");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        hidMatchID.Value = "";

        foreach (DataRow drr in dt.Rows)
        {
            hidMatchID.Value += drr["MatchID"].ToString() + ",";
        }

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

        StringBuilder sb = new StringBuilder();

        sb.Append("<table width=\"100%\" 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[] LotteryNumbers = LotteryNumber.Replace("\r", "").Split('\n');
        string   Number         = "";
        int      No             = 0;
        string   BuyWays        = "";

        StringBuilder sbMatchIDs = new StringBuilder();

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

        DateTime EndTime = DateTime.Now;

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

            No++;
            Count++;

            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
            { }

            SumMoney += 2 * Multiple;

            if (No > 10)
            {
                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[] dr2 = dt.Select("MatchID=" + MatchID.ToString());

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

                sbMatchIDs.Append(Numbers[i].Substring(0, Numbers[i].IndexOf("(")) + ",");

                sb.Append(dr2[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();

        string MatchIDs = sbMatchIDs.ToString();

        if (MatchIDs.EndsWith(","))
        {
            MatchIDs = MatchIDs.Substring(0, MatchIDs.Length - 1);
        }
        if (string.IsNullOrEmpty(MatchIDs.Trim()))
        {
            Shove._Web.JavaScript.Alert(this.Page, "无法获取信息");
            return;
        }
        DataRow[] drTime = dt.Select("MatchID in (" + MatchIDs + ")", "StopSellTime");

        if (drTime.Length > 0)
        {
            EndTime = Shove._Convert.StrToDateTime(drTime[0]["StopSellTime"].ToString(), DateTime.Now.AddHours(1).ToString());
        }

        labEndTime.Text       = EndTime.ToString("yyyy-MM-dd HH:mm:ss");
        HidIsuseEndTime.Value = EndTime.ToString();

        labMultiple.Text    = Multiple.ToString();
        labSchemeMoney.Text = SumMoney.ToString();
        labNum.Text         = Count.ToString();

        dt = new DAL.Tables.T_Isuses().Open("ID", "LotteryID= " + LotID.ToString(), "EndTime desc");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count < 1)
        {
            PF.GoError(ErrorNumber.NoIsuse, "请添加期号", this.GetType().BaseType.FullName);

            return;
        }

        IsuseID = Shove._Convert.StrToLong(dt.Rows[0]["ID"].ToString(), 0);

        hidSchemeMoney.Value = SumMoney.ToString();
        hidMultiple.Value    = Multiple.ToString();
        hidlotid.Value       = LotID.ToString();
        hidplayid.Value      = PlayID.ToString();
        hidSumNum.Value      = Count.ToString();
        hidisuseid.Value     = IsuseID.ToString();

        #endregion
    }