private async void btnTakeBook_Click(object sender, EventArgs e) { var bookId = txtBookId.Text; if (bookId.IsNullOrEmpty()) { return; } // this line is needed to localize the DataGridView in LocalizeDataGridView method _searchText = null; try { Cursor = Cursors.WaitCursor; var createdBookIssue = await BookIssueRepository.TakeBookAsync(Guid.Parse(bookId), Store.CurrentUser.Id); ctlDataGridView.PopulateDataGridView(createdBookIssue, true, true); LocalizeDataGridView(); btnClear.PerformClick(); } catch (Exception exception) { Debug.WriteLine(exception.Message); MessageBox.Show(Resource_Localization.ErrorUnknown); } finally { Cursor = Cursors.Default; } }
public UnitOfWorkLibraryService(string connectionString, string migrationAssemblyName) { _context = new LibraryContext(connectionString, migrationAssemblyName); BookIssueRepositor = new BookIssueRepository(_context); ReturnBookRepository = new ReturnBookRepository(_context); BookRepository = new BookRepository(_context); StudentRepository = new StudentRepository(_context); }
public LibraryUnitOfWork(string ConnectionString, string MigrationAssemblyName) { _context = new LibraryContext(ConnectionString, MigrationAssemblyName); BookIssueRepository = new BookIssueRepository(_context); ReturnBookRepository = new ReturnBookRepository(_context); BookRepository = new BookRepository(_context); StudentRepository = new StudentRepository(_context); }
public EntityService() { _bookService = new BooksRepository(); _studentService = new StudentsRepository(); _genresService = new GenresRepository(); _departmentService = new DepartmentRepository(); _staffService = new StaffRepository(); _bookissueService = new BookIssueRepository(); _bookreturnService = new BookReturnRepository(); }
public LibraryUnitOfWork(string connectionString, string migrationAssemblyName) { _context = new LibrarySystemContext(connectionString, migrationAssemblyName); BookRepository = new BookRepository(_context); StudentRepository = new StudentRepository(_context); BookIssueRepository = new BookIssueRepository(_context); BookFineRepository = new BookFineRepository(_context); BookReturnRepository = new BookReturnRepository(_context); }
private async void btnGiveBook_Click(object sender, EventArgs e) { _searchedFor = SearchedFor.BookIssue; var userId = txtUserId.Text; var bookId = txtBookId.Text; //var days = int.Parse((string) cboDays.SelectedItem); var dueDate = txtDueDate.Text; if (userId.IsNullOrEmpty() || bookId.IsNullOrEmpty()) { return; } try { Cursor = Cursors.WaitCursor; var bookIssue = new BookIssueEntity() { Id = Guid.Parse(bookId), UserId = Guid.Parse(userId), BookId = Guid.Parse(bookId), IssuerId = Store.CurrentUser.Id, DueDate = DateTime.Parse(dueDate) }; var createdBookIssue = await BookIssueRepository.GiveBookAsync(bookIssue); ctlDataGridView.PopulateDataGridView(createdBookIssue, true, true); LocalizeDataGridView(); btnClear.PerformClick(); } catch (Exception exception) { Debug.WriteLine(exception.Message); MessageBox.Show(Resource_Localization.ErrorUnknown); } finally { Cursor = Cursors.Default; } }