예제 #1
0
        public ManagerWindow()
        {
            InitializeComponent();
            dao = new DAO(this);
            CurrentBookstoreId  = new Id <IBookstore>("1");
            CurrentManagerId    = new Id <IWorker>("22");
            workerChangeManager = new WorkerChangeManager(dao, this);

            staff_inWorkerType = (List <Worker>)dao.getAllWorkers().Where(i => i.working_place.id.ToString() == CurrentBookstoreId.ToString()).ToList();
            staff = new StaffViewList(staff_inWorkerType).list;
            managerSubordinatesDataGrid.ItemsSource = staff;
            shiftComboBox.ItemsSource    = WorkingHours.Shifts.Select(i => i.shiftname);
            positionComboBox.ItemsSource = new List <string> {
                "cashier", "deliverer", "manager"
            };


            editedWorkers = new HashSet <string>()
            {
            };
            this.ContentRendered += (s, e) =>
            {
                managerSubordinatesDataGrid.Columns[0].IsReadOnly = true;
                managerSubordinatesDataGrid.Columns[2].IsReadOnly = true;
                managerSubordinatesDataGrid.Columns[3].IsReadOnly = true;
                managerSubordinatesDataGrid.Columns[4].IsReadOnly = true;
                managerSubordinatesDataGrid.Columns[7].IsReadOnly = true;
            };
        }
예제 #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 WorkerFactory(WorkerChangeManager changeManager, DAO dao)
 {
     this.changeManager = changeManager;
     this.dao           = dao;
 }