private string GetBatch(long pLonCustomer, DateTime lDtmAuctionDate, ItemTypeGenderEnum pEnmGender) { var lObjStock = mObjStockDAO.GetEntitiesList() .Where(x => (pEnmGender != ItemTypeGenderEnum.Otro ? x.Item.Gender == pEnmGender : true) && x.ExpirationDate == lDtmAuctionDate && x.CustomerId == pLonCustomer).FirstOrDefault(); return(lObjStock != null ? lObjStock.BatchNumber : string.Empty); }
public int GetSalesQuantityOnCurrentAuction(long pLonAuctionId, ItemTypeGenderEnum pEnmGender = ItemTypeGenderEnum.Otro) { int lIntSales = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pLonAuctionId) .SelectMany(x => x.Batches) .Where(x => !x.Removed && !x.Unsold && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true)) .Sum(x => (int?)x.Quantity) ?? 0; int lIntReturns = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pLonAuctionId) .SelectMany(x => x.Batches) .Where(x => !x.Removed && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true)) .SelectMany(x => x.GoodsReturns) .Where(x => !x.Removed) .Sum(x => (int?)x.Quantity) ?? 0; return(lIntSales - lIntReturns); }
public int GetAvailableQuantityForFutureAuctions(long pLonAuctionId, ItemTypeGenderEnum pEnmGender = ItemTypeGenderEnum.Otro) { DateTime lDtmAuctionDate = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pLonAuctionId) .Select(x => x.Date) .FirstOrDefault(); int lIntBaseStock = mObjStockDAO.GetEntitiesList() .Where(x => (pEnmGender != ItemTypeGenderEnum.Otro ? x.Item.Gender == pEnmGender : true) && x.ExpirationDate != lDtmAuctionDate && x.Quantity > 0) .Sum(x => (int?)x.Quantity) ?? 0; int lIntTemporaryStock = mObjGoodsReceiptDAO.GetEntitiesList() .Where(x => (pEnmGender != ItemTypeGenderEnum.Otro ? x.Item.Gender == pEnmGender : true) && x.ExpirationDate != lDtmAuctionDate && !x.Processed && x.Quantity > 0) .Sum(x => (int?)x.Quantity) ?? 0; return(lIntBaseStock + lIntTemporaryStock); }
public int GetAvailableQuantityForCurrentAuction(long pLonAuctionId, ItemTypeGenderEnum pEnmGender = ItemTypeGenderEnum.Otro) { DateTime lDtmAuctionDate = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pLonAuctionId) .Select(x => x.Date) .FirstOrDefault(); int lIntBaseStock = mObjStockDAO.GetEntitiesList() .Where(x => (pEnmGender != ItemTypeGenderEnum.Otro ? x.Item.Gender == pEnmGender : true) && x.ExpirationDate == lDtmAuctionDate && x.Quantity > 0) .Sum(x => (int?)x.Quantity) ?? 0; int lIntTemporaryStock = mObjGoodsReceiptDAO.GetEntitiesList() .Where(x => (pEnmGender != ItemTypeGenderEnum.Otro ? x.Item.Gender == pEnmGender : true) && x.ExpirationDate == lDtmAuctionDate && !x.Processed && x.Quantity > 0) .Sum(x => (int?)x.Quantity) ?? 0; int lIntSales = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pLonAuctionId) .SelectMany(x => x.Batches) .Where(x => !x.Removed && !x.Unsold && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true)) .Sum(x => (int?)x.Quantity) ?? 0; int lIntReturns = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pLonAuctionId) .SelectMany(x => x.Batches) .Where(x => !x.Removed && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true)) .SelectMany(x => x.GoodsReturns) .Where(x => !x.Removed) .Sum(x => (int?)x.Quantity) ?? 0; return(lIntBaseStock + lIntTemporaryStock - (lIntSales - lIntReturns)); }
public int GetAvailableQuantityForReprogramOnCurrentAuction(long pLonAuctionId, long pLonCustomer, ItemTypeGenderEnum pEnmGender = ItemTypeGenderEnum.Otro) { int lIntNotSales = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pLonAuctionId) .SelectMany(x => x.Batches) .Where(x => !x.Removed && !x.Reprogrammed && x.Unsold && x.SellerId == pLonCustomer && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true)) .Sum(x => (int?)x.Quantity) ?? 0; int lIntReprogramedSales = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pLonAuctionId) .SelectMany(x => x.Batches).Where(x => !x.Removed && !x.Unsold && x.SellerId == pLonCustomer && x.Reprogrammed && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true) ).Sum(x => (int?)x.Quantity) ?? 0; int lIntReturns = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pLonAuctionId) .SelectMany(x => x.Batches) .Where(x => !x.Removed && x.SellerId == pLonCustomer && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true)) .SelectMany(x => x.GoodsReturns) .Where(x => !x.Removed) .Sum(x => (int?)x.Quantity) ?? 0; return((lIntNotSales - lIntReprogramedSales) + lIntReturns); }
public int GetAvailableQuantityForReprogrammedEdited(Batch pObjBatch, long pLonCustomer, int pIntQtty, ItemTypeGenderEnum pEnmGender = ItemTypeGenderEnum.Otro) { int lIntNotSales = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pObjBatch.AuctionId) .SelectMany(x => x.Batches) .Where(x => !x.Removed && !x.Reprogrammed && x.Unsold && x.SellerId == pLonCustomer && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true)) .Sum(x => (int?)x.Quantity) ?? 0; int lIntReprogramedSales = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pObjBatch.AuctionId) .SelectMany(x => x.Batches).Where(x => !x.Removed && !x.Unsold && x.SellerId == pLonCustomer && x.Reprogrammed && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true) ).Sum(x => (int?)x.Quantity) ?? 0; int lIntReturns = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pObjBatch.AuctionId) .SelectMany(x => x.Batches) .Where(x => !x.Removed && x.SellerId == pLonCustomer && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true)) .SelectMany(x => x.GoodsReturns) .Where(x => !x.Removed) .Sum(x => (int?)x.Quantity) ?? 0; int lIntInverseSale = pObjBatch.Unsold && !pObjBatch.Reprogrammed ? pObjBatch.Quantity : 0; int lIntInverseReprogrammed = pObjBatch.Reprogrammed && !pObjBatch.Unsold ? pObjBatch.Quantity : 0; return(((lIntNotSales - lIntInverseSale) - (lIntReprogramedSales - lIntInverseReprogrammed)) + lIntReturns); }
public int GetAvailableQuantityForEditedBatchesInCurrentAuction(Batch pObjBatch, long pLonCustomer, int pIntQtty, ItemTypeGenderEnum pEnmGender = ItemTypeGenderEnum.Otro) { DateTime lDtmAuctionDate = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pObjBatch.AuctionId) .Select(x => x.Date) .FirstOrDefault(); int lIntBaseStock = mObjStockDAO.GetEntitiesList() .Where(x => (pEnmGender != ItemTypeGenderEnum.Otro ? x.Item.Gender == pEnmGender : true) && x.ExpirationDate == lDtmAuctionDate && x.CustomerId == pLonCustomer && x.Quantity > 0) .Sum(x => (int?)x.Quantity) ?? 0; lIntBaseStock = mObjAuctionDAO.GetEntity(pObjBatch.AuctionId).ReOpened ? GetStockFromChanges(GetBatch(pLonCustomer, lDtmAuctionDate, pEnmGender)) : lIntBaseStock; int lIntTemporaryStock = mObjGoodsReceiptDAO.GetEntitiesList() .Where(x => (pEnmGender != ItemTypeGenderEnum.Otro ? x.Item.Gender == pEnmGender : true) && x.ExpirationDate == lDtmAuctionDate && x.CustomerId == pLonCustomer && !x.Processed && x.Quantity > 0) .Sum(x => (int?)x.Quantity) ?? 0; int lIntSales = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pObjBatch.AuctionId) .SelectMany(x => x.Batches) .Where(x => !x.Removed && !x.Unsold && x.SellerId == pLonCustomer && !x.Reprogrammed && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true)) .Sum(x => (int?)x.Quantity) ?? 0; int lIntReprogramedSales = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pObjBatch.AuctionId) .SelectMany(x => x.Batches).Where(x => !x.Removed && !x.Unsold && x.SellerId == pLonCustomer && x.Reprogrammed && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true) ).Sum(x => (int?)x.Quantity) ?? 0; int lIntNotSales = mObjAuctionDAO.GetEntitiesList() .Where(x => x.Id == pObjBatch.AuctionId) .SelectMany(x => x.Batches) .Where(x => !x.Removed && !x.Reprogrammed && x.Unsold && x.SellerId == pLonCustomer && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true)) .Sum(x => (int?)x.Quantity) ?? 0; //int lIntReturns = mObjAuctionDAO.GetEntitiesList() // .Where(x => x.Id == pObjBatch.AuctionId) // .SelectMany(x => x.Batches) // .Where(x => !x.Removed // && x.SellerId == pLonCustomer // && (pEnmGender != ItemTypeGenderEnum.Otro ? x.ItemType.Gender == pEnmGender : true)) // .SelectMany(x => x.GoodsReturns) // .Where(x => !x.Removed) // .Sum(x => (int?)x.Quantity) ?? 0; int value = pObjBatch.Quantity; return((lIntBaseStock + lIntTemporaryStock - lIntNotSales - lIntSales) + value); //return lIntBaseStock + lIntTemporaryStock - (lIntNotSales - lIntReprogramedSales) - (lIntSales - lIntReturns); }
private int GetQuantityForReprogramOnCurrentAuction(ItemTypeGenderEnum pEnmGender) { return(mObjAuctionsFactory.GetAuctionStockService().GetAvailableQuantityForReprogramOnCurrentAuction(mLonAuction, mLonCustomer, pEnmGender)); }
private int GetQuantityPurchasesOnCurrentAuction(ItemTypeGenderEnum pEnmGender) { return(mObjAuctionsFactory.GetAuctionStockService().GetPurchasesQuantityOnCurrentAuction(mLonAuction, mLonCustomer, pEnmGender)); }
public bool SameGender(ItemTypeGenderEnum pItemTypeGenderEnum, long lLonItemId) { return(mObjItemDAO.GetEntitiesList().Where(x => x.Id == lLonItemId && x.Gender == pItemTypeGenderEnum).Select(x => x.Gender).Count() > 0 ? true : false); }