257 lines
9.4 KiB
C#
257 lines
9.4 KiB
C#
using BLL;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.TestRun.BeforeTestRun
|
|
{
|
|
public partial class InspectWanderAboutConfirm : PageBase
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string SubInspectId
|
|
{
|
|
get { return (string)ViewState["SubInspectId"]; }
|
|
set { ViewState["SubInspectId"] = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public int ConfirmType
|
|
{
|
|
get { return (int)ViewState["ConfirmType"]; }
|
|
set { ViewState["ConfirmType"] = value; }
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.SubInspectId = Request.Params["SubInspectId"];
|
|
this.ConfirmType = int.Parse(Request.Params["ConfirmType"]);
|
|
this.BindGrid();
|
|
}
|
|
}
|
|
|
|
#region 数据绑定
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
public void BindGrid()
|
|
{
|
|
//获取子系统
|
|
var data = new List<ConfirmIsPass>();
|
|
var list = Funs.DB.PreRun_SubInspectTermItem.Where(x => x.SubInspectId == this.SubInspectId).OrderBy(x => x.Sort).ToList();
|
|
if (list.Count > 0)
|
|
{
|
|
foreach (var item in list)
|
|
{
|
|
var model = new ConfirmIsPass();
|
|
model.TermItemId = item.TermItemId;
|
|
model.SubItemId = item.SubItemId;
|
|
model.SubInspectId = item.SubInspectId;
|
|
model.WorkInspectName = item.WorkInspectName;
|
|
model.ConfirmType = this.ConfirmType;
|
|
model.InspectionIllustrate = item.InspectionIllustrate;
|
|
//1=分包商2=承包商3=监理4=业主
|
|
if (this.ConfirmType == 1)
|
|
{
|
|
model.IsPass = item.SubcontractorIsPass;
|
|
model.ConfirmTypeName = "分包商";
|
|
}
|
|
if (this.ConfirmType == 2)
|
|
{
|
|
model.IsPass = item.ContractorIsPass;
|
|
model.ConfirmTypeName = "承包商";
|
|
}
|
|
if (this.ConfirmType == 3)
|
|
{
|
|
model.IsPass = item.SupervisionIsPass;
|
|
model.ConfirmTypeName = "监理";
|
|
}
|
|
if (this.ConfirmType == 4)
|
|
{
|
|
model.IsPass = item.OwnerIsPass;
|
|
model.ConfirmTypeName = "业主";
|
|
}
|
|
data.Add(model);
|
|
}
|
|
}
|
|
Grid1.DataSource = data;
|
|
Grid1.DataBind();
|
|
Grid1.Title = this.ConfirmType == 1 ? "分包商确认签字" : this.ConfirmType == 2 ? "承包商确认签字" : this.ConfirmType == 3 ? "监理确认签字" : this.ConfirmType == 4 ? "业主确认签字" : "";
|
|
}
|
|
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
Grid1.SortDirection = e.SortDirection;
|
|
Grid1.SortField = e.SortField;
|
|
BindGrid();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 保存
|
|
|
|
/// <summary>
|
|
/// 保存
|
|
/// </summary>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
JArray mergedData = Grid1.GetMergedData();
|
|
foreach (JObject mergedRow in mergedData)
|
|
{
|
|
string status = mergedRow.Value<string>("status");
|
|
JObject values = mergedRow.Value<JObject>("values");
|
|
int i = mergedRow.Value<int>("index");
|
|
var termItemId = this.Grid1.Rows[i].DataKeys[0].ToString();
|
|
//获取子系统信息
|
|
var model = Funs.DB.PreRun_SubInspectTermItem.FirstOrDefault(x => x.TermItemId == termItemId);
|
|
if (model != null)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(values.Value<string>("IsPass")))
|
|
{
|
|
//1=分包商2=承包商3=监理4=业主
|
|
if (this.ConfirmType == 1)
|
|
{
|
|
model.SubcontractorIsPass = int.Parse(values.Value<string>("IsPass"));
|
|
}
|
|
else if (this.ConfirmType == 2)
|
|
{
|
|
model.ContractorIsPass = int.Parse(values.Value<string>("IsPass"));
|
|
}
|
|
else if (this.ConfirmType == 3)
|
|
{
|
|
model.SupervisionIsPass = int.Parse(values.Value<string>("IsPass"));
|
|
}
|
|
else if (this.ConfirmType == 4)
|
|
{
|
|
model.OwnerIsPass = int.Parse(values.Value<string>("IsPass"));
|
|
}
|
|
}
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
var subInspectId = this.Grid1.Rows[0].DataKeys[3].ToString();
|
|
var subModel = Funs.DB.PreRun_SubInspectTerm.FirstOrDefault(x => x.SubInspectId == subInspectId);
|
|
if (subModel != null)
|
|
{
|
|
//1=分包商2=承包商3=监理4=业主
|
|
if (this.ConfirmType == 1)
|
|
{
|
|
if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == subInspectId && x.SubcontractorIsPass.GetValueOrDefault() != 1) == 0)
|
|
{
|
|
subModel.SubcontractorIsAllPass = 1;
|
|
}
|
|
else
|
|
{
|
|
subModel.SubcontractorIsAllPass = 0;
|
|
}
|
|
}
|
|
else if (this.ConfirmType == 2)
|
|
{
|
|
if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == subInspectId && x.ContractorIsPass.GetValueOrDefault() != 1) == 0)
|
|
{
|
|
subModel.ContractorIsAllPass = 1;
|
|
}
|
|
else
|
|
{
|
|
subModel.ContractorIsAllPass = 0;
|
|
}
|
|
}
|
|
else if (this.ConfirmType == 3)
|
|
{
|
|
if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == subInspectId && x.SupervisionIsPass.GetValueOrDefault() != 1) == 0)
|
|
{
|
|
subModel.SupervisionIsAllPass = 1;
|
|
}
|
|
else
|
|
{
|
|
subModel.SupervisionIsAllPass = 0;
|
|
}
|
|
}
|
|
else if (this.ConfirmType == 4)
|
|
{
|
|
if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == subInspectId && x.OwnerIsPass.GetValueOrDefault() != 1) == 0)
|
|
{
|
|
subModel.OwnerIsAllPass = 1;
|
|
}
|
|
else
|
|
{
|
|
subModel.OwnerIsAllPass = 0;
|
|
}
|
|
}
|
|
}
|
|
Funs.DB.SubmitChanges();
|
|
BindGrid();
|
|
ShowNotify("保存成功!");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ShowNotify(ex.Message, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 实体绑定
|
|
/// </summary>
|
|
public class ConfirmIsPass
|
|
{
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string TermItemId { get; set; }
|
|
/// <summary>
|
|
/// 检查项主键
|
|
/// </summary>
|
|
public string SubItemId { get; set; }
|
|
/// <summary>
|
|
/// 检查表主键
|
|
/// </summary>
|
|
public string SubInspectId { get; set; }
|
|
/// <summary>
|
|
/// 名称
|
|
/// </summary>
|
|
public string WorkInspectName { get; set; }
|
|
/// <summary>
|
|
/// 检查说明
|
|
/// </summary>
|
|
public string InspectionIllustrate { get; set; }
|
|
/// <summary>
|
|
/// 确认类型1=分包商2=承包商3=监理4=业主
|
|
/// </summary>
|
|
public int ConfirmType { get; set; }
|
|
/// <summary>
|
|
/// 确认类型名称
|
|
/// </summary>
|
|
public string ConfirmTypeName { get; set; }
|
|
/// <summary>
|
|
/// 是否通过
|
|
/// </summary>
|
|
public int? IsPass { get; set; }
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 窗口关闭
|
|
/// </summary>
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
}
|
|
} |