2023-03-31 报表升级
This commit is contained in:
@@ -0,0 +1,175 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.InformationProject
|
||||
{
|
||||
public partial class EPSummaryReportEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
private string EPSummaryReportId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["EPSummaryReportId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["EPSummaryReportId"] = 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.EPSummaryReportId = Request.Params["EPSummaryReportId"];
|
||||
if (!string.IsNullOrEmpty(this.EPSummaryReportId))
|
||||
{
|
||||
var report = BLL.ProjectEPSummaryReportService.GetEPSummaryReportById(this.EPSummaryReportId);
|
||||
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.txtDescription1.Text = report.Description1;
|
||||
this.txtDescription2.Text = report.Description2;
|
||||
this.txtDescription3.Text = report.Description3;
|
||||
this.txtDescription4.Text = report.Description4;
|
||||
this.txtDescription5.Text = report.Description5;
|
||||
this.txtDescription6.Text = report.Description6;
|
||||
this.txtDescription7.Text = report.Description7;
|
||||
this.txtDescription8.Text = report.Description8;
|
||||
this.txtDescription9.Text = report.Description9;
|
||||
}
|
||||
#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="p"></param>
|
||||
private void SaveData(string type)
|
||||
{
|
||||
Model.InformationProject_EPSummaryReport report = new Model.InformationProject_EPSummaryReport
|
||||
{
|
||||
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.Description1 = txtDescription1.Text.Trim();
|
||||
report.Description2 = this.txtDescription2.Text.Trim();
|
||||
report.Description3 = this.txtDescription3.Text.Trim();
|
||||
report.Description4 = this.txtDescription4.Text.Trim();
|
||||
report.Description5 = this.txtDescription5.Text.Trim();
|
||||
report.Description6 = this.txtDescription6.Text.Trim();
|
||||
report.Description7 = this.txtDescription7.Text.Trim();
|
||||
report.Description8 = this.txtDescription8.Text.Trim();
|
||||
report.Description9 = this.txtDescription9.Text.Trim();
|
||||
if (!string.IsNullOrEmpty(this.EPSummaryReportId))
|
||||
{
|
||||
report.EPSummaryReportId = this.EPSummaryReportId;
|
||||
BLL.ProjectEPSummaryReportService.UpdateEPSummaryReport(report);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, report.YearId.ToString(), report.EPSummaryReportId, BLL.Const.ProjectEPSummaryReportMenuId, BLL.Const.BtnModify);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.InformationProject_EPSummaryReport oldReport = (from x in Funs.DB.InformationProject_EPSummaryReport
|
||||
where x.ProjectId == report.ProjectId && x.YearId == report.YearId
|
||||
select x).FirstOrDefault();
|
||||
if (oldReport == null)
|
||||
{
|
||||
this.EPSummaryReportId = SQLHelper.GetNewID(typeof(Model.InformationProject_EPSummaryReport));
|
||||
report.EPSummaryReportId = this.EPSummaryReportId;
|
||||
BLL.ProjectEPSummaryReportService.AddEPSummaryReport(report);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, report.YearId.ToString(), report.EPSummaryReportId, BLL.Const.ProjectEPSummaryReportMenuId, BLL.Const.BtnAdd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("该年度记录已存在", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user