Beispiel #1
0
        /// <summary>
        /// This is the one that returns a list of a sale or purchase documents for a specific state within a date period. This is the one that joins the operations.
        /// We will use this data to get the money amount and counts
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="buySellDocStateEnum"></param>
        /// <param name="buySellDocumentTypeEnum"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <returns></returns>
        List <BuySellDoc> getBuySellDocs_For(string userId, BuySellDocStateENUM buySellDocStateEnum, BuySellDocumentTypeENUM buySellDocumentTypeEnum, DateTime fromDate, DateTime toDate)
        {
            IQueryable <BuySellDoc> allDocsWithinDate      = FindAll().Where(x => x.MetaData.Created.Date >= fromDate && x.MetaData.Created.Date <= toDate);
            List <BuySellDoc>       allDocsWithinDateDEBUG = allDocsWithinDate.ToList();

            IQueryable <BuySellDoc> allDocsOfDocumentType      = getByDocumentType_For(userId, allDocsWithinDate, buySellDocumentTypeEnum);
            List <BuySellDoc>       allDocsOfDocumentTypeDEBUG = getByDocumentType_For(userId, allDocsWithinDate, buySellDocumentTypeEnum).ToList();

            IQueryable <BuySellDoc> IQueryable_allDocsOfDocState = BuySellDoc.IQuerable_Orders_For(buySellDocStateEnum, allDocsOfDocumentType);

            List <BuySellDoc> allFilteredDocs = IQueryable_allDocsOfDocState.ToList();

            //fill in the Complex Addresses
            if (!allFilteredDocs.IsNullOrEmpty())
            {
                foreach (BuySellDoc buysellDoc in allFilteredDocs)
                {
                    loadAddressShipTo(buysellDoc);
                    loadAddressBillTo(buysellDoc);
                    loadAddressShipFrom(buysellDoc);

                    //this changes the value of the doc.
                    //buysellDoc.BuySellDocumentTypeEnum = buySellDocumentTypeEnum;
                }
            }

            return(allFilteredDocs);
        }
        private List <BuySellDoc> getAllSaleOrders_For(string userId, BuySellDocStateENUM buySellDocStateEnum)
        {
            List <BuySellDoc> saleOrdersLst = new List <BuySellDoc>();

            switch (buySellDocStateEnum)
            {
            case BuySellDocStateENUM.New:
            case BuySellDocStateENUM.RequestUnconfirmed:
            case BuySellDocStateENUM.InProccess:
            case BuySellDocStateENUM.Closed:
            case BuySellDocStateENUM.BackOrdered:
            case BuySellDocStateENUM.Canceled:
            case BuySellDocStateENUM.Quotation:
            case BuySellDocStateENUM.Credit:
                saleOrdersLst = getAllSaleOrders_For(userId)
                                .Where(x => x.BuySellDocStateEnum == buySellDocStateEnum)
                                .ToList();
                break;

            case BuySellDocStateENUM.All:
                saleOrdersLst = getAllSaleOrders_For(userId)
                                .Where(x =>
                                       x.BuySellDocStateEnum == BuySellDocStateENUM.New ||
                                       x.BuySellDocStateEnum == BuySellDocStateENUM.InProccess)
                                .ToList();
                break;

            case BuySellDocStateENUM.Unknown:
            default:
                throw new Exception("State of document is unknown.");
            }
            //get all sale orders for Owner
            return(saleOrdersLst);
        }
        private double getSaleOrders_Count(string userId, BuySellDocStateENUM buySellDocStateEnum)
        {
            List <BuySellDoc> saleOrdersLst = getAllSaleOrders_For(userId, buySellDocStateEnum);

            //add up the sale amoung
            if (saleOrdersLst.IsNullOrEmpty())
            {
                return(0);
            }

            return(saleOrdersLst.Count());
        }
        private double getPurchaseOrders_Count(string userId, BuySellDocStateENUM buySellDocStateEnum)
        {
            List <BuySellDoc> purchaseOrdersLst = getAllPurchaseOrders_For(userId, buySellDocStateEnum);

            //add up the purchase amoung
            if (purchaseOrdersLst.IsNullOrEmpty())
            {
                return(0);
            }

            return(purchaseOrdersLst.Count());
        }
        //private decimal getPurchaseOrders_InMoney(string userId, BuySellDocStateENUM buySellDocStateEnum)
        //{

        //    //get all purchase orders for Owner
        //    List<BuySellDoc> purchaseOrdersLst = GetAllPurchaseOrders_For(userId, buySellDocStateEnum);

        //    //add up the purchase amoung
        //    if (purchaseOrdersLst.IsNullOrEmpty())
        //        return 0;

        //    decimal totalPurchase = 0;
        //    foreach (var item in purchaseOrdersLst)
        //    {
        //        totalPurchase += item.TotalRemaining;
        //    }

        //    return totalPurchase;
        //}
        //private double getPurchaseOrders_Count(string userId, BuySellDocStateENUM buySellDocStateEnum)
        //{
        //    List<BuySellDoc> purchaseOrdersLst = GetAllPurchaseOrders_For(userId, buySellDocStateEnum);

        //    //add up the purchase amoung
        //    if (purchaseOrdersLst.IsNullOrEmpty())
        //        return 0;

        //    return purchaseOrdersLst.Count();
        //}


        //private IQueryable<BuySellDoc> getAllPurchaseOrders_For(string userId)
        //{
        //    //we need to be able to get all the purchase orders here without the userid
        //    //userId.IsNullOrWhiteSpaceThrowArgumentException("You are not logged in.");


        //    //when selling, the user is the owner
        //    IQueryable<BuySellDoc> purchaseOrdersIq = FindAll();

        //    if (userId.IsNullOrWhiteSpace())
        //    {

        //        return purchaseOrdersIq;

        //    }
        //    Customer customer;

        //    try
        //    {
        //        customer = CustomerBiz.GetEntityFor(userId);
        //        customer.IsNullThrowException("Customer");

        //    }
        //    catch (Exception e)
        //    {

        //        ErrorsGlobal.Add("No Customer is attached", MethodBase.GetCurrentMethod(), e);
        //        throw new Exception(ErrorsGlobal.ToString());
        //    }


        //    //get all purchase orders for Owner
        //    purchaseOrdersIq = purchaseOrdersIq
        //        .Where(x => x.CustomerId == customer.Id);

        //    return purchaseOrdersIq;

        //}

        //public IQueryable<BuySellDoc> getAllPurchaseOrders_For(string userId, DateTime fromDate, DateTime toDate)
        //{
        //    return getAllPurchaseOrders_For(userId)
        //        .Where(x =>
        //            x.MetaData.Created.Date >= fromDate &&
        //            x.MetaData.Created.Date <= toDate);

        //}

        //public IQueryable<BuySellDoc> getAllPurchaseOrders_For(string userId, DateTime fromDate, DateTime toDate, BuySellDocStateENUM buySellDocStateEnum)
        //{
        //    return getAllPurchaseOrders_For(userId, fromDate, toDate)
        //        .Where(x =>
        //            x.BuySellDocStateEnum == buySellDocStateEnum);
        //}

        //public List<BuySellDoc> GetAllPurchaseOrders_For(string userId)
        //{
        //    return getAllPurchaseOrders_For(userId).ToList();
        //}
        //public List<BuySellDoc> GetAllPurchaseOrders_For(string userId, DateTime fromDate, DateTime toDate)
        //{
        //    return getAllPurchaseOrders_For(userId)
        //        .Where(x =>
        //            x.MetaData.Created.Date >= fromDate &&
        //            x.MetaData.Created.Date <= toDate)
        //            .ToList();
        //}

        //public List<BuySellDoc> GetAllPurchaseOrders_For(string userId, DateTime fromDate, DateTime toDate, BuySellDocStateENUM buySellDocStateEnum)
        //{
        //    return GetAllPurchaseOrders_For(userId, fromDate, toDate)
        //        .Where(x =>
        //            x.BuySellDocStateEnum == buySellDocStateEnum)
        //            .ToList();
        //}


        //public List<BuySellDoc> GetAllPurchaseOrders_For(string userId, BuySellDocStateENUM buySellDocStateEnum)
        //{
        //    if (buySellDocStateEnum == BuySellDocStateENUM.Unknown)
        //        throw new Exception("State of document is unknown.");

        //    //get all purchase orders for Owner
        //    List<BuySellDoc> purchaseOrdersLst = getAllPurchaseOrders_For(userId)
        //        .Where(x => x.BuySellDocStateEnum == buySellDocStateEnum)
        //        .ToList();

        //    return purchaseOrdersLst;
        //}



        #endregion



        #region Sale Orders OLD



        private decimal getSaleOrders_InMoney(string userId, BuySellDocStateENUM buySellDocStateEnum)
        {
            //get all sale orders for Owner
            List <BuySellDoc> saleOrdersLst = getAllSaleOrders_For(userId, buySellDocStateEnum);

            //add up the sale amoung
            if (saleOrdersLst.IsNullOrEmpty())
            {
                return(0);
            }

            decimal totalSale = 0;

            foreach (var item in saleOrdersLst)
            {
                totalSale += item.TotalRemaining;
            }

            return(totalSale);
        }
