private void buttonListAllBooks_Click(object sender, EventArgs e) { try { labelSystemMessage.Text = null; textBoxBookName.Text = null; textBoxAuthor.Text = null; dataGridViewListBooks.DataSource = null; BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); dataGridViewListBooks.DataSource = bookWS.GetAllAvailableBooks(); } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewListBooks.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewListBooks.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void radioButtonReserved_CheckedChanged(object sender, EventArgs e) { try { labelSystemMessage.Text = Constants.msgLabelDefault; labelSystemMessage.ForeColor = System.Drawing.Color.Black; dataGridViewUserBookActivity.DataSource = null; BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); dataGridViewUserBookActivity.DataSource = bookWS.GetAllBooksReservedViewByUserId(staticUserID); dataGridViewUserBookActivity.Columns[Constants.fieldUser].Visible = false; dataGridViewUserBookActivity.Columns[Constants.fieldReserveId].Visible = false; dataGridViewUserBookActivity.Columns[Constants.fieldUserId].Visible = false; } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewUserBookActivity.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewUserBookActivity.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void ReportBookBorrowedForm_Load(object sender, EventArgs e) { try { labelSystemMessage.Text = Constants.msgLabelDefault; labelSystemMessage.ForeColor = System.Drawing.Color.Black; dataGridViewBorrowedBooks.DataSource = null; BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); dataGridViewBorrowedBooks.DataSource = bookWS.GetAllBorrowedBooksWithUser(); dataGridViewBorrowedBooks.Columns[Constants.fieldBorrowId].Visible = false; dataGridViewBorrowedBooks.Columns[Constants.fieldLatefee].Visible = false; dataGridViewBorrowedBooks.Columns[Constants.fieldUserId].Visible = false; } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void buttonListAllBorrowedBooks_Click(object sender, EventArgs e) { try { textBoxBookName.Text = null; labelSystemMessage.Text = null; BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); dataGridViewBooksBorrowed.DataSource = bookWS.GetAllBooksBorrowedWithUserView(); dataGridViewBooksBorrowed.Columns[Constants.fieldUserId].Visible = false; dataGridViewBooksBorrowed.Columns[Constants.fieldBorrowId].Visible = false; dataGridViewBooksBorrowed.Columns[Constants.fieldLatefee].Visible = false; if (dataGridViewBooksBorrowed.RowCount == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgNoMatchesFound; } } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void BookBrowseForm_Load(object sender, EventArgs e) { try { dataGridViewBookBrowse.DataSource = null; BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); dataGridViewBookBrowse.DataSource = bookWS.GetAllBooksView(); } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewBookBrowse.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewBookBrowse.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void buttonListAllBooks_Click(object sender, EventArgs e) { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = null; textBoxISBN.Text = null; textBoxBookName.Text = null; textBoxAuthor.Text = null; BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); dataGridViewListBooks.DataSource = bookWS.GetAllBooksView(); }
private void buttonBorrowBook_Click(object sender, EventArgs e) { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = Constants.msgLabelDefault; try { if ((dataGridViewListBooks.DataSource != null && dataGridViewListBooks.SelectedRows.Count > 0) && (dataGridViewUser.DataSource != null && dataGridViewUser.SelectedRows.Count > 0)) { String isbn = dataGridViewListBooks.SelectedRows[0].Cells[(int)AppEnum.ViewBookModel.Isbn].Value.ToString(); int userId = (int) dataGridViewUser.SelectedRows[0].Cells[(int)AppEnum.TabUserModel.ID].Value; BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); int resultOperation = bookWS.InsertBorrowBook(userId, isbn); if (resultOperation == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser; } else { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = Constants.msgOperationCompleted; dataGridViewListBooks.DataSource = null; dataGridViewUser.DataSource = null; } } else { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgSelectRecord; } } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void buttonReturnBook_Click(object sender, EventArgs e) { try { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = null; if (dataGridViewBooksBorrowed.DataSource != null && dataGridViewBooksBorrowed.SelectedRows.Count > 0) { int bidColumnIndex = (int)AppEnum.ViewBookBorrowedWithUserModel.BorrowId; int returnDateColumnIndex = (int)AppEnum.ViewBookBorrowedWithUserModel.Return; int bid = (int)dataGridViewBooksBorrowed.SelectedRows[0].Cells[bidColumnIndex].Value; String returnDate = dataGridViewBooksBorrowed.SelectedRows[0].Cells[returnDateColumnIndex].Value.ToString(); BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); int resultOperation = bookWS.ReturnBorrowBook(bid, returnDate); if (resultOperation == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser; } else { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = Constants.msgOperationCompleted; dataGridViewBooksBorrowed.DataSource = null; } } else { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgSelectRecord; } } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void buttonCancelBookReserve_Click(object sender, EventArgs e) { try { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = null; if (dataGridViewBookReserved.DataSource != null && dataGridViewBookReserved.SelectedRows.Count > 0) { int reserveId = (int)dataGridViewBookReserved.SelectedRows[0].Cells[(int)AppEnum.ViewBookReservedModel.ReserveId].Value; labelSystemMessage.Text = reserveId.ToString(); BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); int resultOperation = bookWS.DeleteBookReserved(reserveId); if (resultOperation == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser; } else { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = Constants.msgOperationCompleted; this.ConsultAndCancelBookReservedForm_Load(sender, e); } } else { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgSelectRecord; } } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void buttonReserve_Click(object sender, EventArgs e) { try { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = null; if (dataGridViewListBooks.DataSource != null && dataGridViewListBooks.SelectedRows.Count > 0) { String isbn = dataGridViewListBooks.SelectedRows[0].Cells[(int)AppEnum.ViewBookModel.Isbn].Value.ToString(); labelSystemMessage.Text = isbn; BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); int resultOperation = bookWS.insertBookReserved(staticUserID, isbn, DateTime.Today.ToString()); if (resultOperation == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser; } else { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = Constants.msgOperationCompleted; dataGridViewListBooks.DataSource = null; } } else { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgSelectRecord; } } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void buttonSearchBook_Click(object sender, EventArgs e) { try { radioInsert.Checked = false; radioUpdate.Checked = false; radioDelete.Checked = false; this.disableFieldsOfMaintenance(); this.disableComboBoxes(); labelSystemMessage.Text = Constants.msgLabelDefault; if (textBoxISBNSearch.Text.Length == 0 && textBoxBookNameSearch.Text.Length == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgNoSearchCriteria; } else { labelSystemMessage.Text = null; BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); dataGridViewListBooks.DataSource = bookWS.BookSearch(textBoxISBNSearch.Text, textBoxBookNameSearch.Text, null); if (dataGridViewListBooks.RowCount == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgNoMatchesFound; } } } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewListBooks.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewListBooks.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void buttonSearch_Click(object sender, EventArgs e) { try { if (textBoxISBN.Text.Length == 0 && textBoxBookName.Text.Length == 0 && textBoxAuthor.Text.Length == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgNoSearchCriteria; } else { labelMessageForUser.Text = null; BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); dataGridViewListBooks.DataSource = bookWS.BookSearch(textBoxISBN.Text, textBoxBookName.Text, textBoxAuthor.Text); if (dataGridViewListBooks.RowCount == 0) { labelMessageForUser.ForeColor = System.Drawing.Color.Red; labelMessageForUser.Text = Constants.msgNoMatchesFound; } } } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewListBooks.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewListBooks.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void buttonSearch_Click(object sender, EventArgs e) { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = null; if (textBoxISBN.Text.Length == 0 && textBoxBookName.Text.Length == 0 && textBoxAuthor.Text.Length == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgNoSearchCriteria; } else { BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); dataGridViewListBooks.DataSource = bookWS.BookSearch(textBoxISBN.Text, textBoxBookName.Text, textBoxAuthor.Text); if (dataGridViewListBooks.RowCount == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgNoMatchesFound; } } }
private void ConsultAndCancelBookReservedForm_Load(object sender, EventArgs e) { try { BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); dataGridViewBookReserved.DataSource = bookWS.GetAllBooksReservedViewByUserId(staticUserID); if (dataGridViewBookReserved.RowCount == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgNoMatchesFound; } else { dataGridViewBookReserved.Columns[Constants.fieldUser].Visible = false; dataGridViewBookReserved.Columns[Constants.fieldReserveId].Visible = false; dataGridViewBookReserved.Columns[Constants.fieldUserId].Visible = false; } } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewBookReserved.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); dataGridViewBookReserved.DataSource = null; labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }
private void buttonExecute_Click(object sender, EventArgs e) { try { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = Constants.msgLabelDefault; int resultOperation = -1; if (validationOfFieldsToPerformManutention()) { BookWSIntegration.BookWS bookWS = new BookWSIntegration.BookWS(); if (radioInsert.Checked) { resultOperation = bookWS.InsertBook(textBoxISBNMaintenace.Text, textBoxNameMaintenance.Text, (int)comboBoxAuthor.SelectedValue, (int)comboBoxCategory.SelectedValue, (int)comboBoxLanguage.SelectedValue, Int32.Parse(textBoxYear.Text), Int32.Parse(textBoxPages.Text), textBoxPublisher.Text); } else if (radioUpdate.Checked) { int isbnColumnIndex = (int)AppEnum.ViewBookModel.Isbn; String isbn = dataGridViewListBooks.SelectedRows[0].Cells[isbnColumnIndex].Value.ToString(); String updatedIsbn = textBoxISBNMaintenace.Text; resultOperation = bookWS.UpdateBook(updatedIsbn, textBoxNameMaintenance.Text, (int)comboBoxAuthor.SelectedValue, (int)comboBoxCategory.SelectedValue, (int)comboBoxLanguage.SelectedValue, Int32.Parse(textBoxYear.Text), Int32.Parse(textBoxPages.Text), textBoxPublisher.Text, isbn); } else if (radioDelete.Checked) { int isbnColumnIndex = (int)AppEnum.ViewBookModel.Isbn; String isbn = dataGridViewListBooks.SelectedRows[0].Cells[isbnColumnIndex].Value.ToString(); resultOperation = bookWS.DeleteBook(isbn); } if (resultOperation == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser; } else { labelSystemMessage.Text = Constants.msgOperationCompleted; this.BookMaintenanceForm_Load(sender, e); dataGridViewListBooks.DataSource = null; } } } catch (SoapException ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser + ex.GetBaseException().Message; } catch (Exception ex) { //Error log simulate Console.WriteLine(ex.ToString()); Console.WriteLine(ex.GetBaseException().ToString()); labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorSystemToUser; } }