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); }
/// <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); } } } } }
//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); }