移交管理添加增加修改功能
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.Transfer
|
||||
{
|
||||
public partial class FirefightingEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
private string Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["Id"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["Id"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目主键
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Id = Request.Params["Id"];
|
||||
ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(Id))
|
||||
{
|
||||
var model = Funs.DB.Transfer_Firefighting.FirstOrDefault(x => x.Id == Id);
|
||||
if (model != null)
|
||||
{
|
||||
txtFirefighting.Text = model.Firefighting;
|
||||
txtSystemName.Text = model.SystemName;
|
||||
txtSubsystem.Text = model.Subsystem;
|
||||
txtTest_Package.Text = model.Test_Package;
|
||||
ddlInstallation.SelectedValue = model.Installation;
|
||||
ddlDebugging.SelectedValue = model.Debugging;
|
||||
ddlAcceptancecheck.SelectedValue = model.Acceptancecheck;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
var model = new Model.Transfer_Firefighting
|
||||
{
|
||||
ProjectId = ProjectId,
|
||||
Firefighting = txtFirefighting.Text,
|
||||
SystemName = txtSystemName.Text,
|
||||
Subsystem = txtSubsystem.Text,
|
||||
Test_Package = txtTest_Package.Text,
|
||||
Installation = ddlInstallation.SelectedValue,
|
||||
Debugging = ddlDebugging.SelectedValue,
|
||||
Acceptancecheck = ddlAcceptancecheck.SelectedValue,
|
||||
|
||||
};
|
||||
|
||||
#region 判断状态
|
||||
var listObj = new List<string>();
|
||||
listObj.Add(model.Installation);
|
||||
listObj.Add(model.Debugging);
|
||||
listObj.Add(model.Acceptancecheck);
|
||||
//全是NA或Completed 状态是Completed
|
||||
if (listObj.Where(x => x == "NA" || x == "Completed").ToList().Count == 3)
|
||||
{
|
||||
model.FINAL_Status = "Completed";
|
||||
} //如果全是Not Start 就是 Not Start
|
||||
else if (listObj.Where(x => x == "Not Start").ToList().Count == 3)
|
||||
{
|
||||
model.FINAL_Status = "Not Start";
|
||||
}
|
||||
|
||||
//如果其中有一项是In progress 或Not Start 是 In progress
|
||||
else if (listObj.Where(x => x == "In progress" || x == "Not Start").ToList().Count >= 1)
|
||||
{
|
||||
model.FINAL_Status = "In progress";
|
||||
}
|
||||
|
||||
#endregion
|
||||
if (!string.IsNullOrEmpty(Id))
|
||||
{
|
||||
var newModel = Funs.DB.Transfer_Firefighting.FirstOrDefault(x => x.Id == Id);
|
||||
if (newModel != null)
|
||||
{
|
||||
newModel.Firefighting = txtFirefighting.Text;
|
||||
newModel.SystemName = txtSystemName.Text;
|
||||
newModel.Subsystem = txtSubsystem.Text;
|
||||
newModel.Test_Package = txtTest_Package.Text;
|
||||
newModel.Installation = ddlInstallation.SelectedValue;
|
||||
newModel.Debugging = ddlDebugging.SelectedValue;
|
||||
newModel.Acceptancecheck = ddlAcceptancecheck.SelectedValue;
|
||||
newModel.FINAL_Status = model.FINAL_Status;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
model.Id = Id = Guid.NewGuid().ToString();
|
||||
Funs.DB.Transfer_Firefighting.InsertOnSubmit(model);
|
||||
}
|
||||
Funs.DB.SubmitChanges();
|
||||
ShowNotify("保存成功", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user