109 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			109 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Web;
 | |
| using System.Web.UI;
 | |
| using System.Web.UI.WebControls;
 | |
| using BLL;
 | |
| 
 | |
| namespace FineUIPro.Web.Party
 | |
| {
 | |
|     public partial class NewsPropagandaWorkEdit : PageBase
 | |
|     {
 | |
|         #region 加载
 | |
|         /// <summary>
 | |
|         /// 页面加载
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 string id = Request.Params["newsPropagandaWorkId"];
 | |
|                 string year = DateTime.Now.Year.ToString();
 | |
|                 if (!string.IsNullOrEmpty(Request.Params["Year"]))
 | |
|                 {
 | |
|                     year = Request.Params["Year"];
 | |
|                 }
 | |
|                 if (!string.IsNullOrEmpty(id))
 | |
|                 {
 | |
|                     Model.Party_NewsPropagandaWork newsPropagandaWork = BLL.NewsPropagandaWorkService.GetNewsPropagandaWorkById(id);
 | |
|                     if (newsPropagandaWork != null)
 | |
|                     {
 | |
|                         this.hdId.Text = id;
 | |
|                         if (newsPropagandaWork.Year != null)
 | |
|                         {
 | |
|                             this.txtYear.Text = newsPropagandaWork.Year.ToString();
 | |
|                         }
 | |
|                         if (newsPropagandaWork.NewsDate != null)
 | |
|                         {
 | |
|                             this.txtNewsDate.Text = string.Format("{0:yyyy-MM-dd}", newsPropagandaWork.NewsDate);
 | |
|                         }
 | |
|                         this.txtAuthor.Text = newsPropagandaWork.Author;
 | |
|                     }
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.txtYear.Text = year;
 | |
|                     this.txtNewsDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 附件上传
 | |
|         /// <summary>
 | |
|         /// 附件上传
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnAttach_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (string.IsNullOrEmpty(this.hdId.Text))   //新增记录
 | |
|             {
 | |
|                 this.hdId.Text = SQLHelper.GetNewID(typeof(Model.Party_NewsPropagandaWork));
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/NewsPropagandaWork&menuId={1}", this.hdId.Text, BLL.Const.NewsPropagandaWorkMenuId)));
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 保存
 | |
|         /// <summary>
 | |
|         /// 保存按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSave_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string id = Request.Params["newsPropagandaWorkId"];
 | |
|             Model.Party_NewsPropagandaWork newNewsPropagandaWork = new Model.Party_NewsPropagandaWork();
 | |
|             newNewsPropagandaWork.Year = Funs.GetNewIntOrZero(this.txtYear.Text.Trim());
 | |
|             newNewsPropagandaWork.NewsDate = Funs.GetNewDateTimeOrNow(this.txtNewsDate.Text.Trim());
 | |
|             newNewsPropagandaWork.Author = this.txtAuthor.Text.Trim();
 | |
|             if (!string.IsNullOrEmpty(id))
 | |
|             {
 | |
|                 newNewsPropagandaWork.NewsPropagandaWorkId = id;
 | |
|                 BLL.NewsPropagandaWorkService.UpdateNewsPropagandaWork(newNewsPropagandaWork);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 if (!string.IsNullOrEmpty(this.hdId.Text))
 | |
|                 {
 | |
|                     newNewsPropagandaWork.NewsPropagandaWorkId = this.hdId.Text.Trim();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     newNewsPropagandaWork.NewsPropagandaWorkId = SQLHelper.GetNewID(typeof(Model.Party_NewsPropagandaWork));
 | |
|                     this.hdId.Text = newNewsPropagandaWork.NewsPropagandaWorkId;
 | |
|                 }
 | |
|                 newNewsPropagandaWork.CompileMan = this.CurrUser.UserId;
 | |
|                 newNewsPropagandaWork.CompileDate = DateTime.Now;
 | |
|                 BLL.NewsPropagandaWorkService.AddNewsPropagandaWork(newNewsPropagandaWork);
 | |
|             }
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
|             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |