private void SaveDataForAliBuy()
    {
        string request = Shove._Web.Utility.GetRequest("HidIsuseID");

        Shove._Web.Utility.GetRequest("HidIsuseEndTime");
        string s     = Shove._Web.Utility.GetRequest("playType");
        string str3  = Shove._Web.Utility.GetRequest("Chase");
        string str4  = Shove._Web.Utility.GetRequest("Cobuy");
        string str5  = Shove._Web.Utility.GetRequest("tb_Share");
        string str6  = Shove._Web.Utility.GetRequest("tb_BuyShare");
        string str7  = Shove._Web.Utility.GetRequest("tb_AssureShare");
        string str8  = Shove._Web.Utility.GetRequest("tb_OpenUserList");
        string str9  = Shove._Web.Utility.GetRequest("tb_Title");
        string str10 = Shove._Web.Utility.GetRequest("tb_Description");
        string str11 = Shove._Web.Utility.GetRequest("tbAutoStopAtWinMoney");
        string str12 = Shove._Web.Utility.GetRequest("SecrecyLevel");

        Shove._Web.Utility.GetRequest("tbPlayTypeName");
        string str13 = Shove._Web.Utility.FilteSqlInfusion(base.Request["tb_LotteryNumber"]);
        string str14 = Shove._Web.Utility.GetRequest("tb_hide_SumMoney");
        string str15 = Shove._Web.Utility.GetRequest("tb_hide_AssureMoney");
        string str   = Shove._Web.Utility.GetRequest("tb_hide_SumNum");

        Shove._Web.Utility.GetRequest("HidIsuseCount");
        string str17 = Shove._Web.Utility.GetRequest("HidLotteryID");

        Shove._Web.Utility.GetRequest("HidIsAlipay");
        string        str18   = Shove._Web.Utility.GetRequest("tb_Multiple");
        string        str19   = "";
        StringBuilder builder = new StringBuilder();
        int           num     = 0;
        int           num2    = 2;

        if (str18 == "")
        {
            str18 = "1";
        }
        if (str3 == "1")
        {
            foreach (string str20 in base.Request.Form.AllKeys)
            {
                if (str20.IndexOf("check") > -1)
                {
                    int num4 = _Convert.StrToInt(str20.Replace("check", ""), -1);
                    if (num4 > 0)
                    {
                        num++;
                        int num5 = (_Convert.StrToInt(str, -1) * num2) * _Convert.StrToInt(base.Request.Form["times" + num4.ToString()], -1);
                        builder.Append(base.Request.Form[str20]).Append(",").Append(base.Request.Form["times" + num4.ToString()]).Append(",").Append(num5.ToString()).Append(",").Append(base.Request.Form["share" + num4.ToString()]).Append(",").Append(base.Request.Form["buyedShare" + num4.ToString()]).Append(",").Append(base.Request.Form["assureShare" + num4.ToString()]).Append(";");
                    }
                }
            }
            string str21 = str13;
            if (builder.Length > 0)
            {
                builder.Remove(builder.Length - 1, 1);
            }
            if (str21[str21.Length - 1] == '\n')
            {
                str21 = str21.Substring(0, str21.Length - 1);
            }
            string[] strArray2 = builder.ToString().Split(new char[] { ';' });
            int      length    = strArray2.Length;
            string[] strArray3 = new string[length * 9];
            DateTime time2     = DateTime.Parse(Functions.F_GetIsuseSystemEndTime(long.Parse(strArray2[0].Split(new char[] { ',' })[0]), int.Parse(s)).ToString());
            if (DateTime.Now >= time2)
            {
                JavaScript.Alert(this.Page, "您选择的追号期号中包含已截止的期,请重新选择。");
                return;
            }
            for (int i = 0; i < length; i++)
            {
                strArray3[i * 9]       = strArray2[i].Split(new char[] { ',' })[0];
                strArray3[(i * 9) + 1] = s;
                strArray3[(i * 9) + 2] = str21;
                strArray3[(i * 9) + 3] = strArray2[i].Split(new char[] { ',' })[1];
                strArray3[(i * 9) + 4] = strArray2[i].Split(new char[] { ',' })[2];
                strArray3[(i * 9) + 5] = str12;
                strArray3[(i * 9) + 6] = strArray2[i].Split(new char[] { ',' })[3];
                strArray3[(i * 9) + 7] = strArray2[i].Split(new char[] { ',' })[4];
                strArray3[(i * 9) + 8] = strArray2[i].Split(new char[] { ',' })[5];
            }
            str19 = PF.BuildIsuseAdditionasXmlForBJKL8(strArray3);
        }
        long num8 = new Tables.T_AlipayBuyTemp
        {
            SiteID                = { Value = 1 },
            UserID                = { Value = -1 },
            Money                 = { Value = str14 },
            HandleResult          = { Value = 0 },
            IsChase               = { Value = str3 == "1" },
            IsCoBuy               = { Value = str4 == "2" },
            LotteryID             = { Value = str17 },
            IsuseID               = { Value = request },
            PlayTypeID            = { Value = s },
            StopwhenwinMoney      = { Value = str11 },
            AdditionasXml         = { Value = str19 },
            Title                 = { Value = str9 },
            Description           = { Value = str10 },
            LotteryNumber         = { Value = str13 },
            UpdateloadFileContent = { Value = "" },
            Multiple              = { Value = str18 },
            BuyMoney              = { Value = str6 },
            SumMoney              = { Value = str14 },
            AssureMoney           = { Value = str15 },
            Share                 = { Value = str5 },
            BuyShare              = { Value = str6 },
            AssureShare           = { Value = str7 },
            OpenUsers             = { Value = str8 },
            SecrecyLevel          = { Value = str12 }
        }.Insert();

        if (num8 < 0L)
        {
            new Log("System").Write("T_AlipayBuyTemp 数据库读写错误。");
        }
        JavaScript.Alert(this.Page, "您的账户余额不足,请先充值,谢谢。", "../Home/Room/OnlinePay/Default.aspx?BuyID=" + num8.ToString());
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 余额不足时,保存数据
    /// </summary>
    private void SaveDataForAliBuy()
    {
        string        HidIsuseID           = Shove._Web.Utility.GetRequest("HidIsuseID");
        string        HidIsuseEndTime      = Shove._Web.Utility.GetRequest("HidIsuseEndTime");
        string        playType             = Shove._Web.Utility.GetRequest("playType");
        string        Chase                = Shove._Web.Utility.GetRequest("Chase");
        string        Cobuy                = Shove._Web.Utility.GetRequest("Cobuy");
        string        tb_Share             = Shove._Web.Utility.GetRequest("tb_Share");
        string        tb_BuyShare          = Shove._Web.Utility.GetRequest("tb_BuyShare");
        string        tb_AssureShare       = Shove._Web.Utility.GetRequest("tb_AssureShare");
        string        tb_OpenUserList      = Shove._Web.Utility.GetRequest("tb_OpenUserList");
        string        tb_Title             = Shove._Web.Utility.GetRequest("tb_Title");
        string        tb_Description       = Shove._Web.Utility.GetRequest("tb_Description");
        string        tbAutoStopAtWinMoney = Shove._Web.Utility.GetRequest("tbAutoStopAtWinMoney");
        string        tbSecrecyLevel       = Shove._Web.Utility.GetRequest("SecrecyLevel");
        string        tbPlayTypeName       = Shove._Web.Utility.GetRequest("tbPlayTypeName");
        string        tb_LotteryNumber     = Shove._Web.Utility.FilteSqlInfusion(Request["tb_LotteryNumber"]);
        string        tb_hide_SumMoney     = Shove._Web.Utility.GetRequest("tb_hide_SumMoney");
        string        tb_hide_AssureMoney  = Shove._Web.Utility.GetRequest("tb_hide_AssureMoney");
        string        tb_hide_SumNum       = Shove._Web.Utility.GetRequest("tb_hide_SumNum");
        string        HidIsuseCount        = Shove._Web.Utility.GetRequest("HidIsuseCount");
        string        HidLotteryID         = Shove._Web.Utility.GetRequest("HidLotteryID");
        string        HidIsAlipay          = Shove._Web.Utility.GetRequest("HidIsAlipay");
        string        tb_Multiple          = Shove._Web.Utility.GetRequest("tb_Multiple");
        string        AdditionasXml        = "";
        StringBuilder ChaseXML             = new StringBuilder();
        int           RpTodayDataCount     = 0;

        int Price = 2;

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

        if (Chase == "1")
        {
            foreach (string key in Request.Form.AllKeys)
            {
                if (key.IndexOf("check") > -1)
                {
                    int row = Shove._Convert.StrToInt(key.Replace("check", ""), -1);
                    if (row > 0)
                    {
                        RpTodayDataCount++;
                        int money = Shove._Convert.StrToInt(tb_hide_SumNum, -1) * Price * Shove._Convert.StrToInt(Request.Form["times" + row.ToString()], -1);
                        ChaseXML.Append(Request.Form[key]).Append(",")
                        .Append(Request.Form["times" + row.ToString()]).Append(",")
                        .Append(money.ToString()).Append(",")
                        .Append(Request.Form["share" + row.ToString()]).Append(",")
                        .Append(Request.Form["buyedShare" + row.ToString()]).Append(",")
                        .Append(Request.Form["assureShare" + row.ToString()]).Append(";");
                    }
                }
            }

            string LotteryNumber = tb_LotteryNumber;

            if (ChaseXML.Length > 0)
            {
                ChaseXML.Remove(ChaseXML.Length - 1, 1);
            }

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

            string[] XML = ChaseXML.ToString().Split(';');
            int      CompetitionCount = XML.Length;

            string[] Xmlparams = new string[CompetitionCount * 9];

            string   str_EndTime = DAL.Functions.F_GetIsuseSystemEndTime(long.Parse(XML[0].Split(',')[0]), int.Parse(playType)).ToString();
            DateTime EndTime     = DateTime.Parse(str_EndTime);

            if (DateTime.Now >= EndTime)
            {
                Shove._Web.JavaScript.Alert(this.Page, "您选择的追号期号中包含已截止的期,请重新选择。");

                return;
            }

            //构建格式:期号,玩法类别,方案,倍数,金额,方案保密级别
            for (int i = 0; i < CompetitionCount; i++)
            {
                Xmlparams[i * 9]     = XML[i].Split(',')[0]; //期号
                Xmlparams[i * 9 + 1] = playType;             //玩法类别
                Xmlparams[i * 9 + 2] = LotteryNumber;        //方案
                Xmlparams[i * 9 + 3] = XML[i].Split(',')[1]; //倍数
                Xmlparams[i * 9 + 4] = XML[i].Split(',')[2]; //金额
                Xmlparams[i * 9 + 5] = tbSecrecyLevel;
                Xmlparams[i * 9 + 6] = XML[i].Split(',')[3]; //总份数
                Xmlparams[i * 9 + 7] = XML[i].Split(',')[4]; //认购份数
                Xmlparams[i * 9 + 8] = XML[i].Split(',')[5]; //保底份数
            }

            AdditionasXml = PF.BuildIsuseAdditionasXmlForBJKL8(Xmlparams);
        }

        DAL.Tables.T_AlipayBuyTemp tbp = new DAL.Tables.T_AlipayBuyTemp();

        tbp.SiteID.Value                = 1;
        tbp.UserID.Value                = -1;
        tbp.Money.Value                 = tb_hide_SumMoney;
        tbp.HandleResult.Value          = 0;
        tbp.IsChase.Value               = Chase == "1";
        tbp.IsCoBuy.Value               = Cobuy == "2";
        tbp.LotteryID.Value             = HidLotteryID;
        tbp.IsuseID.Value               = HidIsuseID;
        tbp.PlayTypeID.Value            = playType;
        tbp.StopwhenwinMoney.Value      = tbAutoStopAtWinMoney;
        tbp.AdditionasXml.Value         = AdditionasXml;
        tbp.Title.Value                 = tb_Title;
        tbp.Description.Value           = tb_Description;
        tbp.LotteryNumber.Value         = tb_LotteryNumber;
        tbp.UpdateloadFileContent.Value = "";
        tbp.Multiple.Value              = tb_Multiple;
        tbp.BuyMoney.Value              = tb_BuyShare;
        tbp.SumMoney.Value              = tb_hide_SumMoney;
        tbp.AssureMoney.Value           = tb_hide_AssureMoney;
        tbp.Share.Value                 = tb_Share;
        tbp.BuyShare.Value              = tb_BuyShare;
        tbp.AssureShare.Value           = tb_AssureShare;
        tbp.OpenUsers.Value             = tb_OpenUserList;
        tbp.SecrecyLevel.Value          = tbSecrecyLevel;

        long Result = tbp.Insert();

        if (Result < 0)
        {
            new Log("System").Write("T_AlipayBuyTemp 数据库读写错误。");
        }

        Shove._Web.JavaScript.Alert(this.Page, "您的账户余额不足,请先充值,谢谢。", "../Home/Room/OnlinePay/Default.aspx?BuyID=" + Result.ToString());
    }
    private void Buy(Users _User)
    {
        string request = Shove._Web.Utility.GetRequest("HidIsuseID");
        string str2    = Shove._Web.Utility.GetRequest("HidIsuseEndTime");
        string s       = Shove._Web.Utility.GetRequest("playType");
        string str4    = Shove._Web.Utility.GetRequest("Chase");

        Shove._Web.Utility.GetRequest("CoBuy");
        string str5 = Shove._Web.Utility.GetRequest("tb_Share");
        string str6 = Shove._Web.Utility.GetRequest("tb_BuyShare");

        Shove._Web.Utility.GetRequest("tb_AssureShare");
        string str7  = Shove._Web.Utility.GetRequest("tb_OpenUserList");
        string str8  = Shove._Web.Utility.GetRequest("tb_Title");
        string str9  = Shove._Web.Utility.GetRequest("tb_Description");
        string str10 = Shove._Web.Utility.GetRequest("tbAutoStopAtWinMoney");
        string str11 = Shove._Web.Utility.GetRequest("SecrecyLevel");
        string str12 = Shove._Web.Utility.FilteSqlInfusion(base.Request["tb_LotteryNumber"]);
        string str13 = Shove._Web.Utility.GetRequest("tb_hide_SumMoney");
        string str14 = Shove._Web.Utility.GetRequest("tb_hide_AssureMoney");
        string str15 = Shove._Web.Utility.GetRequest("tb_hide_SumNum");

        Shove._Web.Utility.GetRequest("HidIsuseCount");
        string str16 = Shove._Web.Utility.GetRequest("HidLotteryID");

        Shove._Web.Utility.GetRequest("HidIsAlipay");
        string str17 = Shove._Web.Utility.GetRequest("tb_Multiple");

        Shove._Web.Utility.GetRequest("HidIsuseName");
        Shove._Web.Utility.GetRequest("tbPlayTypeName");
        string str18 = Shove._Web.Utility.GetRequest("tb_hide_ChaseBuyedMoney");
        string str19 = Shove._Web.Utility.GetRequest("tb_SchemeBonusScale");
        string str20 = Shove._Web.Utility.GetRequest("tb_SchemeBonusScalec");
        int    num   = 2;

        if (str17 == "")
        {
            str17 = "1";
        }
        double money             = 0.0;
        int    share             = 0;
        int    buyShare          = 0;
        double assureMoney       = 0.0;
        int    multiple          = 0;
        int    num7              = 0;
        short  num8              = 0;
        int    playType          = 0;
        int    lotteryID         = 0;
        long   isuseID           = 0L;
        double stopWhenWinMoney  = 0.0;
        double schemeBonusScale  = 0.0;
        double schemeBonusScalec = 0.0;

        try
        {
            money             = double.Parse(str13);
            share             = int.Parse(str5);
            buyShare          = int.Parse(str6);
            assureMoney       = double.Parse(str14);
            multiple          = int.Parse(str17);
            num7              = int.Parse(str15);
            num8              = short.Parse(str11);
            playType          = int.Parse(s);
            lotteryID         = int.Parse(str16);
            isuseID           = long.Parse(request);
            stopWhenWinMoney  = double.Parse(str10);
            schemeBonusScale  = double.Parse(str19);
            schemeBonusScalec = double.Parse(str20);
        }
        catch
        {
            JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");
            return;
        }
        if ((money > 0.0) && (num7 >= 1))
        {
            if (assureMoney < 0.0)
            {
                JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");
            }
            else if (share < 1)
            {
                JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");
            }
            else
            {
                if ((buyShare == share) && (assureMoney == 0.0))
                {
                    share    = 1;
                    buyShare = 1;
                }
                if ((money / ((double)share)) < 1.0)
                {
                    JavaScript.Alert(this.Page, "每份金额最低不能少于 1 元。");
                }
                else
                {
                    double num15 = (buyShare * (money / ((double)share))) + assureMoney;
                    if (str4 != "")
                    {
                        num15 = double.Parse(str18);
                    }
                    if (num15 > _User.Balance)
                    {
                        this.SaveDataForAliBuy();
                    }
                    else if (num15 > 10000000.0)
                    {
                        JavaScript.Alert(this.Page, "投注金额不能大于" + 0x989680.ToString() + ",谢谢。");
                    }
                    else if (multiple > 0x3e7)
                    {
                        JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");
                    }
                    else if ((schemeBonusScale < 0.0) && (schemeBonusScale > 10.0))
                    {
                        JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");
                    }
                    else if ((schemeBonusScale.ToString().IndexOf("-") > -1) || (schemeBonusScale.ToString().IndexOf(".") > -1))
                    {
                        JavaScript.Alert(this.Page, "佣金比例输入有误");
                    }
                    else if ((schemeBonusScalec < 0.0) && (schemeBonusScalec > 10.0))
                    {
                        JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");
                    }
                    else if ((schemeBonusScalec.ToString().IndexOf("-") > -1) || (schemeBonusScalec.ToString().IndexOf(".") > -1))
                    {
                        JavaScript.Alert(this.Page, "佣金比例输入有误");
                    }
                    else
                    {
                        schemeBonusScale  /= 100.0;
                        schemeBonusScalec /= 100.0;
                        string number = str12;
                        if (number[number.Length - 1] == '\n')
                        {
                            number = number.Substring(0, number.Length - 1);
                        }
                        Lottery  lottery  = new Lottery();
                        string[] strArray = this.SplitLotteryNumber(number);
                        if ((strArray == null) || (strArray.Length < 1))
                        {
                            JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");
                        }
                        else
                        {
                            int num17 = 0;
                            foreach (string str22 in strArray)
                            {
                                string str23 = lottery[lotteryID].AnalyseScheme(str22, playType);
                                if (!string.IsNullOrEmpty(str23))
                                {
                                    string[] strArray3 = str23.Split(new char[] { '|' });
                                    if ((strArray3 != null) && (strArray3.Length >= 1))
                                    {
                                        num17 += _Convert.StrToInt(strArray3[strArray3.Length - 1], 0);
                                    }
                                }
                            }
                            if (num17 != num7)
                            {
                                JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");
                            }
                            else
                            {
                                StringBuilder builder           = new StringBuilder();
                                int           num19             = 0;
                                string        detailXML         = "";
                                string        returnDescription = "";
                                if (str4 == "1")
                                {
                                    foreach (string str26 in base.Request.Form.AllKeys)
                                    {
                                        if (str26.IndexOf("check") > -1)
                                        {
                                            int num20 = _Convert.StrToInt(str26.Replace("check", ""), -1);
                                            if (num20 > 0)
                                            {
                                                num19++;
                                                int num21 = (_Convert.StrToInt(base.Request.Form["tb_hide_SumNum"], -1) * num) * _Convert.StrToInt(base.Request.Form["times" + num20.ToString()], -1);
                                                builder.Append(base.Request.Form[str26]).Append(",").Append(base.Request.Form["times" + num20.ToString()]).Append(",").Append(num21.ToString()).Append(",").Append(base.Request.Form["share" + num20.ToString()]).Append(",").Append(base.Request.Form["buyedShare" + num20.ToString()]).Append(",").Append(base.Request.Form["assureShare" + num20.ToString()]).Append(";");
                                            }
                                        }
                                    }
                                    if (builder.Length > 0)
                                    {
                                        builder.Remove(builder.Length - 1, 1);
                                    }
                                    if (number[number.Length - 1] == '\n')
                                    {
                                        number = number.Substring(0, number.Length - 1);
                                    }
                                    try
                                    {
                                        money = double.Parse(str13);
                                    }
                                    catch
                                    {
                                        JavaScript.Alert(this.Page, "输入有错误,请仔细检查。(-1325)");
                                        return;
                                    }
                                    if (money < 2.0)
                                    {
                                        JavaScript.Alert(this.Page, "输入有错误,请仔细检查。(-1332)");
                                    }
                                    else
                                    {
                                        string[] strArray5 = builder.ToString().Split(new char[] { ';' });
                                        int      length    = strArray5.Length;
                                        string[] str       = new string[length * 9];
                                        DateTime time2     = DateTime.Parse(Functions.F_GetIsuseSystemEndTime(long.Parse(strArray5[0].Split(new char[] { ',' })[0]), playType).ToString());
                                        if (DateTime.Now >= time2)
                                        {
                                            JavaScript.Alert(this.Page, "您选择的追号期号中包含已截止的期,请重新选择。");
                                        }
                                        else
                                        {
                                            for (int i = 0; i < length; i++)
                                            {
                                                str[i * 9]       = strArray5[i].Split(new char[] { ',' })[0];
                                                str[(i * 9) + 1] = playType.ToString();
                                                str[(i * 9) + 2] = number;
                                                str[(i * 9) + 3] = strArray5[i].Split(new char[] { ',' })[1];
                                                str[(i * 9) + 4] = strArray5[i].Split(new char[] { ',' })[2];
                                                str[(i * 9) + 5] = num8.ToString();
                                                str[(i * 9) + 6] = strArray5[i].Split(new char[] { ',' })[3];
                                                str[(i * 9) + 7] = strArray5[i].Split(new char[] { ',' })[4];
                                                str[(i * 9) + 8] = strArray5[i].Split(new char[] { ',' })[5];
                                                if ((_Convert.StrToDouble(str[(i * 9) + 3], 0.0) * money) != _Convert.StrToDouble(str[(i * 9) + 4], 1.0))
                                                {
                                                    JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");
                                                    return;
                                                }
                                                if (_Convert.StrToDouble(str[(i * 9) + 3], 0.0) < multiple)
                                                {
                                                    JavaScript.Alert(this.Page, "追号倍数有错误,请仔细检查!");
                                                    return;
                                                }
                                                if (((double.Parse(str[(i * 9) + 3]) * num7) * num) != double.Parse(str[(i * 9) + 4]))
                                                {
                                                    JavaScript.Alert(this.Page, "追号金额有错误,请仔细检查!可能原因:浏览器不兼容,建议使用IE 7.0");
                                                    return;
                                                }
                                            }
                                            detailXML = PF.BuildIsuseAdditionasXmlForBJKL8(str);
                                            if (detailXML == "")
                                            {
                                                JavaScript.Alert(this.Page, "追号发生错误。");
                                            }
                                            else if (_User.InitiateChaseTask(str8.Trim(), str9.Trim(), lotteryID, stopWhenWinMoney, detailXML, number, schemeBonusScalec, ref returnDescription) < 0)
                                            {
                                                PF.GoError(1, returnDescription, base.GetType().FullName + "(-754)");
                                            }
                                            else
                                            {
                                                Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + isuseID.ToString());
                                                Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + isuseID.ToString());
                                                Shove._Web.Cache.ClearCache(base._Site.ID.ToString() + "AccountFreezeDetail_" + _User.ID.ToString());
                                                base.Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + lotteryID.ToString() + "&Type=2&Money=" + num15.ToString());
                                            }
                                        }
                                    }
                                }
                                else if (DateTime.Now >= _Convert.StrToDateTime(str2.Replace("/", "-"), DateTime.Now.AddDays(-1.0).ToString()))
                                {
                                    JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");
                                }
                                else if (((num * num7) * multiple) != money)
                                {
                                    JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");
                                }
                                else
                                {
                                    long num25 = _User.InitiateScheme(isuseID, playType, (str8.Trim() == "") ? "(无标题)" : str8.Trim(), str9.Trim(), number, "", multiple, money, assureMoney, share, buyShare, str7.Trim(), short.Parse(num8.ToString()), schemeBonusScale, ref returnDescription);
                                    if (num25 < 0L)
                                    {
                                        PF.GoError(1, returnDescription, base.GetType().FullName + "(-755)");
                                    }
                                    else
                                    {
                                        Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + isuseID.ToString());
                                        Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + isuseID.ToString());
                                        if ((money > 50.0) && (share > 1))
                                        {
                                            Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindData");
                                        }
                                        base.Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + lotteryID.ToString() + "&Money=" + num15.ToString() + "&SchemeID=" + num25.ToString());
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        else
        {
            JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 购买彩票
    /// </summary>
    /// <param name="_User"></param>
    private void Buy(Users _User)
    {
        string HidIsuseID           = Shove._Web.Utility.GetRequest("HidIsuseID");
        string HidIsuseEndTime      = Shove._Web.Utility.GetRequest("HidIsuseEndTime");
        string playType             = Shove._Web.Utility.GetRequest("playType");
        string Chase                = Shove._Web.Utility.GetRequest("Chase");
        string CoBuy                = Shove._Web.Utility.GetRequest("CoBuy");
        string tb_Share             = Shove._Web.Utility.GetRequest("tb_Share");
        string tb_BuyShare          = Shove._Web.Utility.GetRequest("tb_BuyShare");
        string tb_AssureShare       = Shove._Web.Utility.GetRequest("tb_AssureShare");
        string tb_OpenUserList      = "";
        string tb_Title             = Shove._Web.Utility.GetRequest("tb_Title");
        string tb_Description       = Shove._Web.Utility.GetRequest("tb_Description");
        string tbAutoStopAtWinMoney = Shove._Web.Utility.GetRequest("tbAutoStopAtWinMoney");
        string tbSecrecyLevel       = Shove._Web.Utility.GetRequest("SecrecyLevel");
        string tb_LotteryNumber     = Shove._Web.Utility.FilteSqlInfusion(Request["tb_LotteryNumber"]);
        string tb_hide_SumMoney     = Shove._Web.Utility.GetRequest("tb_hide_SumMoney");
        string tb_hide_AssureMoney  = Shove._Web.Utility.GetRequest("tb_hide_AssureMoney");
        string tb_hide_SumNum       = Shove._Web.Utility.GetRequest("tb_hide_SumNum");
        string HidIsuseCount        = Shove._Web.Utility.GetRequest("HidIsuseCount");
        string HidLotteryID         = Shove._Web.Utility.GetRequest("HidLotteryID");
        string HidIsAlipay          = Shove._Web.Utility.GetRequest("HidIsAlipay");
        string tb_Multiple          = Shove._Web.Utility.GetRequest("tb_Multiple");
        string HidIsuseName         = Shove._Web.Utility.GetRequest("HidIsuseName");
        string tbPlayTypeName       = Shove._Web.Utility.GetRequest("tbPlayTypeName");
        string ChaseBuyedMoney      = Shove._Web.Utility.GetRequest("tb_hide_ChaseBuyedMoney");
        string tb_SchemeBonusScale  = Shove._Web.Utility.GetRequest("tb_SchemeBonusScale");
        string tb_SchemeBonusScalec = Shove._Web.Utility.GetRequest("tb_SchemeBonusScalec");

        int Price = 2;

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

        double SumMoney           = 0;
        int    Share              = 0;
        int    BuyShare           = 0;
        double AssureMoney        = 0;
        int    Multiple           = 0;
        int    SumNum             = 0;
        short  SecrecyLevel       = 0;
        int    PlayTypeID         = 0;
        int    LotteryID          = 0;
        long   IsuseID            = 0;
        double AutoStopAtWinMoney = 0;
        double SchemeBonusScale   = 0;
        double SchemeBonusScalec  = 0;

        try
        {
            SumMoney           = double.Parse(tb_hide_SumMoney);
            Share              = int.Parse(tb_Share);
            BuyShare           = int.Parse(tb_BuyShare);
            AssureMoney        = double.Parse(tb_hide_AssureMoney);
            Multiple           = int.Parse(tb_Multiple);
            SumNum             = int.Parse(tb_hide_SumNum);
            SecrecyLevel       = short.Parse(tbSecrecyLevel);
            PlayTypeID         = int.Parse(playType);
            LotteryID          = int.Parse(HidLotteryID);
            IsuseID            = long.Parse(HidIsuseID);
            AutoStopAtWinMoney = double.Parse(tbAutoStopAtWinMoney);
            SchemeBonusScale   = double.Parse(tb_SchemeBonusScale);
            SchemeBonusScalec  = double.Parse(tb_SchemeBonusScalec);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if ((SumMoney <= 0) || (SumNum < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (AssureMoney < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (Share < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

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

        if ((SumMoney / Share) < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "每份金额最低不能少于 1 元。");

            return;
        }

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

        if (Chase != "")
        {
            BuyMoney = double.Parse(ChaseBuyedMoney);
        }

        if (BuyMoney > _User.Balance)
        {
            SaveDataForAliBuy();

            return;
        }

        if (BuyMoney > PF.SchemeMaxBettingMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注金额不能大于" + PF.SchemeMaxBettingMoney.ToString() + ",谢谢。");

            return;
        }

        if (Multiple > 999)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");

            return;
        }
        //佣金比例的计算

        if (!(SchemeBonusScale >= 0 || SchemeBonusScale <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScale.ToString().IndexOf("-") > -1 || SchemeBonusScale.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }
        if (!(SchemeBonusScalec >= 0 || SchemeBonusScalec <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScalec.ToString().IndexOf("-") > -1 || SchemeBonusScalec.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }

        SchemeBonusScale  = SchemeBonusScale / 100;
        SchemeBonusScalec = SchemeBonusScalec / 100;
        string LotteryNumber = tb_LotteryNumber;

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

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

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

        if ((t_lotterys == null) || (t_lotterys.Length < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");

            return;
        }

        int ValidNum = 0;

        foreach (string str in t_lotterys)
        {
            string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

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

        if (ValidNum != SumNum)
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

            return;
        }

        #endregion

        StringBuilder ChaseXML          = new StringBuilder();
        int           RpTodayDataCount  = 0;
        string        AdditionasXml     = "";
        string        ReturnDescription = "";

        //追号
        if (Chase == "1")
        {
            foreach (string key in Request.Form.AllKeys)
            {
                if (key.IndexOf("check") > -1)
                {
                    int row = Shove._Convert.StrToInt(key.Replace("check", ""), -1);
                    if (row > 0)
                    {
                        RpTodayDataCount++;
                        int money = Shove._Convert.StrToInt(Request.Form["tb_hide_SumNum"], -1) * Price * Shove._Convert.StrToInt(Request.Form["times" + row.ToString()], -1);
                        ChaseXML.Append(Request.Form[key]).Append(",")
                        .Append(Request.Form["times" + row.ToString()]).Append(",")
                        .Append(money.ToString()).Append(",")
                        .Append(Request.Form["share" + row.ToString()]).Append(",")
                        .Append(Request.Form["buyedShare" + row.ToString()]).Append(",")
                        .Append(Request.Form["assureShare" + row.ToString()]).Append(";");
                    }
                }
            }

            if (ChaseXML.Length > 0)
            {
                ChaseXML.Remove(ChaseXML.Length - 1, 1);
            }

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

            try
            {
                SumMoney = double.Parse(tb_hide_SumMoney);
            }
            catch
            {
                Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。(-1325)");

                return;
            }

            if (SumMoney < 2)
            {
                Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。(-1332)");

                return;
            }

            string[] XML = ChaseXML.ToString().Split(';');
            int      CompetitionCount = XML.Length;

            string[] Xmlparams = new string[CompetitionCount * 9];

            string   str_EndTime = DAL.Functions.F_GetIsuseSystemEndTime(long.Parse(XML[0].Split(',')[0]), PlayTypeID).ToString();
            DateTime EndTime     = DateTime.Parse(str_EndTime);

            if (DateTime.Now >= EndTime)
            {
                Shove._Web.JavaScript.Alert(this.Page, "您选择的追号期号中包含已截止的期,请重新选择。");

                return;
            }

            //构建格式:期号,玩法类别,方案,倍数,金额,方案保密级别
            for (int i = 0; i < CompetitionCount; i++)
            {
                Xmlparams[i * 9]     = XML[i].Split(',')[0];    //期号
                Xmlparams[i * 9 + 1] = PlayTypeID.ToString();   //玩法类别
                Xmlparams[i * 9 + 2] = LotteryNumber;           //方案
                Xmlparams[i * 9 + 3] = XML[i].Split(',')[1];    //倍数
                Xmlparams[i * 9 + 4] = XML[i].Split(',')[2];    //金额
                Xmlparams[i * 9 + 5] = SecrecyLevel.ToString();
                Xmlparams[i * 9 + 6] = XML[i].Split(',')[3];    //总份数
                Xmlparams[i * 9 + 7] = XML[i].Split(',')[4];    //认购份数
                Xmlparams[i * 9 + 8] = XML[i].Split(',')[5];    //保底份数

                if (Shove._Convert.StrToDouble(Xmlparams[i * 9 + 3], 0) * SumMoney != Shove._Convert.StrToDouble(Xmlparams[i * 9 + 4], 1))
                {
                    Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

                    return;
                }

                if (Shove._Convert.StrToDouble(Xmlparams[i * 9 + 3], 0) < Multiple)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "追号倍数有错误,请仔细检查!");

                    return;
                }

                if (double.Parse(Xmlparams[i * 9 + 3]) * SumNum * Price != double.Parse(Xmlparams[i * 9 + 4]))
                {
                    Shove._Web.JavaScript.Alert(this.Page, "追号金额有错误,请仔细检查!可能原因:浏览器不兼容,建议使用IE 7.0");

                    return;
                }
            }

            AdditionasXml = PF.BuildIsuseAdditionasXmlForBJKL8(Xmlparams);

            if (AdditionasXml == "")
            {
                Shove._Web.JavaScript.Alert(this.Page, "追号发生错误。");

                return;
            }

            if (_User.InitiateChaseTask(tb_Title.Trim(), tb_Description.Trim(), LotteryID, AutoStopAtWinMoney, AdditionasXml, LotteryNumber, SchemeBonusScalec, ref ReturnDescription) < 0)
            {
                PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-754)");

                return;
            }

            Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + IsuseID.ToString());
            Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + IsuseID.ToString());
            Shove._Web.Cache.ClearCache(_Site.ID.ToString() + "AccountFreezeDetail_" + _User.ID.ToString());

            Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&Type=2&Money=" + BuyMoney.ToString() + "");

            return;
        }
        else
        {
            if (DateTime.Now >= Shove._Convert.StrToDateTime(HidIsuseEndTime.Replace("/", "-"), DateTime.Now.AddDays(-1).ToString()))
            {
                Shove._Web.JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");

                return;
            }

            if (Price * SumNum * Multiple != SumMoney)
            {
                Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

                return;
            }

            long SchemeID = _User.InitiateScheme(IsuseID, PlayTypeID, tb_Title.Trim() == "" ? "(无标题)" : tb_Title.Trim(), tb_Description.Trim(), LotteryNumber, "", Multiple, SumMoney, AssureMoney, Share, BuyShare, tb_OpenUserList.Trim(), short.Parse(SecrecyLevel.ToString()), SchemeBonusScale, ref ReturnDescription);
            if (SchemeID < 0)
            {
                PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-755)");

                return;
            }

            Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + IsuseID.ToString());
            Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + IsuseID.ToString());

            if (SumMoney > 50 && Share > 1)
            {
                Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindData");
            }

            Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&Money=" + BuyMoney.ToString() + "&SchemeID=" + SchemeID.ToString() + "");

            return;
        }
    }