124 lines
5.5 KiB
C#
124 lines
5.5 KiB
C#
using BLL;
|
|
using System;
|
|
|
|
namespace FineUIPro.Web.TestRun.ProduceProperty
|
|
{
|
|
public partial class PropertyRunPumpCheckEdit : PageBase
|
|
{
|
|
#region 加载
|
|
/// <summary>
|
|
/// 页面加载
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkId, this.CurrUser.LoginProjectId, true);
|
|
BLL.UserService.InitUserDropDownList(this.drpInstallationMan, this.CurrUser.LoginProjectId, true);
|
|
|
|
string id = Request.Params["id"];
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
Model.ProduceProperty_PropertyRunPumpCheck data = BLL.PropertyRunPumpCheckService.GetPropertyRunPumpCheckById(id);
|
|
if (data != null)
|
|
{
|
|
this.hdId.Text = id;
|
|
this.txtCode.Text = data.Code;
|
|
if (!string.IsNullOrEmpty(data.UnitWorkId))
|
|
{
|
|
this.drpUnitWorkId.SelectedValue = data.UnitWorkId;
|
|
}
|
|
if (!string.IsNullOrEmpty(data.InstallationMan))
|
|
{
|
|
this.drpInstallationMan.SelectedValue = data.InstallationMan;
|
|
}
|
|
this.txtRecordName.Text = data.RecordName;
|
|
this.txtRecordCode.Text = data.RecordCode;
|
|
this.txtRecordMan.Text = BLL.UserService.GetUserNameByUserId(data.RecordMan);
|
|
this.txtStartDate.Text = data.StartDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.StartDate) : "";
|
|
this.txtEndDate.Text = data.EndDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.EndDate) : "";
|
|
this.txtRecordInstructions.Text = data.RecordInstructions;
|
|
this.txtProblemsSolutions.Text = data.ProblemsSolutions;
|
|
this.txtRemark.Text = data.Remark;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.txtRecordMan.Text = this.CurrUser.UserName;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 附件上传
|
|
/// <summary>
|
|
/// 附件上传
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAttach_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录
|
|
{
|
|
this.hdId.Text = SQLHelper.GetNewID(typeof(Model.ProduceProperty_PropertyRunPumpCheck));
|
|
}
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/ProduceProperty/PropertyRunPumpCheck&menuId={1}", this.hdId.Text, BLL.Const.PropertyRunPumpCheckMenuId)));
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.drpUnitWorkId.SelectedValue == BLL.Const._Null)
|
|
{
|
|
Alert.ShowInTop("请选择考核装置!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string id = Request.Params["id"];
|
|
Model.ProduceProperty_PropertyRunPumpCheck newData = new Model.ProduceProperty_PropertyRunPumpCheck();
|
|
newData.Code = this.txtCode.Text.Trim();
|
|
newData.UnitWorkId = this.drpUnitWorkId.SelectedValue;
|
|
if (this.drpInstallationMan.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newData.InstallationMan = this.drpInstallationMan.SelectedValue;
|
|
}
|
|
newData.RecordName = this.txtRecordName.Text.Trim();
|
|
newData.RecordCode = this.txtRecordCode.Text.Trim();
|
|
newData.RecordMan = this.CurrUser.UserId;
|
|
newData.StartDate = Funs.GetNewDateTime(this.txtStartDate.Text.Trim());
|
|
newData.EndDate = Funs.GetNewDateTime(this.txtEndDate.Text.Trim());
|
|
newData.RecordInstructions = this.txtRecordInstructions.Text.Trim();
|
|
newData.ProblemsSolutions = this.txtProblemsSolutions.Text.Trim();
|
|
newData.Remark = this.txtRemark.Text.Trim();
|
|
newData.ProjectId = this.CurrUser.LoginProjectId;
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
newData.PropertyRunPumpCheckId = id;
|
|
BLL.PropertyRunPumpCheckService.UpdatePropertyRunPumpCheck(newData);
|
|
}
|
|
else
|
|
{
|
|
if (!string.IsNullOrEmpty(this.hdId.Text))
|
|
{
|
|
newData.PropertyRunPumpCheckId = this.hdId.Text.Trim();
|
|
}
|
|
else
|
|
{
|
|
newData.PropertyRunPumpCheckId = SQLHelper.GetNewID(typeof(Model.ProduceProperty_PropertyRunPumpCheck));
|
|
this.hdId.Text = newData.PropertyRunPumpCheckId;
|
|
}
|
|
BLL.PropertyRunPumpCheckService.AddPropertyRunPumpCheck(newData);
|
|
}
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
#endregion
|
|
}
|
|
} |