using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BLL; using Model; namespace FineUIPro.Web.Personal { public partial class TestRunMonthSummaryEdit : PageBase { /// /// 定义项 /// public string TestRunMonthSummaryId { get { return (string)ViewState["TestRunMonthSummaryId"]; } set { ViewState["TestRunMonthSummaryId"] = value; } } /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); ProjectService.InitAllProjectDropDownList2(this.drpProject, true); this.TestRunMonthSummaryId = Request.QueryString["TestRunMonthSummaryId"]; if (!String.IsNullOrEmpty(this.TestRunMonthSummaryId)) { var MonthSummary = BLL.Person_TestRunMonthSummaryService.GetPersonTestRunMonthSummaryById(this.TestRunMonthSummaryId); if (MonthSummary != null) { this.hdId.Text = this.TestRunMonthSummaryId; if (MonthSummary.RaiseDate != null) { this.txtRaiseDate.Text = string.Format("{0:yyyy-MM-dd}", MonthSummary.RaiseDate); } this.lbUserName.Text = BLL.UserService.GetUserNameByUserId(MonthSummary.UserId); if (!string.IsNullOrEmpty(MonthSummary.ProjectId)) { this.drpProject.SelectedValue = MonthSummary.ProjectId; } this.txtMajor.Text = MonthSummary.Major; this.txtProcessName.Text = MonthSummary.ProcessName; this.txtProblemDescription.Text = MonthSummary.ProblemDescription; this.txtHandleMethod.Text = MonthSummary.HandleMethod; this.txtExperienceOrSuggestion.Text = MonthSummary.ExperienceOrSuggestion; } } else { this.txtMajor.Text = "开车"; this.lbUserName.Text = this.CurrUser.UserName; } } } /// /// 保存数据 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtRaiseDate.Text.Trim())) { Alert.ShowInParent("请选择提出时间!", MessageBoxIcon.Warning); return; } if (this.drpProject.SelectedValue == BLL.Const._Null) { Alert.ShowInParent("请选择项目名称/项目号或本部!", MessageBoxIcon.Warning); return; } Model.Person_TestRunMonthSummary newMonthSummary = new Model.Person_TestRunMonthSummary() { RaiseDate = Funs.GetNewDateTimeOrNow(this.txtRaiseDate.Text.Trim()), UserId = this.CurrUser.UserId, ProjectId = this.drpProject.SelectedValue, Major = this.txtMajor.Text.Trim(), ProcessName = this.txtProcessName.Text.Trim(), ProblemDescription = this.txtProblemDescription.Text.Trim(), HandleMethod = this.txtHandleMethod.Text.Trim(), ExperienceOrSuggestion = this.txtExperienceOrSuggestion.Text.Trim(), }; if (!string.IsNullOrEmpty(this.TestRunMonthSummaryId)) { newMonthSummary.TestRunMonthSummaryId = this.TestRunMonthSummaryId; BLL.Person_TestRunMonthSummaryService.UpdatePersonTestRunMonthSummary(newMonthSummary); BLL.LogService.AddSys_Log(this.CurrUser, null, newMonthSummary.TestRunMonthSummaryId, BLL.Const.TestRunMonthSummaryMenuId, BLL.Const.BtnAdd); } else { if (!string.IsNullOrEmpty(this.hdId.Text)) { newMonthSummary.TestRunMonthSummaryId = this.hdId.Text; } else { newMonthSummary.TestRunMonthSummaryId = SQLHelper.GetNewID(); } BLL.Person_TestRunMonthSummaryService.AddPersonTestRunMonthSummary(newMonthSummary); BLL.LogService.AddSys_Log(this.CurrUser, null, newMonthSummary.TestRunMonthSummaryId, BLL.Const.TestRunMonthSummaryMenuId, BLL.Const.BtnModify); } ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } #region 附件上传 /// /// 附件上传 /// /// /// protected void btnAttach_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录 { this.hdId.Text = SQLHelper.GetNewID(); } if (!string.IsNullOrEmpty(Request.Params["type"])) { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/TestRun/TestRunMonthSummary&menuId={1}", this.hdId.Text, BLL.Const.TestRunMonthSummaryMenuId))); } else { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/TestRunMonthSummary&menuId={1}", this.hdId.Text, BLL.Const.TestRunMonthSummaryMenuId))); } } /// /// 附件上传 /// /// /// protected void btnAttachR_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录 { this.hdId.Text = SQLHelper.GetNewID(); } if (!string.IsNullOrEmpty(Request.Params["type"])) { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/TestRun/TestRunMonthSummary&menuId={1}", this.hdId.Text + "R", BLL.Const.TestRunMonthSummaryMenuId))); } else { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/TestRunMonthSummary&menuId={1}", this.hdId.Text + "R", BLL.Const.TestRunMonthSummaryMenuId))); } } #endregion #region 关闭弹出窗口 /// /// 关闭弹出窗口 /// /// /// protected void WindowAtt_Close(object sender, WindowCloseEventArgs e) { } #endregion } }