public void AddProduct(Product Pr)
        {
            IEnumerable <IEnumerable <Product> > products = DataProcessor.LoadJson <IEnumerable <Product> >(Tools.Utils.ProductsPath);
            IEnumerable <Product> filteredProducts        = new List <Product>();

            filteredProducts = products.SelectMany(iepr => iepr.Where(Prod =>
                                                                      Prod.Name == Pr.Name &&
                                                                      Prod.PriceUnit == Pr.PriceUnit &&
                                                                      Prod.Category == Pr.Category &&
                                                                      Prod.Shop == Pr.Shop));

            ScannedProduct pr = new ScannedProduct()
            {
                Shop      = Pr.Shop,
                Name      = Pr.Name,
                PriceUnit = Pr.PriceUnit,
                Price     = Convert.ToDouble(Pr.Price),
                Id        = (from fil in filteredProducts
                             select fil.Id).First()
            };

            ProductEditor.AddProducts(pr);
        }
 public string ComparePrices()
 {
     return(ProductEditor.ComparePrices(Tools.Utils.ProductsPath));
 }
Exemple #3
0
 private void MainViewModel_ProductEditingStarted(object sender, EventArgs e)
 {
     _editorView = new ProductEditor(); // külön szerkesztő dialógus az épületekre
     _editorView.DataContext = _mainViewModel;
     _editorView.Show();
 }