203 lines
9.0 KiB
C#
203 lines
9.0 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.CQMS.ManageReport
|
|
{
|
|
public partial class QualityWorkSummaryReportEdit : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
private string QualityWorkSummaryReportId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["QualityWorkSummaryReportId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["QualityWorkSummaryReportId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 项目主键
|
|
/// </summary>
|
|
public string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <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();
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
|
|
{
|
|
this.ProjectId = Request.Params["projectId"];
|
|
}
|
|
BLL.ConstValue.InitConstValueDropDownList(this.ddlYearId, BLL.ConstValue.Group_0008, true);
|
|
|
|
this.QualityWorkSummaryReportId = Request.Params["qualityWorkSummaryReportId"];
|
|
if (!string.IsNullOrEmpty(this.QualityWorkSummaryReportId))
|
|
{
|
|
var report = BLL.ProjectQualityWorkSummaryReportService.GetQualityWorkSummaryReportById(this.QualityWorkSummaryReportId);
|
|
if (report != null)
|
|
{
|
|
this.ProjectId = report.ProjectId;
|
|
#region 赋值
|
|
if (report.YearId != null)
|
|
{
|
|
this.ddlYearId.SelectedValue = report.YearId.ToString();
|
|
this.txtReportDate.Text = report.ReportDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.ReportDate) : "";
|
|
this.txtResponsiblePerson.Text = report.ResponsiblePerson;
|
|
this.txtResponsiblePersonTel.Text = report.ResponsiblePersonTel;
|
|
this.txtContactPerson.Text = report.ContactPerson;
|
|
this.txtContactPersonTel.Text = report.ContactPersonTel;
|
|
this.txtPerformance.Text = report.Performance;
|
|
this.txtAccidentSituation.Text = report.AccidentSituation;
|
|
this.txtAwards.Text = report.Awards;
|
|
this.txtWorkDevelopment.Text = report.WorkDevelopment;
|
|
this.txtPersonnelTraining.Text = report.PersonnelTraining;
|
|
this.txtCheckSituation.Text = report.CheckSituation;
|
|
this.txtManagementActivity.Text = report.ManagementActivity;
|
|
this.txtWorkExperience.Text = report.WorkExperience;
|
|
this.txtCountermeasures.Text = report.Countermeasures;
|
|
this.txtNextYearWorkPlan.Text = report.NextYearWorkPlan;
|
|
this.txtJobSuggestion.Text = report.JobSuggestion;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.ddlYearId.SelectedValue = DateTime.Now.Year.ToString();
|
|
this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存、提交
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.ddlYearId.SelectedValue == BLL.Const._Null)
|
|
{
|
|
Alert.ShowInTop("请选择年度", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
this.SaveData(BLL.Const.BtnSave);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
|
|
///// <summary>
|
|
///// 提交按钮
|
|
///// </summary>
|
|
///// <param name="sender"></param>
|
|
///// <param name="e"></param>
|
|
//protected void btnSubmit_Click(object sender, EventArgs e)
|
|
//{
|
|
// if (this.ddlYearId.SelectedValue == BLL.Const._Null)
|
|
// {
|
|
// Alert.ShowInTop("请选择年度", MessageBoxIcon.Warning);
|
|
// return;
|
|
// }
|
|
// if (this.ddlQuarter.SelectedValue == BLL.Const._Null)
|
|
// {
|
|
// Alert.ShowInTop("请选择季度", MessageBoxIcon.Warning);
|
|
// return;
|
|
// }
|
|
// this.SaveData(BLL.Const.BtnSubmit);
|
|
// PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 提交数据
|
|
/// </summary>
|
|
/// <param name="p"></param>
|
|
private void SaveData(string type)
|
|
{
|
|
Model.InformationProject_QualityWorkSummaryReport report = new Model.InformationProject_QualityWorkSummaryReport
|
|
{
|
|
ProjectId = this.ProjectId,
|
|
UnitId = string.IsNullOrEmpty(this.CurrUser.UnitId) ? Const.UnitId_CD : this.CurrUser.UnitId,
|
|
};
|
|
if (this.ddlYearId.SelectedValue != BLL.Const._Null)
|
|
{
|
|
report.YearId = Funs.GetNewIntOrZero(this.ddlYearId.SelectedValue);
|
|
}
|
|
report.ResponsiblePerson = this.txtResponsiblePerson.Text.Trim();
|
|
report.ResponsiblePersonTel = this.txtResponsiblePersonTel.Text.Trim();
|
|
report.ContactPerson = this.txtContactPerson.Text.Trim();
|
|
report.ContactPersonTel = this.txtContactPersonTel.Text.Trim();
|
|
report.ReportDate = Funs.GetNewDateTime(this.txtReportDate.Text.Trim());
|
|
report.Performance = this.txtPerformance.Text.Trim();
|
|
report.AccidentSituation = this.txtAccidentSituation.Text.Trim();
|
|
report.Awards = this.txtAwards.Text.Trim();
|
|
report.WorkDevelopment = this.txtWorkDevelopment.Text.Trim();
|
|
report.PersonnelTraining = this.txtPersonnelTraining.Text.Trim();
|
|
report.CheckSituation = this.txtCheckSituation.Text.Trim();
|
|
report.ManagementActivity = this.txtManagementActivity.Text.Trim();
|
|
report.WorkExperience = this.txtWorkExperience.Text.Trim();
|
|
report.Countermeasures = this.txtCountermeasures.Text.Trim();
|
|
report.NextYearWorkPlan = this.txtNextYearWorkPlan.Text.Trim();
|
|
report.JobSuggestion = this.txtJobSuggestion.Text.Trim();
|
|
|
|
report.CompileMan = this.CurrUser.UserId;
|
|
report.CompileDate = DateTime.Now;
|
|
//if (type == BLL.Const.BtnSubmit)
|
|
//{
|
|
// safetyQuarterlyReport.States = this.ctlAuditFlow.NextStep;
|
|
//}
|
|
if (!string.IsNullOrEmpty(this.QualityWorkSummaryReportId))
|
|
{
|
|
report.QualityWorkSummaryReportId = this.QualityWorkSummaryReportId;
|
|
BLL.ProjectQualityWorkSummaryReportService.UpdateQualityWorkSummaryReport(report);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, report.YearId.ToString(), report.QualityWorkSummaryReportId, BLL.Const.ProjectQualitySummaryReportMenuId, BLL.Const.BtnModify);
|
|
}
|
|
else
|
|
{
|
|
Model.InformationProject_QualityWorkSummaryReport oldReport = (from x in Funs.DB.InformationProject_QualityWorkSummaryReport
|
|
where x.ProjectId == report.ProjectId && x.YearId == report.YearId
|
|
select x).FirstOrDefault();
|
|
if (oldReport == null)
|
|
{
|
|
this.QualityWorkSummaryReportId = SQLHelper.GetNewID(typeof(Model.InformationProject_QualityWorkSummaryReport));
|
|
report.QualityWorkSummaryReportId = this.QualityWorkSummaryReportId;
|
|
BLL.ProjectQualityWorkSummaryReportService.AddQualityWorkSummaryReport(report);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, report.YearId.ToString(), report.QualityWorkSummaryReportId, BLL.Const.ProjectQualitySummaryReportMenuId, BLL.Const.BtnAdd);
|
|
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("该年度记录已存在", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |