public IList <FoodChargeCheck> GetEntitiesList(long pLonAuctionId = 1) { DateTime lObjDateTime = mObjAuctionDAO.GetEntity(pLonAuctionId).Date; IList <long> lLstLonSellers = mObjBatchDAO.GetEntitiesList().Where(x => x.AuctionId == pLonAuctionId && x.SellerId != null).Select(y => y.SellerId ?? 0).Distinct().ToList(); return(mObjFoodChargeCheckListDAO.GetEntitiesList().Where(x => lLstLonSellers.Contains(x.SellerId) && DbFunctions.TruncateTime(x.ExpirationDate) == lObjDateTime).ToList()); }
public int GetAvailableQuantityForAuctionOnCurrentAuction(long pLonAuctionId, long pLonCustomer, 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.CustomerId == pLonCustomer && x.Quantity > 0) .Sum(x => (int?)x.Quantity) ?? 0; lIntBaseStock = mObjAuctionDAO.GetEntity(pLonAuctionId).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 == 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 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 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; return(lIntBaseStock + lIntTemporaryStock - lIntNotSales - lIntSales); }
public UserDTO GetUserDTO(long pLonIdUser) { User objUser = mObjUserDAO.GetEntity(pLonIdUser); return(new UserDTO() { Id = objUser.Id, UserName = objUser.UserName, EmailAddress = objUser.EmailAddress, FirstName = objUser.FirstName, LastName = objUser.LastName, UserTypeId = objUser.UserTypeId, UserType = objUser.UserType.Name }); }
public List <BatchLogDTO> GetBatchLogList(long pLonBatchId) { return(InternalGetBatchLogList ( mObjBatchDAO.GetEntity(pLonBatchId), GetBatchChanges(pLonBatchId) )); }
//public void CreateGoodsReturn(IList<DetailedBatchDTO> pLstObjDetailedBatches) //{ // foreach (var lObjDetailedBatch in pLstObjDetailedBatches) // { // CreateGoodsReturn(lObjDetailedBatch); // } //} //public void CreateGoodsReturn(DetailedBatchDTO pObjDetailedBatch) //{ // //Valid availability // if (pObjDetailedBatch.QuantityToPick > 0 && GetAvailableQuantity(pObjDetailedBatch) >= pObjDetailedBatch.QuantityToPick) // { // //Get item batches from lines // foreach (var lObjLine in pObjDetailedBatch.Lines.Where(x => GetAvailableQuantity(pObjDetailedBatch, x) > 0)) // { // if (pObjDetailedBatch.QuantityToPick > 0 && GetAvailableQuantity(pObjDetailedBatch) >= pObjDetailedBatch.QuantityToPick) // { // //Get quantity to apply // int lIntQuantityToApply = pObjDetailedBatch.QuantityToPick > GetAvailableQuantity(pObjDetailedBatch, lObjLine) ? GetAvailableQuantity(pObjDetailedBatch, lObjLine) : pObjDetailedBatch.QuantityToPick; // //Create Goods Return // GoodsReturn lObjGoodsReturn = new GoodsReturn() // { // BatchId = pObjDetailedBatch.Id, // Quantity = lIntQuantityToApply, // //BatchNumber = lObjLine.BatchNumber, // //BatchDate = lObjLine.BatchDate, // //ItemId = lObjLine.ItemId, // Delivered = pObjDetailedBatch.Delivered, // Exported = false // }; // //Add Goods Return // mObjGoodsReturnDAO.AddEntity(lObjGoodsReturn); // //Update quantities // pObjDetailedBatch.ReturnedQuantity += lIntQuantityToApply; // lObjLine.ReturnedQuantity += lIntQuantityToApply; // pObjDetailedBatch.QuantityToPick -= lIntQuantityToApply; // if (pObjDetailedBatch.Delivered) // { // pObjDetailedBatch.AvailableQuantityToReturnDelivery -= lIntQuantityToApply; // lObjLine.AvailableQuantityToReturnDelivery -= lIntQuantityToApply; // } // else // { // pObjDetailedBatch.AvailableQuantityToReturn -= lIntQuantityToApply; // lObjLine.AvailableQuantityToReturn -= lIntQuantityToApply; // } // } // } // //Update Batch // mObjBatchDAO.SaveOrUpdateEntity(mObjBatchDAO.GetEntity(pObjDetailedBatch.Id)); // } // } public void CreateGoodsReturn(DetailedBatchDTO pObjDetailedBatch, int pIntQttyToReturn, int pIntDeliveredQtty) { //Valid availability if (pObjDetailedBatch.QuantityToPick > 0 && GetAvailableQuantity(pObjDetailedBatch, pIntQttyToReturn, pIntDeliveredQtty) >= pObjDetailedBatch.QuantityToPick) { //Get quantity to apply int lIntQuantityToApply = pObjDetailedBatch.QuantityToPick > GetAvailableQuantity(pObjDetailedBatch, pIntQttyToReturn, pIntDeliveredQtty) ? GetAvailableQuantity(pObjDetailedBatch, pIntQttyToReturn, pIntDeliveredQtty) : pObjDetailedBatch.QuantityToPick; //Create Goods Return GoodsReturn lObjGoodsReturn = new GoodsReturn() { BatchId = pObjDetailedBatch.Id, Quantity = lIntQuantityToApply, Weight = pObjDetailedBatch.Weight, Delivered = pObjDetailedBatch.Delivered, Exported = false, ReturnMotive = pObjDetailedBatch.ReturnMotive }; //Add Goods Return mObjGoodsReturnDAO.AddEntity(lObjGoodsReturn); //Update quantities pObjDetailedBatch.ReturnedQuantity += lIntQuantityToApply; //lObjLine.ReturnedQuantity += lIntQuantityToApply; pObjDetailedBatch.QuantityToPick -= lIntQuantityToApply; if (pObjDetailedBatch.Delivered) { pObjDetailedBatch.AvailableQuantityToReturnDelivery -= lIntQuantityToApply; //lObjLine.AvailableQuantityToReturnDelivery -= lIntQuantityToApply; } else { pObjDetailedBatch.AvailableQuantityToReturn -= lIntQuantityToApply; //lObjLine.AvailableQuantityToReturn -= lIntQuantityToApply; } ////Update Batch mObjBatchDAO.SaveOrUpdateEntity(mObjBatchDAO.GetEntity(pObjDetailedBatch.Id)); } }
public Auction Get(long pLonAuctionId) { return(mObjAuctionDAO.GetEntity(pLonAuctionId)); }
public Partner GetEntity(long pLonId) { return(mObjPartnerDAO.GetEntity(pLonId)); }
public PartnerMapping GetEntity(long pLonId) { return(mObjPartnerMappingDAO.GetEntity(pLonId)); }
public ItemType GetEntity(long pLonId) { return(mObjItemTypeDAO.GetEntity(pLonId)); }
public FoodCharge Get(long pLonId) { return(mObjFoodChargeDAO.GetEntity(pLonId)); }
public Batch GetEntity(long pLonId) { return(mObjBatchDAO.GetEntity(pLonId)); }
public Item Get(long pLonId) { return(mObjItemDAO.GetEntity(pLonId)); }
public PartnerClassification GetEntity(long pLonId) { return(mObjPartnerClassificationDAO.GetEntity(pLonId)); }