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);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
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);
    }