using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.UI.WebControls; namespace BLL { /// /// 项目级施工日志明细 /// public static class CQMSConstructionLogImageProgressService { public static Model.SGGLDB db = Funs.DB; /// /// 根据主键获取项目级施工日志 /// /// /// public static List GetConstructionLogImageProgressByConstructionLogIdAndUnitId(string ConstructionLogId, string unitId) { return (from x in Funs.DB.CQMS_ConstructionLogImageProgress where x.ConstructionLogId == ConstructionLogId && x.UnitId == unitId orderby x.SortIndex select x).ToList(); } /// /// 添加项目级施工日志 /// /// public static void AddConstructionLogImageProgress(Model.CQMS_ConstructionLogImageProgress ConstructionLogImageProgress) { Model.SGGLDB db = Funs.DB; Model.CQMS_ConstructionLogImageProgress newConstructionLogImageProgress = new Model.CQMS_ConstructionLogImageProgress { ConstructionLogImageProgressId = ConstructionLogImageProgress.ConstructionLogImageProgressId, ConstructionLogId = ConstructionLogImageProgress.ConstructionLogId, UnitId = ConstructionLogImageProgress.UnitId, ImageProgressDef = ConstructionLogImageProgress.ImageProgressDef, SortIndex = ConstructionLogImageProgress.SortIndex, }; db.CQMS_ConstructionLogImageProgress.InsertOnSubmit(newConstructionLogImageProgress); db.SubmitChanges(); } /// /// 修改项目级施工日志 /// /// public static void UpdateConstructionLogImageProgress(Model.CQMS_ConstructionLogImageProgress ConstructionLogImageProgress) { Model.SGGLDB db = Funs.DB; Model.CQMS_ConstructionLogImageProgress newConstructionLogImageProgress = db.CQMS_ConstructionLogImageProgress.FirstOrDefault(e => e.ConstructionLogId == ConstructionLogImageProgress.ConstructionLogId && e.UnitId == ConstructionLogImageProgress.UnitId); if (newConstructionLogImageProgress != null) { newConstructionLogImageProgress.ImageProgressDef = ConstructionLogImageProgress.ImageProgressDef; newConstructionLogImageProgress.SortIndex = ConstructionLogImageProgress.SortIndex; db.SubmitChanges(); } } /// /// 根据主键删除项目级施工日志 /// /// public static void DeleteConstructionLogImageProgressById(string ConstructionLogId) { Model.SGGLDB db = Funs.DB; var q = from x in db.CQMS_ConstructionLogImageProgress where x.ConstructionLogId == ConstructionLogId select x; if (q.Count() > 0) { db.CQMS_ConstructionLogImageProgress.DeleteAllOnSubmit(q); db.SubmitChanges(); } } /// /// 根据主键删除项目级施工日志 /// /// public static void DeleteConstructionLogImageProgressByIdAndUnitId(string ConstructionLogId, string unitId) { Model.SGGLDB db = Funs.DB; var q = from x in db.CQMS_ConstructionLogImageProgress where x.ConstructionLogId == ConstructionLogId && x.UnitId == unitId select x; if (q.Count() > 0) { db.CQMS_ConstructionLogImageProgress.DeleteAllOnSubmit(q); db.SubmitChanges(); } } } }