86 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			86 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Text; | |||
|  | using System.Threading.Tasks; | |||
|  | 
 | |||
|  | namespace BLL | |||
|  | { | |||
|  |     /// <summary> | |||
|  |     /// 开工报告 | |||
|  |     /// </summary> | |||
|  |    public static class StartWorkReportService | |||
|  |     { | |||
|  |         /// <summary> | |||
|  |         /// 根据主键获取开工报告 | |||
|  |         /// </summary> | |||
|  |         /// <param name="StartWorkReportId"></param> | |||
|  |         /// <returns></returns> | |||
|  |         public static Model.DataBase_StartWorkReport GetStartWorkReportById(string StartWorkReportId) | |||
|  |         { | |||
|  |             return Funs.DB.DataBase_StartWorkReport.FirstOrDefault(e => e.StartWorkReportId == StartWorkReportId); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 添加开工报告 | |||
|  |         /// </summary> | |||
|  |         /// <param name="StartWorkReport"></param> | |||
|  |         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(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 修改开工报告 | |||
|  |         /// </summary> | |||
|  |         /// <param name="StartWorkReport"></param> | |||
|  |         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(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据主键删除开工报告 | |||
|  |         /// </summary> | |||
|  |         /// <param name="StartWorkReportId"></param> | |||
|  |         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(); | |||
|  |             } | |||
|  |         } | |||
|  |     } | |||
|  | } |