201 lines
		
	
	
		
			9.4 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			201 lines
		
	
	
		
			9.4 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Web;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.ZHGL.Meeting
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class CompanySpecialMeetingEdit : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 定义项
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 主键
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public string CompanySpecialMeetingId
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return (string)ViewState["CompanySpecialMeetingId"];
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["CompanySpecialMeetingId"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 加载
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加载页面
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
							 | 
						|||
| 
								 | 
							
								                this.InitDropDownList();
							 | 
						|||
| 
								 | 
							
								                this.CompanySpecialMeetingId = Request.Params["CompanySpecialMeetingId"];
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.CompanySpecialMeetingId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Model.Meeting_CompanySpecialMeeting CompanySpecialMeeting = BLL.CompanySpecialMeetingService.GetCompanySpecialMeetingById(this.CompanySpecialMeetingId);
							 | 
						|||
| 
								 | 
							
								                    if (CompanySpecialMeeting != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.txtCompanySpecialMeetingCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.CompanySpecialMeetingId);
							 | 
						|||
| 
								 | 
							
								                        this.txtCompanySpecialMeetingName.Text = CompanySpecialMeeting.CompanySpecialMeetingName;
							 | 
						|||
| 
								 | 
							
								                        this.txtCompanySpecialMeetingDate.Text = string.Format("{0:yyyy-MM-dd}", CompanySpecialMeeting.CompanySpecialMeetingDate);
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(CompanySpecialMeeting.CompileMan))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.drpCompileMan.SelectedValue = CompanySpecialMeeting.CompileMan;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (CompanySpecialMeeting.AttentPersonNum != null)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtAttentPersonNum.Text = CompanySpecialMeeting.AttentPersonNum.ToString();
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        this.txtCompanySpecialMeetingContents.Text = HttpUtility.HtmlDecode(CompanySpecialMeeting.CompanySpecialMeetingContents);
							 | 
						|||
| 
								 | 
							
								                        this.txtMeetingHours.Text = Convert.ToString(CompanySpecialMeeting.MeetingHours);
							 | 
						|||
| 
								 | 
							
								                        this.txtMeetingHostMan.Text = CompanySpecialMeeting.MeetingHostMan;
							 | 
						|||
| 
								 | 
							
								                        this.txtAttentPerson.Text = CompanySpecialMeeting.AttentPerson;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
							 | 
						|||
| 
								 | 
							
								                    this.txtCompanySpecialMeetingDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
							 | 
						|||
| 
								 | 
							
								                    var codeTemplateRule = BLL.SysConstSetService.GetCodeTemplateRuleByMenuId(BLL.Const.ProjectWeekMeetingMenuId);
							 | 
						|||
| 
								 | 
							
								                    if (codeTemplateRule != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.txtCompanySpecialMeetingContents.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    ////自动生成编码
							 | 
						|||
| 
								 | 
							
								                    this.txtCompanySpecialMeetingCode.Text = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.CompanySpecialMeetingMenuId, null, this.CurrUser.UnitId);
							 | 
						|||
| 
								 | 
							
								                    this.txtCompanySpecialMeetingName.Text = this.SimpleForm1.Title;
							 | 
						|||
| 
								 | 
							
								                    this.txtMeetingHours.Text = "1";
							 | 
						|||
| 
								 | 
							
								                    this.txtMeetingHostMan.Text = this.CurrUser.UserName;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        ///  初始化下拉框
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void InitDropDownList()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            UserService.InitUserDropDownList(this.drpCompileMan, null, true);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 保存
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 保存按钮
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnSave_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.SaveData(BLL.Const.BtnSave);
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 保存数据
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="type"></param>
							 | 
						|||
| 
								 | 
							
								        private void SaveData(string type)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Model.Meeting_CompanySpecialMeeting CompanySpecialMeeting = new Model.Meeting_CompanySpecialMeeting
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                CompanySpecialMeetingCode = this.txtCompanySpecialMeetingCode.Text.Trim(),
							 | 
						|||
| 
								 | 
							
								                CompanySpecialMeetingName = this.txtCompanySpecialMeetingName.Text.Trim(),
							 | 
						|||
| 
								 | 
							
								                CompanySpecialMeetingDate = Funs.GetNewDateTime(this.txtCompanySpecialMeetingDate.Text.Trim())
							 | 
						|||
| 
								 | 
							
								            };
							 | 
						|||
| 
								 | 
							
								            if (this.drpCompileMan.SelectedValue != BLL.Const._Null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                CompanySpecialMeeting.CompileMan = this.drpCompileMan.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            CompanySpecialMeeting.AttentPersonNum = Funs.GetNewIntOrZero(this.txtAttentPersonNum.Text.Trim());
							 | 
						|||
| 
								 | 
							
								            CompanySpecialMeeting.CompanySpecialMeetingContents = HttpUtility.HtmlEncode(this.txtCompanySpecialMeetingContents.Text);
							 | 
						|||
| 
								 | 
							
								            CompanySpecialMeeting.CompileDate = DateTime.Now;
							 | 
						|||
| 
								 | 
							
								            CompanySpecialMeeting.MeetingHours = Funs.GetNewInt(this.txtMeetingHours.Text.Trim());
							 | 
						|||
| 
								 | 
							
								            CompanySpecialMeeting.MeetingHostMan = this.txtMeetingHostMan.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            CompanySpecialMeeting.AttentPerson = this.txtAttentPerson.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(this.CompanySpecialMeetingId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                CompanySpecialMeeting.CompanySpecialMeetingId = this.CompanySpecialMeetingId;
							 | 
						|||
| 
								 | 
							
								                BLL.CompanySpecialMeetingService.UpdateCompanySpecialMeeting(CompanySpecialMeeting);
							 | 
						|||
| 
								 | 
							
								                BLL.LogService.AddSys_Log(this.CurrUser, CompanySpecialMeeting.CompanySpecialMeetingCode, CompanySpecialMeeting.CompanySpecialMeetingId, BLL.Const.CompanySpecialMeetingMenuId, BLL.Const.BtnModify);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.CompanySpecialMeetingId = SQLHelper.GetNewID(typeof(Model.Meeting_CompanySpecialMeeting));
							 | 
						|||
| 
								 | 
							
								                CompanySpecialMeeting.CompanySpecialMeetingId = this.CompanySpecialMeetingId;
							 | 
						|||
| 
								 | 
							
								                BLL.CompanySpecialMeetingService.AddCompanySpecialMeeting(CompanySpecialMeeting);
							 | 
						|||
| 
								 | 
							
								                BLL.LogService.AddSys_Log(this.CurrUser, CompanySpecialMeeting.CompanySpecialMeetingCode, CompanySpecialMeeting.CompanySpecialMeetingId, BLL.Const.CompanySpecialMeetingMenuId, BLL.Const.BtnAdd);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 附件上传
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 上传附件
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnAttachUrl_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (string.IsNullOrEmpty(this.CompanySpecialMeetingId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                SaveData(BLL.Const.BtnSave);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CompanySpecialMeetingAttachUrl&menuId={1}", this.CompanySpecialMeetingId, BLL.Const.CompanySpecialMeetingMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void btnAttachUrl1_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (string.IsNullOrEmpty(this.CompanySpecialMeetingId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                SaveData(Const.BtnSave);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CompanySpecialMeetingAttachUrl&menuId={1}&strParam=1", this.CompanySpecialMeetingId, Const.CompanySpecialMeetingMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void btnAttachUrl2_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (string.IsNullOrEmpty(this.CompanySpecialMeetingId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                SaveData(Const.BtnSave);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CompanySpecialMeetingAttachUrl&menuId={1}&strParam=2", this.CompanySpecialMeetingId, Const.CompanySpecialMeetingMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        ///  计算参会人数
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void txtAttentPerson_Blur(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string str = this.txtAttentPerson.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(str))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (str.Contains(","))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.txtAttentPersonNum.Text = str.Split(',').Length.ToString();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else if (str.Contains(","))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.txtAttentPersonNum.Text = str.Split(',').Length.ToString();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else if (str.Contains(";"))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.txtAttentPersonNum.Text = str.Split(';').Length.ToString();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else if (str.Contains(";"))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.txtAttentPersonNum.Text = str.Split(';').Length.ToString();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |