69 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			69 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | ||
| using System.Collections.Generic;
 | ||
| using System.Linq;
 | ||
| using System.Text;
 | ||
| 
 | ||
| namespace BLL
 | ||
| {
 | ||
|     /// <summary>
 | ||
|     /// 请购单明细
 | ||
|     /// </summary>
 | ||
|     public static class GoodsBuyItemService
 | ||
|     {
 | ||
|         public static Model.SGGLDB db = Funs.DB;
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 根据主键获取请购单明细
 | ||
|         /// </summary>
 | ||
|         /// <param name="GoodsBuyItemId"></param>
 | ||
|         /// <returns></returns>
 | ||
|         public static Model.DriverGoods_GoodsBuyItem GetGoodsBuyItemById(string GoodsBuyItemId)
 | ||
|         {
 | ||
|             return Funs.DB.DriverGoods_GoodsBuyItem.FirstOrDefault(e => e.GoodsBuyItemId == GoodsBuyItemId);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 根据周(月)报Id获取请购单明细
 | ||
|         /// </summary>
 | ||
|         /// <param name="GoodsBuyId"></param>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.DriverGoods_GoodsBuyItem> GetGoodsBuyItemByGoodsBuyId(string GoodsBuyId)
 | ||
|         {
 | ||
|             return (from x in Funs.DB.DriverGoods_GoodsBuyItem where x.GoodsBuyId == GoodsBuyId select x).ToList();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 添加请购单明细
 | ||
|         /// </summary>
 | ||
|         /// <param name="GoodsBuyItem"></param>
 | ||
|         public static void AddGoodsBuyItem(Model.DriverGoods_GoodsBuyItem GoodsBuyItem)
 | ||
|         {
 | ||
|             Model.SGGLDB db = Funs.DB;
 | ||
|             Model.DriverGoods_GoodsBuyItem newGoodsBuyItem = new Model.DriverGoods_GoodsBuyItem();
 | ||
|             newGoodsBuyItem.GoodsBuyItemId = GoodsBuyItem.GoodsBuyItemId;
 | ||
|             newGoodsBuyItem.GoodsBuyId = GoodsBuyItem.GoodsBuyId;
 | ||
|             newGoodsBuyItem.GoodsModelId = GoodsBuyItem.GoodsModelId;
 | ||
|             newGoodsBuyItem.Quantity = GoodsBuyItem.Quantity;
 | ||
|             newGoodsBuyItem.Num = GoodsBuyItem.Num;
 | ||
|             newGoodsBuyItem.RequiredTime = GoodsBuyItem.RequiredTime;
 | ||
|             db.DriverGoods_GoodsBuyItem.InsertOnSubmit(newGoodsBuyItem);
 | ||
|             db.SubmitChanges();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 根据周(月)报Id删除所有相关明细信息
 | ||
|         /// </summary>
 | ||
|         /// <param name="GoodsBuyId"></param>
 | ||
|         public static void DeleteGoodsBuyItemByGoodsBuyId(string GoodsBuyId)
 | ||
|         {
 | ||
|             Model.SGGLDB db = Funs.DB;
 | ||
|             var q = (from x in db.DriverGoods_GoodsBuyItem where x.GoodsBuyId == GoodsBuyId select x).ToList();
 | ||
|             if (q.Count() > 0)
 | ||
|             {
 | ||
|                 db.DriverGoods_GoodsBuyItem.DeleteAllOnSubmit(q);
 | ||
|                 db.SubmitChanges();
 | ||
|             }
 | ||
|         }
 | ||
|     }
 | ||
| }
 |