Пример #1
0
        public CashierWindow()
        {
            InitializeComponent();
            CurrentCashierId   = new Id <IWorker>("6");
            CurrentBookstoreId = new Id <IBookstore>("3");
            dao = new DAO(this);
            bookChangeManager = new BookChangeManager(dao, this);
            purchaseManager   = new PurchaseManager(dao, this);
            catalogue         = new CatalogueViewList((List <Book>)dao.getCatalogueContents(), (List <Bookstore>)dao.getAllBookstores(),
                                                      dao.CachedBookstoresOnBooksAvailability).list;
            cashierCatalogue.ItemsSource = catalogue;

            //bookWindow
            languageComboBox.ItemsSource    = Book.Languages;
            genreSelectComboBox.ItemsSource = dao.uploadGenres();
            selectedGenresList = new ObservableCollection <string>();
            selectedGenresListBox.Items.Clear();
            selectedGenresList.CollectionChanged += catalogueTabContentCollectionChanged;

            //purchaseWindow
            soldBookTypeComboBox.ItemsSource = new List <string>()
            {
                "electronic", "printed"
            };
            soldBookTypeComboBoxOnReturn.ItemsSource = new List <string>()
            {
                "electronic", "printed"
            };
            purchaseCatalogueDataGrid.ItemsSource = catalogue;
        }
Пример #2
0
        public OwnerWindow()
        {
            InitializeComponent();
            dao = new DAO(this);
            workerChangeManager = new WorkerChangeManager(dao, this);
            bookChangeManager   = new BookChangeManager(dao, this);

            //content
            bookstores = new BookstoresViewList((List <Bookstore>)dao.getAllBookstores()).list;
            ownerBookstores.ItemsSource = bookstores;

            staff = new StaffViewList((List <Worker>)dao.getAllWorkers()).list;
            ownerStaff.ItemsSource = staff;

            catalogue = new CatalogueViewList((List <Book>)dao.getCatalogueContents(), (List <Bookstore>)dao.getAllBookstores(), dao.CachedBookstoresOnBooksAvailability).list;
            ownerCatalogue.ItemsSource = catalogue;

            //staff window
            shiftComboBox.ItemsSource     = WorkingHours.Shifts.Select(x => x.shiftname).ToList();
            workplaceComboBox.ItemsSource = bookstores.Select(x => x.Address.ToString()).ToList();

            //bookWindow
            languageComboBox.ItemsSource    = Book.Languages;
            genreSelectComboBox.ItemsSource = dao.uploadGenres();
            selectedGenresList = new ObservableCollection <string>();
            selectedGenresListBox.Items.Clear();
        }
Пример #3
0
        public DAO(IBookstoreWindow window)//добавить разные уровни соединения
        {
            _sqlconnection = ConnectAdminRoute();

            workerChangeManager    = new WorkerChangeManager(this, window);
            bookstoreChangeManager = new BookstoreChangeManager(this);
            bookChangeManager      = new BookChangeManager(this, window);

            workerFactory    = new WorkerFactory(workerChangeManager, this);
            bookstoreFactory = new BookstoreFactory(bookstoreChangeManager);
            bookFactory      = new BookFactory(bookChangeManager);

            cachedAvailableBooksInBookstore = new Dictionary <Id <IBookstore>, List <Tuple <Id <IBook>, int> > >();
            getAllBookstores();
            getAllWorkers();
            getCatalogueContents();
        }
Пример #4
0
 public BookFactory(BookChangeManager changeManager)
 {
     this.changeManager = changeManager;
 }