public DetailBookController(Views.Book.BookDetailsView view, ReadOnlyContext context, int bookID, int userID) { this.userID = userID; this.bookID = bookID; _context = context; _detailBookView = view; _booksRepository = context.GetRepository<DataInterface.Entities.Copy>(); _leasesRepository = context.GetRepository<DataInterface.Entities.Lease>(); _usersRepository = context.GetRepository<DataInterface.Entities.User>(); _reservationsRepository = context.GetRepository<DataInterface.Entities.Reservation>(); selectedBook = _booksRepository.GetById(bookID); var userBorrowedBooks = _leasesRepository.GetByQuery(x => x.Copy.Book.Id == bookID); var userBookingBooks = _reservationsRepository.GetByQuery(x => x.ReservedCopy.Book.Id == bookID); Views.Book.BookDetailsView example = new Views.Book.BookDetailsView(selectedBook, userBorrowedBooks, userBookingBooks); if (_context.CurrentUser.Role == DataInterface.Enums.Role.Reader) { Return.Visible = false; Title.Enabled = false; Author.Enabled = false; ISBN.Enabled = false; PublishingYear.Enabled = false; Publisher.Enabled = false; Format.Enabled = false; } _detailBookView = example; Return.Click += ReturnBook_Click; Borrow.Click += Borrow_Click; _detailBookView.Show(); }
public UserController(ICreateUser view, ReadOnlyContext context) { _context = context; _view = view; _view.AddUser += AddUser; _usersRepository = context.GetRepository<DataInterface.Entities.User>(); _cityRepository = context.GetRepository<DataInterface.Entities.City>(); _view.SetComboBoxItemList(ConvertToObject()); _view.AddRoleComboBoxItems(_context.CurrentUser.Role == DataInterface.Enums.Role.Admin ? 1 : 0); _view.Show(); }
public ManageUserScheduleController(IMenageSchedule view, ReadOnlyContext context) { _usersRepository = context.GetRepository<DataInterface.Entities.User>(); _timetableOverrideRepository = context.GetRepository<TimetableOverride>(); _timetableRepository = context.GetRepository<Timetable>(); _view = view; _view.MenageSchedule += MenageSchedule; _view.fillListView(RepoDataToList()); _view.moveRepoDataToView(_timetableRepository.GetAll(), _timetableOverrideRepository.GetAll(), _usersRepository.GetAll()); _view.Show(); }
public BookController(ICreateBook view, ReadOnlyContext context) { _context = context; _bookRepository = context.GetRepository<DataInterface.Entities.Book>(); _copyRepository = context.GetRepository<Copy>(); _tagsRepository = context.GetRepository<Tag>(); _settingsRepository = context.GetRepository<CategorySettings>(); _view = view; _view.AddBook += AddBook; _view.AddCopies += AddCopies; _view.UpdateTagsAutocompleteFieldValues(TagsToStringArray()); _view.UpdateBorrowCategoriesComboBox(CategoriesToStringArray()); _view.Show(); }
public AddCategoryController(ICategoryCreate view, ReadOnlyContext context) { _settingsRepository = context.GetRepository<CategorySettings>(); _view = view; _view.CreateCategory += CreateCategory; _view.Show(); }
public DeleteUserController(IDeleteUser view, ReadOnlyContext context) { _usersRepository = context.GetRepository<DataInterface.Entities.User>(); _view = view; _view.DeleteUser += DeleteUser; _view.fillListView(RepoDataToList()); _view.Show(); }
public ReportController(IReportView view, ReadOnlyContext context) { _leaseRepository = context.GetRepository<Lease>(); _view = view; _view.GenerateReport += GenerateReport; _view.Show(); }
public DetailUserController(Views.User.UserDetailView view, ReadOnlyContext context, int userID) { _detailUserView = view; _view = (IDetailView)view; _usersRepository = context.GetRepository<DataInterface.Entities.User>(); _leasesRepository = context.GetRepository<DataInterface.Entities.Lease>(); _reservationsRepository = context.GetRepository<DataInterface.Entities.Reservation>(); _bookCopiesRepository = context.GetRepository<DataInterface.Entities.Copy>(); selectedUser = _usersRepository.GetById(userID); var userBorrowedBooks = _leasesRepository.GetByQuery(x => x.User.Id == userID); var userReservedBooks = _reservationsRepository.GetByQuery(x => x.ReservedBy.Id == userID); Views.User.UserDetailView example = new Views.User.UserDetailView(selectedUser, userBorrowedBooks, userReservedBooks); _detailUserView = example; _view = example; if (context.CurrentUser.Role == DataInterface.Enums.Role.Reader) { Name.Enabled = false; Surname.Enabled = false; PESEL.Enabled = false; Mail.Enabled = false; Phone.Enabled = false; Role.Enabled = false; Address.Enabled = false; Postal.Enabled = false; City.Enabled = false; State.Enabled = false; Country.Enabled = false; Active.Enabled = false; Update.Enabled = false; Return.Enabled = false; } if (context.CurrentUser.Role == DataInterface.Enums.Role.Librarian) { Role.Enabled = false; } isRegistered = Active.Checked; Update.Click += Update_Click; Return.Click += ReturnBook_Click; CancelReservation.Click += CancelReservation_Click; ExtendLease.Click += ExtendLease_Click; _detailUserView.Show(); }
public BrowseCategoryController(IBrowseCategory view, ReadOnlyContext context) { _settingsRepository = context.GetRepository<CategorySettings>(); _view = view; _view.EditCategory += EditCategory; _view.fillComboBox(RepoDataToList()); _view.Show(); }
public ScheduleController(ICreateUserSchedule view, DataInterface.Entities.User user, ReadOnlyContext context) { _view = view; _user = user; _timetableRepository = context.GetRepository<Timetable>(); _view.CreateSchedule += CreateSchedule; _view.Show(); }
public CopyController(ICreateCopy view, Library_Enterprise_University_Project.DataInterface.Entities.Book book, ReadOnlyContext context, bool withNewBook) { _view = view; _book = book; _copyRepository = context.GetRepository<Copy>(); _withNewBook = withNewBook; _view.CreateCopies += CreateCopies; _view.InitControls(TagsToString(), _book.CategorySetting.Category, _book.Title, ConvertAuthorsToString()); _view.Show(); }
public SearchUserController(SearchUserView searchUserView, ReadOnlyContext context) { _context = context; _usersRepository = _context.GetRepository<DataInterface.Entities.User>(); _searchUserView = searchUserView; _usersRepository.GetAll().ToList().ForEach(user => _usersCache.Add(MapUserToViewModel(user))); SetDefaultFilters(); BindEvents(); UpdateSearchResults(this, new EventArgs()); _searchUserView.FormClosing += new FormClosingEventHandler(Form1_FormClosing); closeByXButton = true; _searchUserView.ShowDialog(); }
public DetailBookController(Views.Book.BookDetailsView view, ReadOnlyContext context, int bookID) { // _view = view; _detailBookView = view; this.bookID = bookID; this.userID = -1; _context = context; _booksRepository = context.GetRepository<DataInterface.Entities.Copy>(); _leasesRepository = context.GetRepository<DataInterface.Entities.Lease>(); _usersRepository = context.GetRepository<DataInterface.Entities.User>(); _reservationsRepository = context.GetRepository<DataInterface.Entities.Reservation>(); selectedBook = _booksRepository.GetById(bookID); var userBorrowedBooks = _leasesRepository.GetByQuery(x => x.Copy.Book.Id == bookID); var userBookingBooks = _reservationsRepository.GetByQuery(x => x.ReservedCopy.Book.Id == bookID); Views.Book.BookDetailsView example = new Views.Book.BookDetailsView(selectedBook, userBorrowedBooks, userBookingBooks); _detailBookView = example; Return.Enabled = false; Return.Click += ReturnBook_Click; Borrow.Click += Borrow_Click; _detailBookView.Show(); }
public SearchBookController(SearchBookView searchBookView, ReadOnlyContext context) { _context = context; _booksRepository = _context.GetRepository<DataInterface.Entities.Book>(); _bookCopiesRepository = _context.GetRepository<Copy>(); _leasesRepository = _context.GetRepository<Lease>(); _settingsRepository = _context.GetRepository<CategorySettings>(); _usersRepository = _context.GetRepository<DataInterface.Entities.User>(); _reservationsRepository = _context.GetRepository<Reservation>(); _searchBookView = searchBookView; _booksRepository.GetAll().ToList().ForEach(book => _booksCache.Add(MapBookToViewModel(book))); _bookCopiesRepository.GetAll().ToList().ForEach(bookCopy => _bookCopiesCache.Add(MapBookCopyToViewModel(bookCopy))); SetButtonsBasedOnContext(); SetDefaultFilters(); BindEvents(); UpdateBooksSearchResults(this, new EventArgs()); UpdateBookCopiesSearchResults(this, new EventArgs()); _searchBookView.Show(); }