Beispiel #6
0
        MoneyCountItemClass GetMoneyCountItemFor(string userId, BuySellDocStateENUM buySellDocStateEnum, BuySellDocumentTypeENUM buySellDocumentTypeEnum, DateTime fromDate, DateTime toDate)
        {
            List <BuySellDoc> alldocuments = getBuySellDocs_For(userId, buySellDocStateEnum, buySellDocumentTypeEnum, fromDate, toDate);

            MoneyCountItemClass mcic = new MoneyCountItemClass();

            mcic.MoneyAmount = get_Money_For(alldocuments, buySellDocumentTypeEnum);
            mcic.Count       = get_Count_For(alldocuments, buySellDocumentTypeEnum, buySellDocStateEnum);

            if (userId.IsNullOrWhiteSpace())
            {
                mcic.MenuName    = BuySellDoc.GetMenuItem_Admin(buySellDocStateEnum, buySellDocumentTypeEnum, mcic.MoneyAmount_Formatted, mcic.Count_Formatted);
                mcic.MenuToolTip = BuySellDoc.GetMenuToolTip_Admin(buySellDocStateEnum, buySellDocumentTypeEnum, mcic.MoneyAmount_Formatted, mcic.Count_Formatted);
            }
            else
            {
                //this is for the individual user
                mcic.MenuName    = BuySellDoc.GetMenuItem(buySellDocStateEnum, buySellDocumentTypeEnum, mcic.MoneyAmount_Formatted, mcic.Count_Formatted);
                mcic.MenuToolTip = BuySellDoc.GetMenuToolTip(buySellDocStateEnum, buySellDocumentTypeEnum, mcic.MoneyAmount_Formatted, mcic.Count_Formatted);
            }
            return(mcic);
        }
        /// <summary>
        /// Use this to create buy sell orders programatically
        /// </summary>
        /// <param name="productChild"></param>
        /// <param name="ownerProductChild"></param>
        /// <param name="quantity"></param>
        /// <param name="customerUser"></param>
        /// <param name="selectListOwner"></param>
        /// <param name="selectListCustomer"></param>
        /// <param name="addressBillToId"></param>
        /// <param name="addressShipToId"></param>
        /// <param name="selectListBillTo"></param>
        /// <param name="selectListShipTo"></param>
        /// <param name="buySellDocStateEnum"></param>
        /// <returns></returns>


        public BuySellDoc CreateSale(
            ProductChild productChild,
            Owner ownerProductChild,
            int quantity,
            decimal salePrice,
            Customer customerUser,
            System.Web.Mvc.SelectList selectListOwner,
            System.Web.Mvc.SelectList selectListCustomer,
            string addressBillToId,
            string addressShipToId,
            System.Web.Mvc.SelectList selectListBillTo,
            System.Web.Mvc.SelectList selectListShipTo,
            BuySellDocStateENUM buySellDocStateEnum,
            BuySellDocStateModifierENUM buySellDocStateModifierEnum,
            DateTime pleasePickupOnDate_End,
            DateTime expectedDeliveryDate,
            string shopId)
        {
            BuySellDoc sale = BuySellDocBiz.Factory() as BuySellDoc;

            sale.ShopId = shopId;

            sale.Initialize(
                ownerProductChild.Id,
                customerUser.Id,
                addressBillToId,
                addressShipToId,
                selectListOwner,
                selectListCustomer,
                selectListBillTo,
                selectListShipTo);

            if (pleasePickupOnDate_End == DateTime.MaxValue || pleasePickupOnDate_End == DateTime.MinValue)
            {
            }
            else
            {
                sale.PleasePickupOnDate_End = pleasePickupOnDate_End;
            }

            if (expectedDeliveryDate == DateTime.MaxValue || expectedDeliveryDate == DateTime.MinValue)
            {
            }
            else
            {
                sale.ExpectedDeliveryDate = expectedDeliveryDate;
            }


            //dont really need this, but it is good for consistancy.
            sale.BuySellDocumentTypeEnum     = BuySellDocumentTypeENUM.Purchase;
            sale.BuySellDocStateModifierEnum = buySellDocStateModifierEnum;
            sale.BuySellDocStateEnum         = buySellDocStateEnum;
            sale.ExpectedDeliveryDate        = expectedDeliveryDate;
            BuySellItem buySellItem = new BuySellItem(sale.Id, productChild.Id, quantity, salePrice, productChild.FullName());

            sale.Add(buySellItem);



            BuySellDocBiz.GetDefaultVehicalType(sale);
            //add the owners address
            sale.AddressShipFromId = productChild.ShipFromAddressId;

            setStatusDate(sale);
            ControllerCreateEditParameter parm = new ControllerCreateEditParameter();

            parm.Entity       = sale as ICommonWithId;
            parm.GlobalObject = GetGlobalObject();
            getCustomerSalesmanAndOwnerSalesman(sale);


            //add the payment amount.



            BuySellDocBiz.Create(parm);

            return(sale);
        }
 private List <BuySellDoc> getAllSaleOrders_For(string userId, DateTime fromDate, DateTime toDate, BuySellDocStateENUM buySellDocStateEnum)
 {
     return(getAllSaleOrders_For(userId, buySellDocStateEnum)
            .Where(x =>
                   x.MetaData.Created.Date >= fromDate &&
                   x.MetaData.Created.Date <= toDate)
            .ToList());
 }
        private List <BuySellDoc> getAllPurchaseOrders_For(string userId, BuySellDocStateENUM buySellDocStateEnum)
        {
            List <BuySellDoc> purchaseOrdersLst = new List <BuySellDoc>();

            switch (buySellDocStateEnum)
            {
            case BuySellDocStateENUM.RequestUnconfirmed:
                purchaseOrdersLst = getAllPurchaseOrders_For(userId)
                                    .Where(x =>
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.RequestUnconfirmed)
                                    .ToList();
                break;


            case BuySellDocStateENUM.RequestConfirmed:
                purchaseOrdersLst = getAllPurchaseOrders_For(userId)
                                    .Where(x =>
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.RequestConfirmed)
                                    .ToList();
                break;


            case BuySellDocStateENUM.ConfirmedBySeller:
                purchaseOrdersLst = getAllPurchaseOrders_For(userId)
                                    .Where(x =>
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.ConfirmedBySeller)
                                    .ToList();
                break;


            case BuySellDocStateENUM.ReadyForShipment:
                purchaseOrdersLst = getAllPurchaseOrders_For(userId)
                                    .Where(x =>
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.ReadyForShipment)
                                    .ToList();
                break;


            case BuySellDocStateENUM.ConfirmedByCourier:
                purchaseOrdersLst = getAllPurchaseOrders_For(userId)
                                    .Where(x =>
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.ConfirmedByCourier)
                                    .ToList();
                break;


            case BuySellDocStateENUM.PickedUp:
                purchaseOrdersLst = getAllPurchaseOrders_For(userId)
                                    .Where(x =>
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.PickedUp)
                                    .ToList();
                break;


            case BuySellDocStateENUM.Delivered:
                purchaseOrdersLst = getAllPurchaseOrders_For(userId)
                                    .Where(x =>
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.Delivered)
                                    .ToList();
                break;


            case BuySellDocStateENUM.Rejected:
                purchaseOrdersLst = getAllPurchaseOrders_For(userId)
                                    .Where(x =>
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.Rejected)
                                    .ToList();
                break;


            case BuySellDocStateENUM.Problem:
                purchaseOrdersLst = getAllPurchaseOrders_For(userId)
                                    .Where(x =>
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.Problem)
                                    .ToList();
                break;


            case BuySellDocStateENUM.InProccess:
                purchaseOrdersLst = getAllPurchaseOrders_For(userId)
                                    .Where(x =>
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.RequestConfirmed ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.ConfirmedBySeller ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.ReadyForShipment ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.ConfirmedByCourier ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.PickedUp ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.Delivered)
                                    .ToList();
                break;


            case BuySellDocStateENUM.All:
                purchaseOrdersLst = getAllPurchaseOrders_For(userId)
                                    .Where(x =>
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.RequestUnconfirmed ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.RequestConfirmed ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.ConfirmedBySeller ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.ReadyForShipment ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.ConfirmedByCourier ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.PickedUp ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.Delivered ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.Rejected ||
                                           x.BuySellDocStateEnum == BuySellDocStateENUM.Problem)
                                    .ToList();
                break;


            case BuySellDocStateENUM.Unknown:
            default:
                break;
            }
            //get all purchase orders for Owner
            return(purchaseOrdersLst);
        }
