using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { public static class HJGL_YardPlanningService { public static Model.HJGL_YardPlanning GetHJGL_YardPlanningById(string YardPlanningId) { return Funs.DB.HJGL_YardPlanning.FirstOrDefault(e => e.YardPlanningId == YardPlanningId); } public static Model.HJGL_YardPlanning GetHJGL_YardPlanningByProjectId(string projectId,string unitworkid) { return Funs.DB.HJGL_YardPlanning.FirstOrDefault(e => e.ProjectId == projectId && e.UnitWorkId == unitworkid); } /// /// 保存应急流程图 /// /// /// /// public static void SavePic(string projectid,string unitworkid, string imgurl) { var model = Funs.DB.HJGL_YardPlanning.FirstOrDefault(e => e.ProjectId == projectid && e.UnitWorkId==unitworkid); if (model != null) { model.FlowChartPic = imgurl; UpdateHJGL_YardPlanning(model); } else { Model.HJGL_YardPlanning table = new Model.HJGL_YardPlanning(); table.YardPlanningId = SQLHelper.GetNewID(typeof(Model.HJGL_YardPlanning)); table.ProjectId = projectid; table.UnitWorkId = unitworkid; table.FlowChartPic = imgurl; Funs.DB.HJGL_YardPlanning.InsertOnSubmit(table); Funs.DB.SubmitChanges(); } } public static void AddHJGL_YardPlanning(Model.HJGL_YardPlanning newtable) { Model.HJGL_YardPlanning table = new Model.HJGL_YardPlanning(); table.YardPlanningId = newtable.YardPlanningId; table.ProjectId = newtable.ProjectId; table.Remark = newtable.Remark; table.FlowChartPic = newtable.FlowChartPic; table.UnitWorkId = newtable.UnitWorkId; Funs.DB.HJGL_YardPlanning.InsertOnSubmit(table); Funs.DB.SubmitChanges(); } public static void UpdateHJGL_YardPlanning(Model.HJGL_YardPlanning newtable) { Model.HJGL_YardPlanning table = Funs.DB.HJGL_YardPlanning.FirstOrDefault(e => e.YardPlanningId == newtable.YardPlanningId); if (table != null) { table.YardPlanningId = newtable.YardPlanningId; table.ProjectId = newtable.ProjectId; table.Remark = newtable.Remark; table.FlowChartPic = newtable.FlowChartPic; table.UnitWorkId = newtable.UnitWorkId; Funs.DB.SubmitChanges(); } } public static void DeleteHJGL_YardPlanningById(string YardPlanningId) { Model.HJGL_YardPlanning table = Funs.DB.HJGL_YardPlanning.FirstOrDefault(e => e.YardPlanningId == YardPlanningId); if (table != null) { Funs.DB.HJGL_YardPlanning.DeleteOnSubmit(table); Funs.DB.SubmitChanges(); } } } }