99 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			99 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Text; | |||
|  | using System.Threading.Tasks; | |||
|  | 
 | |||
|  | namespace BLL | |||
|  | { | |||
|  |     public class WbsSetMatchCostControlInitService | |||
|  |     { | |||
|  |         /// <summary> | |||
|  |         /// 根据费控项对应关系Id获取费控项对应关系信息 | |||
|  |         /// </summary> | |||
|  |         /// <param name="unitProjectId">费控项对应关系Id</param> | |||
|  |         /// <returns></returns> | |||
|  |         public static Model.WBS_WbsSetMatchCostControlInit GetWbsSetMatchCostControlInitByWbsSetMatchCostControlInitId(string wbsSetMatchCostControlInitId) | |||
|  |         { | |||
|  |             return Funs.DB.WBS_WbsSetMatchCostControlInit.FirstOrDefault(e => e.WbsSetMatchCostControlInitId.ToString() == wbsSetMatchCostControlInitId); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据费控项对应关系Id获取费控项对应关系信息 | |||
|  |         /// </summary> | |||
|  |         /// <param name="unitProjectId">费控项对应关系Id</param> | |||
|  |         /// <returns></returns> | |||
|  |         public static Model.WBS_WbsSetMatchCostControlInit GetWbsSetMatchCostControlInitByWbsSetCodeAndCostControlInitCode(string wbsSetCode, string costControlInitCode) | |||
|  |         { | |||
|  |             return Funs.DB.WBS_WbsSetMatchCostControlInit.FirstOrDefault(e => e.WbsSetCode == wbsSetCode && e.CostControlInitCode == costControlInitCode); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 增加费控项对应关系 | |||
|  |         /// </summary> | |||
|  |         /// <param name="user">费控项对应关系</param> | |||
|  |         public static void AddWbsSetMatchCostControlInit(Model.WBS_WbsSetMatchCostControlInit wbsSetMatchCostControlInit) | |||
|  |         { | |||
|  |             Model.SGGLDB db = Funs.DB; | |||
|  |             Model.WBS_WbsSetMatchCostControlInit newUP = new Model.WBS_WbsSetMatchCostControlInit(); | |||
|  |             newUP.WbsSetMatchCostControlInitId = wbsSetMatchCostControlInit.WbsSetMatchCostControlInitId; | |||
|  |             newUP.WbsSetCode = wbsSetMatchCostControlInit.WbsSetCode; | |||
|  |             newUP.CostControlInitCode = wbsSetMatchCostControlInit.CostControlInitCode; | |||
|  | 
 | |||
|  |             db.WBS_WbsSetMatchCostControlInit.InsertOnSubmit(newUP); | |||
|  |             db.SubmitChanges(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 修改费控项对应关系 | |||
|  |         /// </summary> | |||
|  |         /// <param name="user">费控项对应关系</param> | |||
|  |         public static void UpdateWbsSetMatchCostControlInit(Model.WBS_WbsSetMatchCostControlInit wbsSetMatchCostControlInit) | |||
|  |         { | |||
|  |             Model.SGGLDB db = Funs.DB; | |||
|  |             Model.WBS_WbsSetMatchCostControlInit newUP = db.WBS_WbsSetMatchCostControlInit.First(e => e.WbsSetMatchCostControlInitId == wbsSetMatchCostControlInit.WbsSetMatchCostControlInitId); | |||
|  | 
 | |||
|  |             newUP.WbsSetCode = wbsSetMatchCostControlInit.WbsSetCode; | |||
|  |             newUP.CostControlInitCode = wbsSetMatchCostControlInit.CostControlInitCode; | |||
|  |             db.SubmitChanges(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据Id删除费控项对应关系信息 | |||
|  |         /// </summary> | |||
|  |         /// <param name="userId"></param> | |||
|  |         public static void DeleteWbsSetMatchCostControlInit(string wbsSetMatchCostControlInitId) | |||
|  |         { | |||
|  |             Model.SGGLDB db = Funs.DB; | |||
|  |             Model.WBS_WbsSetMatchCostControlInit CnP = db.WBS_WbsSetMatchCostControlInit.First(e => e.WbsSetMatchCostControlInitId.ToString() == wbsSetMatchCostControlInitId); | |||
|  |             db.WBS_WbsSetMatchCostControlInit.DeleteOnSubmit(CnP); | |||
|  |             db.SubmitChanges(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据Id删除费控项对应关系信息 | |||
|  |         /// </summary> | |||
|  |         /// <param name="userId"></param> | |||
|  |         public static void DeleteWbsSetMatchCostControlInitByWbsSetCodeAndCostControlInitCode(string wbsSetCode,string costControlInitCode) | |||
|  |         { | |||
|  |             Model.SGGLDB db = Funs.DB; | |||
|  |             Model.WBS_WbsSetMatchCostControlInit CnP = db.WBS_WbsSetMatchCostControlInit.First(e => e.WbsSetCode == wbsSetCode && e.CostControlInitCode== costControlInitCode); | |||
|  |             if (CnP != null) | |||
|  |             { | |||
|  |                 db.WBS_WbsSetMatchCostControlInit.DeleteOnSubmit(CnP); | |||
|  |                 db.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 获取费控项对应关系下拉选项 | |||
|  |         /// </summary> | |||
|  |         /// <returns></returns> | |||
|  |         public static List<Model.WBS_WbsSetMatchCostControlInit> GetWbsSetMatchCostControlInits(string wbsSetCode) | |||
|  |         { | |||
|  |             var list = (from x in Funs.DB.WBS_WbsSetMatchCostControlInit where x.WbsSetCode == wbsSetCode orderby x.WbsSetMatchCostControlInitId select x).ToList(); | |||
|  |             return list; | |||
|  |         } | |||
|  |     } | |||
|  | } |