87 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			87 lines
		
	
	
		
			3.4 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 GoodsBuyService
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 根据主键获取开车物资请购管理信息
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="GoodsBuyId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static Model.DriverGoods_GoodsBuy GetGoodsBuyById(string GoodsBuyId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return Funs.DB.DriverGoods_GoodsBuy.FirstOrDefault(e => e.GoodsBuyId == GoodsBuyId);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 添加开车物资请购管理信息
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="GoodsBuy"></param>
							 | 
						|||
| 
								 | 
							
								        public static void AddGoodsBuy(Model.DriverGoods_GoodsBuy GoodsBuy)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Model.DriverGoods_GoodsBuy newGoodsBuy = new Model.DriverGoods_GoodsBuy();
							 | 
						|||
| 
								 | 
							
								            newGoodsBuy.GoodsBuyId = GoodsBuy.GoodsBuyId;
							 | 
						|||
| 
								 | 
							
								            newGoodsBuy.ProjectId = GoodsBuy.ProjectId;
							 | 
						|||
| 
								 | 
							
								            newGoodsBuy.Code = GoodsBuy.Code;
							 | 
						|||
| 
								 | 
							
								            newGoodsBuy.BuyName = GoodsBuy.BuyName;
							 | 
						|||
| 
								 | 
							
								            newGoodsBuy.BuyCode = GoodsBuy.BuyCode;
							 | 
						|||
| 
								 | 
							
								            newGoodsBuy.CompileMan = GoodsBuy.CompileMan;
							 | 
						|||
| 
								 | 
							
								            newGoodsBuy.ApprovalDate = GoodsBuy.ApprovalDate;
							 | 
						|||
| 
								 | 
							
								            newGoodsBuy.SubmitDate = GoodsBuy.SubmitDate;
							 | 
						|||
| 
								 | 
							
								            newGoodsBuy.GetGoodsDate = GoodsBuy.GetGoodsDate;
							 | 
						|||
| 
								 | 
							
								            newGoodsBuy.AttachUrl = GoodsBuy.AttachUrl;
							 | 
						|||
| 
								 | 
							
								            newGoodsBuy.Remark = GoodsBuy.Remark;
							 | 
						|||
| 
								 | 
							
								            Funs.DB.DriverGoods_GoodsBuy.InsertOnSubmit(newGoodsBuy);
							 | 
						|||
| 
								 | 
							
								            Funs.DB.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 修改开车物资请购管理
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="GoodsBuy"></param>
							 | 
						|||
| 
								 | 
							
								        public static void UpdateGoodsBuy(Model.DriverGoods_GoodsBuy GoodsBuy)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Model.DriverGoods_GoodsBuy newGoodsBuy = Funs.DB.DriverGoods_GoodsBuy.FirstOrDefault(e => e.GoodsBuyId == GoodsBuy.GoodsBuyId);
							 | 
						|||
| 
								 | 
							
								            if (newGoodsBuy != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newGoodsBuy.Code = GoodsBuy.Code;
							 | 
						|||
| 
								 | 
							
								                newGoodsBuy.BuyName = GoodsBuy.BuyName;
							 | 
						|||
| 
								 | 
							
								                newGoodsBuy.BuyCode = GoodsBuy.BuyCode;
							 | 
						|||
| 
								 | 
							
								                //newGoodsBuy.CompileMan = GoodsBuy.CompileMan;
							 | 
						|||
| 
								 | 
							
								                newGoodsBuy.ApprovalDate = GoodsBuy.ApprovalDate;
							 | 
						|||
| 
								 | 
							
								                newGoodsBuy.SubmitDate = GoodsBuy.SubmitDate;
							 | 
						|||
| 
								 | 
							
								                newGoodsBuy.GetGoodsDate = GoodsBuy.GetGoodsDate;
							 | 
						|||
| 
								 | 
							
								                newGoodsBuy.AttachUrl = GoodsBuy.AttachUrl;
							 | 
						|||
| 
								 | 
							
								                newGoodsBuy.Remark = GoodsBuy.Remark;
							 | 
						|||
| 
								 | 
							
								                Funs.DB.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 根据主键删除开车物资请购管理
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="GoodsBuyId"></param>
							 | 
						|||
| 
								 | 
							
								        public static void DeleteGoodsBuy(string GoodsBuyId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Model.DriverGoods_GoodsBuy GoodsBuy = Funs.DB.DriverGoods_GoodsBuy.FirstOrDefault(e => e.GoodsBuyId == GoodsBuyId);
							 | 
						|||
| 
								 | 
							
								            if (GoodsBuy != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(GoodsBuy.AttachUrl))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, GoodsBuy.AttachUrl);//删除附件
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                Funs.DB.DriverGoods_GoodsBuy.DeleteOnSubmit(GoodsBuy);
							 | 
						|||
| 
								 | 
							
								                Funs.DB.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |