Пример #1
0
        /// <summary>Retrieves the stock entries from the server</summary>
        private void GetStockEntries()
        {
            try
            {
                LoggingService.Log("Getting Stock Entries", "Log.txt");

                Mouse.OverrideCursor = Cursors.Wait;
                FilterBound.Validate();
                FilterError.Text       = "";
                FilterError.Visibility = Visibility.Collapsed;

                SQLStockRepository stockRepo = new SQLStockRepository();
                StockEntriesBound = null;
                StockEntriesBound = new TrulyObservableCollection <StockEntry>(stockRepo.GetStockEntries(FilterBound));
                StockEntriesDataGrid.ItemsSource       = StockEntriesBound;
                StockEntriesBound.ItemPropertyChanged += StockEntriesBound_ItemPropertyChanged;
                StockEntriesBound.CollectionChanged   += StockEntriesBound_CollectionChanged;

                Messages.Items.Insert(0, "Retrieved " + StockEntriesBound.Count.ToString() + " entries");
            }
            catch (Exception ex)
            {
                Messages.Items.Insert(0, ex.Message);
                LoggingService.Log(ex, "Log.txt");
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }
Пример #2
0
        public void CSVAddStockEntriesTest()
        {
            CSVStockRepository  stockRepo    = new CSVStockRepository();
            List <StockEntry>   stockEntries = new List <StockEntry>();
            SQLStockRepository  sqlStockRepo = new SQLStockRepository();
            SQLFilterRepository filterRepo   = new SQLFilterRepository();
            Filter filter = new Filter();
            string actualResponse;
            string expectedResponse = "Stock entries saved";

            filter       = filterRepo.GetMinMaxValues();
            stockEntries = sqlStockRepo.GetStockEntries(filter) as List <StockEntry>;

            actualResponse = stockRepo.AddStockEntries(stockEntries);

            Assert.AreEqual(expectedResponse, actualResponse);
        }
Пример #3
0
        public void GetStockEntriesByFilterTest()
        {
            //-- Arrange
            SQLStockRepository stockRepo = new SQLStockRepository();
            List <StockEntry>  actual;

            SQLFilterRepository filterRepo = new SQLFilterRepository();
            Filter filter = new Filter();

            int expected = 102580;

            //-- Act
            filter = filterRepo.GetMinMaxValues();
            actual = stockRepo.GetStockEntries(filter) as List <StockEntry>;

            //-- Assert
            Assert.AreEqual(expected, actual.Count);
        }
Пример #4
0
        /// <summary>Gets a list of stock entries</summary>
        public IEnumerable <StockEntry> GetStockEntries(Filter filter)
        {
            SQLStockRepository stockRepo = new SQLStockRepository();

            return(stockRepo.GetStockEntries(filter));
        }