예제 #1
0
파일: Open.aspx.cs 프로젝트: ichari/ichari
    protected void btnGO_Step2_Click(object sender, EventArgs e)
    {
        btnGO_Step1.AlertText = "";

        if (ddlLottery.SelectedValue == SLS.Lottery.ZCDC.sID)
        {
            Shove._Web.JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。");

            return;
        }

        tbWinNumber.Text = Shove._Convert.ToDBC(tbWinNumber.Text.Trim().Replace(" ", " ")).Trim();

        if (!new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].AnalyseWinNumber(tbWinNumber.Text))
        {
            Shove._Web.JavaScript.Alert(this.Page, "开奖号码不正确!");

            return;
        }

        SystemOptions so = new SystemOptions();
        bool isCompareWinMoneyNoWithFax = so["isCompareWinMoneyNoWithFax"].ToBoolean(true);

        double[] WinMoneyList = new double[g.Rows.Count * 2];

        for (int i = 0; i < g.Rows.Count; i++)
        {
            WinMoneyList[i * 2] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0);
            WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0);

            if (WinMoneyList[i * 2] < 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项奖金输入错误!");

                return;
            }

            if (WinMoneyList[i * 2] < WinMoneyList[i * 2 + 1])
            {
                if (isCompareWinMoneyNoWithFax)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!");

                    return;
                }
            }
        }

        if (Shove._Convert.ToTextCode(tbOpenAffiche.Value.Trim()) == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入开奖公告!");

            return;
        }

        DataTable dt = new DAL.Tables.T_ElectronTicketAgentSchemes().Open("*", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and WinMoney is null and state = 1", "[ID]");

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

            return;
        }

        DAL.Tables.T_ElectronTicketAgentSchemes t_ElectronTicketAgentSchemes = new DAL.Tables.T_ElectronTicketAgentSchemes();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string LotteryNumber = dt.Rows[i]["LotteryNumber"].ToString();
            string Description = "";
            double WinMoneyNoWithTax = 0;

            double WinMoney = new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].ComputeWin(LotteryNumber, tbWinNumber.Text.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dt.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

            t_ElectronTicketAgentSchemes.WinMoney.Value = WinMoney * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1);
            t_ElectronTicketAgentSchemes.WinMoneyWithoutTax.Value = WinMoneyNoWithTax * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1);
            t_ElectronTicketAgentSchemes.WinDescription.Value = Description;

            t_ElectronTicketAgentSchemes.Update("[ID] =" + dt.Rows[i]["ID"].ToString());
        }

        dt = new DAL.Tables.T_ElectronTicketAgentSchemes().Open("top 1 * ", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and state = 1 and WinMoney is null", "[ID]");

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

            return;
        }

        Step2IsOpen = (dt.Rows.Count > 0);

        btnGO_Step2.Enabled = Step2IsOpen;
        btnGO_Step3.Enabled = (!Step2IsOpen);

        string Message = "请再次执行第二步";

        if (!Step2IsOpen)
        {
            Message = "开奖步骤二已经完成,请执行第三步.";
        }

        Shove._Web.JavaScript.Alert(this.Page, Message);
    }
예제 #2
0
 protected void btnGO_Step2_Click(object sender, EventArgs e)
 {
     this.btnGO_Step1.AlertText = "";
     if (this.ddlLottery.SelectedValue == "45")
     {
         JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。");
     }
     else
     {
         this.tbWinNumber.Text = _Convert.ToDBC(this.tbWinNumber.Text.Trim().Replace(" ", " ")).Trim();
         if (!new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].AnalyseWinNumber(this.tbWinNumber.Text))
         {
             JavaScript.Alert(this.Page, "开奖号码不正确!");
         }
         else
         {
             SystemOptions options = new SystemOptions();
             bool flag = options["isCompareWinMoneyNoWithFax"].ToBoolean(true);
             double[] winMoneyList = new double[this.g.Rows.Count * 2];
             for (int i = 0; i < this.g.Rows.Count; i++)
             {
                 winMoneyList[i * 2] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0.0);
                 winMoneyList[(i * 2) + 1] = _Convert.StrToDouble(((TextBox)this.g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0.0);
                 if (winMoneyList[i * 2] < 0.0)
                 {
                     JavaScript.Alert(this.Page, "第 " + ((i + 1)).ToString() + " 项奖金输入错误!");
                     return;
                 }
                 if ((winMoneyList[i * 2] < winMoneyList[(i * 2) + 1]) && flag)
                 {
                     JavaScript.Alert(this.Page, "第 " + ((i + 1)).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!");
                     return;
                 }
             }
             if (_Convert.ToTextCode(this.tbOpenAffiche.Text.Trim()) == "")
             {
                 JavaScript.Alert(this.Page, "请输入开奖公告!");
             }
             else
             {
                 DataTable table = new Tables.T_ElectronTicketAgentSchemes().Open("top 500 *", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and WinMoney is null and state = 1", "[ID]");
                 if (table == null)
                 {
                     PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName);
                 }
                 else
                 {
                     Tables.T_ElectronTicketAgentSchemes schemes = new Tables.T_ElectronTicketAgentSchemes();
                     for (int j = 0; j < table.Rows.Count; j++)
                     {
                         string number = table.Rows[j]["LotteryNumber"].ToString();
                         string description = "";
                         double winMoneyNoWithTax = 0.0;
                         double num6 = new Lottery()[int.Parse(this.ddlLottery.SelectedValue)].ComputeWin(number, this.tbWinNumber.Text.Trim(), ref description, ref winMoneyNoWithTax, int.Parse(table.Rows[j]["PlayTypeID"].ToString()), winMoneyList);
                         schemes.WinMoney.Value = num6 * _Convert.StrToInt(table.Rows[j]["Multiple"].ToString(), 1);
                         schemes.WinMoneyWithoutTax.Value = winMoneyNoWithTax * _Convert.StrToInt(table.Rows[j]["Multiple"].ToString(), 1);
                         schemes.WinDescription.Value = description;
                         schemes.Update("[ID] =" + table.Rows[j]["ID"].ToString());
                     }
                     this.Step2IsOpen = table.Rows.Count == 500;
                     if (!this.Step2IsOpen)
                     {
                         table = new Tables.T_ElectronTicketAgentSchemes().Open("top 1 * ", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and state = 1 and WinMoney is null", "[ID]");
                         if (table == null)
                         {
                             PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName);
                             return;
                         }
                         this.Step2IsOpen = table.Rows.Count > 0;
                     }
                     this.btnGO_Step2.Enabled = this.Step2IsOpen;
                     this.btnGO_Step3.Enabled = !this.Step2IsOpen;
                     string msg = "请再次执行第二步";
                     if (!this.Step2IsOpen)
                     {
                         msg = "开奖步骤二已经完成,请执行第三步.";
                     }
                     JavaScript.Alert(this.Page, msg);
                 }
             }
         }
     }
 }