Esempio n. 1
0
 public void GetDataList()
 {
     for (int i = 0; i < categoryList.gameObject.transform.childCount; i++)
     {
         CategoryListItem categoryListItem = categoryList.gameObject.transform.GetChild(i).gameObject.transform.GetComponent <CategoryListItem>();
         if (dataList.Count == 0)
         {
             dataList.Add(new DataList(categoryListItem));
         }
         if (dataList.Count > 0)
         {
             //Check all categoryName in playerDataList
             if (dataList.Any(category => category.categoryName == categoryListItem.categoryName))
             {
                 //get numbers of completed level
                 foreach (var data in dataList)
                 {
                     if (data.categoryName == categoryListItem.categoryName)
                     {
                         data.completedLevel = categoryListItem.NumOfActiveLevel;
                     }
                 }
             }
             else if (dataList.Any(category => category.categoryName != categoryListItem.categoryName))
             {
                 dataList.Add(new DataList(categoryListItem));
             }
         }
     }
 }
        private async void CompleteAnimationWithItems(CategoryListItem item)
        {
            CategoryList.Remove(item);
            CategoryList.Insert(0, item);

            await Task.Delay(100);

            foreach (var cat in CategoryList)
            {
                try
                {
                    var ani = ConnectedAnimationService.GetForCurrentView().GetAnimation(cat.Title);
                    if (ani != null)
                    {
                        await Category.TryStartConnectedAnimationAsync(ani, cat, "Panel");
                    }
                }
                catch (Exception)
                {
                }
            }
            foreach (var cat in CategoryList)
            {
                cat.IsCurrent = false;
            }

            item.IsCurrent = true;
        }
        public static IList <CategoryListItem> ToCategoryListItem(IList <Category> categories)
        {
            var categoriesList = new List <CategoryListItem>();

            foreach (var category in categories)
            {
                var categoryListItem = new CategoryListItem
                {
                    Id          = category.Id,
                    IsPublished = category.IsPublished,
                    Name        = category.Name
                };

                var parentCategory = category.Parent;
                while (parentCategory != null)
                {
                    categoryListItem.Name = $"{parentCategory.Name} >> {categoryListItem.Name}";
                    parentCategory        = parentCategory.Parent;
                }

                categoriesList.Add(categoryListItem);
            }

            return(categoriesList.OrderBy(x => x.Name).ToList());
        }
Esempio n. 4
0
        public IList <CategoryListItem> GetAll()
        {
            var categories     = _categoryRepository.Query().Where(x => !x.IsDeleted).ToList();
            var categoriesList = new List <CategoryListItem>();

            foreach (var category in categories)
            {
                var categoryListItem = new CategoryListItem
                {
                    Id          = category.Id,
                    IsPublished = category.IsPublished,
                    Name        = category.Name
                };

                var parentCategory = category.Parent;
                while (parentCategory != null)
                {
                    categoryListItem.Name = $"{parentCategory.Name} >> {categoryListItem.Name}";
                    parentCategory        = parentCategory.Parent;
                }

                categoriesList.Add(categoryListItem);
            }

            return(categoriesList.OrderBy(x => x.Name).ToList());
        }
Esempio n. 5
0
        public async Task <IList <CategoryListItem> > GetAll()
        {
            var categories = await _categoryRepository.Query().Where(x => !x.IsDeleted).ToListAsync();

            var categoriesList = new List <CategoryListItem>();

            foreach (var category in categories)
            {
                var categoryListItem = new CategoryListItem
                {
                    Id            = category.Id,
                    IsPublished   = category.IsPublished,
                    IncludeInMenu = category.IncludeInMenu,
                    Name          = category.Name,
                    DisplayOrder  = category.DisplayOrder,
                    ParentId      = category.ParentId
                };

                var parentCategory = category.Parent;
                while (parentCategory != null)
                {
                    categoryListItem.Name = $"{parentCategory.Name} >> {categoryListItem.Name}";
                    parentCategory        = parentCategory.Parent;
                }

                categoriesList.Add(categoryListItem);
            }

            return(categoriesList.OrderBy(x => x.Name).ToList());
        }