Beispiel #10
0
        //public BuySellStatementModel GetDeliveryOrders(string userId, string id)
        //{
        //    userId.IsNullOrWhiteSpaceThrowArgumentException("You are not logged in.");

        //    List<BuySellDoc> lstbuySellDocs = new List<BuySellDoc>(); ;

        //    BuySellDoc buySellDoc = Find(id);
        //    buySellDoc.IsNullThrowException();

        //    lstbuySellDocs.Add(buySellDoc);

        //    decimal customerBalanceRefundable = 0;
        //    decimal customerBalanceNonRefundable = 0;

        //    BuySellStatementModel buySellStatementModel = new BuySellStatementModel(lstbuySellDocs, DateTime.MinValue, DateTime.MaxValue, BuySellDocumentTypeENUM.Delivery, false, customerBalanceRefundable, customerBalanceNonRefundable, BuySellDocStateENUM.ReadyForPickup);

        //    return buySellStatementModel;

        //}


        /// <summary>
        /// This gets the order list of Sale or Purchase documents date delimited.
        /// This also figures out if it is a sale or a purchase
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="buySellDocumentTypeEnum"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <returns></returns>

        public BuySellStatementModel GetBuySellStatementModel(string userId, DateTime fromDate, DateTime toDate, bool isAdmin, BuySellDocumentTypeENUM buySellDocumentTypeEnum, BuySellDocStateENUM buySellDocStateEnum)
        {
            //userId.IsNullOrWhiteSpaceThrowArgumentException("You are not logged in.");


            List <BuySellDoc> buySellDocs = getBuySellDocs_For(userId, buySellDocStateEnum, buySellDocumentTypeEnum, fromDate, toDate).ToList();

            decimal     customerBalanceRefundable = 0, customerBalanceNonRefundable = 0;
            Deliveryman deliveryman = DeliverymanBiz.GetPlayerFor(userId);



            BuySellStatementModel buySellStatementModel = new BuySellStatementModel(buySellDocs, fromDate, toDate, buySellDocumentTypeEnum, isAdmin, customerBalanceRefundable, customerBalanceNonRefundable, deliveryman, buySellDocStateEnum);

            return(buySellStatementModel);
        }
