CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/Personal/TestRunMonthSummaryEdit.asp...

112 lines
4.7 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;
using Model;
namespace FineUIPro.Web.Personal
{
public partial class TestRunMonthSummaryEdit : PageBase
{
/// <summary>
/// 定义项
/// </summary>
public string TestRunMonthSummaryId
{
get
{
return (string)ViewState["TestRunMonthSummaryId"];
}
set
{
ViewState["TestRunMonthSummaryId"] = value;
}
}
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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)
{
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.txtProcessName.Text = MonthSummary.ProcessName;
this.txtProblemDescription.Text = MonthSummary.ProblemDescription;
this.txtHandleMethod.Text = MonthSummary.HandleMethod;
this.txtExperienceOrSuggestion.Text = MonthSummary.ExperienceOrSuggestion;
}
}
else
{
this.lbUserName.Text = this.CurrUser.UserName;
}
}
}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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,
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
{
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());
}
}
}