protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtFK_Users_Id.Text)) { strErr += "留言用户格式错误!\\n"; } if (!PageValidate.IsDateTime(txtAddTimes.Text)) { strErr += "留言时间格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int Fk_News_Id = int.Parse(this.ddlFk_News_Id.SelectedValue); String Contents = this.txtContents.Text; int FK_Users_Id = int.Parse(this.txtFK_Users_Id.Text); DateTime AddTimes = DateTime.Parse(this.txtAddTimes.Text); Maticsoft.Model.Leaveword model = new Maticsoft.Model.Leaveword(); model.Fk_News_Id = Fk_News_Id; model.Contents = Contents; model.FK_Users_Id = FK_Users_Id; model.AddTimes = AddTimes; Maticsoft.BLL.Leaveword bll = new Maticsoft.BLL.Leaveword(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "Add.aspx"); }
private void ShowInfo(int Id) { Maticsoft.BLL.Leaveword bll = new Maticsoft.BLL.Leaveword(); Maticsoft.Model.Leaveword model = bll.GetModel(Id); this.lblId.Text = model.Id.ToString(); this.ddlFk_News_Id.SelectedValue = model.Fk_News_Id.ToString(); this.txtContents.Text = model.Contents; this.txtAddTimes.Text = model.AddTimes.ToString(); }
private void ShowInfo(int Id) { Maticsoft.BLL.Leaveword bll = new Maticsoft.BLL.Leaveword(); Maticsoft.Model.Leaveword model = bll.GetModel(Id); this.lblId.Text = model.Id.ToString(); BLL.News BLLNews = new BLL.News(); Model.News ModelNews = BLLNews.GetModel((int)model.Fk_News_Id); this.lblFk_News_Id.Text = ModelNews.Name; this.lblContents.Text = model.Contents; this.lblAddTimes.Text = model.AddTimes.ToString(); }