Esempio n. 6
0
    public void SetupCategory()
    {
        categoryItemObjectPool.ReturnAllObjectsToPool();

        for (int i = 0; i < GuessManager.Instance.CategoryInfos.Count; i++)
        {
            CategoryInfo     categoryInfo     = GuessManager.Instance.CategoryInfos[i];
            CategoryListItem categoryListItem = gameObject.transform.GetChild(1).GetChild(i).transform.GetComponent <CategoryListItem>();
            categoryListItem.Setup(categoryInfo);
            categoryListItem.gameObject.SetActive(true);
        }
    }
Esempio n. 7
0
        // GET : Edit
        public ActionResult Edit(int id)
        {
            var service = CreateCategoryService();
            var detail  = service.GetCategoryByID(id);
            var model   =
                new CategoryListItem
            {
                CategoryID   = detail.CategoryID,
                CategoryName = detail.CategoryName
            };

            return(View(model));
        }
Esempio n. 8
0
 //increase numbers of active level in category
 public void IncreaseCategoryLevelNumber()
 {
     for (int i = 0; i < categoryList.transform.childCount; i++)
     {
         CategoryListItem categoryListItem = categoryList.transform.GetChild(i).GetComponent <CategoryListItem>();
         if (activeCategoryInfo == categoryListItem.categoryName)
         {
             if (type == LevelListItem.Type.Normal)
             {
                 categoryListItem.NumOfActiveLevel++;
             }
         }
     }
 }
Esempio n. 9
0
        public IHttpActionResult Delete([FromUri] int id)
        {
            CategoryListItem item = _service.GetCategoryById(id);

            if (item == null)
            {
                return(NotFound());
            }
            if (_service.DeleteCategory(id))
            {
                return(Ok());
            }
            return(InternalServerError());
        }
Esempio n. 10
0
        public static CategoryListItem[] FindCategories(string eBayToken, string searchTerm)
        {
            // Get suggested categories from Ebay
            var categories = EbayClientHelper.FindCategories(eBayToken, searchTerm);

            // Convert into POCO objects
            var ret = new List <CategoryListItem>();

            foreach (var a in categories)
            {
                // Build list of parent categories
                var parents = new List <CategoryListItem>();
                for (int i = 0; i < a.Category.CategoryParentID.Count; i++)
                {
                    var category = new CategoryListItem
                    {
                        Id   = a.Category.CategoryParentID[i].ToIntOrDefault().Value,
                        Name = a.Category.CategoryParentName[i]
                    };
                    parents.Add(category);
                }

                // Go through the categories and determine what the full category
                // name is (with parents included in the string)
                var fullCategoryName = new StringBuilder();
                foreach (var item in parents)
                {
                    fullCategoryName.Append(item.Name);
                    item.FullName = fullCategoryName.ToString();
                    fullCategoryName.Append(" > ");
                }
                fullCategoryName.Append(a.Category.CategoryName);

                // Create new category
                var newItem = new CategoryListItem();
                newItem.Id       = a.Category.CategoryID.ToIntOrDefault().Value;
                newItem.Name     = a.Category.CategoryName;
                newItem.FullName = fullCategoryName.ToString();
                ret.Add(new CategoryListItem
                {
                    Id       = a.Category.CategoryID.ToIntOrDefault().Value,
                    Name     = a.Category.CategoryName,
                    FullName = fullCategoryName.ToString(),
                    Parents  = parents.ToArray()
                });
            }
            return(ret.ToArray());
        }
Esempio n. 11
0
        private List <CategoryListItem> GetChildCategoryList(IPublishedContent page)
        {
            List <CategoryListItem> listItems = null;
            var childPages = page.Children.Where(x => x.IsVisible()).Where(x => x.Level <= 2).Where(x => !x.HasValue("excludeFromTopCategory") || (x.HasValue("excludeFromTopCategory") && !x.Value <bool>("excludeFromTopCategory")));

            if (childPages != null && childPages.Any() && childPages.Count() > 0)
            {
                listItems = new List <CategoryListItem>();
                foreach (var childPage in childPages)
                {
                    CategoryListItem listItem = new CategoryListItem(new CategoryLink(childPage.Url, childPage.Name));
                    listItem.Items = GetChildCategoryList(childPage);
                    listItems.Add(listItem);
                }
            }
            return(listItems);
        }
Esempio n. 12
0
        public ActionResult GetCategory(int id)
        {
            var category = moneyRepository.GetCategory(id);

            if (category == null)
            {
                return(NotFound());
            }

            if (category.UserId != CurrentUserId)
            {
                return(Unauthorized());
            }

            var vm = new CategoryListItem(category);

            return(Ok(vm));
        }
