253 lines
12 KiB
C#
253 lines
12 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 InspectionEquipmentService
|
|
{
|
|
public static Model.SGGLDB 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.Comprehensive_InspectionEquipment> q = from x in db.Comprehensive_InspectionEquipment
|
|
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.Unit,
|
|
x.UsedPlace,
|
|
x.EquipmentNO,
|
|
x.EquipmentOrMatail
|
|
};
|
|
}
|
|
|
|
/// <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.Comprehensive_InspectionEquipment GetInspectionEquipmentById(string inspectionEquipmentId)
|
|
{
|
|
return Funs.DB.Comprehensive_InspectionEquipment.FirstOrDefault(e => e.InspectionEquipmentId == inspectionEquipmentId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加设备材料报验
|
|
/// </summary>
|
|
/// <param name="inspectionEquipment"></param>
|
|
public static void AddInspectionEquipment(Model.Comprehensive_InspectionEquipment inspectionEquipment)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Comprehensive_InspectionEquipment newInspectionEquipment = new Model.Comprehensive_InspectionEquipment();
|
|
newInspectionEquipment.InspectionEquipmentId = inspectionEquipment.InspectionEquipmentId;
|
|
newInspectionEquipment.ProjectId = inspectionEquipment.ProjectId;
|
|
newInspectionEquipment.UnitId = inspectionEquipment.UnitId;
|
|
newInspectionEquipment.InspectionCode = inspectionEquipment.InspectionCode;
|
|
newInspectionEquipment.CNProfessionalId = inspectionEquipment.CNProfessionalId;
|
|
newInspectionEquipment.InspectionName = inspectionEquipment.InspectionName;
|
|
newInspectionEquipment.Specifications = inspectionEquipment.Specifications;
|
|
newInspectionEquipment.Supplier = inspectionEquipment.Supplier;
|
|
newInspectionEquipment.Counts = inspectionEquipment.Counts;
|
|
newInspectionEquipment.Unit = inspectionEquipment.Unit;
|
|
newInspectionEquipment.SamplingCount = inspectionEquipment.SamplingCount;
|
|
newInspectionEquipment.SamplingResult = inspectionEquipment.SamplingResult;
|
|
newInspectionEquipment.InspectionDate = inspectionEquipment.InspectionDate;
|
|
newInspectionEquipment.AttachUrl = inspectionEquipment.AttachUrl;
|
|
newInspectionEquipment.CompileMan = inspectionEquipment.CompileMan;
|
|
newInspectionEquipment.CompileDate = inspectionEquipment.CompileDate;
|
|
newInspectionEquipment.EquipmentNO = inspectionEquipment.EquipmentNO;
|
|
newInspectionEquipment.RemarkCode = inspectionEquipment.RemarkCode;
|
|
newInspectionEquipment.UsedPlace = inspectionEquipment.UsedPlace;
|
|
newInspectionEquipment.Attribute = inspectionEquipment.Attribute;
|
|
newInspectionEquipment.AuditMan = inspectionEquipment.AuditMan;
|
|
newInspectionEquipment.EquipmentOrMatail = inspectionEquipment.EquipmentOrMatail;
|
|
newInspectionEquipment.Status = inspectionEquipment.Status;
|
|
db.Comprehensive_InspectionEquipment.InsertOnSubmit(newInspectionEquipment);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改设备材料报验
|
|
/// </summary>
|
|
/// <param name="inspectionEquipment"></param>
|
|
public static void UpdateInspectionEquipment(Model.Comprehensive_InspectionEquipment inspectionEquipment)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Comprehensive_InspectionEquipment newInspectionEquipment = db.Comprehensive_InspectionEquipment.FirstOrDefault(e => e.InspectionEquipmentId == inspectionEquipment.InspectionEquipmentId);
|
|
if (newInspectionEquipment != null)
|
|
{
|
|
newInspectionEquipment.ProjectId = inspectionEquipment.ProjectId;
|
|
newInspectionEquipment.UnitId = inspectionEquipment.UnitId;
|
|
newInspectionEquipment.InspectionCode = inspectionEquipment.InspectionCode;
|
|
newInspectionEquipment.CNProfessionalId = inspectionEquipment.CNProfessionalId;
|
|
newInspectionEquipment.InspectionName = inspectionEquipment.InspectionName;
|
|
newInspectionEquipment.Specifications = inspectionEquipment.Specifications;
|
|
newInspectionEquipment.Supplier = inspectionEquipment.Supplier;
|
|
newInspectionEquipment.Counts = inspectionEquipment.Counts;
|
|
newInspectionEquipment.Unit = inspectionEquipment.Unit;
|
|
newInspectionEquipment.SamplingCount = inspectionEquipment.SamplingCount;
|
|
newInspectionEquipment.SamplingResult = inspectionEquipment.SamplingResult;
|
|
newInspectionEquipment.InspectionDate = inspectionEquipment.InspectionDate;
|
|
newInspectionEquipment.AttachUrl = inspectionEquipment.AttachUrl;
|
|
newInspectionEquipment.EquipmentNO = inspectionEquipment.EquipmentNO;
|
|
newInspectionEquipment.RemarkCode = inspectionEquipment.RemarkCode;
|
|
newInspectionEquipment.UsedPlace = inspectionEquipment.UsedPlace;
|
|
newInspectionEquipment.Attribute = inspectionEquipment.Attribute;
|
|
newInspectionEquipment.AuditMan = inspectionEquipment.AuditMan;
|
|
newInspectionEquipment.Status = inspectionEquipment.Status;
|
|
newInspectionEquipment.EquipmentOrMatail = inspectionEquipment.EquipmentOrMatail;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除设备材料报验
|
|
/// </summary>
|
|
/// <param name="inspectionEquipmentId"></param>
|
|
public static void DeleteInspectionEquipment(string inspectionEquipmentId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Comprehensive_InspectionEquipment inspectionEquipment = db.Comprehensive_InspectionEquipment.FirstOrDefault(e => e.InspectionEquipmentId == inspectionEquipmentId);
|
|
if (inspectionEquipment != null)
|
|
{
|
|
db.Comprehensive_InspectionEquipment.DeleteOnSubmit(inspectionEquipment);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据专业id获取设备材料报验信息
|
|
/// </summary>
|
|
/// <param name="cNProfessionalId"></param>
|
|
/// <returns></returns>
|
|
public static Model.Comprehensive_InspectionEquipment GetInspectionEquipmentByCNProfessionalId(string cNProfessionalId)
|
|
{
|
|
return Funs.DB.Comprehensive_InspectionEquipment.FirstOrDefault(e => e.CNProfessionalId == cNProfessionalId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据单位id获取设备材料报验信息
|
|
/// </summary>
|
|
/// <param name="cNProfessionalId"></param>
|
|
/// <returns></returns>
|
|
public static Model.Comprehensive_InspectionEquipment GetInspectionEquipmentByUnitId(string unitId)
|
|
{
|
|
return Funs.DB.Comprehensive_InspectionEquipment.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);
|
|
}
|
|
}
|
|
}
|
|
}
|