private void ShowInfo(int ID) { YueDuLibrary.BLL.BorrowandReturn bll = new YueDuLibrary.BLL.BorrowandReturn(); YueDuLibrary.Model.BorrowandReturn model = bll.GetModel(ID); this.lblID.Text = model.ID.ToString(); this.txtReaderID.Text = model.ReaderID.ToString(); this.txtBookCode.Text = model.BookCode; this.txtBorrowTime.Text = model.BorrowTime.ToString(); this.txtBackTime.Text = model.BackTime.ToString(); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtReaderID.Text)) { strErr += "ReaderID格式错误!\\n"; } if (this.txtBookCode.Text.Trim().Length == 0) { strErr += "BookCode不能为空!\\n"; } if (!PageValidate.IsDateTime(txtBorrowTime.Text)) { strErr += "BorrowTime格式错误!\\n"; } if (!PageValidate.IsDateTime(txtBackTime.Text)) { strErr += "BackTime格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int ID = int.Parse(this.lblID.Text); int ReaderID = int.Parse(this.txtReaderID.Text); string BookCode = this.txtBookCode.Text; DateTime BorrowTime = DateTime.Parse(this.txtBorrowTime.Text); DateTime BackTime = DateTime.Parse(this.txtBackTime.Text); YueDuLibrary.Model.BorrowandReturn model = new YueDuLibrary.Model.BorrowandReturn(); model.ID = ID; model.ReaderID = ReaderID; model.BookCode = BookCode; model.BorrowTime = BorrowTime; model.BackTime = BackTime; YueDuLibrary.BLL.BorrowandReturn bll = new YueDuLibrary.BLL.BorrowandReturn(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }