121 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			121 lines
		
	
	
		
			4.8 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 CommentPartyerEdit : 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["commentPartyerId"];
							 | 
						|||
| 
								 | 
							
								                string year = DateTime.Now.Year.ToString();
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(Request.Params["Year"]))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    year = Request.Params["Year"];
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                ProjectService.InitAllProjectDropDownList(this.drpProject, true);
							 | 
						|||
| 
								 | 
							
								                PartyerService.InitPartyerDropDownList(drpPartyers, false);
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(id))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Model.Party_CommentPartyer commentPartyer = BLL.CommentPartyerService.GetCommentPartyerById(id);
							 | 
						|||
| 
								 | 
							
								                    if (commentPartyer != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.hdId.Text = id;
							 | 
						|||
| 
								 | 
							
								                        if (commentPartyer.Year != null)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtYear.Text = commentPartyer.Year.ToString();
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(commentPartyer.ProjectId))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.drpProject.SelectedValue = commentPartyer.ProjectId;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(commentPartyer.Partyers))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.drpPartyers.SelectedValueArray = commentPartyer.Partyers.Split(',');
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        this.txtHost.Text = commentPartyer.Host;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                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_CommentPartyer));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/CommentPartyer&menuId={1}", this.hdId.Text, BLL.Const.CommentPartyerMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 保存
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 保存按钮
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnSave_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (this.drpProject.SelectedValue == BLL.Const._Null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("请选择项目", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            string id = Request.Params["commentPartyerId"];
							 | 
						|||
| 
								 | 
							
								            Model.Party_CommentPartyer newCommentPartyer = new Model.Party_CommentPartyer();
							 | 
						|||
| 
								 | 
							
								            newCommentPartyer.Year = Funs.GetNewIntOrZero(this.txtYear.Text.Trim());
							 | 
						|||
| 
								 | 
							
								            newCommentPartyer.ProjectId = this.drpProject.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            string partyers = Funs.GetStringByArray(this.drpPartyers.SelectedValueArray);
							 | 
						|||
| 
								 | 
							
								            newCommentPartyer.Partyers = partyers;
							 | 
						|||
| 
								 | 
							
								            newCommentPartyer.Host = this.txtHost.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(id))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newCommentPartyer.CommentPartyerId = id;
							 | 
						|||
| 
								 | 
							
								                BLL.CommentPartyerService.UpdateCommentPartyer(newCommentPartyer);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.hdId.Text))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    newCommentPartyer.CommentPartyerId = this.hdId.Text.Trim();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    newCommentPartyer.CommentPartyerId = SQLHelper.GetNewID(typeof(Model.Party_CommentPartyer));
							 | 
						|||
| 
								 | 
							
								                    this.hdId.Text = newCommentPartyer.CommentPartyerId;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                newCommentPartyer.CompileMan = this.CurrUser.UserId;
							 | 
						|||
| 
								 | 
							
								                newCommentPartyer.CompileDate = DateTime.Now;
							 | 
						|||
| 
								 | 
							
								                BLL.CommentPartyerService.AddCommentPartyer(newCommentPartyer);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            ShowNotify("保存成功!", MessageBoxIcon.Success);
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |