示例#1
0
        public EditBookForm(BookDataSource book, Library_Exchange mainForm)
        {
            InitializeComponent();

            this.mainForm = mainForm;
            this.book     = book;

            txtIsbn.Text          = book.Isbn;
            txtTitle.Text         = book.Title;
            txtYearPublished.Text = book.Year;

            try
            {
                LibraryExchangeClient.BookManagement.OperationResultSetOfstring booktypes = mainForm.WebServiceProxy.GetAllTypes(mainForm.UserName, mainForm.Guid);
                cmbType.DataSource = booktypes.ResultSet;
                cmbType.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Some internal error occured during getting data for book types.");
            }
            cmbType.Text = book.Type;

            try
            {
                LibraryExchangeClient.BookManagement.OperationResultSetOfstring bookgenres = mainForm.WebServiceProxy.GetAllGenres(mainForm.UserName, mainForm.Guid);
                cmbGenre.DataSource = bookgenres.ResultSet;
                cmbGenre.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Some internal error occured during getting data for genres.");
            }
            cmbGenre.Text = book.Genre;

            try
            {
                LibraryExchangeClient.BookManagement.OperationResultSetOfAuthorUcBWdBTS bookauthors = mainForm.WebServiceProxy.GetAllAuthors(mainForm.UserName, mainForm.Guid);
                cmbAuthor.DataSource    = bookauthors.ResultSet;
                cmbAuthor.DisplayMember = "AuthorInfo";
                cmbAuthor.ValueMember   = "AuthorInfo";
                cmbAuthor.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Some internal error occured during getting data for authors.");
            }
            cmbAuthor.Text = book.Book.Author.AuthorInfo;

            if (book.Book.Reserved)
            {
                rbtnReservedYes.Checked = true;
            }
            else
            {
                rbtnReservedNo.Checked = true;
            }
        }
示例#2
0
        private void gridViewBooks_DoubleClick(object sender, System.EventArgs e)
        {
            BookDataSource item = ((DataGridView)sender).Rows[(int)((DataGridView)sender).CurrentCell.RowIndex].DataBoundItem as BookDataSource;

            EditBookForm form = new EditBookForm(item, mainForm);

            form.ShowDialog();

            try
            {
                OperationResultSetOfBookUcBWdBTS books = mainForm.WebServiceProxy.GetAllBooksByUser(mainForm.UserName, mainForm.Guid);
                gridViewBooks.DataSource = readBooks(books);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Some error occured during getting all client`s books");
            }
        }
示例#3
0
        public ReserveBookForm(BookDataSource info, Library_Exchange mainForm)
        {
            InitializeComponent();

            this.info     = info;
            this.mainForm = mainForm;

            txtTitle.Text         = info.Title;
            txtAuthor.Text        = info.Author;
            txtGenre.Text         = info.Genre;
            txtType.Text          = info.Type;
            txtIsbn.Text          = info.Isbn;
            txtYearPublished.Text = info.Year;
            txtOwner.Text         = info.Book.User.FirstName + " " + info.Book.User.LastName;
            txtLocation.Text      = info.Book.User.Location.Country + " " +
                                    info.Book.User.Location.City + " " +
                                    info.Book.User.Location.PostCode + " " +
                                    info.Book.User.Location.Address;
        }