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

            if (!PageValidate.IsDateTime(txtOrderDate.Text))
            {
                strErr += "OrderDate格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtUserId.Text))
            {
                strErr += "UserId格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtTotalPrice.Text))
            {
                strErr += "TotalPrice格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            DateTime OrderDate  = DateTime.Parse(this.txtOrderDate.Text);
            int      UserId     = int.Parse(this.txtUserId.Text);
            decimal  TotalPrice = decimal.Parse(this.txtTotalPrice.Text);

            OLBookstore.Model.Orders model = new OLBookstore.Model.Orders();
            model.OrderDate  = OrderDate;
            model.UserId     = UserId;
            model.TotalPrice = TotalPrice;

            OLBookstore.BLL.OrdersManager bll = new OLBookstore.BLL.OrdersManager();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
예제 #2
0
 private void ShowInfo(int Id)
 {
     OLBookstore.BLL.OrdersManager bll   = new OLBookstore.BLL.OrdersManager();
     OLBookstore.Model.Orders      model = bll.GetModel(Id);
     this.lblId.Text         = model.Id.ToString();
     this.lblOrderDate.Text  = model.OrderDate.ToString();
     this.lblUserId.Text     = model.UserId.ToString();
     this.lblTotalPrice.Text = model.TotalPrice.ToString();
 }