Exemple #1
0
 public LikeUnlikeBiz(MenuPathMainBiz menuPathMainBiz, UserBiz userBiz, /* ProductBiz productBiz, */ AbstractControllerParameters myWorkClasses, IRepositry <LikeUnlike> entityDal, BizParameters bizParameters)
     : base(entityDal, bizParameters)
 {
     _menuPathMainBiz = menuPathMainBiz;
     //_productBiz = productBiz;
     _userBiz = userBiz;
 }
        private List <string> picturesForMenuPath(MenuPath1 mp1, MenuPath2 mp2)
        {
            //get all menupaths with mp1 and mp2
            mp1.IsNullThrowException();
            mp2.IsNullThrowException();

            List <MenuPathMain> mpmList = MenuPathMainBiz.FindAll().Where(x => x.MenuPath1Id == mp1.Id && x.MenuPath2Id == mp2.Id).ToList();

            if (mpmList.IsNullOrEmpty())
            {
                return(null);
            }

            List <string> picList = new List <string>();

            foreach (MenuPathMain mpm in mpmList)
            {
                List <string> picListFromMpm = picturesForMenuPath(mpm);
                if (!picListFromMpm.IsNullOrEmpty())
                {
                    picList = picList.Concat(picListFromMpm).ToList();
                }
            }

            return(picList);
        }
