using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CY.BLL; using CY.Model; using CY.Infrastructure.Query; using CY.Infrastructure.Common; using CY.BLL.OA; using CY.BLL.Promotion; namespace CY.WebForm.Pages.sysglobal { public partial class Promotion_ArticleInfoEdit : BasePage { Promotion_ArticleInfoBLL _Promotion_ArticleInfoBLL = null; Promotion_ArticleInfo ArticleInfo = null; public Promotion_ArticleInfoEdit() { ArticleInfo = new Promotion_ArticleInfo(); _Promotion_ArticleInfoBLL = new Promotion_ArticleInfoBLL(); } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["Keyid"].ToInt32() > 0) { InitialModifyData(); } } } /// /// 加载要修改的数据 /// protected void InitialModifyData() { ArticleInfo = _Promotion_ArticleInfoBLL.SelectSingleModel(Request["Keyid"].ToString2()); this.txtContent.Value = ArticleInfo.Content; this.txtRemark.Value = ArticleInfo.Remark; this.txtTitle.Value = ArticleInfo.Title; } protected void btn_Submit_Click(object sender, EventArgs e) { if (Request["Keyid"].ToInt32() > 0) //如果keyid 大于0 则再加载一次对象,方便利用对象里面的不变属性 { ArticleInfo = _Promotion_ArticleInfoBLL.SelectSingleModel(Request["Keyid"].ToString2()); } ArticleInfo.Remark = txtRemark.Value; ArticleInfo.Content = txtContent.Value; ArticleInfo.Title = txtTitle.Value; ArticleInfo.LastUpdateTime = DateTime.Now; ArticleInfo.Operator = CurrentUser.ShortName; if (Request["Keyid"].ToInt32() > 0) { if (_Promotion_ArticleInfoBLL.UpdateModel(ArticleInfo)) { JavaScript.RefreshDIVOpener(this); } else { JavaScript.MessageBox("修改失败", this); } } else { if (_Promotion_ArticleInfoBLL.insertModel(ArticleInfo)) { JavaScript.RefreshDIVOpener(this); } else { JavaScript.MessageBox("添加失败", this); } } } } }