Esempio n. 13
0
        public IHttpActionResult Put([FromBody] CategoryEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            CategoryListItem item = _service.GetCategoryById(model.Id);

            if (item == null)
            {
                return(NotFound());
            }
            if (_service.UpdateCategory(model))
            {
                return(Ok());
            }
            return(InternalServerError());
        }
Esempio n. 14
0
    public override void OnShowing(object data)
    {
        categoryItemObjectPool.ReturnAllObjectsToPool();

        for (int i = 0; i < GameManager.Instance.CategoryInfos.Count; i++)
        {
            CategoryInfo categoryInfo = GameManager.Instance.CategoryInfos[i];

            // If its the daily puzzle category the don't show it in the list of categories
            if (categoryInfo.name == GameManager.dailyPuzzleId)
            {
                continue;
            }

            CategoryListItem categoryListItem = categoryItemObjectPool.GetObject().GetComponent <CategoryListItem>();

            categoryListItem.Setup(categoryInfo);
            categoryListItem.gameObject.SetActive(true);
        }
    }
Esempio n. 15
0
    public void LoadData()
    {
        PlayerData dataList = SaveLoadSystem.Load();

        if (dataList != null)
        {
            for (int i = 0; i < categoryList.gameObject.transform.childCount; i++)
            {
                CategoryListItem categoryListItem = categoryList.gameObject.transform.GetChild(i).gameObject.transform.GetComponent <CategoryListItem>();
                foreach (var data in dataList.dataList)
                {
                    if (data.categoryName == categoryListItem.categoryName)
                    {
                        categoryListItem.NumOfActiveLevel = data.completedLevel;
                    }
                }
            }
            CoinNumber = dataList.coins;
        }
    }
Esempio n. 16
0
        public ActionResult Edit(int id, CategoryListItem model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.CategoryID != id)
            {
                ModelState.AddModelError("", "ID Mismatch");
            }

            var service = CreateCategoryService();

            if (service.UpdateCategory(model))
            {
                TempData["SaveResult"] = "Your category was updated.";
                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError("", "Your category could not be updated.");
            return(View(model));
        }
Esempio n. 17
0
        private void AddViews(IEnumerable <IRokredListChildDataSource> source)
        {
            foreach (var category in source.OfType <CategoryVmi>())
            {
                var view = new CategoryListItem(category);
                view.SelectedCategory = SelectedItem as CategoryVmi;
                var button = new RokredButton();
                button.Content = view;

                button.Command          = ListItemTappedCommand;
                button.CommandParameter = category;

                StackChildren.Children.Add(button);
            }

            foreach (var subject in source.OfType <SubjectVmi>())
            {
                var view   = new SubjectListItem(subject);
                var button = new RokredButton();
                button.Content = view;

                button.Command          = ListItemTappedCommand;
                button.CommandParameter = subject;

                StackChildren.Children.Add(button);
            }
            foreach (var opinion in source.OfType <OpinionVmi>())
            {
                var view   = new OpinionListItem(opinion);
                var button = new RokredButton();
                button.Content = view;

                button.Command          = ListItemTappedCommand;
                button.CommandParameter = opinion;

                StackChildren.Children.Add(button);
            }
        }
Esempio n. 18
0
        public static IList<CategoryListItem> ToCategoryListItem(IList<Category> categories)
        {
            var categoriesList = new List<CategoryListItem>();
            foreach (var category in categories)
            {
                var categoryListItem = new CategoryListItem
                {
                    Id = category.Id,
                    IsPublished = category.IsPublished,
                    Name = category.Name
                };

                var parentCategory = category.Parent;
                while (parentCategory != null)
                {
                    categoryListItem.Name = $"{parentCategory.Name} >> {categoryListItem.Name}";
                    parentCategory = parentCategory.Parent;
                }

                categoriesList.Add(categoryListItem);
            }

            return categoriesList.OrderBy(x => x.Name).ToList();
        }
Esempio n. 19
0
 public DataList(CategoryListItem categoryListItem)
 {
     categoryName   = categoryListItem.categoryName;
     completedLevel = categoryListItem.NumOfActiveLevel;
 }
        // GET: Category
        public ActionResult Index()
        {
            var model = new CategoryListItem[0];

            return(View());
        }