Ejemplo n.º 1
0
        public void ListLoad()
        {
            Sales.Clear();

            var lines = FILE.read(path_sale);

            if (lines == null)
            {
                return;
            }

            foreach (string line in lines)
            {
                try
                {
                    var datas = line.Split(',');
                    Sales.Add(new Sale
                    {
                        date    = datas[0],
                        count   = datas[1],
                        total   = Convert.ToInt32(datas[2]),
                        product = new Product()
                        {
                            code     = datas[3],
                            category = datas[4],
                            name     = datas[5],
                            price    = Convert.ToInt32(datas[6]),
                            comment  = datas[7],
                        }
                    });
                }
                catch { continue; }
            }
            ListADD();
        }
Ejemplo n.º 2
0
        async Task ExecuteLoadSalesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Sales.Clear();
                var sales = await DataStore.GetItemsAsync(true);

                foreach (var sale in sales)
                {
                    Sales.Add(sale);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Clear Storage
 /// </summary>
 public static void Clear()
 {
     FileNamesRead.Clear();
     FileNamesErrors.Clear();
     Customers.Clear();
     Sales.Clear();
     Sellers.Clear();
 }
Ejemplo n.º 4
0
        private async void SearchHandler(object param)
        {
            Sales.Clear();

            var textBox     = param as TextBox;
            var searchQuery = textBox.Text;

            var sales = await _context.Sales
                        .Where(e => e.Name.Contains(searchQuery))
                        .ToListAsync();

            foreach (var sale in sales)
            {
                Sales.Add(sale);
            }

            RaisePropertyChanged("Sales");
        }
Ejemplo n.º 5
0
        private void populateSales()
        {
            if (Sales != null)
            {
                Sales.Clear();
            }
            else
            {
                Sales = new ObservableCollection <Sale>();
            }

            IEnumerable <Sale> sales = _context.Sales.getSalesOf(minDate, maxDate, selectedProduct != NullProduct ? selectedProduct : null, selectedStore != NullStore ? selectedStore : null);

            foreach (Sale sale in sales)
            {
                sale.PropertyChanged += (s, e) => saveChangesCommand.RaiseCanExecuteChanged();
                Sales.Add(sale);
            }
            RaisePropertyChanged("TotalSum");
            RaisePropertyChanged("TotalAmount");
        }
Ejemplo n.º 6
0
        private async void FilterHasChangedAsync(SaleFilterHasChangedEventArgs obj)
        {
            //Since filter is used after any field got changed, we need to make sure
            //that we are not running more than one process at the time
            if (_isFilterWorking == false)
            {
                _isFilterWorking = true;
                var sales = await _carRepository.ApplySaleFilterAsync(SaleFiltersViewModel, obj.SaleFilter);

                Sales.Clear();
                TotalGrossSales = 0;
                TotalCars       = 0;
                foreach (var sale in sales)
                {
                    Sales.Add(new SaleListItemViewModel(sale, _eventAggregator));
                    TotalGrossSales += sale.SalePrice;
                    TotalCars++;
                }

                _isFilterWorking = false;
            }
        }
Ejemplo n.º 7
0
        private async Task LoadSearchResults()
        {
            var startTime = DateTime.Now;

            try
            {
                var sales = await _saleBussinessLogic.SearchSaleList(_searchPageIndex, string.IsNullOrEmpty(SearchText)? 0 : Convert.ToInt32(SearchText, CultureInfo.InvariantCulture), _selectedSaleDate);

                // Resetting the Collection if Search is instantiated
                if (_searchPageIndex == 1)
                {
                    Sales.Clear();
                }

                PopulateSales(sales);
            }
            finally
            {
                SearchText = string.Empty;
                var endTime = DateTime.Now;
                _log.Info(string.Format("Time Taken In Search Suspended Sales  is {0}ms", (endTime - startTime).TotalMilliseconds));
            }
        }
Ejemplo n.º 8
0
 public void ListRESET()
 {
     Sales.Clear();
     Sales.Add(new Sale());
 }
Ejemplo n.º 9
0
 private void LoadItems(object obj)
 {
     Sales.Clear();
     GetSales();
 }
Ejemplo n.º 10
0
 private void SearchItem(object obj)
 {
     Sales.Clear();
     GetSales();
 }