private void ShowInfo(int Id) { OLBookstore.BLL.OrderBookManager bll = new OLBookstore.BLL.OrderBookManager(); OLBookstore.Model.OrderBook model = bll.GetModel(Id); this.lblId.Text = model.Id.ToString(); this.lblOrderID.Text = model.OrderID.ToString(); this.lblBookID.Text = model.BookID.ToString(); this.lblQuantity.Text = model.Quantity.ToString(); this.lblUnitPrice.Text = model.UnitPrice.ToString(); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtOrderID.Text)) { strErr += "OrderID格式错误!\\n"; } if (!PageValidate.IsNumber(txtBookID.Text)) { strErr += "BookID格式错误!\\n"; } if (!PageValidate.IsNumber(txtQuantity.Text)) { strErr += "Quantity格式错误!\\n"; } if (!PageValidate.IsDecimal(txtUnitPrice.Text)) { strErr += "UnitPrice格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int Id = int.Parse(this.lblId.Text); int OrderID = int.Parse(this.txtOrderID.Text); int BookID = int.Parse(this.txtBookID.Text); int Quantity = int.Parse(this.txtQuantity.Text); decimal UnitPrice = decimal.Parse(this.txtUnitPrice.Text); OLBookstore.Model.OrderBook model = new OLBookstore.Model.OrderBook(); model.Id = Id; model.OrderID = OrderID; model.BookID = BookID; model.Quantity = Quantity; model.UnitPrice = UnitPrice; OLBookstore.BLL.OrderBookManager bll = new OLBookstore.BLL.OrderBookManager(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }