91 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			91 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.TestRun.DriverPrepare
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class ConStudyEdit : 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["conStudyId"];
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(id))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Model.DriverPrepare_ConStudy data = BLL.DriverPrepareDriverConStudyService.GetDriverPlanById(id);
							 | 
						|||
| 
								 | 
							
								                    if (data != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.hdId.Text = id;
							 | 
						|||
| 
								 | 
							
								                        this.txtCode.Text = data.Code;
							 | 
						|||
| 
								 | 
							
								                        this.txtConstudyName.Text = data.ConstudyName;
							 | 
						|||
| 
								 | 
							
								                        this.txtOrganizationMan.Text = data.OrganizationMan;
							 | 
						|||
| 
								 | 
							
								                        this.txtOrganizationDate.Text = data.OrganizationDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.OrganizationDate) : "";
							 | 
						|||
| 
								 | 
							
								                        this.txtRemark.Text = data.Remark;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #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.DriverPrepare_ConStudy));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverPrepare/ConStudy&menuId={1}", this.hdId.Text, BLL.Const.ConStudyMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 保存
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 保存按钮
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnSave_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string id = Request.Params["conStudyId"];
							 | 
						|||
| 
								 | 
							
								            Model.DriverPrepare_ConStudy newDriverPlan = new Model.DriverPrepare_ConStudy();
							 | 
						|||
| 
								 | 
							
								            newDriverPlan.Code = this.txtCode.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newDriverPlan.ConstudyName = this.txtConstudyName.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newDriverPlan.OrganizationMan = this.txtOrganizationMan.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newDriverPlan.OrganizationDate = Funs.GetNewDateTime(this.txtOrganizationDate.Text.Trim());
							 | 
						|||
| 
								 | 
							
								            newDriverPlan.Remark = this.txtRemark.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newDriverPlan.ProjectId = this.CurrUser.LoginProjectId;
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(id))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newDriverPlan.ConStudyId = id;
							 | 
						|||
| 
								 | 
							
								                BLL.DriverPrepareDriverConStudyService.UpdateDriverPrepareDriverPlan(newDriverPlan);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.hdId.Text))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    newDriverPlan.ConStudyId = this.hdId.Text.Trim();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    newDriverPlan.ConStudyId = SQLHelper.GetNewID(typeof(Model.DriverPrepare_ConStudy));
							 | 
						|||
| 
								 | 
							
								                    this.hdId.Text = newDriverPlan.ConStudyId;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                BLL.DriverPrepareDriverConStudyService.AddDriverPrepareDriverPlan(newDriverPlan);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            ShowNotify("保存成功!", MessageBoxIcon.Success);
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |