Files
HJGL_DS/HJGL_DS/FineUIPro.Web/JGZL/ElectrostaticGroundingEdit.aspx.cs
T
2026-01-21 17:31:17 +08:00

141 lines
5.8 KiB
C#

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 ElectrostaticGroundingEdit : PageBase
{
#region 定义项
/// <summary>
/// 主键
/// </summary>
private string ElectrostaticGroundingId
{
get
{
return (string)ViewState["ElectrostaticGroundingId"];
}
set
{
ViewState["ElectrostaticGroundingId"] = 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.drpCompileMan.DataTextField = "UserName";
this.drpCompileMan.DataValueField = "UserId";
this.drpCompileMan.DataSource = BLL.Sys_UserService.GetUserList();
this.drpCompileMan.DataBind();
Funs.FineUIPleaseSelect(this.drpCompileMan);
this.ProjectId = Request.Params["projectId"];
this.ElectrostaticGroundingId = Request.Params["electrostaticGroundingId"];
if (!string.IsNullOrEmpty(this.ElectrostaticGroundingId))
{
var report = BLL.ElectrostaticGroundingService.GetElectrostaticGroundingById(this.ElectrostaticGroundingId);
if (report != null)
{
this.txtPipelineCode.Text = report.PipelineCode;
this.txtConnectionType.Text = report.ConnectionType;
this.txtBWSpecification.Text = report.BWSpecification;
this.txtBWMaterial.Text = report.BWMaterial;
this.txtBWResistance.Text = report.BWResistance.HasValue ? report.BWResistance.ToString() : "";
this.txtGWSpecification.Text = report.GWSpecification;
this.txtGWMaterial.Text = report.GWMaterial;
this.txtGWResistance.Text = report.GWResistance.HasValue ? report.GWResistance.ToString() : "";
if (!string.IsNullOrEmpty(report.CompileMan))
{
this.drpCompileMan.SelectedValue = report.CompileMan;
}
this.txtCompileDate.Text = report.CompileDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.CompileDate) : "";
}
}
else
{
this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
this.txtCompileDate.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 (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.JGZL_ElectrostaticGroundingMenuId, Const.BtnSave))
{
Model.JGZL_ElectrostaticGrounding newReport = new Model.JGZL_ElectrostaticGrounding();
newReport.PipelineCode = this.txtPipelineCode.Text;
newReport.ConnectionType= this.txtConnectionType.Text;
newReport.BWSpecification= this.txtBWSpecification.Text;
newReport.BWMaterial=this.txtBWMaterial.Text;
newReport.BWResistance = Funs.GetNewDecimal(this.txtBWResistance.Text);
newReport.GWSpecification=this.txtGWSpecification.Text;
newReport.GWMaterial=this.txtGWMaterial.Text;
newReport.GWResistance=Funs.GetNewDecimal(this.txtGWResistance.Text);
if (this.drpCompileMan.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpCompileMan.SelectedValue))
{
newReport.CompileMan = this.drpCompileMan.SelectedValue;
}
newReport.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text);
if (!string.IsNullOrEmpty(this.ElectrostaticGroundingId))
{
newReport.ElectrostaticGroundingId = this.ElectrostaticGroundingId;
BLL.ElectrostaticGroundingService.UpdateElectrostaticGrounding(newReport);
}
else
{
newReport.ProjectId = this.ProjectId;
newReport.ElectrostaticGroundingId = SQLHelper.GetNewID(typeof(Model.JGZL_ElectrostaticGrounding));
this.ElectrostaticGroundingId = newReport.ElectrostaticGroundingId;
BLL.ElectrostaticGroundingService.AddElectrostaticGrounding(newReport);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
}
}