Esempio n. 1
0
        private string GetTotalMoneySFC(string IsuseID)
        {
            string    str = "";
            string    key = "Home_Room_Buy_GetTotalMoneySFC_" + IsuseID;
            DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key);

            if (cacheAsDataTable == null)
            {
                cacheAsDataTable = new Tables.T_TotalMoney().Open("", "IsuseID=" + IsuseID, "");
                if (cacheAsDataTable == null)
                {
                    new Log("System").Write(base.GetType().FullName + "数据库繁忙,请重试(GetTotalMoneySFC)");
                    return("");
                }
                Shove._Web.Cache.SetCache(key, cacheAsDataTable, 120);
            }
            if (cacheAsDataTable.Rows.Count > 0)
            {
                str = cacheAsDataTable.Rows[0]["TotalMoney"].ToString();
            }
            return(str);
        }
    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);
                                }
                            }
                        }
                    }
                }
            }
        }
    }