Beispiel #11
0
        /// <summary>
        /// This gets a list from getAllDocuments_For.
        /// </summary>
        /// <param name="orderListDateDelimitedByDocumentTypeAndState"></param>
        /// <returns></returns>
        long get_Count_For(List <BuySellDoc> orderListDateDelimitedByDocumentTypeAndState, BuySellDocumentTypeENUM buySellDocumentTypeEnum, BuySellDocStateENUM buySellDocStateEnum)
        {
            //get all purchase orders for Owner

            //add up the purchase amoung
            if (orderListDateDelimitedByDocumentTypeAndState.IsNullOrEmpty())
            {
                return(0);
            }


            IQueryable <BuySellDoc> iq_orderListDateDelimitedByDocumentTypeAndState = orderListDateDelimitedByDocumentTypeAndState.AsQueryable <BuySellDoc>();

            IQueryable <BuySellDoc> orderListDuplicate = BuySellDoc.IQuerable_Orders_For(
                buySellDocStateEnum,
                iq_orderListDateDelimitedByDocumentTypeAndState);

            long count = 0;

            //if (buySellDocumentTypeEnum == BuySellDocumentTypeENUM.Delivery)
            //{
            //    if (buySellDocStateEnum == BuySellDocStateENUM.ReadyForPickup || buySellDocStateEnum == BuySellDocStateENUM.All)
            //    { }
            //    else
            //    {
            //        Deliveryman deliveryman = DeliverymanBiz.GetPlayerFor(UserId);

            //        if (deliveryman.IsNull())
            //            return 0;

            //        count = orderListDuplicate
            //            .Where(x => x.DeliverymanId == deliveryman.Id)
            //            .Count();

            //        return count;
            //    }
            //}
            //for the deliveryman, it should return all items as per its query
            count = orderListDuplicate.Count();
            return(count);
        }
