Example #1
0
        public ProductsCompariserViewModel()
        {
            SelectedFirstProduct = new Product
            {
                ProductName         = "Unknown",
                ProductCarboValue   = 0,
                ProductProteinValue = 0,
                ProductFatValue     = 0,
                ProductPrice        = 0
            };

            SelectedSecondProduct = new Product
            {
                ProductName         = "Unknown",
                ProductCarboValue   = 0,
                ProductProteinValue = 0,
                ProductFatValue     = 0,
                ProductPrice        = 0
            };

            var databaseManager = new ProductDatabaseManager();

            allProductsList = databaseManager.GetAll().ToList();

            ProductsNames = allProductsList.Select(x => x.ProductName).ToList();
        }
        private void ShowResults()
        {
            var databaseConnetor = new ProductDatabaseManager();
            var allProducts      = databaseConnetor.GetAll().ToList();

            ProductCollection = new ObservableCollection <IProduct>(FilterTableProducts.StartFiltration(allProducts, operationList, RowsNumber));
        }
Example #3
0
        public EatenFoodCalculatorViewModel()
        {
            eatenProductCollection = new ObservableCollection <IProduct>();
            SelectedProduct        = new Product
            {
                ProductName         = "Product name",
                ProductCarboValue   = 0,
                ProductProteinValue = 0,
                ProductFatValue     = 0,
                ProductPrice        = 0
            };

            EatenProduct = new Product
            {
                ProductName         = "Product name",
                ProductCarboValue   = 0,
                ProductProteinValue = 0,
                ProductFatValue     = 0,
                ProductPrice        = 0
            };

            eatenFoodSummaryDetails = new List <KeyValuePair <Macronutrients, double> >
            {
                new KeyValuePair <Macronutrients, double>(Macronutrients.Carbo, 0),
                new KeyValuePair <Macronutrients, double>(Macronutrients.Protein, 0),
                new KeyValuePair <Macronutrients, double>(Macronutrients.Fat, 0)
            };

            LeftToEatFoodSummaryDetails = new Collection <KeyValuePair <Macronutrients, double> >
            {
                new KeyValuePair <Macronutrients, double>(Macronutrients.Carbo, 0),
                new KeyValuePair <Macronutrients, double>(Macronutrients.Protein, 0),
                new KeyValuePair <Macronutrients, double>(Macronutrients.Fat, 0)
            };



            foodWeight   = 0;
            eatenCarbo   = 0;
            eatenProtein = 0;
            eatenFat     = 0;


            var databaseManager = new ProductDatabaseManager();

            allProducts = databaseManager.GetAll().ToList();

            ProductNamesList = allProducts.Select(a => a.ProductName).ToList();
        }