Exemple #3
0
        public ShopVM Setup_To_Create_Shop_Get(string returnUrl, string menuPathMainId)
        {
            menuPathMainId.IsNullOrWhiteSpaceThrowException("No Menu Path");
            UserId.IsNullOrWhiteSpaceThrowException("You must be logged in to continue.");
            decimal ratePerMonth = getShopRatePerMonth();
            int     noOfMonths   = 1;
            decimal totalAmount  = ratePerMonth * noOfMonths;

            AddressStringWithNames customerAddress = getDefaultCustomerAddress();
            MenuPathMain           mpm             = MenuPathMainBiz.Find(menuPathMainId);

            mpm.IsNullThrowException("Menu Path not found");

            CashDistributionEngine cashDistributionEnginge = get_CashDistributionEngineAndCheckBalance(totalAmount, true);

            string explaintion = string.Format("{0}. All your products will be collected and will be shown in your shop. Note, every shop must have a unique name and will be created in its own area. This shop will be created in: ", cashDistributionEnginge.Message);



            List <string> shopNames = getShopNamesForCurrUser();
            string        shopName  = getAUniqueNameForShop();

            ShopVM shopCreate = new ShopVM("", shopName, explaintion, noOfMonths, ratePerMonth, returnUrl, shopNames, mpm, customerAddress);

            return(shopCreate);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="menuPath1Id"></param>
        /// <param name="menupath2Id"></param>
        public void getPeopleFromMp2Etc(string menuPath1Id, string menupath2Id)
        {
            menuPath1Id.IsNullOrWhiteSpaceThrowArgumentException("menuPath1Id");
            menupath2Id.IsNullOrWhiteSpaceThrowArgumentException("menupath2Id");

            List <MenuPathMain> mpmList = MenuPathMainBiz.FindAll()
                                          .Where(x =>
                                                 x.MenuPath1Id == menuPath1Id &&
                                                 x.MenuPath2Id == menupath2Id)
                                          .ToList();

            if (!mpmList.IsNullOrEmpty())
            {
                foreach (var mpm in mpmList)
                {
                    //this will also get the likes
                    getPeopleFromMp3Etc(mpm);

                    if (!mpm.MenuPath2.IsNull())
                    {
                        if (!mpm.MenuPath2.LikeUnlikes.IsNull())
                        {
                            AddLikes(mpm.MenuPath2.LikeUnlikes);
                        }
                    }
                }
            }
        }
Exemple #5
0
        private MenuPathMain getMainMenuPath(ShopVM shopCreate)
        {
            MenuPathMain mpm = MenuPathMainBiz.Find(shopCreate.MenuPathMainId);

            mpm.IsNullThrowException("Menu Path Not Found.");
            return(mpm);
        }
Exemple #6
0
        public GlobalCommentBiz(MenuPathMainBiz menuPathMainBiz, ProductBiz productBiz, UserBiz userBiz, IRepositry <GlobalComment> entityDal, BizParameters bizParameters)
            : base(entityDal, bizParameters)

        {
            _menuPathMainBiz = menuPathMainBiz;
            _productBiz      = productBiz;
            _userBiz         = userBiz;
        }
        //private ICollection<OwnersChildProductsWithLink> loadOwnersChildProductsWithLinks(HashSet<ProductChild> childProductsBelongingToUserFrom)
        //{
        //    if (childProductsBelongingToUserFrom.IsNullOrEmpty())
        //        return null;

        //    List<OwnersChildProductsWithLink> ownersChildProductsWithLinkLst = new List<OwnersChildProductsWithLink>();

        //    foreach (ProductChild productChild in childProductsBelongingToUserFrom)
        //    {
        //        string saleLink = createLandingPageLinkForProductChild(productChild);
        //        OwnersChildProductsWithLink ownersChildProductsWithLink = new OwnersChildProductsWithLink(productChild, saleLink);
        //    }

        //    return ownersChildProductsWithLinkLst;
        //}

        //private string createLandingPageLinkForProductChild(ProductChild productChild)
        //{
        //    //Url.Action("ProductChildLandingPage", "ProductChilds", new { productChildId = menuVar.IdForEdit, menuEnum = Model.MenuManager.MenuState.NextMenu, returnUrl = returnUrl });
        //}

        private MenuPathMain getMpm(string menuPathMainId)
        {
            menuPathMainId.IsNullOrWhiteSpaceThrowArgumentException("menuPathMainId");
            MenuPathMain mpm = MenuPathMainBiz.Find(menuPathMainId);

            mpm.IsNullThrowException("mpm");
            return(mpm);
        }
Exemple #8
0
 public MenuBiz(MenuPathMainBiz menuPathMainBiz, ProductBiz productBiz, IRepositry <MenuPathMain> entityDal, BizParameters bizParameters, CashTrxBiz cashTrxBiz, BankBiz bankBiz, OwnerBiz ownerBiz, AddressBiz addressBiz)
     : base(entityDal, bizParameters)
 {
     _menuPathMainBiz = menuPathMainBiz;
     _productBiz      = productBiz;
     _productChildBiz = productBiz.ProductChildBiz;
     //_likeUnlikeBiz = likeUnlikeBiz;
     _cashTrxBiz = cashTrxBiz;
     _bankBix    = bankBiz;
     _ownerBiz   = ownerBiz;
     //_addressBiz = addressBiz;
     _addressBiz = addressBiz;
 }
        //private List<string> GetProductPicturesForWrapper(Product product)
        //{

        //    //int noOfImages = 0;
        //    int returnNoOfPictures = MenuPath1.MaxNumberOfPicturesInMenu();
        //    //int getNoOfPicturesToSelectFrom = returnNoOfPictures * 20;



        //    //get products pictures
        //    List<string> pictureAddresses = GetCurrItemsPictureList(product);

        //    List<string> pictureList = getPicturesForProduct(product);

        //    if (pictureList.IsNullOrEmpty())
        //        return pictureAddresses;

        //    //Randomize the list
        //    List<string> pictureList_Random = pictureList.OrderBy(x => Guid.NewGuid()).ToList();

        //    if (pictureList_Random.Count > returnNoOfPictures)
        //        return pictureList_Random.GetRange(0, returnNoOfPictures);

        //    return pictureList_Random;
        //}
        //private List<string> getPicturesForProduct(Product product)
        //{
        //    int noOfImages = 0;
        //    int returnNoOfPictures = MenuPath1.MaxNumberOfPicturesInMenu();
        //    int getNoOfPicturesToSelectFrom = returnNoOfPictures * 20;
        //    string defaultFileLocation = UploadedFile.DefaultBlankPictureLocation();

        //    List<string> pictureList = new List<string>();
        //    foreach (ProductChild pchild in product.ProductChildren_Fixed)
        //    {
        //        if (noOfImages == getNoOfPicturesToSelectFrom)
        //            break;

        //        if (pchild.MiscFiles_Fixed.IsNullOrEmpty())
        //            continue;

        //        //getImageAddressOf()
        //        //get one from each product until we have 5
        //        foreach (UploadedFile upf in pchild.MiscFiles_Fixed)
        //        {
        //            if (noOfImages == getNoOfPicturesToSelectFrom)
        //                break;

        //            if (!upf.IsImage())
        //                continue;

        //            string imageLocation = getImageAddressOf(upf);

        //            if (imageLocation.IsNullOrWhiteSpace())
        //                continue;

        //            if (imageLocation.ToLower() == defaultFileLocation.ToLower())
        //                continue;

        //            pictureList.Add(imageLocation);
        //            noOfImages++;
        //            break;
        //        }

        //    }
        //    return pictureList;

        //}



        /// <summary>
        /// this counts the views of Mp2
        /// </summary>
        /// <param name="mpm"></param>
        /// <returns></returns>
        private long getMp2Count(MenuPathMain mpm)
        {
            if (mpm.IsNull())
            {
                return(0);
            }

            long count = MenuPathMainBiz
                         .FindAll()
                         .Where(x => x.MenuPath1Id == mpm.MenuPath1Id && x.MenuPath2Id == mpm.MenuPath2Id)
                         .Sum(y => y.NoOfVisits.Amount);

            return(count);
        }
Exemple #10
0
        private async Task <List <ICommonWithId> > indexProduct_DataListAsync(ControllerIndexParams parms)
        {
            //get the menupathMain
            MenuPathMain mpm = await FindAsync(parms.MenuPathMainId);

            mpm.IsNullThrowException("Menu Path does note exist. Something is wrong.");

            //Get all the products listed by it
            List <Product> listOfProducts = mpm.Products_Fixed_And_Approved;

            //update the count of Menu3Path
            MenuPath3 mp3 = MenuPathMainBiz.MenuPath3Biz.FindAll().FirstOrDefault(x => x.Id == mpm.MenuPath3Id);

            if (!mp3.IsNull())
            {
                if (!UserId.IsNullOrWhiteSpace())
                {
                    mpm.NoOfVisits.AddOne(UserId, UserName);
                    MenuPathMainBiz.Update(mpm);

                    //these can be wrng if they also describe other paths
                    //this is how many times this particular picture has been clicked

                    mp3.NoOfVisits.AddOne(UserId, UserName);
                    await MenuPathMainBiz.MenuPath3Biz.UpdateAndSaveAsync(mp3);
                }
            }



            if (listOfProducts.IsNullOrEmpty())
            {
                return(null);
            }


            List <ICommonWithId> pclst = listOfProducts.Cast <ICommonWithId>().ToList();

            return(pclst);
        }
Exemple #11
0
        public override void BusinessRulesFor(ControllerCreateEditParameter parm)
        {
            if (IsCreate)
            {
                Product product = Product.Unbox(parm.Entity);
                product.IsUnApproved = false;

                Owner owner = OwnerBiz.GetPlayerFor(UserId);
                owner.IsNullThrowException("You must first become a seller. Go to ' I Want To...' to become a seller.");

                product.OwnerId = owner.Id;

                if (owner.Shops.IsNull())
                {
                    owner.Shops = new List <Product>();
                }

                owner.Shops.Add(product);


                product.MainMenuIdForShop.IsNullOrWhiteSpaceThrowException();
                MenuPathMain mpm = MenuPathMainBiz.Find(product.MainMenuIdForShop);

                mpm.IsNullThrowException();
                if (mpm.Products.IsNull())
                {
                    mpm.Products = new List <Product>();
                }
                if (product.MenuPathMains.IsNull())
                {
                    product.MenuPathMains = new List <MenuPathMain>();
                }
                mpm.Products.Add(product);
                product.MenuPathMains.Add(mpm);
            }

            base.BusinessRulesFor(parm);
        }
Exemple #12
0
 public override void Fix(ControllerCreateEditParameter parm)
 {
     base.Fix(parm);
     MenuPathMainBiz.Fix(parm);
 }
Exemple #13
0
 public SelectList MenuPath2_SelectList_FilteredFor(MenuPath1ENUM menuPath1Enum)
 {
     return(MenuPathMainBiz.MenuPath2_SelectList_FilteredFor(menuPath1Enum));
 }
Exemple #14
0
 public SelectList MenuPath3_SelectList()
 {
     return(MenuPathMainBiz.MenuPath3_SelectList());
 }