Beispiel #12
0
        public ProductChild LoadProductChildForLandingPage(string productChildId, string searchFor, string returnUrl)
        {
            //ProductChild productChild = _icrudBiz.Factory() as ProductChild;
            //productChildId.IsNullThrowExceptionArgument("Id not received. Bad Request");

            ProductChild productChild = Find(productChildId);

            productChild.IsNullThrowException("Product Child not found.");

            string productIdDud      = "";
            string isandForSearchDud = "";
            string selectIdDud       = "";
            string menuPathMainIdDud = "";
            string logoAddress       = "";
            string buttonDud         = "";
            //string sortByDud = "";
            LikeUnlikeParameters likeUnlikeParameters = null;

            bool isMenuDud   = false;
            bool isUserAdmin = false;
            BuySellDocumentTypeENUM buySellDocumentTypeEnum = BuySellDocumentTypeENUM.Unknown; //DUD
            BuySellDocStateENUM     BuySellDocStateEnum     = BuySellDocStateENUM.Unknown;     //dud

            if (!UserId.IsNullOrWhiteSpace())
            {
                isUserAdmin = UserBiz.IsAdmin(UserId);
            }

            ControllerIndexParams parms = new ControllerIndexParams(
                productChildId,
                menuPathMainIdDud,
                searchFor,
                isandForSearchDud,
                selectIdDud,
                MenuENUM.IndexMenuProductChildLandingPage,
                SortOrderENUM.Item1_Asc,
                logoAddress,
                productChild,
                productChild,
                UserId,
                UserName,
                isUserAdmin,
                isMenuDud,
                BreadCrumbManager,
                ActionNameENUM.Unknown,
                likeUnlikeParameters,
                productIdDud,
                returnUrl,
                buySellDocumentTypeEnum,
                BuySellDocStateEnum,
                buttonDud);

            InitializeMenuManagerForEntity(parms);

            //IHasUploads hasUploadsEntity = parms.Entity as IHasUploads;
            //MenuManager menuManager = new MenuManager(parms.Entity.MenuManager.MenuPathMain, null, null, parms.Menu.MenuEnum, BreadCrumbManager, parms.LikeUnlikeCounter, UserId, parms.ReturnUrl, UserName);
            IMenuManager menuManager = parms.Entity.MenuManager;

            if (menuManager.IndexMenuVariables.IsNull())
            {
                menuManager.IndexMenuVariables = new IndexMenuVariables(UserId);
            }



            Person person = UserBiz.GetPersonFor(UserId);

            if (!person.IsNull())
            {
                string userPersonId         = person.Id;
                string productChildPersonId = productChild.Owner.PersonId;
                menuManager.IndexMenuVariables.updateRequiredProperties(userPersonId, productChildPersonId);
            }



            List <string> pictureAddresses = GetCurrItemsPictureList(productChild);

            //if none are available get them from the product
            if (pictureAddresses.IsNullOrEmpty())
            {
                productChild.Product.IsNullThrowException();
                pictureAddresses = GetCurrItemsPictureList(productChild.Product);
            }

            if (pictureAddresses.IsNullOrEmpty())
            {
                pictureAddresses = GetDefaultPicture();
            }



            menuManager.PictureAddresses = pictureAddresses;

            ////also add the ProductChildperson and UserPerson
            //Person userPerson = UserBiz.GetPersonFor(UserId);

            //if (!productChild.Owner.IsNull())
            //    menuManager.IndexMenuVariables.ProductChildPersonId = productChild.Owner.PersonId;

            productChild.AllFeatures = Get_All_ProductChild_Features_For(productChild);



            if (UserId.IsNullOrEmpty())
            {
                //Log an annonymous user as a visitor
            }
            else
            {
                //Log user as visitor to this product child
                LogPersonsVisit(UserId, productChild);
            }


            return(productChild);
        }