using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { /// /// 开车分包计划 /// public static class DriverSubPlanService { /// /// 根据主键获取开车分包计划信息 /// /// /// public static Model.DriverSub_DriverSubPlan GetDriverSubPlanById(string DriverSubPlanId) { return Funs.DB.DriverSub_DriverSubPlan.FirstOrDefault(e => e.DriverSubPlanId == DriverSubPlanId); } /// /// 添加开车分包计划信息 /// /// public static void AddDriverSubPlan(Model.DriverSub_DriverSubPlan DriverSubPlan) { Model.DriverSub_DriverSubPlan newDriverSubPlan = new Model.DriverSub_DriverSubPlan(); newDriverSubPlan.DriverSubPlanId = DriverSubPlan.DriverSubPlanId; newDriverSubPlan.ProjectId = DriverSubPlan.ProjectId; newDriverSubPlan.Code = DriverSubPlan.Code; newDriverSubPlan.SubUnitId = DriverSubPlan.SubUnitId; newDriverSubPlan.Introductions = DriverSubPlan.Introductions; newDriverSubPlan.Achievement = DriverSubPlan.Achievement; newDriverSubPlan.Cooperation = DriverSubPlan.Cooperation; newDriverSubPlan.InstallationIds = DriverSubPlan.InstallationIds; newDriverSubPlan.InstallationNames = DriverSubPlan.InstallationNames; newDriverSubPlan.IsInvited = DriverSubPlan.IsInvited; newDriverSubPlan.AttachUrl = DriverSubPlan.AttachUrl; newDriverSubPlan.Remark = DriverSubPlan.Remark; Funs.DB.DriverSub_DriverSubPlan.InsertOnSubmit(newDriverSubPlan); Funs.DB.SubmitChanges(); } /// /// 修改开车分包计划 /// /// public static void UpdateDriverSubPlan(Model.DriverSub_DriverSubPlan DriverSubPlan) { Model.DriverSub_DriverSubPlan newDriverSubPlan = Funs.DB.DriverSub_DriverSubPlan.FirstOrDefault(e => e.DriverSubPlanId == DriverSubPlan.DriverSubPlanId); if (newDriverSubPlan != null) { newDriverSubPlan.Code = DriverSubPlan.Code; newDriverSubPlan.SubUnitId = DriverSubPlan.SubUnitId; newDriverSubPlan.Introductions = DriverSubPlan.Introductions; newDriverSubPlan.Achievement = DriverSubPlan.Achievement; newDriverSubPlan.Cooperation = DriverSubPlan.Cooperation; newDriverSubPlan.InstallationIds = DriverSubPlan.InstallationIds; newDriverSubPlan.InstallationNames = DriverSubPlan.InstallationNames; newDriverSubPlan.IsInvited = DriverSubPlan.IsInvited; newDriverSubPlan.AttachUrl = DriverSubPlan.AttachUrl; newDriverSubPlan.Remark = DriverSubPlan.Remark; Funs.DB.SubmitChanges(); } } /// /// 根据主键删除开车分包计划 /// /// public static void DeleteDriverSubPlanById(string DriverSubPlanId) { Model.DriverSub_DriverSubPlan DriverSubPlan = Funs.DB.DriverSub_DriverSubPlan.FirstOrDefault(e => e.DriverSubPlanId == DriverSubPlanId); if (DriverSubPlan != null) { if (!string.IsNullOrEmpty(DriverSubPlan.AttachUrl)) { BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, DriverSubPlan.AttachUrl);//删除附件 } Funs.DB.DriverSub_DriverSubPlan.DeleteOnSubmit(DriverSubPlan); Funs.DB.SubmitChanges(); } } } }