ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/HJGL/WeldingManage/JointReportUpdate.aspx.cs

118 lines
4.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace FineUIPro.Web.HJGL.WeldingManage
{
public partial class JointReportUpdate : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string jotId = Request.Params["JOT_ID"];
// 焊接位置
this.drpLocation.DataTextField = "Text";
this.drpLocation.DataValueField = "Value";
this.drpLocation.DataSource = BLL.DropListService.HJGL_JOT_LocationItem();
this.drpLocation.DataBind();
if (!string.IsNullOrEmpty(jotId))
{
var jot = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(jotId);
var dayly = BLL.HJGL_WeldReportService.GetWeldReportByDReportID(jot.DReportID);
//盖面焊工
drpCellWelder.DataTextField = "Text";
drpCellWelder.DataValueField = "Value";
drpCellWelder.DataSource = BLL.HJGL_PersonManageService.GetProjectWelderList(jot.ProjectId);
drpCellWelder.DataBind();
Funs.FineUIPleaseSelect(this.drpCellWelder);
///打底焊工
drpFloorWelder.DataTextField = "Text";
drpFloorWelder.DataValueField = "Value";
drpFloorWelder.DataSource = BLL.HJGL_PersonManageService.GetProjectWelderList(jot.ProjectId);
drpFloorWelder.DataBind();
Funs.FineUIPleaseSelect(this.drpFloorWelder);
drpFloorWelder.SelectedValue = jot.JOT_FloorWelder;
drpCellWelder.SelectedValue = jot.JOT_CellWelder;
if (!string.IsNullOrEmpty(jot.JOT_Location))
{
drpLocation.SelectedValue = jot.JOT_Location;
}
if (jot.Jot_WeldingDate.HasValue)
{
txtWeldingDate.Text = jot.Jot_WeldingDate.Value.ToString();
}
else
{
if (dayly != null)
{
txtWeldingDate.Text = dayly.JOT_WeldDate.ToString();
}
}
}
}
}
protected void drpFloorWelder_OnSelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpFloorWelder.SelectedValue != BLL.Const._Null)
{
drpCellWelder.SelectedValue = drpFloorWelder.SelectedValue;
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
string jotId = Request.Params["JOT_ID"];
Model.HJGL_PW_JointInfo jot = Funs.DB.HJGL_PW_JointInfo.FirstOrDefault(x => x.JOT_ID == jotId);
if (this.drpFloorWelder.SelectedValue != BLL.Const._Null)
{
jot.JOT_FloorWelder = drpFloorWelder.SelectedValue;
}
else
{
Alert.ShowInTop("请选择打底焊工!", MessageBoxIcon.Warning);
return;
}
if (this.drpCellWelder.SelectedValue != BLL.Const._Null)
{
jot.JOT_CellWelder = drpCellWelder.SelectedValue;
}
else
{
Alert.ShowInTop("请选择盖面焊工!", MessageBoxIcon.Warning);
return;
}
if (this.drpLocation.SelectedValue != BLL.Const._Null)
{
jot.JOT_Location = drpLocation.SelectedValue;
}
else
{
Alert.ShowInTop("请选择焊接位置!", MessageBoxIcon.Warning);
return;
}
jot.Jot_WeldingDate = Convert.ToDateTime(txtWeldingDate.Text.Trim());
Funs.DB.SubmitChanges();
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "更新日报信息!");
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
Alert.ShowInTop("日报信息更新成功!", MessageBoxIcon.Success);
}
}
}