using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { /// /// 开工报告 /// public static class StartWorkReportService { /// /// 根据主键获取开工报告 /// /// /// public static Model.DataBase_StartWorkReport GetStartWorkReportById(string StartWorkReportId) { return Funs.DB.DataBase_StartWorkReport.FirstOrDefault(e => e.StartWorkReportId == StartWorkReportId); } /// /// 添加开工报告 /// /// public static void AddStartWorkReport(Model.DataBase_StartWorkReport StartWorkReport) { Model.DataBase_StartWorkReport newStartWorkReport = new Model.DataBase_StartWorkReport(); newStartWorkReport.StartWorkReportId = StartWorkReport.StartWorkReportId; newStartWorkReport.ProjectId = StartWorkReport.ProjectId; newStartWorkReport.DataTypeProjectId = StartWorkReport.DataTypeProjectId; newStartWorkReport.FileCode = StartWorkReport.FileCode; newStartWorkReport.FileContent = StartWorkReport.FileContent; newStartWorkReport.CNProfessionalId = StartWorkReport.CNProfessionalId; newStartWorkReport.UnitWorkIds = StartWorkReport.UnitWorkIds; newStartWorkReport.UnitIds = StartWorkReport.UnitIds; newStartWorkReport.Remark = StartWorkReport.Remark; newStartWorkReport.AttachUrl = StartWorkReport.AttachUrl; newStartWorkReport.CompileMan = StartWorkReport.CompileMan; newStartWorkReport.CompileDate = StartWorkReport.CompileDate; Funs.DB.DataBase_StartWorkReport.InsertOnSubmit(newStartWorkReport); Funs.DB.SubmitChanges(); } /// /// 修改开工报告 /// /// public static void UpdateStartWorkReport(Model.DataBase_StartWorkReport StartWorkReport) { Model.DataBase_StartWorkReport newStartWorkReport = Funs.DB.DataBase_StartWorkReport.FirstOrDefault(e => e.StartWorkReportId == StartWorkReport.StartWorkReportId); if (newStartWorkReport != null) { newStartWorkReport.FileCode = StartWorkReport.FileCode; newStartWorkReport.FileContent = StartWorkReport.FileContent; newStartWorkReport.CNProfessionalId = StartWorkReport.CNProfessionalId; newStartWorkReport.UnitWorkIds = StartWorkReport.UnitWorkIds; newStartWorkReport.UnitIds = StartWorkReport.UnitIds; newStartWorkReport.Remark = StartWorkReport.Remark; newStartWorkReport.AttachUrl = StartWorkReport.AttachUrl; Funs.DB.SubmitChanges(); } } /// /// 根据主键删除开工报告 /// /// public static void DeleteStartWorkReportById(string StartWorkReportId) { Model.DataBase_StartWorkReport StartWorkReport = Funs.DB.DataBase_StartWorkReport.FirstOrDefault(e => e.StartWorkReportId == StartWorkReportId); if (StartWorkReport != null) { if (!string.IsNullOrEmpty(StartWorkReport.AttachUrl)) { BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, StartWorkReport.AttachUrl);//删除附件 } Funs.DB.DataBase_StartWorkReport.DeleteOnSubmit(StartWorkReport); Funs.DB.SubmitChanges(); } } } }