using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { /// /// 开车保运管理 /// public static class DriverRunService { /// /// 根据主键获取开车保运管理 /// /// /// public static Model.DriverRun_DriverRun GetDriverRunById(string driverRunId) { return Funs.DB.DriverRun_DriverRun.FirstOrDefault(e => e.DriverRunId == driverRunId); } /// /// 添加开车保运管理 /// /// public static void AddDriverRun(Model.DriverRun_DriverRun driverRun) { Model.DriverRun_DriverRun newDriverRun = new Model.DriverRun_DriverRun(); newDriverRun.DriverRunId = driverRun.DriverRunId; newDriverRun.ProjectId = driverRun.ProjectId; newDriverRun.Code = driverRun.Code; newDriverRun.UnitId = driverRun.UnitId; newDriverRun.Implement = driverRun.Implement; newDriverRun.Descriptions = driverRun.Descriptions; newDriverRun.AttachUrl = driverRun.AttachUrl; newDriverRun.Remark = driverRun.Remark; Funs.DB.DriverRun_DriverRun.InsertOnSubmit(newDriverRun); Funs.DB.SubmitChanges(); } /// /// 修改开车保运管理 /// /// public static void UpdateDriverRun(Model.DriverRun_DriverRun driverRun) { Model.DriverRun_DriverRun newDriverRun = Funs.DB.DriverRun_DriverRun.FirstOrDefault(e => e.DriverRunId == driverRun.DriverRunId); if (newDriverRun != null) { newDriverRun.ProjectId = driverRun.ProjectId; newDriverRun.Code = driverRun.Code; newDriverRun.UnitId = driverRun.UnitId; newDriverRun.Implement = driverRun.Implement; newDriverRun.Descriptions = driverRun.Descriptions; newDriverRun.AttachUrl = driverRun.AttachUrl; newDriverRun.Remark = driverRun.Remark; Funs.DB.SubmitChanges(); } } /// /// 根据主键删除开车保运管理 /// /// public static void DeleteDriverRunById(string driverRunId) { Model.DriverRun_DriverRun newDriverRun = Funs.DB.DriverRun_DriverRun.FirstOrDefault(e => e.DriverRunId == driverRunId); if (newDriverRun != null) { if (!string.IsNullOrEmpty(newDriverRun.AttachUrl)) { UploadAttachmentService.DeleteFile(Funs.RootPath, newDriverRun.AttachUrl); } Funs.DB.DriverRun_DriverRun.DeleteOnSubmit(newDriverRun); Funs.DB.SubmitChanges(); } } } }