Пример #1
0
        internal void Execute_LoadProductsListCommand(object parameter)
        {
            //Re-loads the list of products to be shown in the page
            var temp = CategoryCatalog.GetList(Constants.DataFolderPath + Constants.ProductPageOne);

            _products = new ObservableCollection <string>(temp);
        }
Пример #2
0
        /// <summary>
        /// Get items list and title for the pages
        /// </summary>
        /// <param name="pageNumber"></param>
        /// <returns></returns>
        public ObservableCollection <string> GetPageItemsList(int pageNumber)
        {
            List <string> items;

            switch (pageNumber)
            {
            case 1:
            {
                items = CategoryCatalog.GetList(Constants.DataFolderPath + Constants.ProductPageOne);
                _pageOneButtonTitle = items.First();
                items.RemoveAt(0);
                break;
            }

            case 2:
            {
                items = CategoryCatalog.GetList(Constants.DataFolderPath + Constants.ProductPageTwo);
                _pageTwoButtonTitle = items.First();
                items.RemoveAt(0);
                break;
            }

            case 3:
            {
                items = CategoryCatalog.GetList(Constants.DataFolderPath + Constants.ProductPageThree);
                _pageThreeButtonTitle = items.First();
                items.RemoveAt(0);
                break;
            }

            case 4:
            {
                items = CategoryCatalog.GetList(Constants.DataFolderPath + Constants.ProductPageFour);
                _pageFourButtonTitle = items.First();
                items.RemoveAt(0);
                break;
            }

            case 5:
            {
                items = CategoryCatalog.GetList(Constants.DataFolderPath + Constants.ProductPageFive);
                _pageFiveButtonTitle = items.First();
                items.RemoveAt(0);
                break;
            }

            default:
            {
                items = null;
                break;
            }
            }
            return(new ObservableCollection <string>(items));
        }
Пример #3
0
        public List <IProduct> GetProductList(string filePath, out string listName)
        {
            var productList = new List <IProduct>();

            if (InventoryBase._inventory != null)
            {
                //Get codes from product lists
                var list = CategoryCatalog.GetList(filePath);
                //Skip first line, which is title of the list
                for (int i = 1; i < list.Count; ++i)
                {
                    productList.Add(InventoryBase._inventory.GetProduct(list[i]));
                }
                listName = list.First();
                return(productList);
            }
            else
            {
                listName = "Lista";
                return(productList);
            }
        }
Пример #4
0
 /// <summary>
 /// Updates the list of categories from database
 /// </summary>
 public void UpdateCategoriesList()
 {
     CategoriesList = new ObservableCollection <string>(CategoryCatalog.GetList(Constants.DataFolderPath + Constants.CategoryListFileName));
 }
Пример #5
0
        public List <Tuple <string, int, decimal> > GetDataPerCategory(out decimal cashAmount, out decimal cardAmount)
        {
            TotalAmountSold     = 0;
            TotalUnitsSold      = 0;
            _firstReceiptNumber = 0;
            _lastReceiptNumber  = 0;
            cashAmount          = 0;
            cardAmount          = 0;

            string selectedFilePath = String.Empty;

            var categoryData = new List <Tuple <string, int, decimal> >();

            //Open current transaction file and get data
            if (_receiptType == ReceiptType.DailyInternal)
            {
                selectedFilePath = _posData.TransactionMasterDataFilePath;
            }
            else if (_receiptType == ReceiptType.DailyRegular)
            {
                selectedFilePath = _posData.TransactionsDataFilePath;
            }

            using (var parser = new GenericParserAdapter(selectedFilePath))
            {
                parser.ColumnDelimiter      = ',';
                parser.FirstRowHasHeader    = true;
                parser.SkipStartingDataRows = 0;
                parser.SkipEmptyRows        = true;
                parser.MaxBufferSize        = 4096;
                parser.MaxRows = 8000;

                _data = parser.GetDataTable();
            }

            var categories = CategoryCatalog.GetList(Constants.DataFolderPath + Constants.CategoryListFileName); //new CategoryCatalog(_posData.Catalog).categories;

            //Get each category
            foreach (var category in categories)
            {
                decimal amount      = 0M;
                int     itemsNumber = 0;

                for (var index = 0; index < _data.Rows.Count; index++)
                {
                    var row = _data.Rows[index];

                    if (row["CategoriaProducto"].ToString() == category)
                    {
                        var tempAmount = decimal.Parse(row["TotalVendido"].ToString());
                        amount      += tempAmount;
                        itemsNumber += Int32.Parse(row["UnidadesVendidas"].ToString());
                        if (row["MetodoPago"].ToString() == "Cash")
                        {
                            cashAmount += tempAmount;
                        }
                        else
                        {
                            cardAmount += tempAmount;
                        }
                    }
                }

                categoryData.Add(new Tuple <string, int, decimal>(category.ToString(), itemsNumber, amount));
                TotalAmountSold += amount;
                TotalUnitsSold  += itemsNumber;
            }

            //Get first and last receipt number
            var firstRow = _data.Rows[0];
            var lastRow  = _data.Rows[_data.Rows.Count - 1];

            _firstReceiptNumber = Int32.Parse(firstRow["NumeroTicket"].ToString());
            _lastReceiptNumber  = Int32.Parse(lastRow["NumeroTicket"].ToString());

            return(categoryData);
        }