예제 #1
0
        //GetConsignmentDetailsByConsignmentID
        public List <ConsignmentDetail> GetConsignmentDetailsByConsignmentID(long consignmentID)
        {
            DataCacheObject dco = new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.INVOICES, "GETCONSIGNMENTDETAILSBYCONSIGNMENTID",
                                                      new object[] { consignmentID }, CachingExpirationTime.Hours_01);
            List <ConsignmentDetail> result = CacheRepository.Get(dco) as List <ConsignmentDetail>;

            if (result != null && result.Any())
            {
                return(result);
            }
            result = (from p in dataContext.spInvoice_View_GetConsignmentByConsignments(consignmentID)
                      select new ConsignmentDetail
            {
                Consignment_ID = p.Consignment_ID,
                Invoice_ID = p.Invoice_ID.GetValueOrDefault(0),
                Reserve = p.Reserve.GetValueOrDefault(0),
                Cost = p.Cost,
                Amount = p.Amount,
                LinkParams = new LinkParams {
                    EventTitle = p.EventTitle, MainCategoryTitle = p.MainCategoryTitle, CategoryTitle = p.CategoryTitle, Lot = p.Lot.HasValue ? p.Lot.Value : (short)0, Title = p.Title, ID = p.Auction_ID
                },
                CommissionRate = p.CommRate
            }).ToList();
            if (result.Any())
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result);
        }