138 lines
		
	
	
		
			5.5 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			138 lines
		
	
	
		
			5.5 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.CQMS.WBS
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class ProjectControlPointAuditRecordEdit : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public string AuditId
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return (string)ViewState["AuditId"];
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["AuditId"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                var userList = from x in Funs.DB.Sys_User
							 | 
						|||
| 
								 | 
							
								                               join p in Funs.DB.Project_ProjectUser
							 | 
						|||
| 
								 | 
							
								                               on x.UserId equals p.UserId
							 | 
						|||
| 
								 | 
							
								                               where x.UnitId == Const.UnitId_TCC && p.ProjectId == CurrUser.LoginProjectId
							 | 
						|||
| 
								 | 
							
								                               select new { UserId = x.UserId, UserName = x.UserName };
							 | 
						|||
| 
								 | 
							
								                dpAuditer.DataValueField = "UserId";
							 | 
						|||
| 
								 | 
							
								                dpAuditer.DataTextField = "UserName";
							 | 
						|||
| 
								 | 
							
								                this.dpAuditer.DataSource = userList.ToList();
							 | 
						|||
| 
								 | 
							
								                this.dpAuditer.DataBind();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                AuditId = Request.Params["AuditId"];
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(AuditId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.hdAttach.Text = AuditId;
							 | 
						|||
| 
								 | 
							
								                      var breakdownProjectAuditRecord = BLL.BreakdownProjectAuditRecordService.GetBreakdownProjectAuditRecordById(AuditId);
							 | 
						|||
| 
								 | 
							
								                    if (breakdownProjectAuditRecord != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(breakdownProjectAuditRecord.AuditCode))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            txtAuditCode.Text = breakdownProjectAuditRecord.AuditCode;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(breakdownProjectAuditRecord.AuditName))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            txtAuditName.Text = breakdownProjectAuditRecord.AuditName;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (breakdownProjectAuditRecord.AuditDate.HasValue)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            dpAuditDate.Text = breakdownProjectAuditRecord.AuditDate.Value.ToString("yyyy-MM-dd");
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(breakdownProjectAuditRecord.AuditId))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            dpAuditer.SelectedValue = breakdownProjectAuditRecord.AuditId;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(breakdownProjectAuditRecord.Remark))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            txtRemark.Text = breakdownProjectAuditRecord.Remark;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #region 附件上传
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 附件上传
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnAttach_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (string.IsNullOrEmpty(AuditId))   //新增记录
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.hdAttach.Text = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProjectAuditRecord));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&menuId={1}", this.hdAttach.Text, BLL.Const.ProjectControlPointAuditMenuId)));
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								        protected void btnSave_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointAuditMenuId, BLL.Const.BtnSave))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Model.WBS_BreakdownProjectAuditRecord breakdownProjectAuditRecord = new Model.WBS_BreakdownProjectAuditRecord();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                breakdownProjectAuditRecord.AuditCode = txtAuditCode.Text;
							 | 
						|||
| 
								 | 
							
								                breakdownProjectAuditRecord.AuditName = txtAuditName.Text;
							 | 
						|||
| 
								 | 
							
								                breakdownProjectAuditRecord.AuditDate = dpAuditDate.SelectedDate;
							 | 
						|||
| 
								 | 
							
								                breakdownProjectAuditRecord.Auditer = dpAuditer.SelectedValue;
							 | 
						|||
| 
								 | 
							
								                breakdownProjectAuditRecord.Remark = txtRemark.Text;
							 | 
						|||
| 
								 | 
							
								                breakdownProjectAuditRecord.CreateDate = DateTime.Now;
							 | 
						|||
| 
								 | 
							
								                breakdownProjectAuditRecord.ProjectId = CurrUser.LoginProjectId;
							 | 
						|||
| 
								 | 
							
								                breakdownProjectAuditRecord.Creater = CurrUser.UserId;
							 | 
						|||
| 
								 | 
							
								                if (string.IsNullOrEmpty(AuditId))
							 | 
						|||
| 
								 | 
							
								                {if (!string.IsNullOrEmpty(hdAttach.Text))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        breakdownProjectAuditRecord.AuditId = hdAttach.Text.ToString();
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        breakdownProjectAuditRecord.AuditId = Guid.NewGuid().ToString();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    BLL.BreakdownProjectAuditRecordService.AddBreakdownProject(breakdownProjectAuditRecord);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    breakdownProjectAuditRecord.AuditId = AuditId;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    BLL.BreakdownProjectAuditRecordService.UpdateBreakdownProject(breakdownProjectAuditRecord);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |