public DataTable BookSearch(string bookISBN, string bookName, string author) { try { BookLogic bookLogic = new BookLogic(); return(bookLogic.BookSearch(bookISBN, bookName, author).ToDataTable()); } catch (BusinessLogicException ex) { HandleSoapException handleSoapExceptionnew = new HandleSoapException(); SoapException soapException = new SoapException(); soapException = handleSoapExceptionnew.CreateSoapException(Constants.faultUri, "BookSearch", ex.Message, AppEnum.FaultSourceWS.BusinessError.ToString(), Constants.faultBusinessError, AppEnum.FaultSourceWS.BusinessError); throw soapException; } catch (Exception ex) { HandleSoapException handleSoapExceptionnew = new HandleSoapException(); SoapException soapException = new SoapException(); soapException = handleSoapExceptionnew.CreateSoapException(Constants.faultUri, "BookSearch", ex.Message, AppEnum.FaultSourceWS.AplicationError.ToString(), Constants.faultAplicationError, AppEnum.FaultSourceWS.AplicationError); throw soapException; } }
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; BookLogic bookLogic = new BookLogic(); dataGridViewListBooks.DataSource = bookLogic.BookSearch(textBoxISBNSearch.Text, textBoxBookNameSearch.Text, null); if (dataGridViewListBooks.RowCount == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgNoMatchesFound; } } } catch (BusinessLogicException 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; BookLogic bookLogic = new BookLogic(); dataGridViewListBooks.DataSource = bookLogic.BookSearch(textBoxISBN.Text, textBoxBookName.Text, textBoxAuthor.Text); if (dataGridViewListBooks.RowCount == 0) { labelMessageForUser.ForeColor = System.Drawing.Color.Red; labelMessageForUser.Text = "No matches found."; } } } catch (BusinessLogicException 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 { BookLogic bookLogic = new BookLogic(); dataGridViewListBooks.DataSource = bookLogic.BookSearch(textBoxISBN.Text, textBoxBookName.Text, textBoxAuthor.Text); if (dataGridViewListBooks.RowCount == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgNoMatchesFound; } } }