130 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			130 lines
		
	
	
		
			5.2 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 PartyCommitteeEdit : 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["partyCommitteeId"];
 | 
						|
                string year = DateTime.Now.Year.ToString();
 | 
						|
                if (!string.IsNullOrEmpty(Request.Params["Year"]))
 | 
						|
                {
 | 
						|
                    year = Request.Params["Year"];
 | 
						|
                }
 | 
						|
                ConstValue.InitConstValueDropDownList(this.drpMonth, ConstValue.Group_0009, true);
 | 
						|
                if (!string.IsNullOrEmpty(id))
 | 
						|
                {
 | 
						|
                    Model.Party_PartyCommittee partyCommittee = BLL.PartyCommitteeService.GetPartyCommitteeById(id);
 | 
						|
                    if (partyCommittee != null)
 | 
						|
                    {
 | 
						|
                        this.hdId.Text = id;
 | 
						|
                        if (partyCommittee.Year != null)
 | 
						|
                        {
 | 
						|
                            this.txtYear.Text = partyCommittee.Year.ToString();
 | 
						|
                        }
 | 
						|
                        if (partyCommittee.Month != null)
 | 
						|
                        {
 | 
						|
                            this.drpMonth.SelectedValue = partyCommittee.Month.ToString();
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                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_PartyCommittee));
 | 
						|
            }
 | 
						|
            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/PartyCommittee&menuId={1}", this.hdId.Text, BLL.Const.PartyCommitteeMenuId)));
 | 
						|
        }
 | 
						|
 | 
						|
        protected void btnAttach2_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (string.IsNullOrEmpty(this.hdId.Text))   //新增记录
 | 
						|
            {
 | 
						|
                this.hdId.Text = SQLHelper.GetNewID(typeof(Model.Party_PartyCommittee));
 | 
						|
            }
 | 
						|
            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/PartyCommittee&menuId={1}", this.hdId.Text + "2", BLL.Const.PartyCommitteeMenuId)));
 | 
						|
        }
 | 
						|
 | 
						|
        protected void btnAttach3_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (string.IsNullOrEmpty(this.hdId.Text))   //新增记录
 | 
						|
            {
 | 
						|
                this.hdId.Text = SQLHelper.GetNewID(typeof(Model.Party_PartyCommittee));
 | 
						|
            }
 | 
						|
            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/PartyCommittee&menuId={1}", this.hdId.Text + "3", BLL.Const.PartyCommitteeMenuId)));
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 保存
 | 
						|
        /// <summary>
 | 
						|
        /// 保存按钮
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnSave_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (this.drpMonth.SelectedValue == BLL.Const._Null)
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("请选择月份", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
            string id = Request.Params["partyCommitteeId"];
 | 
						|
            Model.Party_PartyCommittee newPartyCommittee = new Model.Party_PartyCommittee();
 | 
						|
            newPartyCommittee.Year = Funs.GetNewIntOrZero(this.txtYear.Text.Trim());
 | 
						|
            newPartyCommittee.Month = Funs.GetNewInt(this.drpMonth.SelectedValue);
 | 
						|
            if (!string.IsNullOrEmpty(id))
 | 
						|
            {
 | 
						|
                newPartyCommittee.PartyCommitteeId = id;
 | 
						|
                BLL.PartyCommitteeService.UpdatePartyCommittee(newPartyCommittee);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                if (!string.IsNullOrEmpty(this.hdId.Text))
 | 
						|
                {
 | 
						|
                    newPartyCommittee.PartyCommitteeId = this.hdId.Text.Trim();
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    newPartyCommittee.PartyCommitteeId = SQLHelper.GetNewID(typeof(Model.Party_PartyCommittee));
 | 
						|
                    this.hdId.Text = newPartyCommittee.PartyCommitteeId;
 | 
						|
                }
 | 
						|
                newPartyCommittee.CompileMan = this.CurrUser.UserId;
 | 
						|
                newPartyCommittee.CompileDate = DateTime.Now;
 | 
						|
                BLL.PartyCommitteeService.AddPartyCommittee(newPartyCommittee);
 | 
						|
            }
 | 
						|
            ShowNotify("保存成功!", MessageBoxIcon.Success);
 | 
						|
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
} |