using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public class ConstructionLogProblemService
{
public static Model.SGGLDB db = Funs.DB;
///
/// 获取施工日志需要协调解决的问题明细列表
///
///
///
///
public static List getListData(string ConstructionLogId)
{
return (from x in db.ZHGL_ConstructionLogProblem
where x.ConstructionLogId == ConstructionLogId
select x).ToList();
}
///
/// 增加施工日志需要协调解决的问题明细
///
/// 施工日志需要协调解决的问题明细实体
public static void AddConstructionLogProblem(Model.ZHGL_ConstructionLogProblem constructionLogProblem)
{
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ConstructionLogProblem newConstructionLogProblem = new Model.ZHGL_ConstructionLogProblem();
newConstructionLogProblem.ConstructionLogProblemId = constructionLogProblem.ConstructionLogProblemId;
newConstructionLogProblem.ConstructionLogId = constructionLogProblem.ConstructionLogId;
newConstructionLogProblem.UnitWorkId = constructionLogProblem.UnitWorkId;
newConstructionLogProblem.MainProblem = constructionLogProblem.MainProblem;
newConstructionLogProblem.HandlingMeasures = constructionLogProblem.HandlingMeasures;
newConstructionLogProblem.WorkPackageId = constructionLogProblem.WorkPackageId;
newConstructionLogProblem.ImportanceLevel = constructionLogProblem.ImportanceLevel;
db.ZHGL_ConstructionLogProblem.InsertOnSubmit(newConstructionLogProblem);
db.SubmitChanges();
}
///
/// 根据月报id删除对应的所有施工日志需要协调解决的问题明细
///
/// 施工日志需要协调解决的问题明细编号
public static void DeleteConstructionLogProblemsByConstructionLogId(string ConstructionLogId)
{
Model.SGGLDB db = Funs.DB;
var q = (from x in db.ZHGL_ConstructionLogProblem where x.ConstructionLogId == ConstructionLogId select x).ToList();
if (q.Count() > 0)
{
db.ZHGL_ConstructionLogProblem.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
///
/// 根据月报id获取对应的所有施工日志需要协调解决的问题明细
///
/// 施工日志需要协调解决的问题明细编号
public static List GetConstructionLogProblemsByConstructionLogId(string ConstructionLogId)
{
Model.SGGLDB db = Funs.DB;
return (from x in db.ZHGL_ConstructionLogProblem where x.ConstructionLogId == ConstructionLogId orderby x.UnitWorkId select x).ToList();
}
}
}