예제 #1
0
 /// <summary>
 /// Configures the UITableView's datasource, and forces a reload of the data from the database.
 /// </summary>
 public void ReloadData()
 {
     _data = new CategoriesData();
     _categoriesTableSource = new CategoriesTableSource(_data, this);
     TableView.Source       = _categoriesTableSource;
     TableView.ReloadData();
 }
예제 #2
0
 public static void Initialize(IServiceProvider serviceProvider)
 {
     using (var context = new ApplicationDbContext(
                serviceProvider.GetRequiredService <
                    DbContextOptions <ApplicationDbContext> >()))
     {
         if (!context.Users.Any())
         {
             UsersData usersData = new UsersData();
             context.AddRange(usersData.users);
             context.SaveChanges();
         }
         if (!context.Categories.Any())
         {
             CategoriesData category = new CategoriesData();
             context.AddRange(category.categories);
             context.SaveChanges();
         }
         if (!context.Products.Any())
         {
             ProductsData productsData = new ProductsData();
             context.AddRange(productsData.products);
             context.SaveChanges();
         }
     }
 }
예제 #3
0
        private async Task LoadViewModel()
        {
            if (viewModelList == null || RefreshedNext < DateTime.Now)
            {
                RefreshedNext = DateTime.Now.AddMinutes(40);

                var categories = await CategoriesData.GetCategoriesAsync();

                CategoryViewModel cvm;
                foreach (var item in categories)
                {
                    if (!string.IsNullOrEmpty(item.LatestDealId))
                    {
                        cvm = new CategoryViewModel();
                        cvm.CategoryName = item.Name;
                        cvm.LatestDealId = item.LatestDealId;
                        cvm.CategoryId   = item.CategoryId;

                        viewModelList.Add(cvm);
                    }
                }

                itemsViewSource.Source = viewModelList;

                foreach (var item in viewModelList)
                {
                    item.DealCountInCategory = await DealData.GetDealCount(item.CategoryId);

                    var image = await DealImageData.GetDealImageAsync(item.LatestDealId, "250x250");

                    item.LatestImageUrl = image.ImageUrl;
                }
            }
        }
 /// <summary>
 /// Configures the UITableView's datasource, and forces a reload of the data from the database.
 /// </summary>
 public void ReloadData()
 {
     _data = new CategoriesData();
     _categoriesTableSource = new CategoriesTableSource(_data, this);
     TableView.Source = _categoriesTableSource;
     TableView.ReloadData();
 }
예제 #5
0
        /// <summary>
        /// Determines whether a installed package file is out of date by checking current package files in the database.
        /// </summary>
        /// <param name="modsData"></param>
        /// <param name="categoriesData"></param>
        /// <param name="packageFile"></param>
        /// <returns></returns>
        public bool IsPackageFileOldVersion(ModsData modsData, CategoriesData categoriesData, PackageFile packageFile)
        {
            foreach (var modItem in modsData.Mods)
            {
                if (modItem.GetCategoryType(categoriesData) == CategoryType.Homebrew)
                {
                    if (packageFile.Id.Equals(modItem.Id))
                    {
                        try
                        {
                            Version oldVersion = Version.Parse(packageFile.Version);
                            Version newVersion = Version.Parse(modItem.Version);

                            if (oldVersion.CompareTo(newVersion) < 0)
                            {
                                return(true);
                            }
                        }
                        catch
                        {
                            return(false);
                        }
                    }
                }
            }

            return(false);
        }
