HJGL_DS/HJGL_DS/FineUIPro.Web/JGZL/IndustrialPipelineInstallat...

174 lines
8.8 KiB
C#

using BLL;
using Model;
using System;
namespace FineUIPro.Web.JGZL
{
public partial class IndustrialPipelineInstallationQualityCertificateEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string CertificateId
{
get
{
return (string)ViewState["CertificateId"];
}
set
{
ViewState["CertificateId"] = value;
}
}
/// <summary>
/// 项目Id
/// </summary>
private 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.ProjectId = Request.Params["projectId"];
this.CertificateId = Request.Params["certificateId"];
//管道等级
this.drpPipelineLevel.DataTextField = "ISC_IsoName";
this.drpPipelineLevel.DataValueField = "ISC_IsoName";
this.drpPipelineLevel.DataSource = BLL.HJGL_PW_IsoInfoService.GetPipelineLevelList(this.ProjectId);
this.drpPipelineLevel.DataBind();
//管道长度
this.drpPipelineLength.DataTextField = "PipeLineLength";
this.drpPipelineLength.DataValueField = "PipeLineLength";
this.drpPipelineLength.DataSource = BLL.HJGL_PW_IsoInfoService.GetPipeLineLengthList(this.ProjectId);
this.drpPipelineLength.DataBind();
if (!string.IsNullOrEmpty(this.CertificateId))
{
var report = BLL.IndustrialPipelineInstallationQualityCertificateService.GetIndustrialPipelineInstallationQualityCertificateById(this.CertificateId);
if (report != null)
{
this.txtCertificateCode.Text = report.CertificateCode;
this.txtSpecialEquipmentProductionLicenseCode.Text = report.SpecialEquipmentProductionLicenseCode;
//this.txtEngineeringName.Text = report.EngineeringName;
//this.txtEngineeringCode.Text = report.EngineeringCode;
this.txtDeliveryUnit.Text = report.DeliveryUnit;
this.txtDeliveryUnitCode.Text = report.DeliveryUnitCode;
this.txtInstallStartDate.Text = report.InstallStartDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.InstallStartDate) : "";
this.txtInstallEndDate.Text = report.InstallEndDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.InstallEndDate) : "";
if (!string.IsNullOrEmpty(report.PipelineLevel))
{
this.drpPipelineLevel.SelectedValue = report.PipelineLevel;
}
if (!string.IsNullOrEmpty(report.PipelineLength))
{
this.drpPipelineLength.SelectedValue = report.PipelineLength;
}
//this.txtPipelineLevel.Text = report.PipelineLevel;
//this.txtPipelineLength.Text = report.PipelineLength;
//this.txtDesignLicenseCode.Text = report.DesignLicenseCode;
//this.txtQualificationCertificateCode.Text = report.QualificationCertificateCode;
//this.txtInstitutionalApprovalCertificate.Text = report.InstitutionalApprovalCertificate;
this.txtDesignUnit.Text = report.DesignUnit;
//this.txtSupervisoryAndInspectionAgency.Text = report.SupervisoryAndInspectionAgency;
this.txtLosslessTestingAgency.Text = report.LosslessTestingAgency;
this.txtInstallationInspection.Text = report.InstallationInspection;
this.txtConstructionUnit.Text = report.ConstructionUnit;
//this.txtRemark.Text = report.Remark;
}
}
else
{
this.txtInstallationInspection.Text = "浙江省特种设备研究院";
this.txtConstructionUnit.Text = "浙江石油化工有限公司";
this.txtSpecialEquipmentProductionLicenseCode.Text = "TS3833339-2028";
}
}
}
#endregion
#region
/// <summary>
/// 提交按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.JGZL_IndustrialPipelineInstallationQualityCertificateMenuId, Const.BtnSave))
{
Model.JGZL_IndustrialPipelineInstallationQualityCertificate newReport = new Model.JGZL_IndustrialPipelineInstallationQualityCertificate();
newReport.CertificateCode = this.txtCertificateCode.Text.Trim();
newReport.SpecialEquipmentProductionLicenseCode = this.txtSpecialEquipmentProductionLicenseCode.Text.Trim();
//newReport.EngineeringName = this.txtEngineeringName.Text.Trim();
//newReport.EngineeringCode = this.txtEngineeringCode.Text.Trim();
newReport.DeliveryUnit = this.txtDeliveryUnit.Text.Trim();
newReport.DeliveryUnitCode = this.txtDeliveryUnitCode.Text.Trim();
newReport.InstallStartDate = Funs.GetNewDateTime(this.txtInstallStartDate.Text.Trim());
newReport.InstallEndDate = Funs.GetNewDateTime(this.txtInstallEndDate.Text.Trim());
if(!string.IsNullOrEmpty(drpPipelineLevel.SelectedValue))
{
newReport.PipelineLevel = this.drpPipelineLevel.SelectedValue;
}
if (!string.IsNullOrEmpty(drpPipelineLength.SelectedValue))
{
newReport.PipelineLength = this.drpPipelineLength.SelectedValue;
}
//newReport.PipelineLevel = this.txtPipelineLevel.Text.Trim();
//newReport.PipelineLength = this.txtPipelineLength.Text.Trim();
newReport.DesignUnit = this.txtDesignUnit.Text.Trim();
newReport.LosslessTestingAgency = this.txtLosslessTestingAgency.Text.Trim();
//newReport.SupervisoryAndInspectionAgency = this.txtSupervisoryAndInspectionAgency.Text.Trim();
newReport.ConstructionUnit = this.txtConstructionUnit.Text.Trim();
//newReport.Remark = this.txtRemark.Text.Trim();
//newReport.DesignLicenseCode = this.txtDesignLicenseCode.Text.Trim();
//newReport.QualificationCertificateCode = this.txtQualificationCertificateCode.Text.Trim();
//newReport.InstitutionalApprovalCertificate = this.txtInstitutionalApprovalCertificate.Text.Trim();
newReport.InstallationInspection = this.txtInstallationInspection.Text.Trim();
if (!string.IsNullOrEmpty(this.CertificateId))
{
newReport.CertificateId = this.CertificateId;
BLL.IndustrialPipelineInstallationQualityCertificateService.UpdateIndustrialPipelineInstallationQualityCertificate(newReport);
}
else
{
newReport.ProjectId = this.ProjectId;
newReport.CompileMan = this.CurrUser.UserId;
newReport.CompileDate = DateTime.Now;
newReport.Reviewer = this.CurrUser.UserId;
newReport.RevieweDate = DateTime.Now;
newReport.CertificateId = SQLHelper.GetNewID(typeof(Model.JGZL_IndustrialPipelineInstallationQualityCertificate));
this.CertificateId = newReport.CertificateId;
BLL.IndustrialPipelineInstallationQualityCertificateService.AddIndustrialPipelineInstallationQualityCertificate(newReport);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
}
}