122 lines
		
	
	
		
			5.4 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			122 lines
		
	
	
		
			5.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 EmployeeConversationRecordEdit : 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["employeeConversationRecordId"];
 | |
|                 string year = DateTime.Now.Year.ToString();
 | |
|                 if (!string.IsNullOrEmpty(Request.Params["Year"]))
 | |
|                 {
 | |
|                     year = Request.Params["Year"];
 | |
|                 }
 | |
|                 if (!string.IsNullOrEmpty(Request.Params["type"]))
 | |
|                 {
 | |
|                     this.btnSave.Hidden = true;
 | |
|                 }
 | |
|                 if (!string.IsNullOrEmpty(id))
 | |
|                 {
 | |
|                     Model.Party_EmployeeConversationRecord employeeConversationRecord = BLL.EmployeeConversationRecordService.GetEmployeeConversationRecordById(id);
 | |
|                     if (employeeConversationRecord != null)
 | |
|                     {
 | |
|                         this.hdId.Text = id;
 | |
|                         if (employeeConversationRecord.Year != null)
 | |
|                         {
 | |
|                             this.txtYear.Text = employeeConversationRecord.Year.ToString();
 | |
|                         }
 | |
|                         this.txtSpeaker.Text = employeeConversationRecord.Speaker;
 | |
|                         this.txtInterviewee.Text = employeeConversationRecord.Interviewee;
 | |
|                         if (employeeConversationRecord.ConversationDate != null)
 | |
|                         {
 | |
|                             this.txtConversationDate.Text = string.Format("{0:yyyy-MM-dd}", employeeConversationRecord.ConversationDate);
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.txtYear.Text = year;
 | |
|                     this.txtConversationDate.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_EmployeeConversationRecord));
 | |
|             }
 | |
|             if (!string.IsNullOrEmpty(Request.Params["type"]))
 | |
|             {
 | |
|                 PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/Party/EmployeeConversationRecord&menuId={1}", this.hdId.Text, BLL.Const.EmployeeConversationRecordMenuId)));
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/EmployeeConversationRecord&menuId={1}", this.hdId.Text, BLL.Const.EmployeeConversationRecordMenuId)));
 | |
|             }
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 保存
 | |
|         /// <summary>
 | |
|         /// 保存按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSave_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string id = Request.Params["employeeConversationRecordId"];
 | |
|             Model.Party_EmployeeConversationRecord newEmployeeConversationRecord = new Model.Party_EmployeeConversationRecord();
 | |
|             newEmployeeConversationRecord.Year = Funs.GetNewIntOrZero(this.txtYear.Text.Trim());
 | |
|             newEmployeeConversationRecord.Speaker = this.txtSpeaker.Text.Trim();
 | |
|             newEmployeeConversationRecord.Interviewee = this.txtInterviewee.Text.Trim();
 | |
|             newEmployeeConversationRecord.ConversationDate = Funs.GetNewDateTimeOrNow(this.txtConversationDate.Text.Trim());
 | |
|             if (!string.IsNullOrEmpty(id))
 | |
|             {
 | |
|                 newEmployeeConversationRecord.EmployeeConversationRecordId = id;
 | |
|                 BLL.EmployeeConversationRecordService.UpdateEmployeeConversationRecord(newEmployeeConversationRecord);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 if (!string.IsNullOrEmpty(this.hdId.Text))
 | |
|                 {
 | |
|                     newEmployeeConversationRecord.EmployeeConversationRecordId = this.hdId.Text.Trim();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     newEmployeeConversationRecord.EmployeeConversationRecordId = SQLHelper.GetNewID(typeof(Model.Party_EmployeeConversationRecord));
 | |
|                     this.hdId.Text = newEmployeeConversationRecord.EmployeeConversationRecordId;
 | |
|                 }
 | |
|                 newEmployeeConversationRecord.CompileMan = this.CurrUser.UserId;
 | |
|                 newEmployeeConversationRecord.CompileDate = DateTime.Now;
 | |
|                 BLL.EmployeeConversationRecordService.AddEmployeeConversationRecord(newEmployeeConversationRecord);
 | |
|             }
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
|             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |