private void BindData()
 {
     DataTable table = new Tables.T_Isuses().Open("", "[ID]=" + Utility.FilteSqlInfusion(this.tbIsuseID.Text), "");
     if ((table == null) || (table.Rows.Count < 1))
     {
         PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);
     }
     else
     {
         this.tbIsuse.Text = table.Rows[0]["Name"].ToString();
         this.tbStartTime.Text = _Convert.StrToDateTime(table.Rows[0]["StartTime"].ToString(), "0000-00-00 00:00:00").ToString("yyyy-MM-dd HH:mm:ss");
         this.tbEndTime.Text = _Convert.StrToDateTime(table.Rows[0]["EndTime"].ToString(), "0000-00-00 00:00:00").ToString("yyyy-MM-dd HH:mm:ss");
         if (this.tbLotteryID.Text == "1")
         {
             table = new Tables.T_IsuseForSFC().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.tbIsuseID.Text), "[No]");
             if ((table == null) || (table.Rows.Count < 14))
             {
                 PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);
                 return;
             }
             for (int i = 0; i < 14; i++)
             {
                 int num2 = i + 1;
                 TextBox box = (TextBox)this.FindControl("tbSFC" + num2.ToString());
                 int num3 = i + 1;
                 TextBox box2 = (TextBox)this.FindControl("tbSFC" + num3.ToString() + "_1");
                 int num4 = i + 1;
                 TextBox box3 = (TextBox)this.FindControl("tbSFC" + num4.ToString() + "_2");
                 box.Text = table.Rows[i]["HostTeam"].ToString();
                 box2.Text = table.Rows[i]["QuestTeam"].ToString();
                 box3.Text = table.Rows[i]["DateTime"].ToString();
             }
         }
         if (this.tbLotteryID.Text == "2")
         {
             table = new Tables.T_IsuseForJQC().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.tbIsuseID.Text), "[No]");
             if ((table == null) || (table.Rows.Count < 8))
             {
                 PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);
                 return;
             }
             for (int j = 0; j < 8; j++)
             {
                 int num6 = j + 1;
                 TextBox box4 = (TextBox)this.FindControl("tbJQC" + num6.ToString());
                 int num7 = j + 1;
                 TextBox box5 = (TextBox)this.FindControl("tbJQC" + num7.ToString() + "_2");
                 box4.Text = table.Rows[j]["Team"].ToString();
                 box5.Text = table.Rows[j]["DateTime"].ToString();
             }
         }
         if (this.tbLotteryID.Text == "15")
         {
             table = new Tables.T_IsuseForLCBQC().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.tbIsuseID.Text), "[No]");
             if ((table == null) || (table.Rows.Count < 6))
             {
                 PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);
                 return;
             }
             for (int k = 0; k < 6; k++)
             {
                 int num9 = k + 1;
                 TextBox box6 = (TextBox)this.FindControl("tbLCBQC" + num9.ToString());
                 int num10 = k + 1;
                 TextBox box7 = (TextBox)this.FindControl("tbLCBQC" + num10.ToString() + "_1");
                 int num11 = k + 1;
                 TextBox box8 = (TextBox)this.FindControl("tbLCBQC" + num11.ToString() + "_2");
                 box6.Text = table.Rows[k]["HostTeam"].ToString();
                 box7.Text = table.Rows[k]["QuestTeam"].ToString();
                 box8.Text = table.Rows[k]["DateTime"].ToString();
             }
         }
         if (this.tbLotteryID.Text == "19")
         {
             table = new Tables.T_IsuseForLCDC().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.tbIsuseID.Text), "[No]");
             if ((table == null) || (table.Rows.Count < 1))
             {
                 PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);
                 return;
             }
             for (int m = 0; m < 1; m++)
             {
                 int num13 = m + 1;
                 TextBox box9 = (TextBox)this.FindControl("tbLCDC" + num13.ToString());
                 int num14 = m + 1;
                 TextBox box10 = (TextBox)this.FindControl("tbLCDC" + num14.ToString() + "_1");
                 int num15 = m + 1;
                 TextBox box11 = (TextBox)this.FindControl("tbLCDC" + num15.ToString() + "_2");
                 box9.Text = table.Rows[m]["HostTeam"].ToString();
                 box10.Text = table.Rows[m]["QuestTeam"].ToString();
                 box11.Text = table.Rows[m]["DateTime"].ToString();
             }
         }
         if (this.tbLotteryID.Text == "45")
         {
             table = new Tables.T_IsuseForZCDC().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.tbIsuseID.Text), "[No]");
             if ((table == null) || (table.Rows.Count < 1))
             {
                 PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);
                 return;
             }
             this.DataListZCDC.DataSource = table.DefaultView;
             this.DataListZCDC.DataBind();
         }
         DataTable table2 = new Tables.T_TestNumber().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.tbIsuseID.Text), "");
         DataTable table3 = new Tables.T_TotalMoney().Open("", "IsuseID= " + Utility.FilteSqlInfusion(this.tbIsuseID.Text), "");
         if (table2 == null)
         {
             PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);
         }
         else if (table3 == null)
         {
             PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);
         }
         else
         {
             if (table2.Rows.Count > 0)
             {
                 this.tbTestNumber.Text = table2.Rows[0]["TestNumber"].ToString();
                 this.hidID.Value = table2.Rows[0]["ID"].ToString();
             }
             if (table3.Rows.Count > 0)
             {
                 this.tbMoney.Text = table3.Rows[0]["TotalMoney"].ToString();
                 this.moneyID.Value = table3.Rows[0]["ID"].ToString();
             }
         }
     }
 }
 protected void btnEdit_Click(object sender, EventArgs e)
 {
     string name = "";
     try
     {
         name = Utility.FilteSqlInfusion(this.tbIsuse.Text.Trim());
     }
     catch
     {
     }
     if (name == "")
     {
         JavaScript.Alert(this.Page, "期号不能为空!");
     }
     else
     {
         DataTable table = new Tables.T_Isuses().Open("[ID]", "[Name]='" + name + "' and LotteryID=" + Utility.FilteSqlInfusion(this.tbLotteryID.Text) + " and [ID] <> " + Utility.FilteSqlInfusion(this.tbIsuseID.Text), "");
         if (table == null)
         {
             PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);
         }
         else if (table.Rows.Count > 0)
         {
             JavaScript.Alert(this.Page, "期号已经存在,请不要输入重名期号!");
         }
         else
         {
             object obj2 = PF.ValidLotteryTime(this.tbStartTime.Text);
             if (obj2 == null)
             {
                 JavaScript.Alert(this.Page, "开始时间格式输入错误!");
             }
             else
             {
                 DateTime startTime = (DateTime)obj2;
                 obj2 = PF.ValidLotteryTime(this.tbEndTime.Text);
                 if (obj2 == null)
                 {
                     JavaScript.Alert(this.Page, "截止时间格式输入错误!");
                 }
                 else
                 {
                     DateTime endTime = (DateTime)obj2;
                     if (endTime <= startTime)
                     {
                         JavaScript.Alert(this.Page, "截止时间应该在开始时间之后!");
                     }
                     else
                     {
                         string additionasXml = "";
                         if ((((((this.tbLotteryID.Text != "1") || (this.BuildAdditionasXmlForSFC(ref additionasXml) >= 0)) && ((this.tbLotteryID.Text != "2") || (this.BuildAdditionasXmlForJQC(ref additionasXml) >= 0))) && ((this.tbLotteryID.Text != "15") || (this.BuildAdditionasXmlForLCBQC(ref additionasXml) >= 0))) && ((this.tbLotteryID.Text != "19") || (this.BuildAdditionasXmlForLCDC(ref additionasXml) >= 0))) && ((this.tbLotteryID.Text != "45") || (this.BuildAdditionasXmlForZCDC(ref additionasXml) >= 0)))
                         {
                             long isuseID = long.Parse(this.tbIsuseID.Text);
                             int returnValue = -1;
                             string returnDescription = "";
                             if (Procedures.P_IsuseEdit(isuseID, name, startTime, endTime, additionasXml, ref returnValue, ref returnDescription) < 0)
                             {
                                 PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);
                             }
                             else if (returnValue < 0)
                             {
                                 PF.GoError(1, returnDescription, this.Page.GetType().BaseType.FullName);
                             }
                             else
                             {
                                 if (this.tbTestNumber.Text.Trim() != "")
                                 {
                                     Tables.T_TestNumber number = new Tables.T_TestNumber
                                     {
                                         TestNumber = { Value = this.tbTestNumber.Text.Trim() },
                                         IsuseID = { Value = isuseID.ToString() }
                                     };
                                     if (_Convert.StrToLong(this.hidID.Value, 0L) > 0L)
                                     {
                                         number.Update("ID=" + this.hidID.Value);
                                     }
                                     else
                                     {
                                         number.Insert();
                                     }
                                 }
                                 if (this.tbMoney.Text.Trim() != "")
                                 {
                                     Tables.T_TotalMoney money = new Tables.T_TotalMoney
                                     {
                                         TotalMoney = { Value = this.tbMoney.Text.Trim() },
                                         IsuseID = { Value = this.tbIsuseID.Text }
                                     };
                                     if (_Convert.StrToLong(this.moneyID.Value, 0L) > 0L)
                                     {
                                         money.Update("ID=" + this.moneyID.Value);
                                     }
                                     else
                                     {
                                         money.Insert();
                                     }
                                 }
                                 Shove._Web.Cache.ClearCache("LotteryCalendar");
                                 Shove._Web.Cache.ClearCache(DataCache.IsusesInfo + this.tbLotteryID.Text.Trim());
                                 base.Response.Redirect("Isuse.aspx?LotteryID=" + this.tbLotteryID.Text, true);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #3
0
 private string GetTestNumber(string IsuseID)
 {
     string str = "";
     string key = "Home_Room_Buy_GetTestNumber_" + IsuseID;
     DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key);
     if (cacheAsDataTable == null)
     {
         cacheAsDataTable = new Tables.T_TestNumber().Open("", "IsuseID=" + IsuseID, "");
         if (cacheAsDataTable == null)
         {
             new Log("System").Write(base.GetType().FullName + "数据库繁忙,请重试(GetTestNumber)");
             return "";
         }
         Shove._Web.Cache.SetCache(key, cacheAsDataTable, 120);
     }
     if (cacheAsDataTable.Rows.Count > 0)
     {
         str = cacheAsDataTable.Rows[0]["TestNumber"].ToString();
     }
     return str;
 }
Example #4
0
    /// <summary>
    /// 获取试机号
    /// </summary>
    /// <param name="IsuseID"></param>
    /// <returns></returns>
    private string GetTestNumber(string IsuseID)
    {
        string TestNumber = "";

        string Key = "Home_Room_Buy_GetTestNumber_" + IsuseID;
        DataTable dtTestNumber = Shove._Web.Cache.GetCacheAsDataTable(Key);

        if (dtTestNumber == null)
        {
            dtTestNumber = new DAL.Tables.T_TestNumber().Open("", "IsuseID=" + IsuseID, "");

            if (dtTestNumber == null)
            {
                new Log("System").Write(this.GetType().FullName + "数据库繁忙,请重试(GetTestNumber)");

                return "";
            }

            Shove._Web.Cache.SetCache(Key, dtTestNumber, 120);
        }

        if (dtTestNumber.Rows.Count > 0)
        {
            TestNumber = dtTestNumber.Rows[0]["TestNumber"].ToString();
        }

        return TestNumber;
    }
Example #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataTable dtFc = BindNewWinNumber(6);//福彩3D
            if (dtFc.Rows.Count > 0 && dtFc != null)
            {
                lblFC3D.Text = dtFc.Rows[0]["Name"].ToString();
                spFCWinNumber.InnerHtml = "<font class='redfont'>" + dtFc.Rows[0]["WinLotteryNumber"].ToString() + "</font>";

                DataTable dtTestNumber = new DAL.Tables.T_TestNumber().Open("", "IsuseID=" + dtFc.Rows[0]["ID"].ToString(), "");

                if (dtTestNumber == null)
                {
                    return;
                }

                if (dtTestNumber.Rows.Count > 0)
                {
                    spFCTest.InnerHtml = dtTestNumber.Rows[0]["TestNumber"].ToString();
                }
            }

            DataTable dtSSQ = BindNewWinNumber(5);//双色球
            if (dtSSQ.Rows.Count > 0 && dtSSQ != null)
            {
                lbSSQ.Text = dtSSQ.Rows[0]["Name"].ToString();
                spSSQWinNumber.InnerHtml = "<font class='redfont'>" + dtSSQ.Rows[0]["WinLotteryNumber"].ToString() + "</font>";
            }

            DataTable dtQLC = BindNewWinNumber(13);//七乐彩
            if (dtQLC.Rows.Count > 0 && dtQLC != null)
            {
                lbQLC.Text = dtQLC.Rows[0]["Name"].ToString();
                spQLCWinNumber.InnerHtml = "<font class='redfont'>" + dtQLC.Rows[0]["WinLotteryNumber"].ToString() + "</font>";
            }

            DataTable dtHNFC22X5 = BindNewWinNumber(69);//河南福彩22选5
            if (dtHNFC22X5.Rows.Count > 0 && dtHNFC22X5 != null)
            {
                lbHNFC22X5.Text = dtHNFC22X5.Rows[0]["Name"].ToString();
                spHNFC22X5WinNumber.InnerHtml = "<font class='redfont'>" + dtHNFC22X5.Rows[0]["WinLotteryNumber"].ToString() + "</font>";
            }

            DataTable dtTCDTL = BindNewWinNumber(39);//超级大透乐
            if (dtTCDTL.Rows.Count > 0 && dtTCDTL != null)
            {
                lbTCDTL.Text = dtTCDTL.Rows[0]["Name"].ToString();
                spTCDTLWinNumber.InnerHtml = "<font class='redfont'>" + dtTCDTL.Rows[0]["WinLotteryNumber"].ToString() + "</font>";
            }

            DataTable dtPL3 = BindNewWinNumber(63);//排列3
            if (dtPL3.Rows.Count > 0 && dtPL3 != null)
            {
                lbPl3.Text = dtPL3.Rows[0]["Name"].ToString();
                spPl3WinNumber.InnerHtml = "<font class='redfont'>" + dtPL3.Rows[0]["WinLotteryNumber"].ToString() + "</font>";
            }

            DataTable dtPL5 = BindNewWinNumber(64);//排列5
            if (dtPL5.Rows.Count > 0 && dtPL5 != null)
            {
                lbPl5.Text = dtPL5.Rows[0]["Name"].ToString();
                spPl5WinNumber.InnerHtml = "<font class='redfont'>" + dtPL5.Rows[0]["WinLotteryNumber"].ToString() + "</font>";
            }

            DataTable dtQxC = BindNewWinNumber(3);//七星彩
            if (dtQxC.Rows.Count > 0 && dtQxC != null)
            {
                lbQxC.Text = dtQxC.Rows[0]["Name"].ToString();
                spQxCWinNumber.InnerHtml = "<font class='redfont'>" + dtQxC.Rows[0]["WinLotteryNumber"].ToString() + "</font>";
            }

            DataTable dtTC22_5 = BindNewWinNumber(9);//体彩22选5
            if (dtTC22_5.Rows.Count > 0 && dtTC22_5 != null)
            {
                lbTC22_5.Text = dtTC22_5.Rows[0]["Name"].ToString();
                spTC22_5WinNumber.InnerHtml = "<font class='redfont'>" + dtTC22_5.Rows[0]["WinLotteryNumber"].ToString() + "</font>";
            }

            DataTable dtSFCRJ = BindNewWinNumber(74);//胜负彩(任九)
            if (dtSFCRJ.Rows.Count > 0 && dtSFCRJ != null)
            {
                lblSFCRJ.Text = dtSFCRJ.Rows[0]["Name"].ToString();
                spSFCRJWinNumber.InnerHtml = "<font class='redfont'>" + dtSFCRJ.Rows[0]["WinLotteryNumber"].ToString() + "</font>";
            }

            DataTable dtLCBQC = BindNewWinNumber(15);//六场半全场
            if (dtLCBQC.Rows.Count > 0 && dtLCBQC != null)
            {
                lblLCBQC.Text = dtLCBQC.Rows[0]["Name"].ToString();
                spLCBQCWinNumber.InnerHtml = "<font class='redfont'>" + dtLCBQC.Rows[0]["WinLotteryNumber"].ToString() + "</font>";
            }

            DataTable dtSCJQC = BindNewWinNumber(2);//四场进球彩
            if (dtSCJQC.Rows.Count > 0 && dtSCJQC != null)
            {
                lblSCJQC.Text = dtSCJQC.Rows[0]["Name"].ToString();
                spSCJQC.InnerHtml = "<font class='redfont'>" + dtSCJQC.Rows[0]["WinLotteryNumber"].ToString() + "</font>";
            }

        }
    }
Example #6
0
    private void BindData()
    {
        DataTable dt = new DAL.Tables.T_Isuses().Open("", "[ID]=" + Shove._Web.Utility.FilteSqlInfusion(tbIsuseID.Text), "");

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

            return;
        }

        tbIsuse.Text = dt.Rows[0]["Name"].ToString();
        tbStartTime.Text = Shove._Convert.StrToDateTime(dt.Rows[0]["StartTime"].ToString(), "0000-00-00 00:00:00").ToString("yyyy-MM-dd HH:mm:ss");
        tbEndTime.Text = Shove._Convert.StrToDateTime(dt.Rows[0]["EndTime"].ToString(), "0000-00-00 00:00:00").ToString("yyyy-MM-dd HH:mm:ss");

        if (tbLotteryID.Text == SLS.Lottery.SFC.sID || tbLotteryID.Text == SLS.Lottery.ZCSFC.sID || tbLotteryID.Text == SLS.Lottery.ZCRJC.sID)
        {
            dt = new DAL.Tables.T_IsuseForSFC().Open("", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(tbIsuseID.Text), "[No]");

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

                return;
            }

            if (dt.Rows.Count != 14)
            {
                return;
            }

            for (int i = 0; i < 14; i++)
            {
                TextBox tb = (TextBox)this.FindControl("tbSFC" + (i + 1).ToString());
                TextBox tb_1 = (TextBox)this.FindControl("tbSFC" + (i + 1).ToString() + "_1");
                TextBox tb_2 = (TextBox)this.FindControl("tbSFC" + (i + 1).ToString() + "_2");

                tb.Text = dt.Rows[i]["HostTeam"].ToString();
                tb_1.Text = dt.Rows[i]["QuestTeam"].ToString();
                tb_2.Text = dt.Rows[i]["DateTime"].ToString();
            }
        }

        if (tbLotteryID.Text == SLS.Lottery.JQC.sID)
        {
            dt = new DAL.Tables.T_IsuseForJQC().Open("", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(tbIsuseID.Text), "[No]");

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

                return;
            }

            for (int i = 0; i < 8; i++)
            {
                TextBox tb = (TextBox)this.FindControl("tbJQC" + (i + 1).ToString());
                TextBox tb_2 = (TextBox)this.FindControl("tbJQC" + (i + 1).ToString() + "_2");

                tb.Text = dt.Rows[i]["Team"].ToString();
                tb_2.Text = dt.Rows[i]["DateTime"].ToString();
            }
        }

        if (tbLotteryID.Text == SLS.Lottery.LCBQC.sID)
        {
            dt = new DAL.Tables.T_IsuseForLCBQC().Open("", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(tbIsuseID.Text), "[No]");

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

                return;
            }

            for (int i = 0; i < 6; i++)
            {
                TextBox tb = (TextBox)this.FindControl("tbLCBQC" + (i + 1).ToString());
                TextBox tb_1 = (TextBox)this.FindControl("tbLCBQC" + (i + 1).ToString() + "_1");
                TextBox tb_2 = (TextBox)this.FindControl("tbLCBQC" + (i + 1).ToString() + "_2");

                tb.Text = dt.Rows[i]["HostTeam"].ToString();
                tb_1.Text = dt.Rows[i]["QuestTeam"].ToString();
                tb_2.Text = dt.Rows[i]["DateTime"].ToString();
            }
        }

        if (tbLotteryID.Text == SLS.Lottery.LCDC.sID)
        {
            dt = new DAL.Tables.T_IsuseForLCDC().Open("", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(tbIsuseID.Text), "[No]");

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

                return;
            }

            for (int i = 0; i < 1; i++)
            {
                TextBox tb = (TextBox)this.FindControl("tbLCDC" + (i + 1).ToString());
                TextBox tb_1 = (TextBox)this.FindControl("tbLCDC" + (i + 1).ToString() + "_1");
                TextBox tb_2 = (TextBox)this.FindControl("tbLCDC" + (i + 1).ToString() + "_2");

                tb.Text = dt.Rows[i]["HostTeam"].ToString();
                tb_1.Text = dt.Rows[i]["QuestTeam"].ToString();
                tb_2.Text = dt.Rows[i]["DateTime"].ToString();
            }
        }     

        DataTable dtTestNumber = new DAL.Tables.T_TestNumber().Open("", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(tbIsuseID.Text), "");

        DataTable dtTotalMoney = new DAL.Tables.T_TotalMoney().Open("", "IsuseID= " + Shove._Web.Utility.FilteSqlInfusion(tbIsuseID.Text) , "");


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

            return;
        }
        if (dtTotalMoney == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite,"数据库繁忙,请重试",this.Page.GetType().BaseType.FullName);
            return;
        }
        if (dtTestNumber.Rows.Count > 0)
        {
            tbTestNumber.Text = dtTestNumber.Rows[0]["TestNumber"].ToString();
            hidID.Value = dtTestNumber.Rows[0]["ID"].ToString();
        }
        if (dtTotalMoney.Rows.Count > 0)
        {
            tbMoney.Text = dtTotalMoney.Rows[0]["TotalMoney"].ToString();
            moneyID.Value = dtTotalMoney.Rows[0]["ID"].ToString();
        }
    }
