/// <summary>
        /// Gets the product regulation parameters.
        /// </summary>
        /// <returns>The product regulation parameters.</returns>
        /// <param name="cell">Cell.</param>
        /// <param name="CategoriesStyles">Parameters styles.</param>
        /// <param name="Last_Category">Last parameter.</param>
        private ProductCell GetProductRegulationParameters(ref ExcelRange cell, ref Dictionary <int, int> CategoriesStyles, ref ProductCell Last_Category, ref string created_at)
        {
            CategoryCell category;

            if (CategoriesStyles.ContainsValue(cell.StyleID))
            {
                foreach (KeyValuePair <int, int> parameter in CategoriesStyles)
                {
                    if (parameter.Value == cell.StyleID)
                    {
                        string cell_text = cell.Text;
                        category = database.category.SelectCategoryByName(ref cell_text);
                        if (category == null)
                        {
                            category                   = new CategoryCell();
                            category.created_at        = created_at;
                            category.category_name     = cell.Text;
                            category.category_position = (short)parameter.Key;
                            category                   = database.category.AddCategory(ref category);
                        }
                        switch (parameter.Key)
                        {
                        case 1:
                            Last_Category.category      = category.category_id;
                            Last_Category.subcat        = -1;
                            Last_Category.second_subcat = -1;
                            break;

                        case 2:
                            Last_Category.subcat        = category.category_id;
                            Last_Category.second_subcat = -1;
                            break;

                        case 3:
                            Last_Category.second_subcat = category.category_id;
                            break;
                        }
                    }
                }
            }
            return(Last_Category);
        }
Example #2
0
        private void LoadCategories()
        {
            this.filterSessionsViewModel.LoadCategories();
            Device.BeginInvokeOnMainThread(
                () =>
            {
                var allCell =
                    new CategoryCell {
                    BindingContext = this.filterSessionsViewModel.AllCategory
                };

                this.TableSectionCategories.Add(allCell);

                foreach (var item in this.filterSessionsViewModel.Categories)
                {
                    this.TableSectionCategories.Add(new CategoryCell {
                        BindingContext = item
                    });
                }
            });
        }
        public string SelectCategories(ref string request, ref Socket handleSocket)
        {
            int?category_id = ConvertSaveString(FindParamFromRequest(ref request, "category_id"));
            int page        = ConvertSaveString(FindParamFromRequest(ref request, "page"));

            if (category_id == -1)
            {
                List <CategoryCell> categories = database.category.SelectCategoriesByPosition(1);
                List <ProductCell>  products   = database.product.SelectProducts(-1, -1, -1);
                logger.WriteLog("Get general categories.", LogLevel.Worker);
                return(JsonCategoriesProducts(categories, products));
            }
            else
            {
                CategoryCell category = database.category.SelectCategoryById(category_id);
                if (category == null)
                {
                    logger.WriteLog("Can not find category with insert id", LogLevel.Error);
                    SendErrorJsonRequest(JsonAnswer(false, "Can not find category with insert id"), handleSocket);
                    return(null);
                }
                List <CategoryCell> categories        = new List <CategoryCell>();
                List <ProductCell>  products          = database.product.SelectProductsByCategory(category.category_id, category.category_position);
                List <int>          findingCategories = database.product.FindNextStepCategories(ref category.category_id, category.category_position);
                foreach (int findCategory in findingCategories)
                {
                    category = database.category.SelectCategoryById(findCategory);
                    if (category != null)
                    {
                        categories.Add(category);
                    }
                }
                logger.WriteLog("Select categories and products by category_id=" + category_id, LogLevel.Worker);
                return(JsonCategoriesProducts(categories, products));
            }
        }
Example #4
0
        public AppsCollectionViewSource(CategoryCell categoryCell, UICollectionView collectionView, string cellId) : base(collectionView, new NSString(cellId))
        {
            _categoryCell = categoryCell;

            collectionView.RegisterClassForCell(typeof(AppCell), AppCell.Id);
        }
 public LargeAppsCollectionViewSource(CategoryCell categoryCell, UICollectionView collectionView, string cellId) : base(categoryCell, collectionView, cellId)
 {
     collectionView.RegisterClassForCell(typeof(LargeAppCell), LargeAppCell.Id);
 }