Files
HJGL_DS/HJGL_DS/FineUIPro.Web/JGZL/SpecialEquipmentMaintenanceEdit.aspx.cs
T
2026-01-05 15:49:33 +08:00

158 lines
7.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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.JGZL
{
public partial class SpecialEquipmentMaintenanceEdit : PageBase
{
#region 定义项
/// <summary>
/// 主键
/// </summary>
private string MaintenanceId
{
get
{
return (string)ViewState["MaintenanceId"];
}
set
{
ViewState["MaintenanceId"] = 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.MaintenanceId = Request.Params["maintenanceId"];
if (!string.IsNullOrEmpty(this.MaintenanceId))
{
var report = BLL.SpecialEquipmentMaintenanceService.GetSpecialEquipmentMaintenance(this.MaintenanceId);
if (report != null)
{
this.txtMaintenanceCode.Text = report.MaintenanceCode;
this.txtConUnit.Text = report.ConUnit;
this.txtEquipmentName.Text = report.EquipmentName;
this.txtEquipmentModel.Text = report.EquipmentModel;
this.txtEquipmentCode.Text = report.EquipmentCode;
this.txtManufacturingNumber.Text = report.ManufacturingNumber;
this.txtManufacturingUnit.Text = report.ManufacturingUnit;
this.txtManufacturingLicenseNumber.Text = report.ManufacturingLicenseNumber;
this.txtEquipmentLocation.Text = report.EquipmentLocation;
this.txtConstructionDate.Text = report.ConstructionDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.ConstructionDate) : "";
this.drpConstructionCategory.SelectedValue = report.ConstructionCategory;
this.txtLicenseNumber.Text = report.LicenseNumber;
this.txtLicenseValidityDate.Text = report.LicenseValidityDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.LicenseValidityDate) : "";
this.txtConContactMan.Text = report.ConContactMan;
this.txtConTelephone.Text = report.ConTelephone;
this.txtConFax.Text = report.ConFax;
this.txtConAddress.Text = report.ConAddress;
this.txtConEmail.Text = report.ConEmail;
this.txtUseUnit.Text = report.UseUnit;
this.txtUseContactMan.Text = report.UseContactMan;
this.txtUseTelephone.Text = report.UseTelephone;
this.txtUseFax.Text = report.UseFax;
this.txtUseAddress.Text = report.UseAddress;
this.txtUseEmail.Text = report.UseEmail;
}
}
else
{
this.txtConUnit.Text = "浙江鼎盛石化工程有限公司";
this.txtEquipmentName.Text = "压力管道(" + BLL.Base_ProjectService.GetProjectByProjectId(ProjectId).ProjectName + ")";
}
}
}
#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_SpecialEquipmentMaintenanceMenuId, Const.BtnSave))
{
Model.JGZL_SpecialEquipmentMaintenance newReport = new Model.JGZL_SpecialEquipmentMaintenance();
newReport.MaintenanceCode = this.txtMaintenanceCode.Text.Trim();
newReport.ConUnit = this.txtConUnit.Text.Trim();
newReport.EquipmentName = this.txtEquipmentName.Text.Trim();
newReport.EquipmentModel = this.txtEquipmentModel.Text.Trim();
newReport.EquipmentCode = this.txtEquipmentCode.Text.Trim();
newReport.ManufacturingNumber = this.txtManufacturingNumber.Text.Trim();
newReport.ManufacturingUnit = this.txtManufacturingUnit.Text.Trim();
newReport.ManufacturingLicenseNumber = this.txtManufacturingLicenseNumber.Text.Trim();
newReport.EquipmentLocation = this.txtEquipmentLocation.Text.Trim();
newReport.ConstructionDate = Funs.GetNewDateTime(this.txtConstructionDate.Text.Trim());
newReport.ConstructionCategory = this.drpConstructionCategory.SelectedValue;
newReport.LicenseNumber = this.txtLicenseNumber.Text.Trim();
newReport.LicenseValidityDate = Funs.GetNewDateTime(this.txtLicenseValidityDate.Text);
newReport.ConContactMan = this.txtConContactMan.Text.Trim();
newReport.ConTelephone = this.txtConTelephone.Text.Trim();
newReport.ConFax = this.txtConFax.Text.Trim();
newReport.ConAddress = this.txtConAddress.Text.Trim();
newReport.ConEmail = this.txtConEmail.Text.Trim();
newReport.UseUnit = this.txtUseUnit.Text.Trim();
newReport.UseContactMan = this.txtUseContactMan.Text.Trim();
newReport.UseTelephone = this.txtUseTelephone.Text.Trim();
newReport.UseFax = this.txtUseFax.Text.Trim();
newReport.UseAddress = this.txtUseAddress.Text.Trim();
newReport.UseEmail = this.txtUseEmail.Text.Trim();
if (!string.IsNullOrEmpty(this.MaintenanceId))
{
newReport.MaintenanceId = this.MaintenanceId;
BLL.SpecialEquipmentMaintenanceService.UpdateSpecialEquipmentMaintenance(newReport);
}
else
{
newReport.ProjectId = this.ProjectId;
newReport.CompileMan = this.CurrUser.UserId;
newReport.CompileDate = DateTime.Now;
newReport.MaintenanceId = SQLHelper.GetNewID(typeof(Model.JGZL_SpecialEquipmentMaintenance));
this.MaintenanceId = newReport.MaintenanceId;
BLL.SpecialEquipmentMaintenanceService.AddSpecialEquipmentMaintenance(newReport);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
}
}