using BLL; using System; namespace FineUIPro.Web.TestRun.DriverPrepare { public partial class DriverPersonPlanEdit : PageBase { #region 加载 /// /// 页面加载 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.UserService.InitUserDropDownList(this.drpCompileMan, this.CurrUser.LoginProjectId, true); string id = Request.Params["driverPersonPlanId"]; if (!string.IsNullOrEmpty(id)) { Model.DriverPrepare_DriverPersonPlan driverPlan = BLL.DriverPrepareDriverPersonPlanService.GetDriverPlanById(id); if (driverPlan != null) { this.hdId.Text = id; this.txtDriverPersonPlanName.Text = driverPlan.DriverPersonPlanName; this.txtDriverPersonPlanCode.Text = driverPlan.DriverPersonPlanCode; if (!string.IsNullOrEmpty(driverPlan.CompileMan)) { this.drpCompileMan.SelectedValue = driverPlan.CompileMan; } this.txtSubmitDate.Text = driverPlan.SubmitDate.HasValue ? string.Format("{0:yyyy-MM-dd}", driverPlan.SubmitDate) : ""; this.txtAudit.Text = driverPlan.Audit; this.txtApprove.Text = driverPlan.Approve; this.txtApproveDate.Text = driverPlan.ApproveDate.HasValue ? string.Format("{0:yyyy-MM-dd}", driverPlan.ApproveDate) : ""; this.txtRemark.Text = driverPlan.Remark; } } else { this.drpCompileMan.SelectedValue = this.CurrUser.UserId; this.txtSubmitDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); } } } #endregion #region 附件上传 /// /// 附件上传 /// /// /// protected void btnAttach_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录 { this.hdId.Text = SQLHelper.GetNewID(typeof(Model.DriverPrepare_DriverPersonPlan)); } PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverPrepare/DriverPersonPlan&menuId={1}", this.hdId.Text, BLL.Const.DriverPersonPlanMenuId))); } #endregion #region 保存 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { string id = Request.Params["driverPersonPlanId"]; Model.DriverPrepare_DriverPersonPlan newDriverPlan = new Model.DriverPrepare_DriverPersonPlan(); newDriverPlan.DriverPersonPlanName = this.txtDriverPersonPlanName.Text.Trim(); newDriverPlan.DriverPersonPlanCode = this.txtDriverPersonPlanCode.Text.Trim(); if (this.drpCompileMan.SelectedValue != BLL.Const._Null) { newDriverPlan.CompileMan = this.drpCompileMan.SelectedValue; } newDriverPlan.SubmitDate = Funs.GetNewDateTime(this.txtSubmitDate.Text.Trim()); newDriverPlan.Audit = this.txtAudit.Text.Trim(); newDriverPlan.Approve = this.txtApprove.Text.Trim(); newDriverPlan.ApproveDate = Funs.GetNewDateTime(this.txtApproveDate.Text.Trim()); newDriverPlan.Remark = this.txtRemark.Text.Trim(); newDriverPlan.ProjectId = this.CurrUser.LoginProjectId; if (!string.IsNullOrEmpty(id)) { newDriverPlan.DriverPersonPlanId = id; BLL.DriverPrepareDriverPersonPlanService.UpdateDriverPrepareDriverPlan(newDriverPlan); } else { if (!string.IsNullOrEmpty(this.hdId.Text)) { newDriverPlan.DriverPersonPlanId = this.hdId.Text.Trim(); } else { newDriverPlan.DriverPersonPlanId = SQLHelper.GetNewID(typeof(Model.DriverPrepare_DriverPersonPlan)); this.hdId.Text = newDriverPlan.DriverPersonPlanId; } BLL.DriverPrepareDriverPersonPlanService.AddDriverPrepareDriverPlan(newDriverPlan); } ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } #endregion } }