HJGL_DS/HJGL_DS/BLL/JGZL/MaterialIdentificationInspe...

108 lines
4.3 KiB
C#

using Model;
using System.Linq;
using System.Collections.Generic;
using System.Resources;
namespace BLL
{
public class MaterialIdentificationInspectionRecordService
{
/// <summary>
/// 根据主键获取管道材料材质标识检查记录
/// </summary>
/// <param name="recordId"></param>
/// <returns></returns>
public static Model.JGZL_MaterialIdentificationInspectionRecord GetRecordById(
string recordId)
{
return Funs.DB.JGZL_MaterialIdentificationInspectionRecord.FirstOrDefault(e =>
e.RecordId == recordId);
}
public static List<Model.JGZL_MaterialIdentificationInspectionRecord> GetListsByProjectId(string projectId)
{
return (from x in Funs.DB.JGZL_MaterialIdentificationInspectionRecord where x.ProjectId == projectId select x).ToList();
}
/// <summary>
/// 添加管道材料材质标识检查记录
/// </summary>
/// <param name="report"></param>
public static void AddRecord(
Model.JGZL_MaterialIdentificationInspectionRecord report)
{
SGGLDB db = Funs.DB;
Model.JGZL_MaterialIdentificationInspectionRecord newRecord =
new Model.JGZL_MaterialIdentificationInspectionRecord();
newRecord.RecordId = report.RecordId;
newRecord.ProjectId = report.ProjectId;
newRecord.ISO_Id = report.ISO_Id;
newRecord.STE_ID = report.STE_ID;
newRecord.Specifications = report.Specifications;
newRecord.PrescribedColor = report.PrescribedColor;
newRecord.TubeIdentificationStatus = report.TubeIdentificationStatus;
newRecord.PipeFittingName = report.PipeFittingName;
newRecord.PipeFittingStatus = report.PipeFittingStatus;
newRecord.Conclusion = report.Conclusion;
newRecord.CompileMan = report.CompileMan;
newRecord.CompileDate = report.CompileDate;
db.JGZL_MaterialIdentificationInspectionRecord.InsertOnSubmit(newRecord);
db.SubmitChanges();
}
/// <summary>
/// 修改管道材料材质标识检查记录
/// </summary>
/// <param name="report"></param>
public static void UpdateRecord(
Model.JGZL_MaterialIdentificationInspectionRecord report)
{
SGGLDB db = Funs.DB;
Model.JGZL_MaterialIdentificationInspectionRecord newRecord =
db.JGZL_MaterialIdentificationInspectionRecord.FirstOrDefault(e =>
e.RecordId == report.RecordId);
if (newRecord != null)
{
newRecord.ISO_Id = report.ISO_Id;
newRecord.STE_ID = report.STE_ID;
newRecord.Specifications = report.Specifications;
newRecord.PrescribedColor = report.PrescribedColor;
newRecord.TubeIdentificationStatus = report.TubeIdentificationStatus;
newRecord.PipeFittingName = report.PipeFittingName;
newRecord.PipeFittingStatus = report.PipeFittingStatus;
newRecord.Conclusion = report.Conclusion;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除管道材料材质标识检查记录
/// </summary>
/// <param name="recordId"></param>
public static void DeleteRecordById(string recordId)
{
SGGLDB db = Funs.DB;
Model.JGZL_MaterialIdentificationInspectionRecord report =
db.JGZL_MaterialIdentificationInspectionRecord.FirstOrDefault(e =>
e.RecordId == recordId);
if (report != null)
{
db.JGZL_MaterialIdentificationInspectionRecord.DeleteOnSubmit(report);
db.SubmitChanges();
}
}
public static void DeleteListsByProjectId(string projectId)
{
SGGLDB db = Funs.DB;
var q = (from x in db.JGZL_MaterialIdentificationInspectionRecord where x.ProjectId == projectId select x).ToList();
if (q.Count>0)
{
db.JGZL_MaterialIdentificationInspectionRecord.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
}