private void ShowInfo() { OLBookstore.BLL.RecomBooksManager bll = new OLBookstore.BLL.RecomBooksManager(); OLBookstore.Model.RecomBooks model = bll.GetModel(); this.lblBookId.Text = model.BookId.ToString(); this.lblUserId.Text = model.UserId.ToString(); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtBookId.Text)) { strErr += "BookId格式错误!\\n"; } if (!PageValidate.IsNumber(txtUserId.Text)) { strErr += "UserId格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int BookId = int.Parse(this.txtBookId.Text); int UserId = int.Parse(this.txtUserId.Text); OLBookstore.Model.RecomBooks model = new OLBookstore.Model.RecomBooks(); model.BookId = BookId; model.UserId = UserId; OLBookstore.BLL.RecomBooksManager bll = new OLBookstore.BLL.RecomBooksManager(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }