示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtGroupPriceNo.Text))
            {
                strErr += "GroupPriceNo格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtFareRateNo.Text))
            {
                strErr += "FareRateNo格式错误!\\n";
            }
            if (this.txtFareName.Text.Trim().Length == 0)
            {
                strErr += "FareName不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtPrice.Text))
            {
                strErr += "Price格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int     GroupPriceNo = int.Parse(this.txtGroupPriceNo.Text);
            int     FareRateNo   = int.Parse(this.txtFareRateNo.Text);
            string  FareName     = this.txtFareName.Text;
            decimal Price        = decimal.Parse(this.txtPrice.Text);

            WebDemo.Model.WebDemo.RatePrice model = new WebDemo.Model.WebDemo.RatePrice();
            model.GroupPriceNo = GroupPriceNo;
            model.FareRateNo   = FareRateNo;
            model.FareName     = FareName;
            model.Price        = Price;

            WebDemo.BLL.WebDemo.RatePrice bll = new WebDemo.BLL.WebDemo.RatePrice();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }