129 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			129 lines
		
	
	
		
			5.6 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 PartyPioneerDemonstrationEdit : 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["partyPioneerDemonstrationId"];
 | 
						|
                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;
 | 
						|
                }
 | 
						|
                PartyerService.InitPartyerDropDownList(drpPartyer, false);
 | 
						|
                if (!string.IsNullOrEmpty(id))
 | 
						|
                {
 | 
						|
                    Model.Party_PartyPioneerDemonstration partyPioneerDemonstration = BLL.PartyPioneerDemonstrationService.GetPartyPioneerDemonstrationById(id);
 | 
						|
                    if (partyPioneerDemonstration != null)
 | 
						|
                    {
 | 
						|
                        this.hdId.Text = id;
 | 
						|
                        if (partyPioneerDemonstration.Year != null)
 | 
						|
                        {
 | 
						|
                            this.txtYear.Text = partyPioneerDemonstration.Year.ToString();
 | 
						|
                        }
 | 
						|
                        if (!string.IsNullOrEmpty(partyPioneerDemonstration.PartyerId))
 | 
						|
                        {
 | 
						|
                            this.drpPartyer.SelectedValue = partyPioneerDemonstration.PartyerId;
 | 
						|
                        }
 | 
						|
                        this.txtIntroduce.Text = partyPioneerDemonstration.Introduce;
 | 
						|
                        this.txtDeeds.Text = partyPioneerDemonstration.Deeds;
 | 
						|
                        this.txtSummary.Text = partyPioneerDemonstration.Summary;
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    this.txtYear.Text = year;
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #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_PartyPioneerDemonstration));
 | 
						|
            }
 | 
						|
            if (!string.IsNullOrEmpty(Request.Params["type"]))
 | 
						|
            {
 | 
						|
                PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/Party/PartyPioneerDemonstration&menuId={1}", this.hdId.Text, BLL.Const.PartyPioneerDemonstrationMenuId)));
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/PartyPioneerDemonstration&menuId={1}", this.hdId.Text, BLL.Const.PartyPioneerDemonstrationMenuId)));
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 保存
 | 
						|
        /// <summary>
 | 
						|
        /// 保存按钮
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnSave_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (string.IsNullOrEmpty(this.drpPartyer.SelectedValue))
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("请选择人员", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
            string id = Request.Params["partyPioneerDemonstrationId"];
 | 
						|
            Model.Party_PartyPioneerDemonstration newPartyPioneerDemonstration = new Model.Party_PartyPioneerDemonstration();
 | 
						|
            newPartyPioneerDemonstration.Year = Funs.GetNewIntOrZero(this.txtYear.Text.Trim());
 | 
						|
            newPartyPioneerDemonstration.PartyerId = this.drpPartyer.SelectedValue;
 | 
						|
            newPartyPioneerDemonstration.Introduce = this.txtIntroduce.Text.Trim();
 | 
						|
            newPartyPioneerDemonstration.Deeds = this.txtDeeds.Text.Trim();
 | 
						|
            newPartyPioneerDemonstration.Summary = this.txtSummary.Text.Trim();
 | 
						|
            if (!string.IsNullOrEmpty(id))
 | 
						|
            {
 | 
						|
                newPartyPioneerDemonstration.PartyPioneerDemonstrationId = id;
 | 
						|
                BLL.PartyPioneerDemonstrationService.UpdatePartyPioneerDemonstration(newPartyPioneerDemonstration);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                if (!string.IsNullOrEmpty(this.hdId.Text))
 | 
						|
                {
 | 
						|
                    newPartyPioneerDemonstration.PartyPioneerDemonstrationId = this.hdId.Text.Trim();
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    newPartyPioneerDemonstration.PartyPioneerDemonstrationId = SQLHelper.GetNewID(typeof(Model.Party_PartyPioneerDemonstration));
 | 
						|
                    this.hdId.Text = newPartyPioneerDemonstration.PartyPioneerDemonstrationId;
 | 
						|
                }
 | 
						|
                newPartyPioneerDemonstration.CompileMan = this.CurrUser.UserId;
 | 
						|
                newPartyPioneerDemonstration.CompileDate = DateTime.Now;
 | 
						|
                BLL.PartyPioneerDemonstrationService.AddPartyPioneerDemonstration(newPartyPioneerDemonstration);
 | 
						|
            }
 | 
						|
            ShowNotify("保存成功!", MessageBoxIcon.Success);
 | 
						|
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
} |