예제 #6
0
    public BWDataManager(AGGameIndex gameIndex, int categoryIndex, string file)
    {
        if (gameIndex == AGGameIndex.k_Beeworld_NumberSequence)
        {
            currentCategoryID = 179;
            currentCategory   = "Number Sequence";
        }
        else
        {
            if (categoryIndex == 0)
            {
                currentCategoryID = 178;
                currentCategory   = "Counting Up From";
            }
            else
            {
                currentCategoryID = 180;
                currentCategory   = "Counting Down From";
            }
        }

        CategoriesData data = CategoriesData.getSharedData(file);
        Hashtable      numberSequenceData = data.getGameDataForIndex(gameIndex);
        ArrayList      availableCat       = (ArrayList)numberSequenceData["availableCategories"];

        allLevels = (Hashtable)availableCat[categoryIndex];

#if (!MAC_PLATFORM)
        coreManager           = new CoreDataManager(currentCategoryID);
        allCategoriesCoreData = coreManager.getResultDict();
        currentLevel          = coreManager.getCurrentLevel();
#endif
        fetchLevelData();
    }
 public IHttpActionResult Put(CategorieDTO pCategorieDTO)
 {
     if (!CategoriesData.updateCategorie(pCategorieDTO))
     {
         return(BadRequest());
     }
     return(Ok());
 }
 public IHttpActionResult putAtrributeList(AttributeListDTO pAttributeList)
 {
     if (!CategoriesData.updateAttributeList(pAttributeList))
     {
         return(BadRequest());
     }
     return(Ok());
 }
 public IHttpActionResult putGeneralAtrribute(GeneralAttributeDTO pGeneralAttributeDTO)
 {
     if (!CategoriesData.updateGeneralAttribute(pGeneralAttributeDTO))
     {
         return(BadRequest());
     }
     return(Ok());
 }
 public IHttpActionResult postAttributeList(AttributeListDTO pAttributeList)
 {
     if (!CategoriesData.insertAttributeList(pAttributeList))
     {
         return(BadRequest());
     }
     return(Ok());
 }
 public IHttpActionResult Delete(string id_categorie)
 {
     if (!CategoriesData.deleteCategorie(id_categorie))
     {
         return(BadRequest());
     }
     return(Ok());
 }
 public IHttpActionResult DeletePersonalAttribute(string id_attribute, string userLog)
 {
     if (!CategoriesData.deletePersonalAttribute(id_attribute, userLog))
     {
         return(BadRequest());
     }
     return(Ok());
 }
 public IHttpActionResult putPersonalAtrribute(PersonalAttributeDTO pPersonaAttributeDTO)
 {
     if (!CategoriesData.updatePersonalAttribute(pPersonaAttributeDTO))
     {
         return(BadRequest());
     }
     return(Ok());
 }
 public IHttpActionResult DeleteAttributeList(string id_attributeValue, string user)
 {
     if (!CategoriesData.deleteAttributeList(id_attributeValue, user))
     {
         return(BadRequest());
     }
     return(Ok());
 }
예제 #15
0
        public async void BindDataAsync()
        {
            var category = await CategoriesData.GetCategoryAsync(CategoryIdParam);

            var country = await CountryData.GetCountryAsync(CountryIdParam);

            pageTitle.Text = category.Name + " from " + country.CountryName;

            await LoadViewModel();
        }
        public async Task SeedAsync(ApplicationDbContext dbContext, IServiceProvider serviceProvider)
        {
            if (dbContext.Categories.Any())
            {
                return;
            }

            var categoriesAndProductsData = CategoriesData.GetCategories();
            await dbContext.Categories.AddRangeAsync(categoriesAndProductsData);
        }
예제 #17
0
    public MADataManager(AGGameIndex gameIndex, int categoryIndex, string file)
    {
        CategoriesData data   = CategoriesData.getSharedData(file);
        Hashtable      maData = data.getGameDataForIndex(gameIndex);

        allLevels = (Hashtable)maData["allLevels"];

#if (!MAC_PLATFORM)
        coreManager           = new CoreDataManager(currentCategoryID);
        allCategoriesCoreData = coreManager.getResultDict();
        currentLevel          = coreManager.getCurrentLevel();
#endif
        fetchLevelData();
    }
예제 #18
0
    public static CategoriesData getSharedData(string file)
    {
        if (file == null) {
            Debug.Log("empty log");
            return null;
        }

        if(sharedData == null) {
            sharedData = new CategoriesData(file);
        }

        if(sharedData == null) {
            Debug.Log("something went wrong ... cannot access categories data from plist");
        }

        return sharedData;
    }
