93 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			93 lines
		
	
	
		
			4.6 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 PropertyRunRecordService | |||
|  |     { | |||
|  |         /// <summary> | |||
|  |         /// 根据主键获取运行记录管理信息 | |||
|  |         /// </summary> | |||
|  |         /// <param name="PropertyRunRecordId"></param> | |||
|  |         /// <returns></returns> | |||
|  |         public static Model.ProduceProperty_PropertyRunRecord GetPropertyRunRecordById(string PropertyRunRecordId) | |||
|  |         { | |||
|  |             return Funs.DB.ProduceProperty_PropertyRunRecord.FirstOrDefault(e => e.PropertyRunRecordId == PropertyRunRecordId); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 添加运行记录管理信息 | |||
|  |         /// </summary> | |||
|  |         /// <param name="PropertyRunRecord"></param> | |||
|  |         public static void AddPropertyRunRecord(Model.ProduceProperty_PropertyRunRecord PropertyRunRecord) | |||
|  |         { | |||
|  |             Model.ProduceProperty_PropertyRunRecord newPropertyRunRecord = new Model.ProduceProperty_PropertyRunRecord(); | |||
|  |             newPropertyRunRecord.PropertyRunRecordId = PropertyRunRecord.PropertyRunRecordId; | |||
|  |             newPropertyRunRecord.ProjectId = PropertyRunRecord.ProjectId; | |||
|  |             newPropertyRunRecord.Code = PropertyRunRecord.Code; | |||
|  |             newPropertyRunRecord.UnitWorkId = PropertyRunRecord.UnitWorkId; | |||
|  |             newPropertyRunRecord.InstallationMan = PropertyRunRecord.InstallationMan; | |||
|  |             newPropertyRunRecord.RecordName = PropertyRunRecord.RecordName; | |||
|  |             newPropertyRunRecord.RecordCode = PropertyRunRecord.RecordCode; | |||
|  |             newPropertyRunRecord.RecordMan = PropertyRunRecord.RecordMan; | |||
|  |             newPropertyRunRecord.StartDate = PropertyRunRecord.StartDate; | |||
|  |             newPropertyRunRecord.EndDate = PropertyRunRecord.EndDate; | |||
|  |             newPropertyRunRecord.RecordInstructions = PropertyRunRecord.RecordInstructions; | |||
|  |             newPropertyRunRecord.ProblemsSolutions = PropertyRunRecord.ProblemsSolutions; | |||
|  |             newPropertyRunRecord.AttachUrl = PropertyRunRecord.AttachUrl; | |||
|  |             newPropertyRunRecord.Remark = PropertyRunRecord.Remark; | |||
|  |             Funs.DB.ProduceProperty_PropertyRunRecord.InsertOnSubmit(newPropertyRunRecord); | |||
|  |             Funs.DB.SubmitChanges(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 修改运行记录管理 | |||
|  |         /// </summary> | |||
|  |         /// <param name="PropertyRunRecord"></param> | |||
|  |         public static void UpdatePropertyRunRecord(Model.ProduceProperty_PropertyRunRecord PropertyRunRecord) | |||
|  |         { | |||
|  |             Model.ProduceProperty_PropertyRunRecord newPropertyRunRecord = Funs.DB.ProduceProperty_PropertyRunRecord.FirstOrDefault(e => e.PropertyRunRecordId == PropertyRunRecord.PropertyRunRecordId); | |||
|  |             if (newPropertyRunRecord != null) | |||
|  |             { | |||
|  |                 newPropertyRunRecord.Code = PropertyRunRecord.Code; | |||
|  |                 newPropertyRunRecord.UnitWorkId = PropertyRunRecord.UnitWorkId; | |||
|  |                 newPropertyRunRecord.InstallationMan = PropertyRunRecord.InstallationMan; | |||
|  |                 newPropertyRunRecord.RecordName = PropertyRunRecord.RecordName; | |||
|  |                 newPropertyRunRecord.RecordCode = PropertyRunRecord.RecordCode; | |||
|  |                 // newPropertyRunRecord.RecordMan = PropertyRunRecord.RecordMan; | |||
|  |                 newPropertyRunRecord.StartDate = PropertyRunRecord.StartDate; | |||
|  |                 newPropertyRunRecord.EndDate = PropertyRunRecord.EndDate; | |||
|  |                 newPropertyRunRecord.RecordInstructions = PropertyRunRecord.RecordInstructions; | |||
|  |                 newPropertyRunRecord.ProblemsSolutions = PropertyRunRecord.ProblemsSolutions; | |||
|  |                 newPropertyRunRecord.AttachUrl = PropertyRunRecord.AttachUrl; | |||
|  |                 newPropertyRunRecord.Remark = PropertyRunRecord.Remark; | |||
|  |                 Funs.DB.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据主键删除运行记录管理 | |||
|  |         /// </summary> | |||
|  |         /// <param name="PropertyRunRecordId"></param> | |||
|  |         public static void DeletePropertyRunRecord(string PropertyRunRecordId) | |||
|  |         { | |||
|  |             Model.ProduceProperty_PropertyRunRecord PropertyRunRecord = Funs.DB.ProduceProperty_PropertyRunRecord.FirstOrDefault(e => e.PropertyRunRecordId == PropertyRunRecordId); | |||
|  |             if (PropertyRunRecord != null) | |||
|  |             { | |||
|  |                 if (!string.IsNullOrEmpty(PropertyRunRecord.AttachUrl)) | |||
|  |                 { | |||
|  |                     BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, PropertyRunRecord.AttachUrl);//删除附件 | |||
|  |                 } | |||
|  |                 Funs.DB.ProduceProperty_PropertyRunRecord.DeleteOnSubmit(PropertyRunRecord); | |||
|  |                 Funs.DB.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  |     } | |||
|  | } |