80 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			80 lines
		
	
	
		
			2.7 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 MilePostService | |||
|  |     { | |||
|  |         /// <summary> | |||
|  |         /// 根据主键获取里程碑 | |||
|  |         /// </summary> | |||
|  |         /// <param name="milePostId"></param> | |||
|  |         /// <returns></returns> | |||
|  |         public static Model.WBS_MilePost GetMilePostById(string milePostId) | |||
|  |         { | |||
|  |             return Funs.DB.WBS_MilePost.FirstOrDefault(e => e.MilePostId == milePostId); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 添加里程碑 | |||
|  |         /// </summary> | |||
|  |         /// <param name="milePost"></param> | |||
|  |         public static void AddMilePost(Model.WBS_MilePost milePost) | |||
|  |         { | |||
|  |             Model.WBS_MilePost newMilePost = new Model.WBS_MilePost | |||
|  |             { | |||
|  |                 MilePostId = milePost.MilePostId, | |||
|  |                 ProjectId = milePost.ProjectId, | |||
|  |                 CnProfessionId = milePost.CnProfessionId, | |||
|  |                 MilePostName = milePost.MilePostName, | |||
|  |                 PlanDate = milePost.PlanDate, | |||
|  |                 RealDate = milePost.RealDate, | |||
|  |                 CompileMan = milePost.CompileMan, | |||
|  |                 CompileDate = milePost.CompileDate, | |||
|  |                 Remark = milePost.Remark | |||
|  |             }; | |||
|  |             Funs.DB.WBS_MilePost.InsertOnSubmit(newMilePost); | |||
|  |             Funs.DB.SubmitChanges(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 修改里程碑 | |||
|  |         /// </summary> | |||
|  |         /// <param name="milePost"></param> | |||
|  |         public static void UpdateMilePost(Model.WBS_MilePost milePost) | |||
|  |         { | |||
|  |             Model.WBS_MilePost newMilePost = Funs.DB.WBS_MilePost.FirstOrDefault(e => e.MilePostId == milePost.MilePostId); | |||
|  |             if (newMilePost != null) | |||
|  |             { | |||
|  |                 newMilePost.CnProfessionId = milePost.CnProfessionId; | |||
|  |                 newMilePost.MilePostName = milePost.MilePostName; | |||
|  |                 newMilePost.PlanDate = milePost.PlanDate; | |||
|  |                 newMilePost.RealDate = milePost.RealDate; | |||
|  |                 newMilePost.Remark = milePost.Remark; | |||
|  |                 Funs.DB.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据主键删除里程碑 | |||
|  |         /// </summary> | |||
|  |         /// <param name="milePostId"></param> | |||
|  |         public static void DeleteMilePostById(string milePostId) | |||
|  |         { | |||
|  |             Model.WBS_MilePost milePost = Funs.DB.WBS_MilePost.FirstOrDefault(e => e.MilePostId == milePostId); | |||
|  |             if (milePost != null) | |||
|  |             { | |||
|  |                 CommonService.DeleteAttachFileById(milePostId); | |||
|  |                 Funs.DB.WBS_MilePost.DeleteOnSubmit(milePost); | |||
|  |                 Funs.DB.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  |     } | |||
|  | } |