xinjiang/SGGL/FineUIPro.Web/HJGL/BaseInfo/VCSEdit.aspx.cs

157 lines
5.7 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.HJGL.BaseInfo
{
public partial class VCSEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
public string vvsId
{
get
{
return (string)ViewState["vvsId"];
}
set
{
ViewState["vvsId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
btnClose.OnClientClick = ActiveWindow.GetHideReference();
BLL.Base_MaterialService.InitMaterialDropDownList(this.drpMaterial, true,this.CurrUser.LoginProjectId );//材质
BLL.Base_WeldingMethodService.InitWeldingMethodDropDownList(this.drpWeldingMethod, true);//焊接方法
this.vvsId = Request.Params["vvsId"];
if (!string.IsNullOrEmpty(this.vvsId))
{
Model.Base_VCS vvs = Funs.DB.Base_VCS.FirstOrDefault(x=>x.VvsId==this.vvsId);
if (vvs != null)
{
if (!string.IsNullOrEmpty(vvs.WeldingMethodId))
{
this.drpWeldingMethod.SelectedValue = vvs.WeldingMethodId;
}
if (!string.IsNullOrEmpty(vvs.MaterialId))
{
this.drpMaterial.SelectedValue = vvs.MaterialId;
}
if (!string.IsNullOrEmpty(vvs.SteelFormat))
{
this.txtSteelFormat.Text = vvs.SteelFormat;
}
if (!string.IsNullOrEmpty(vvs.Sch))
{
this.txtSch.Text = vvs.Sch;
}
if (!string.IsNullOrEmpty(vvs.Voltage))
{
this.txtVoltage.Text = vvs.Voltage;
}
if (!string.IsNullOrEmpty(vvs.Current))
{
this.txtCurrent.Text = vvs.Current;
}
if (!string.IsNullOrEmpty(vvs.Speed))
{
this.txtSpeed.Text = vvs.Speed;
}
if (vvs.PrepareTemp.HasValue)
{
this.txtPrepareTemp.Text = vvs.PrepareTemp.Value.ToString();
}
if (!string.IsNullOrEmpty(vvs.Layers))
{
this.txtLayers.Text = vvs.Layers.ToString();
}
if (vvs.LastTemp.HasValue)
{
this.txtLastTemp.Text = vvs.LastTemp.Value.ToString();
}//drpTestType.SelectedValue = Medium.TestType;
this.txtRemark.Text = vvs.Remark;
}
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
Model.Base_VCS vvs = new Model.Base_VCS
{
Remark = this.txtRemark.Text.Trim()
};
if(drpMaterial.SelectedValue!= BLL.Const._Null)
{
vvs.MaterialId = drpMaterial.SelectedValue;
}
if (drpWeldingMethod.SelectedValue != BLL.Const._Null)
{
vvs.WeldingMethodId = drpWeldingMethod.SelectedValue;
}
vvs.ProjectId = CurrUser.LoginProjectId;
vvs.SteelFormat = this.txtSteelFormat.Text;
vvs.Sch = this.txtSch.Text;
vvs.Voltage = this.txtVoltage.Text;
vvs.Current = this.txtCurrent.Text;
vvs.Speed = this.txtSpeed.Text;
vvs.Layers = this.txtLayers.Text;
vvs.CreateDate = DateTime.Now;
if (!string.IsNullOrEmpty(this.txtPrepareTemp.Text))
{
vvs.PrepareTemp = decimal.Parse(this.txtPrepareTemp.Text);
}
if (!string.IsNullOrEmpty(this.txtLastTemp.Text))
{
vvs.LastTemp = decimal.Parse(this.txtLastTemp.Text);
}
if (!string.IsNullOrEmpty(this.vvsId))
{
vvs.VvsId = this.vvsId;
BLL.Base_VCSService.UpdateVCS(vvs);
//BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_MediumMenuId, Const.BtnDelete, this.MediumId);
}
else
{
this.vvsId = SQLHelper.GetNewID(typeof(Model.Base_VCS));
vvs.VvsId = this.vvsId;
BLL.Base_VCSService.AddVCS(vvs);
//BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_MediumMenuId, Const.BtnDelete, this.MediumId);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
}
}