ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/HJGLServer/WeldingManage/TestingParametersEdit.aspx.cs

147 lines
7.3 KiB
C#

using System;
using BLL;
namespace FineUIPro.Web.HJGLServer.WeldingManage
{
public partial class TestingParametersEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string TestingParametersId
{
get
{
return (string)ViewState["TestingParametersId"];
}
set
{
ViewState["TestingParametersId"] = 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.drpSTE_ID.DataTextField = "STE_Code";
this.drpSTE_ID.DataValueField = "STE_ID";
this.drpSTE_ID.DataSource = BLL.HJGL_MaterialService.GetSteelList();
this.drpSTE_ID.DataBind();
Funs.FineUIPleaseSelect(this.drpSTE_ID);
this.drpIsHot.DataTextField = "Text";
this.drpIsHot.DataValueField = "Value";
this.drpIsHot.DataSource = BLL.DropListService.IsTrueOrFalseDrpList();
this.drpIsHot.DataBind();
this.drpTestingEquipment.DataTextField = "Text";
this.drpTestingEquipment.DataValueField = "Value";
this.drpTestingEquipment.DataSource = BLL.DropListService.TestingEquipmentListItem();
this.drpTestingEquipment.DataBind();
Funs.FineUIPleaseSelect(this.drpTestingEquipment);
this.TestingParametersId = Request.Params["TestingParametersId"];
if (!string.IsNullOrEmpty(this.TestingParametersId))
{
Model.HJGL_WeldingManage_TestingParameters testingParameters = BLL.HJGL_TestingParametersService.GetTestingParametersById(this.TestingParametersId);
if (testingParameters != null)
{
this.txtWeldSpecification.Text = testingParameters.WeldSpecification;
if (!string.IsNullOrEmpty(testingParameters.STE_ID))
{
this.drpSTE_ID.SelectedValue = testingParameters.STE_ID;
}
this.txtTestingTime.Text = testingParameters.TestingTime;
this.drpIsHot.SelectedValue = testingParameters.IsHot.ToString();
this.txtImageQualityModel.Text = testingParameters.ImageQualityModel;
this.txtWireDiameterCode.Text = testingParameters.WireDiameterCode;
if (!string.IsNullOrEmpty(testingParameters.TestingEquipment))
{
this.drpTestingEquipment.SelectedValue = testingParameters.TestingEquipment;
}
this.txtFilmModel.Text = testingParameters.FilmModel;
this.txtIntensifyingWay.Text = testingParameters.IntensifyingWay;
this.txtTubeVoltage.Text = testingParameters.TubeVoltage;
this.txtSourceActivity.Text = testingParameters.SourceActivity;
this.txtExposureTime.Text = testingParameters.ExposureTime;
this.txtTransilluminationMode.Text = testingParameters.TransilluminationMode;
this.txtFocalLength.Text = testingParameters.FocalLength;
if (testingParameters.TransilluminationNum != null)
{
this.txtTransilluminationNum.Text = Convert.ToString(testingParameters.TransilluminationNum);
}
if (testingParameters.EffectiveLength != null)
{
this.txtEffectiveLength.Text = Convert.ToString(testingParameters.EffectiveLength);
}
}
}
else
{
this.drpIsHot.SelectedValue = "False";
}
}
}
#endregion
#region
/// <summary>
/// 提交按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
Model.HJGL_WeldingManage_TestingParameters newTestingParameters = new Model.HJGL_WeldingManage_TestingParameters();
newTestingParameters.WeldSpecification = this.txtWeldSpecification.Text.Trim();
if (this.drpSTE_ID.SelectedValue != BLL.Const._Null)
{
newTestingParameters.STE_ID = this.drpSTE_ID.SelectedValue;
}
newTestingParameters.TestingTime = this.txtTestingTime.Text.Trim();
newTestingParameters.IsHot = Convert.ToBoolean(this.drpIsHot.SelectedValue);
newTestingParameters.ImageQualityModel = this.txtImageQualityModel.Text.Trim();
newTestingParameters.WireDiameterCode = this.txtWireDiameterCode.Text.Trim();
if (this.drpTestingEquipment.SelectedValue != BLL.Const._Null)
{
newTestingParameters.TestingEquipment = this.drpTestingEquipment.SelectedValue;
}
newTestingParameters.FilmModel = this.txtFilmModel.Text.Trim();
newTestingParameters.IntensifyingWay = this.txtIntensifyingWay.Text.Trim();
newTestingParameters.TubeVoltage = this.txtTubeVoltage.Text.Trim();
newTestingParameters.SourceActivity = this.txtSourceActivity.Text.Trim();
newTestingParameters.ExposureTime = this.txtExposureTime.Text.Trim();
newTestingParameters.TransilluminationMode = this.txtTransilluminationMode.Text.Trim();
newTestingParameters.FocalLength = this.txtFocalLength.Text.Trim();
newTestingParameters.TransilluminationNum = Funs.GetNewIntOrZero(this.txtTransilluminationNum.Text.Trim());
newTestingParameters.EffectiveLength = Funs.GetNewDecimalOrZero(this.txtEffectiveLength.Text.Trim());
if (!string.IsNullOrEmpty(this.TestingParametersId))
{
newTestingParameters.TestingParametersId = this.TestingParametersId;
BLL.HJGL_TestingParametersService.UpdateTestingParameters(newTestingParameters);
BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改检测工艺参数");
}
else
{
this.TestingParametersId = SQLHelper.GetNewID(typeof(Model.HJGL_WeldingManage_TestingParameters));
newTestingParameters.TestingParametersId = this.TestingParametersId;
BLL.HJGL_TestingParametersService.AddTestingParameters(newTestingParameters);
BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加检测工艺参数");
}
ShowNotify("提交成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
}
}