using BLL; using System; namespace FineUIPro.Web.TestRun.DriverReport { public partial class LinkedTestRunReportEdit : PageBase { #region 加载 /// /// 页面加载 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkId, this.CurrUser.LoginProjectId, true); string id = Request.Params["id"]; if (!string.IsNullOrEmpty(id)) { Model.Driver_DriverReport data = BLL.DriverReportService.GetDriverReportById(id); if (data != null) { this.hdId.Text = id; if (!string.IsNullOrEmpty(data.UnitWorkId)) { this.drpUnitWorkId.SelectedValue = data.UnitWorkId; } this.txtDriverReportCode.Text = data.DriverReportCode; this.txtDriverReporName.Text = data.DriverReporName; this.txtCompilePerson.Text = BLL.UserService.GetUserNameByUserId(data.CompilePerson); this.txtSubmitDate.Text = data.SubmitDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.SubmitDate) : ""; this.txtNumber.Text = data.Number; this.txtRemark.Text = data.Remark; } } else { this.txtCompilePerson.Text = this.CurrUser.UserName; 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.Driver_DriverReport)); } PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverReport/LinkedTestRunReport&menuId={1}", this.hdId.Text, BLL.Const.LinkedTestRunReportMenuId))); } #endregion #region 保存 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { string id = Request.Params["id"]; Model.Driver_DriverReport newData = new Model.Driver_DriverReport(); if (this.drpUnitWorkId.SelectedValue != BLL.Const._Null) { newData.UnitWorkId = this.drpUnitWorkId.SelectedValue; } newData.DriverReportCode = this.txtDriverReportCode.Text.Trim(); newData.DriverReporName = this.txtDriverReporName.Text.Trim(); newData.CompilePerson = this.CurrUser.UserId; newData.SubmitDate = Funs.GetNewDateTime(this.txtSubmitDate.Text.Trim()); newData.Number = this.txtNumber.Text.Trim(); newData.Remark = this.txtRemark.Text.Trim(); newData.ProjectId = this.CurrUser.LoginProjectId; if (!string.IsNullOrEmpty(id)) { newData.DriverReportId = id; BLL.DriverReportService.UpdateDriverReport(newData); } else { newData.ReportType = "3"; if (!string.IsNullOrEmpty(this.hdId.Text)) { newData.DriverReportId = this.hdId.Text.Trim(); } else { newData.DriverReportId = SQLHelper.GetNewID(typeof(Model.Driver_DriverReport)); this.hdId.Text = newData.DriverReportId; } BLL.DriverReportService.AddDriverReport(newData); } ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } #endregion } }