88 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| 
 | |
| namespace BLL
 | |
| {
 | |
|     /// <summary>
 | |
|     /// 工程量清单设置
 | |
|     /// </summary>
 | |
|     public class QuantityListService
 | |
|     {
 | |
|         public static Model.SGGLDB db = Funs.DB;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据主键获取工程量清单
 | |
|         /// </summary>
 | |
|         /// <param name="quantityListId"></param>
 | |
|         /// <returns></returns>
 | |
|         public static Model.JDGL_QuantityList GetQuantityListById(string quantityListId)
 | |
|         {
 | |
|             return Funs.DB.JDGL_QuantityList.FirstOrDefault(e => e.QuantityListId == quantityListId);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 添加工程量清单
 | |
|         /// </summary>
 | |
|         /// <param name="quantityList"></param>
 | |
|         public static void AddQuantityList(Model.JDGL_QuantityList quantityList)
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             Model.JDGL_QuantityList newQuantityList = new Model.JDGL_QuantityList
 | |
|             {
 | |
|                 QuantityListId = quantityList.QuantityListId,
 | |
|                 ProjectId = quantityList.ProjectId,
 | |
|                 CNProfessionalId = quantityList.CNProfessionalId,
 | |
|                 Name = quantityList.Name,
 | |
|                 Unit = quantityList.Unit,
 | |
|                 DesignNum = quantityList.DesignNum
 | |
|             };
 | |
|             db.JDGL_QuantityList.InsertOnSubmit(newQuantityList);
 | |
|             db.SubmitChanges();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 修改工程量清单
 | |
|         /// </summary>
 | |
|         /// <param name="quantityList"></param>
 | |
|         public static void UpdateQuantityList(Model.JDGL_QuantityList quantityList)
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             Model.JDGL_QuantityList newQuantityList = db.JDGL_QuantityList.FirstOrDefault(e => e.QuantityListId == quantityList.QuantityListId);
 | |
|             if (newQuantityList != null)
 | |
|             {
 | |
|                 newQuantityList.CNProfessionalId = quantityList.CNProfessionalId;
 | |
|                 newQuantityList.Name = quantityList.Name;
 | |
|                 newQuantityList.Unit = quantityList.Unit;
 | |
|                 newQuantityList.DesignNum = quantityList.DesignNum;
 | |
|                 db.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据主键删除工程量清单
 | |
|         /// </summary>
 | |
|         /// <param name="quantityListId"></param>
 | |
|         public static void DeleteQuantityListById(string quantityListId)
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             Model.JDGL_QuantityList quantityList = db.JDGL_QuantityList.FirstOrDefault(e => e.QuantityListId == quantityListId);
 | |
|             if (quantityList != null)
 | |
|             {
 | |
|                 db.JDGL_QuantityList.DeleteOnSubmit(quantityList);
 | |
|                 db.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 获取工程量清单下拉列表项
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public static List<Model.JDGL_QuantityList> GetQuantityListList()
 | |
|         {
 | |
|             return (from x in Funs.DB.JDGL_QuantityList orderby x.CNProfessionalId select x).ToList();
 | |
|         }
 | |
|     }
 | |
| }
 |