private void ShowInfo(int RoomNum) { BookShop.BLL.RoomService bll = new BookShop.BLL.RoomService(); BookShop.Model.Room model = bll.GetModel(RoomNum); this.lblRoomType.Text = model.RoomType.ToString(); this.lblRoomState.Text = model.RoomState; this.lblBedNum.Text = model.BedNum.ToString(); this.lblGustNum.Text = model.GustNum.ToString(); this.lblDescription.Text = model.Description; }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtRoomNum.Text)) { strErr += "RoomNum不是数字!\\n"; } if (!PageValidate.IsNumber(txtRoomType.Text)) { strErr += "RoomType不是数字!\\n"; } if (this.txtRoomState.Text == "") { strErr += "RoomState不能为空!\\n"; } if (!PageValidate.IsNumber(txtBedNum.Text)) { strErr += "BedNum不是数字!\\n"; } if (!PageValidate.IsNumber(txtGustNum.Text)) { strErr += "GustNum不是数字!\\n"; } if (this.txtDescription.Text == "") { strErr += "Description不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int RoomNum = int.Parse(this.txtRoomNum.Text); int RoomType = int.Parse(this.txtRoomType.Text); string RoomState = this.txtRoomState.Text; int BedNum = int.Parse(this.txtBedNum.Text); int GustNum = int.Parse(this.txtGustNum.Text); string Description = this.txtDescription.Text; BookShop.Model.Room model = new BookShop.Model.Room(); model.RoomNum = RoomNum; model.RoomType = RoomType; model.RoomState = RoomState; model.BedNum = BedNum; model.GustNum = GustNum; model.Description = Description; BookShop.BLL.RoomService bll = new BookShop.BLL.RoomService(); bll.Add(model); }