ChengDa_English/SGGL/BLL/CQMS/ManageReport/ConstructionProblemsService.cs

80 lines
3.3 KiB
C#
Raw Normal View History

2022-03-15 17:36:38 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
/// <summary>
/// 施工过程问题
/// </summary>
public static class ConstructionProblemsService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 根据主键获取施工过程问题
/// </summary>
/// <param name="constructionProblemsId"></param>
/// <returns></returns>
public static Model.Report_ConstructionProblems GetConstructionProblemsById(string constructionProblemsId)
{
return Funs.DB.Report_ConstructionProblems.FirstOrDefault(e => e.ConstructionProblemsId == constructionProblemsId);
}
/// <summary>
/// 根据周报Id获取施工过程问题
/// </summary>
/// <param name="reportId"></param>
/// <returns></returns>
public static List<Model.Report_ConstructionProblems> GetConstructionProblemsByReportId(string reportId)
{
return (from x in Funs.DB.Report_ConstructionProblems where x.ReportId == reportId select x).ToList();
}
/// <summary>
/// 根据周报Id获取施工过程问题视图列表
/// </summary>
/// <param name="reportId"></param>
/// <returns></returns>
public static List<Model.View_Report_ConstructionProblems> GetConstructionProblemsViewListByReportId(string reportId)
{
return (from x in Funs.DB.View_Report_ConstructionProblems where x.ReportId == reportId select x).ToList();
}
/// <summary>
/// 添加施工过程问题
/// </summary>
/// <param name="constructionProblems"></param>
public static void AddConstructionProblems(Model.Report_ConstructionProblems constructionProblems)
{
Model.SGGLDB db = Funs.DB;
Model.Report_ConstructionProblems newConstructionProblems = new Model.Report_ConstructionProblems();
newConstructionProblems.ConstructionProblemsId = constructionProblems.ConstructionProblemsId;
newConstructionProblems.ReportId = constructionProblems.ReportId;
newConstructionProblems.UnitId = constructionProblems.UnitId;
newConstructionProblems.ProblemDesrioption = constructionProblems.ProblemDesrioption;
newConstructionProblems.TreatmentMeasures = constructionProblems.TreatmentMeasures;
newConstructionProblems.ProcessingResults = constructionProblems.ProcessingResults;
newConstructionProblems.Remark = constructionProblems.Remark;
db.Report_ConstructionProblems.InsertOnSubmit(newConstructionProblems);
db.SubmitChanges();
}
/// <summary>
/// 根据周报Id删除所有相关明细信息
/// </summary>
/// <param name="reportId"></param>
public static void DeleteConstructionProblemsByReportId(string reportId)
{
Model.SGGLDB db = Funs.DB;
var q = (from x in db.Report_ConstructionProblems where x.ReportId == reportId select x).ToList();
if (q.Count() > 0)
{
db.Report_ConstructionProblems.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
}