public void AddPurchaseOrder(IPurchaseHeader purchaseOrder)
 {
     var newpurc = Mapper.Map<IPurchaseHeader, PurchaseOrderHeader>(purchaseOrder);
     var newpurcDetail = Mapper.Map<List<IPurchaseDetail>, List<PurchaseOrderDetail>>(purchaseOrder.purchaseDetail.ToList());
     foreach (var item in newpurcDetail)
     {
         newpurc.PurchaseOrderDetails.Add(item);
     }
     _repository.Add(newpurc);
 }
        /// <summary>
        /// 获取指定条件的入库、出库数量
        /// </summary>
        /// <param name="condition">查询条件</param>
        /// <param name="isIn">入库还是出库,true为入库,否则为出库</param>
        /// <returns></returns>
        public int GetPurchaseQuantity(string condition, bool isIn)
        {
            IPurchaseHeader dal = baseDal as IPurchaseHeader;

            return(dal.GetPurchaseQuantity(condition, isIn));
        }
        /// <summary>
        /// 获取日期字段的年份列表(不重复)
        /// </summary>
        /// <param name="fieldName">日期字段</param>
        /// <returns></returns>
        public List <string> GetYearList(string fieldName)
        {
            IPurchaseHeader dal = baseDal as IPurchaseHeader;

            return(dal.GetYearList(fieldName));
        }
        public void UpdatePurchaseOrder(int orderID, IPurchaseHeader purchaseOrder)
        {
            var updatedHeader = Mapper.Map<IPurchaseHeader, PurchaseOrderHeader>(purchaseOrder);
            var newpurcDetail = Mapper.Map<List<IPurchaseDetail>, List<PurchaseOrderDetail>>(purchaseOrder.purchaseDetail.ToList());
            foreach (var item in newpurcDetail)
            {
                updatedHeader.PurchaseOrderDetails.Add(item);
            }

            _repository.Update(updatedHeader);
            _repository.SaveChanges();
        }
Exemple #5
0
        /// <summary>
        /// 获取采购单报表
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public DataTable GetPurchaseReport(string condition)
        {
            IPurchaseHeader dal = baseDal as IPurchaseHeader;

            return(dal.GetPurchaseReport(condition));
        }