Basf_TCC7/HJGL/FineUIPro.Web/WelderManage/AnalysisEdit.aspx.cs

136 lines
5.9 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;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Header;
namespace FineUIPro.Web.WelderManage
{
public partial class AnalysisEdit : PageBase
{
#region
/// <summary>
/// 合格项目id
/// </summary>
public string WelderQualifiedProjectId
{
get
{
return (string)ViewState["WelderQualifiedProjectId"];
}
set
{
ViewState["WelderQualifiedProjectId"] = value;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.WelderQualifiedProjectId = Request.Params["WelderQualifiedProjectId"];
drpWeldingLocation.DataValueField = "WeldingLocationCode";
drpWeldingLocation.DataTextField = "WeldingLocationCode";
drpWeldingLocation.DataSource = (from x in Funs.DB.Base_WeldingLocation orderby x.WeldingLocationCode select x).ToList();
drpWeldingLocation.DataBind();
Funs.FineUIPleaseSelect(drpWeldingLocation, "");
drpWeldingMethod.DataValueField = "WeldingMethodCode";
drpWeldingMethod.DataTextField = "WeldingMethodCode";
drpWeldingMethod.DataSource = (from x in Funs.DB.Base_WeldingMethod orderby x.WeldingMethodCode select x).ToList();
drpWeldingMethod.DataBind();
Funs.FineUIPleaseSelect(drpWeldingMethod, "");
if (!string.IsNullOrEmpty(this.WelderQualifiedProjectId))
{
var welderQualifiedProject = BLL.WelderQualifiedService.GetWelderQualifiedProjectById(this.WelderQualifiedProjectId);
if (welderQualifiedProject != null)
{
string wlederId = welderQualifiedProject.WelderId;
this.txtQualifiedProjectCode.Text = welderQualifiedProject.QualifiedProjectCode;
if (!string.IsNullOrEmpty(welderQualifiedProject.WeldingMethodId))
{
drpWeldingMethod.SelectedValueArray = welderQualifiedProject.WeldingMethodId.Split(',');
}
if (!string.IsNullOrEmpty(welderQualifiedProject.MaterialType))
{
drpMaterialType.SelectedValueArray = welderQualifiedProject.MaterialType.Split(',');
}
if (!string.IsNullOrEmpty(welderQualifiedProject.WeldingLocationId))
{
drpWeldingLocation.SelectedValueArray = welderQualifiedProject.WeldingLocationId.Split(',');
}
if (!string.IsNullOrEmpty(welderQualifiedProject.WeldType))
{
drpWeldType.SelectedValueArray = welderQualifiedProject.WeldType.Split(',');
}
if (welderQualifiedProject.ThicknessMax != null)
{
numThicknessMax.Text = welderQualifiedProject.ThicknessMax.Value.ToString();
}
if (welderQualifiedProject.SizesMin != null)
{
numSizesMin.Text = welderQualifiedProject.SizesMin.Value.ToString();
}
Model.Welder_Welder welder = BLL.WelderService.GetWelderById(wlederId);
if (welder != null)
{
this.lbWedlerName.Text = welder.WelderName;
this.lbWedlerCode.Text = welder.WelderCode;
}
}
}
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
Model.Welder_WelderQualify updateQue = Funs.DB.Welder_WelderQualify.FirstOrDefault(x => x.WelderQualifiedProjectId == this.WelderQualifiedProjectId);
if (!string.IsNullOrEmpty(drpWeldingMethod.SelectedValue))
{
updateQue.WeldingMethodId = String.Join(",", drpWeldingMethod.SelectedValueArray);
}
if (!string.IsNullOrEmpty(drpMaterialType.SelectedValue))
{
updateQue.MaterialType = String.Join(",", drpMaterialType.SelectedValueArray);
}
if (!string.IsNullOrEmpty(drpWeldingLocation.SelectedValue))
{
updateQue.WeldingLocationId = String.Join(",", drpWeldingLocation.SelectedValueArray);
}
if (!string.IsNullOrEmpty(drpWeldType.SelectedValue))
{
updateQue.WeldType = String.Join(",", drpWeldType.SelectedValueArray);
}
if (!string.IsNullOrEmpty(numSizesMin.Text))
{
updateQue.SizesMin = Convert.ToInt32(numSizesMin.Text);
}
else
{
updateQue.SizesMin = 0;
}
if (!string.IsNullOrEmpty(numThicknessMax.Text))
{
updateQue.ThicknessMax = Convert.ToInt32(numThicknessMax.Text);
}
else
{
updateQue.ThicknessMax = 0;
}
updateQue.IsHand=true;
Funs.DB.SubmitChanges();
BLL.Sys_LogService.AddLog(Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.Welder_QualifiedProjectMenuId, Const.BtnModify, this.WelderQualifiedProjectId);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
}
}