예제 #19
0
        private async Task LoadCategories()
        {
            if (!countryCache.Keys.Contains(CountryIdParam) || RefreshedNext < DateTime.Now)
            {
                RefreshedNext = DateTime.Now.AddMinutes(40);

                var categories = await CategoriesData.GetCategoriesAsync();

                viewModelList = new List <CategoryViewModel>();
                CategoryViewModel cvm;
                foreach (var item in categories)
                {
                    if (!string.IsNullOrEmpty(item.LatestDealId))
                    {
                        cvm = new CategoryViewModel();
                        cvm.CategoryName = item.Name;
                        cvm.LatestDealId = item.LatestDealId;
                        cvm.CategoryId   = item.CategoryId;

                        viewModelList.Add(cvm);
                    }
                }

                countryCache.Add(CountryIdParam, viewModelList);
                var source = countryCache.Where(e => e.Key == CountryIdParam).Select(e => e.Value).Single();

                categoryGridView.ItemsSource = source;

                foreach (var item in source)
                {
                    item.DealCountInCategory = await DealData.GetDealCount(CountryIdParam, item.CategoryId);

                    var image = await DealImageData.GetDealImageAsync(item.LatestDealId, "250x250");

                    item.LatestImageUrl = image.ImageUrl;
                }
            }
            else
            {
                var source = countryCache.Where(e => e.Key == CountryIdParam).Select(e => e.Value).Single();
                categoryGridView.ItemsSource = source;
            }
        }
예제 #20
0
    public JW_DataManager(AGGameIndex gIndex, int categoryIndex, string file)
    {
        _CategoryIndex = categoryIndex;
        gameIndex      = (int)gIndex;

        getSkillIDForGame(gIndex);
        CategoriesData data         = CategoriesData.getSharedData(file);
        Hashtable      shapesData   = data.getGameDataForIndex(gIndex);
        ArrayList      availableCat = (ArrayList)shapesData["skills"];

        allLevels = (Hashtable)availableCat[categoryIndex];

        //----------- Core Communication
        #if (!MAC_PLATFORM)
        coreManager           = new CoreDataManager(currentSkillID);
        allCategoriesCoreData = coreManager.getResultDict();
        currentLevel          = coreManager.getCurrentLevel();
        #endif
    }
예제 #21
0
    public static CategoriesData getSharedData(string file)
    {
        if (file == null)
        {
            Debug.Log("empty log");
            return(null);
        }

        if (sharedData == null)
        {
            sharedData = new CategoriesData(file);
        }

        if (sharedData == null)
        {
            Debug.Log("something went wrong ... cannot access categories data from plist");
        }

        return(sharedData);
    }
        public AttributeListDTO getAttributeList(string id_attributeValue)
        {
            AttributeListDTO attribute = CategoriesData.getAttributeList(id_attributeValue);

            return(attribute);
        }
예제 #23
0
 public ProductsCategoryViewModel(INavigation navigation)
 {
     _categoriesData      = new CategoriesData();
     CategoriesCollection = _categoriesData.GetCategories();
     _navigation          = navigation;
 }
예제 #24
0
 public CategoriesTableSource(CategoriesData data, CategoriesController parentController)
 {
     _questionsDueCount = 0;
     _data             = data;
     _parentController = parentController;
 }
        public IEnumerable <CategorieDTO> Get()
        {
            List <CategorieDTO> categories = CategoriesData.getCategories();

            return(categories);
        }
        public PersonalAttributeDTO getPersonalAttribute(string id_attribute)
        {
            PersonalAttributeDTO attribute = CategoriesData.getPersonalAttribute(id_attribute);

            return(attribute);
        }
 public CategoriesTableSource(CategoriesData data, CategoriesController parentController)
 {
     _questionsDueCount = 0;
     _data = data;
     _parentController = parentController;
 }
        public IEnumerable <AttributeTypeDTO> getAttributeTypes()
        {
            List <AttributeTypeDTO> type = CategoriesData.getAttributeTypes();

            return(type);
        }
        public AttributeTypeDTO getAttributeTypes(string id_type)
        {
            AttributeTypeDTO type = CategoriesData.getAttributeTypes(id_type);

            return(type);
        }
        public GeneralAttributeDTO getGeneralAttribute(string id_attribute)
        {
            GeneralAttributeDTO attribute = CategoriesData.getGeneralAttribute(id_attribute);

            return(attribute);
        }
        public IEnumerable <GeneralAttributeDTO> getGeneralAttributes(string categorie_id)
        {
            List <GeneralAttributeDTO> attributes = CategoriesData.getGeneralAttributes(categorie_id);

            return(attributes);
        }
        public IEnumerable <AttributeListDTO> getAttributesList(string id_attribute)
        {
            List <AttributeListDTO> attributes = CategoriesData.getAttributesList(id_attribute);

            return(attributes);
        }
        public CategorieDTO Get(string id_categorie)
        {
            CategorieDTO categorie = CategoriesData.getCategorie(id_categorie);

            return(categorie);
        }