Example #7
0
    protected void btnEdit_Click(object sender, System.EventArgs e)
    {
        string Isuse = "";

        try
        {
            Isuse = Shove._Web.Utility.FilteSqlInfusion(tbIsuse.Text.Trim());
        }
        catch
        { }

        if (Isuse == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "期号不能为空!");

            return;
        }

        DataTable dt = new DAL.Tables.T_Isuses().Open("[ID]", "[Name]='" + Isuse + "' and LotteryID=" + Shove._Web.Utility.FilteSqlInfusion(tbLotteryID.Text) + " and [ID] <> " + Shove._Web.Utility.FilteSqlInfusion(tbIsuseID.Text), "");

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

            return;
        }

        if (dt.Rows.Count > 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "期号已经存在,请不要输入重名期号!");

            return;
        }

        System.DateTime StartTime, EndTime;

        object time = PF.ValidLotteryTime(tbStartTime.Text);
        if (time == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "开始时间格式输入错误!");
            return;
        }

        StartTime = (DateTime)time;

        time = PF.ValidLotteryTime(tbEndTime.Text);

        if (time == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "截止时间格式输入错误!");

            return;
        }

        EndTime = (DateTime)time;

        if (EndTime <= StartTime)
        {
            Shove._Web.JavaScript.Alert(this.Page, "截止时间应该在开始时间之后!");

            return;
        }

        string AdditionasXml = "";

        if ((tbLotteryID.Text == SLS.Lottery.SFC.sID || tbLotteryID.Text == SLS.Lottery.ZCSFC.sID || tbLotteryID.Text == SLS.Lottery.ZCRJC.sID) && (BuildAdditionasXmlForSFC(ref AdditionasXml) < 0))
        {
            return;
        }

        if ((tbLotteryID.Text == SLS.Lottery.JQC.sID) && (BuildAdditionasXmlForJQC(ref AdditionasXml) < 0))
        {
            return;
        }

        if ((tbLotteryID.Text == SLS.Lottery.LCBQC.sID) && (BuildAdditionasXmlForLCBQC(ref AdditionasXml) < 0))
        {
            return;
        }

        if ((tbLotteryID.Text == SLS.Lottery.LCDC.sID) && (BuildAdditionasXmlForLCDC(ref AdditionasXml) < 0))
        {
            return;
        }

        if ((tbLotteryID.Text == SLS.Lottery.ZCDC.sID) && (BuildAdditionasXmlForZCDC(ref AdditionasXml) < 0))
        {
            return;
        }

        long IsuseID = long.Parse(tbIsuseID.Text);

        int ReturnValue = -1;
        string ReturnDescription = "";

        int Result = DAL.Procedures.P_IsuseEdit(IsuseID, Isuse, StartTime, EndTime, AdditionasXml, ref ReturnValue, ref ReturnDescription);

        if (Result < 0)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);

            return;
        }

        if (ReturnValue < 0)
        {
            PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.Page.GetType().BaseType.FullName);

            return;
        }

        if (tbTestNumber.Text.Trim() != "")
        {
            DAL.Tables.T_TestNumber t_TestNumber = new DAL.Tables.T_TestNumber();

            t_TestNumber.TestNumber.Value = tbTestNumber.Text.Trim();
            t_TestNumber.IsuseID.Value = IsuseID.ToString();

            if (Shove._Convert.StrToLong(hidID.Value, 0) > 0)
            {
                t_TestNumber.Update("ID=" + hidID.Value);
            }
            else
            {
                t_TestNumber.Insert();
            }
        }

        if (tbMoney.Text.Trim() != "")
        {
            DAL.Tables.T_TotalMoney t_TotalMoney = new DAL.Tables.T_TotalMoney();
            t_TotalMoney.TotalMoney.Value = tbMoney.Text.Trim();
            t_TotalMoney.IsuseID.Value = tbIsuseID.Text;

            if (Shove._Convert.StrToLong(moneyID.Value, 0) > 0)
            {
                t_TotalMoney.Update("ID=" + moneyID.Value);
            }
            else
            {
                t_TotalMoney.Insert();
            }
        }
        Shove._Web.Cache.ClearCache(CacheKey.LotteryCalendar);
        Shove._Web.Cache.ClearCache(DataCache.IsusesInfo + tbLotteryID.Text.Trim());
        this.Response.Redirect("Isuse.aspx?LotteryID=" + tbLotteryID.Text, true);
    }