114 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			114 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Threading.Tasks;
 | |
| 
 | |
| namespace BLL
 | |
| {
 | |
|     public class WbsSetMatchCostControlService
 | |
|     {
 | |
|         /// <summary>
 | |
|         /// 根据费控项对应关系Id获取费控项对应关系信息
 | |
|         /// </summary>
 | |
|         /// <param name="unitProjectId">费控项对应关系Id</param>
 | |
|         /// <returns></returns>
 | |
|         public static Model.WBS_WbsSetMatchCostControl GetWbsSetMatchCostControlByWbsSetMatchCostControlId(string wbsSetMatchCostControlId)
 | |
|         {
 | |
|             return Funs.DB.WBS_WbsSetMatchCostControl.FirstOrDefault(e => e.WbsSetMatchCostControlId.ToString() == wbsSetMatchCostControlId);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据费控项对应关系Id获取费控项对应关系信息
 | |
|         /// </summary>
 | |
|         /// <param name="unitProjectId">费控项对应关系Id</param>
 | |
|         /// <returns></returns>
 | |
|         public static Model.WBS_WbsSetMatchCostControl GetWbsSetMatchCostControlByWbsSetIdAndCostControlCode(string wbsSetId, string costControlCode)
 | |
|         {
 | |
|             return Funs.DB.WBS_WbsSetMatchCostControl.FirstOrDefault(e => e.WbsSetId == wbsSetId && e.CostControlCode == costControlCode);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 增加费控项对应关系
 | |
|         /// </summary>
 | |
|         /// <param name="user">费控项对应关系</param>
 | |
|         public static void AddWbsSetMatchCostControl(Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl)
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             Model.WBS_WbsSetMatchCostControl newUP = new Model.WBS_WbsSetMatchCostControl();
 | |
|             newUP.WbsSetMatchCostControlId = wbsSetMatchCostControl.WbsSetMatchCostControlId;
 | |
|             newUP.WbsSetId = wbsSetMatchCostControl.WbsSetId;
 | |
|             newUP.CostControlCode = wbsSetMatchCostControl.CostControlCode;
 | |
| 
 | |
|             db.WBS_WbsSetMatchCostControl.InsertOnSubmit(newUP);
 | |
|             db.SubmitChanges();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 修改费控项对应关系
 | |
|         /// </summary>
 | |
|         /// <param name="user">费控项对应关系</param>
 | |
|         public static void UpdateWbsSetMatchCostControl(Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl)
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             Model.WBS_WbsSetMatchCostControl newUP = db.WBS_WbsSetMatchCostControl.First(e => e.WbsSetMatchCostControlId == wbsSetMatchCostControl.WbsSetMatchCostControlId);
 | |
| 
 | |
|             newUP.WbsSetId = wbsSetMatchCostControl.WbsSetId;
 | |
|             newUP.CostControlCode = wbsSetMatchCostControl.CostControlCode;
 | |
|             db.SubmitChanges();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据Id删除费控项对应关系信息
 | |
|         /// </summary>
 | |
|         /// <param name="userId"></param>
 | |
|         public static void DeleteWbsSetMatchCostControl(string wbsSetMatchCostControlId)
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             Model.WBS_WbsSetMatchCostControl CnP = db.WBS_WbsSetMatchCostControl.First(e => e.WbsSetMatchCostControlId.ToString() == wbsSetMatchCostControlId);
 | |
|             db.WBS_WbsSetMatchCostControl.DeleteOnSubmit(CnP);
 | |
|             db.SubmitChanges();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据Id删除费控项对应关系信息
 | |
|         /// </summary>
 | |
|         /// <param name="userId"></param>
 | |
|         public static void DeleteWbsSetMatchCostControlByWbsSetIdAndCostControlCode(string wbsSetId, string costControlCode)
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             Model.WBS_WbsSetMatchCostControl CnP = db.WBS_WbsSetMatchCostControl.First(e => e.WbsSetId == wbsSetId && e.CostControlCode == costControlCode);
 | |
|             if (CnP != null)
 | |
|             {
 | |
|                 db.WBS_WbsSetMatchCostControl.DeleteOnSubmit(CnP);
 | |
|                 db.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据Id删除费控项对应关系信息
 | |
|         /// </summary>
 | |
|         /// <param name="userId"></param>
 | |
|         public static void DeleteWbsSetMatchCostControlByWbsSetId(string wbsSetId)
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             var CnP = from x in db.WBS_WbsSetMatchCostControl where x.WbsSetId == wbsSetId select x;
 | |
|             if (CnP.Count()>0)
 | |
|             {
 | |
|                 db.WBS_WbsSetMatchCostControl.DeleteAllOnSubmit(CnP);
 | |
|                 db.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 获取费控项对应关系下拉选项
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public static List<Model.WBS_WbsSetMatchCostControl> GetWbsSetMatchCostControls(string wbsSetId)
 | |
|         {
 | |
|             var list = (from x in Funs.DB.WBS_WbsSetMatchCostControl where x.WbsSetId == wbsSetId orderby x.WbsSetMatchCostControlId select x).ToList();
 | |
|             return list;
 | |
|         }
 | |
|     }
 | |
| }
 |