private void ShowInfo(int Id) { Maticsoft.BLL.ArticleManagement bll = new Maticsoft.BLL.ArticleManagement(); Maticsoft.Model.ArticleManagement model = bll.GetModel(Id); this.lblId.Text = model.Id.ToString(); this.lblTitle.Text = model.Title; this.lblKeyword.Text = model.Keyword; this.lblContent.Text = model.Content; this.lblImage.Text = model.Image; this.lblUploadtime.Text = model.Uploadtime.ToString(); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtTitle.Text.Trim().Length == 0) { strErr += "Title不能为空!\\n"; } if (this.txtKeyword.Text.Trim().Length == 0) { strErr += "Keyword不能为空!\\n"; } if (this.txtContent.Text.Trim().Length == 0) { strErr += "Content不能为空!\\n"; } if (this.txtImage.Text.Trim().Length == 0) { strErr += "Image不能为空!\\n"; } if (!PageValidate.IsDateTime(txtUploadtime.Text)) { strErr += "Uploadtime格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int Id = int.Parse(this.lblId.Text); string Title = this.txtTitle.Text; string Keyword = this.txtKeyword.Text; string Content = this.txtContent.Text; string Image = this.txtImage.Text; DateTime Uploadtime = DateTime.Parse(this.txtUploadtime.Text); Maticsoft.Model.ArticleManagement model = new Maticsoft.Model.ArticleManagement(); model.Id = Id; model.Title = Title; model.Keyword = Keyword; model.Content = Content; model.Image = Image; model.Uploadtime = Uploadtime; Maticsoft.BLL.ArticleManagement bll = new Maticsoft.BLL.ArticleManagement(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }