248 lines
11 KiB
C#
248 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Collections;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 设备材料报验管理
|
|
/// </summary>
|
|
public class EquipmentAndMaterialInspectionService
|
|
{
|
|
public static Model.SUBQHSEDB db = Funs.DB;
|
|
|
|
/// <summary>
|
|
/// 记录数
|
|
/// </summary>
|
|
private static int count
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取分页列表
|
|
/// </summary>
|
|
/// <param name="projectId"></param>
|
|
/// <param name="unitId"></param>
|
|
/// <param name="inspectionName"></param>
|
|
/// <param name="date1"></param>
|
|
/// <param name="date2"></param>
|
|
/// <param name="startRowIndex"></param>
|
|
/// <param name="maximumRows"></param>
|
|
/// <returns></returns>
|
|
public static IEnumerable GetListData(string projectId, string unitId, string inspectionName, string startDate, string endDate, int startRowIndex, int maximumRows)
|
|
{
|
|
IQueryable<Model.FireGasSafety_EquipmentAndMaterialInspection> q = from x in db.FireGasSafety_EquipmentAndMaterialInspection
|
|
where x.ProjectId == projectId
|
|
orderby x.RemarkCode
|
|
select x;
|
|
if (unitId != "0")
|
|
{
|
|
q = q.Where(e => e.UnitId == unitId);
|
|
}
|
|
if (!string.IsNullOrEmpty(inspectionName))
|
|
{
|
|
q = q.Where(e => e.InspectionName.Contains(inspectionName));
|
|
}
|
|
if (!string.IsNullOrEmpty(startDate))
|
|
{
|
|
q = q.Where(e => e.InspectionDate >= Funs.GetNewDateTime(startDate));
|
|
}
|
|
if (!string.IsNullOrEmpty(endDate))
|
|
{
|
|
q = q.Where(e => e.InspectionDate <= Funs.GetNewDateTime(endDate));
|
|
}
|
|
count = q.Count();
|
|
if (count == 0)
|
|
{
|
|
return new object[] { "" };
|
|
}
|
|
return from x in q.Skip(startRowIndex).Take(maximumRows)
|
|
select new
|
|
{
|
|
x.InspectionEquipmentId,
|
|
x.ProjectId,
|
|
UnitName = (from y in db.Base_Unit where y.UnitId == x.UnitId select y.UnitName).FirstOrDefault(),
|
|
x.InspectionCode,
|
|
ProfessionalName = (from y in db.Base_CNProfessional where y.CNProfessionalId == x.CNProfessionalId select y.ProfessionalName).FirstOrDefault(),
|
|
x.InspectionName,
|
|
x.Specifications,
|
|
x.Supplier,
|
|
x.Counts,
|
|
x.SamplingCount,
|
|
SamplingResult = x.SamplingResult == "1" ? "合格" : "不合格",
|
|
x.InspectionDate,
|
|
x.AttachUrl,
|
|
x.Attribute,
|
|
x.RemarkCode,
|
|
x.UsedPlace,
|
|
x.EquipmentNO
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取分页列表数
|
|
/// </summary>
|
|
/// <param name="projectId"></param>
|
|
/// <param name="unitId"></param>
|
|
/// <param name="inspectionName"></param>
|
|
/// <param name="date1"></param>
|
|
/// <param name="date2"></param>
|
|
/// <returns></returns>
|
|
public static int GetListCount(string projectId, string unitId, string inspectionName, string startDate, string endDate)
|
|
{
|
|
return count;
|
|
}
|
|
public static int GetListCountForDataType(string attribute, string projectId, string unitId, string inspectionName, string startDate, string endDate)
|
|
{
|
|
return count;
|
|
}
|
|
/// <summary>
|
|
/// 根据主键获取设备材料报验信息
|
|
/// </summary>
|
|
/// <param name="inspectionEquipmentId"></param>
|
|
/// <returns></returns>
|
|
public static Model.FireGasSafety_EquipmentAndMaterialInspection GetEquipmentAndMaterialInspectionById(string inspectionEquipmentId)
|
|
{
|
|
return Funs.DB.FireGasSafety_EquipmentAndMaterialInspection.FirstOrDefault(e => e.InspectionEquipmentId == inspectionEquipmentId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加设备材料报验
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
public static void AddInspectionEquipment(Model.FireGasSafety_EquipmentAndMaterialInspection model)
|
|
{
|
|
Model.SUBQHSEDB db = Funs.DB;
|
|
Model.FireGasSafety_EquipmentAndMaterialInspection newmodel = new Model.FireGasSafety_EquipmentAndMaterialInspection();
|
|
newmodel.InspectionEquipmentId = model.InspectionEquipmentId;
|
|
newmodel.ProjectId = model.ProjectId;
|
|
newmodel.UnitId = model.UnitId;
|
|
newmodel.InspectionCode = model.InspectionCode;
|
|
newmodel.CNProfessionalId = model.CNProfessionalId;
|
|
newmodel.InspectionName = model.InspectionName;
|
|
newmodel.Specifications = model.Specifications;
|
|
newmodel.Supplier = model.Supplier;
|
|
newmodel.Counts = model.Counts;
|
|
newmodel.SamplingCount = model.SamplingCount;
|
|
newmodel.SamplingResult = model.SamplingResult;
|
|
newmodel.InspectionDate = model.InspectionDate;
|
|
newmodel.AttachUrl = model.AttachUrl;
|
|
newmodel.CompileMan = model.CompileMan;
|
|
newmodel.CompileDate = model.CompileDate;
|
|
newmodel.EquipmentNO = model.EquipmentNO;
|
|
newmodel.RemarkCode = model.RemarkCode;
|
|
newmodel.UsedPlace = model.UsedPlace;
|
|
newmodel.Attribute = model.Attribute;
|
|
newmodel.AuditMan = model.AuditMan;
|
|
|
|
newmodel.Status = model.Status;
|
|
db.FireGasSafety_EquipmentAndMaterialInspection.InsertOnSubmit(newmodel);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改设备材料报验
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
public static void UpdateInspectionEquipment(Model.FireGasSafety_EquipmentAndMaterialInspection model)
|
|
{
|
|
Model.SUBQHSEDB db = Funs.DB;
|
|
Model.FireGasSafety_EquipmentAndMaterialInspection newmodel = db.FireGasSafety_EquipmentAndMaterialInspection.FirstOrDefault(e => e.InspectionEquipmentId == model.InspectionEquipmentId);
|
|
if (newmodel != null)
|
|
{
|
|
newmodel.ProjectId = model.ProjectId;
|
|
newmodel.UnitId = model.UnitId;
|
|
newmodel.InspectionCode = model.InspectionCode;
|
|
newmodel.CNProfessionalId = model.CNProfessionalId;
|
|
newmodel.InspectionName = model.InspectionName;
|
|
newmodel.Specifications = model.Specifications;
|
|
newmodel.Supplier = model.Supplier;
|
|
newmodel.Counts = model.Counts;
|
|
newmodel.SamplingCount = model.SamplingCount;
|
|
newmodel.SamplingResult = model.SamplingResult;
|
|
newmodel.InspectionDate = model.InspectionDate;
|
|
newmodel.AttachUrl = model.AttachUrl;
|
|
newmodel.EquipmentNO = model.EquipmentNO;
|
|
newmodel.RemarkCode = model.RemarkCode;
|
|
newmodel.UsedPlace = model.UsedPlace;
|
|
newmodel.Attribute = model.Attribute;
|
|
newmodel.AuditMan = model.AuditMan;
|
|
newmodel.Status = model.Status;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除设备材料报验
|
|
/// </summary>
|
|
/// <param name="inspectionEquipmentId"></param>
|
|
public static void DeleteEquipmentAndMaterialInspection(string inspectionEquipmentId)
|
|
{
|
|
Model.SUBQHSEDB db = Funs.DB;
|
|
Model.FireGasSafety_EquipmentAndMaterialInspection model = db.FireGasSafety_EquipmentAndMaterialInspection.FirstOrDefault(e => e.InspectionEquipmentId == inspectionEquipmentId);
|
|
if (model != null)
|
|
{
|
|
db.FireGasSafety_EquipmentAndMaterialInspection.DeleteOnSubmit(model);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据专业id获取设备材料报验信息
|
|
/// </summary>
|
|
/// <param name="cNProfessionalId"></param>
|
|
/// <returns></returns>
|
|
public static Model.FireGasSafety_EquipmentAndMaterialInspection GetInspectionEquipmentByCNProfessionalId(string cNProfessionalId)
|
|
{
|
|
return Funs.DB.FireGasSafety_EquipmentAndMaterialInspection.FirstOrDefault(e => e.CNProfessionalId == cNProfessionalId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据单位id获取设备材料报验信息
|
|
/// </summary>
|
|
/// <param name="cNProfessionalId"></param>
|
|
/// <returns></returns>
|
|
public static Model.FireGasSafety_EquipmentAndMaterialInspection GetInspectionEquipmentByUnitId(string unitId)
|
|
{
|
|
return Funs.DB.FireGasSafety_EquipmentAndMaterialInspection.FirstOrDefault(e => e.UnitId == unitId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取属性项
|
|
/// </summary>
|
|
/// <param name="projectId">项目Id</param>
|
|
/// <returns></returns>
|
|
public static ListItem[] drpAttribute()
|
|
{
|
|
ListItem[] list = new ListItem[10];
|
|
list[0] = new ListItem("钢材出厂合格证、试验报告核查要录", "1");
|
|
list[1] = new ListItem("钢筋机械连接、焊接接头检验报告核查要录", "2");
|
|
list[2] = new ListItem("水泥合格证、试验报告核查要录", "3");
|
|
list[3] = new ListItem("砖石(砌块)合格证、试验报告核查要录", "4");
|
|
list[4] = new ListItem("防水材料合格证、检验报告核查要录", "5");
|
|
list[5] = new ListItem("其它材料、构件合格证、试验报告核查要录", "6");
|
|
list[6] = new ListItem("混凝土、砂浆试件抗压强度试验报告核查要录", "7");
|
|
list[7] = new ListItem("混凝土抗渗试件试验报告核查要录", "8");
|
|
list[8] = new ListItem("商品混凝土进场验收记录", "9");
|
|
list[9] = new ListItem("试样/试件台账", "10");
|
|
return list;
|
|
}
|
|
public static void InitAttributeDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "Value";
|
|
dropName.DataTextField = "Text";
|
|
dropName.DataSource = drpAttribute();
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName);
|
|
}
|
|
}
|
|
}
|
|
}
|