140 lines
6.4 KiB
C#
140 lines
6.4 KiB
C#
using BLL;
|
|
using System;
|
|
|
|
namespace FineUIPro.Web.TestRun
|
|
{
|
|
public partial class DriverSchemeEdit : PageBase
|
|
{
|
|
#region 加载
|
|
/// <summary>
|
|
/// 页面加载
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
BLL.UnitService.InitUnitDownList(this.drpApprovalUnitId, this.CurrUser.LoginProjectId, true);
|
|
BLL.UnitService.InitUnitDownList(this.drpExaminationUnitId, this.CurrUser.LoginProjectId, true);
|
|
BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkId, this.CurrUser.LoginProjectId, true);
|
|
BLL.UserService.InitUserDropDownList(this.drpCompileMan, this.CurrUser.LoginProjectId, true);
|
|
|
|
string id = Request.Params["id"];
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
Model.Driver_DriverScheme data = BLL.DriverSchemeService.GetDriverSchemeById(id);
|
|
if (data != null)
|
|
{
|
|
this.hdId.Text = id;
|
|
this.txtCode.Text = data.Code;
|
|
if (!string.IsNullOrEmpty(data.UnitWorkId))
|
|
{
|
|
this.drpUnitWorkId.SelectedValue = data.UnitWorkId;
|
|
}
|
|
this.txtSchemeName.Text = data.SchemeName;
|
|
this.txtSchemeCode.Text = data.SchemeCode;
|
|
if (!string.IsNullOrEmpty(data.CompileMan))
|
|
{
|
|
this.drpCompileMan.SelectedValue = data.CompileMan;
|
|
}
|
|
if (!string.IsNullOrEmpty(data.ApprovalUnitId))
|
|
{
|
|
this.drpApprovalUnitId.SelectedValue = data.ApprovalUnitId;
|
|
}
|
|
if (!string.IsNullOrEmpty(data.ExaminationUnitId))
|
|
{
|
|
this.drpExaminationUnitId.SelectedValue = data.ExaminationUnitId;
|
|
}
|
|
this.txtPlanCompileDate.Text = data.PlanCompileDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.PlanCompileDate) : "";
|
|
this.txtActualCompileDate.Text = data.ActualCompileDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.ActualCompileDate) : "";
|
|
this.txtSubmitDate.Text = data.SubmitDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.SubmitDate) : "";
|
|
this.txtApprovalCompletionDate.Text = data.ApprovalCompletionDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.ApprovalCompletionDate) : "";
|
|
this.txtRemark.Text = data.Remark;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
|
|
}
|
|
}
|
|
}
|
|
#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.Driver_DriverScheme));
|
|
}
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverScheme&menuId={1}", this.hdId.Text, BLL.Const.DriverSchemeMenuId)));
|
|
}
|
|
#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.Driver_DriverScheme newData = new Model.Driver_DriverScheme();
|
|
newData.Code = this.txtCode.Text.Trim();
|
|
newData.SchemeName = this.txtSchemeName.Text.Trim();
|
|
newData.SchemeCode = this.txtSchemeCode.Text.Trim();
|
|
newData.UnitWorkId = this.drpUnitWorkId.SelectedValue;
|
|
if (this.drpCompileMan.SelectedValue!=BLL.Const._Null)
|
|
{
|
|
newData.CompileMan = this.drpCompileMan.SelectedValue;
|
|
}
|
|
if (this.drpApprovalUnitId.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newData.ApprovalUnitId = this.drpApprovalUnitId.SelectedValue;
|
|
}
|
|
if (this.drpExaminationUnitId.SelectedValue != BLL.Const._Null)
|
|
{
|
|
newData.ExaminationUnitId = this.drpExaminationUnitId.SelectedValue;
|
|
}
|
|
newData.PlanCompileDate = Funs.GetNewDateTime(this.txtPlanCompileDate.Text.Trim());
|
|
newData.ActualCompileDate = Funs.GetNewDateTime(this.txtActualCompileDate.Text.Trim());
|
|
newData.SubmitDate = Funs.GetNewDateTime(this.txtSubmitDate.Text.Trim());
|
|
newData.ApprovalCompletionDate = Funs.GetNewDateTime(this.txtApprovalCompletionDate.Text.Trim());
|
|
newData.Remark = this.txtRemark.Text.Trim();
|
|
newData.ProjectId = this.CurrUser.LoginProjectId;
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
newData.DriverSchemeId = id;
|
|
BLL.DriverSchemeService.UpdateDriverScheme(newData);
|
|
}
|
|
else
|
|
{
|
|
if (!string.IsNullOrEmpty(this.hdId.Text))
|
|
{
|
|
newData.DriverSchemeId = this.hdId.Text.Trim();
|
|
}
|
|
else
|
|
{
|
|
newData.DriverSchemeId = SQLHelper.GetNewID(typeof(Model.Driver_DriverScheme));
|
|
this.hdId.Text = newData.DriverSchemeId;
|
|
}
|
|
BLL.DriverSchemeService.AddDriverScheme(newData);
|
|
}
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
#endregion
|
|
}
|
|
} |