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