Exemplo n.º 1
0
        public AddBook()
        {
            InitializeComponent();

            BookManagement.BookManagementClient proxy = new BookManagement.BookManagementClient();

            LibraryExchangeClient.BookManagement.OperationResultSetOfstring booktypes = new LibraryExchangeClient.BookManagement.OperationResultSetOfstring();

            booktypes = proxy.GetAllTypes();

            comboBox1Type.DataSource = booktypes.ResultSet;
            comboBox1Type.Refresh();

            LibraryExchangeClient.BookManagement.OperationResultSetOfstring bookgenres = proxy.GetAllGenres();

            comboBox2Genre.DataSource = bookgenres.ResultSet;
            comboBox2Genre.Refresh();

            LibraryExchangeClient.BookManagement.OperationResultSetOfAuthorUcBWdBTS bookauthors = proxy.GetAllAuthors();

            comboBox1Author.DataSource = bookauthors.ResultSet;
            comboBox1Author.Refresh();
        }
Exemplo n.º 2
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;
            }
        }
Exemplo n.º 3
0
        private void chckMissingAuthor_CheckedChanged(object sender, EventArgs e)
        {
            AddAuthor addAuthorForm = new AddAuthor(mainForm);

            addAuthorForm.ShowDialog();
            try
            {
                LibraryExchangeClient.BookManagement.OperationResultSetOfAuthorUcBWdBTS bookauthors = mainForm.WebServiceProxy.GetAllAuthors(mainForm.UserName, mainForm.Guid);

                cmbAuthor.DataSource    = bookauthors.ResultSet;
                cmbAuthor.DisplayMember = "AuthorInfo";
                cmbAuthor.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Some error occured during initializing authors");
            }
        }
Exemplo n.º 4
0
        public AddBook(Library_Exchange mainForm)
        {
            InitializeComponent();

            this.mainForm = mainForm;

            try
            {
                LibraryExchangeClient.BookManagement.OperationResultSetOfstring booktypes = mainForm.WebServiceProxy.GetAllTypes(mainForm.UserName, mainForm.Guid);
                if (booktypes.Error.Equals(OperationResultErrorEnum.None))
                {
                    cmbType.DataSource = booktypes.ResultSet;
                    cmbType.Refresh();
                }
                else
                {
                    MessageBox.Show(booktypes.ErrorString);
                }

                if (booktypes.Error.Equals(OperationResultErrorEnum.NotAuthenticated))
                {
                    return;
                }

                LibraryExchangeClient.BookManagement.OperationResultSetOfstring bookgenres = mainForm.WebServiceProxy.GetAllGenres(mainForm.UserName, mainForm.Guid);
                if (booktypes.Error.Equals(OperationResultErrorEnum.None))
                {
                    cmbGenre.DataSource = bookgenres.ResultSet;
                    cmbGenre.Refresh();
                }
                else
                {
                    MessageBox.Show(booktypes.ErrorString);
                }

                LibraryExchangeClient.BookManagement.OperationResultSetOfAuthorUcBWdBTS bookauthors = mainForm.WebServiceProxy.GetAllAuthors(mainForm.UserName, mainForm.Guid);

                if (booktypes.Error.Equals(OperationResultErrorEnum.None))
                {
                    cmbAuthor.DataSource    = bookauthors.ResultSet;
                    cmbAuthor.DisplayMember = "AuthorInfo";
                    cmbAuthor.Refresh();
                }
                else
                {
                    MessageBox.Show(booktypes.ErrorString);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Some error occured during initializing data");
            }
        }