public int updateLanguage(string languageName, int languageId) { try { MasterLogic masterLogic = new MasterLogic(); return(masterLogic.updateLanguage(languageName, languageId)); } catch (BusinessLogicException ex) { HandleSoapException handleSoapExceptionnew = new HandleSoapException(); SoapException soapException = new SoapException(); soapException = handleSoapExceptionnew.CreateSoapException(Constants.faultUri, "updateLanguage", 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, "updateLanguage", ex.Message, AppEnum.FaultSourceWS.AplicationError.ToString(), Constants.faultAplicationError, AppEnum.FaultSourceWS.AplicationError); throw soapException; } }
private void buttonExecute_Click(object sender, EventArgs e) { try { labelSystemMessage.ForeColor = System.Drawing.Color.Black; labelSystemMessage.Text = Constants.msgLabelDefault; if (radioInsert.Checked) { if (textBoxName.Text.Length == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgValidInformation; } else { int resultOperation = 0; MasterLogic masterLogic = new MasterLogic(); switch (comboBoxMasterInformation.SelectedItem.ToString()) { case "Author": resultOperation = masterLogic.insertAuthor(textBoxName.Text); break; case "Category": resultOperation = masterLogic.insertCategory(textBoxName.Text); break; case "Language": resultOperation = masterLogic.insertLanguage(textBoxName.Text); break; } if (resultOperation == 0) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgErrorBusinessToUser; } else { labelSystemMessage.Text = Constants.msgOperationCompleted; this.buttonList_Click(sender, e); } } } else if (radioUpdate.Checked) { if ((textBoxName.Text.Length == 0) || (dataGridViewMasterInformation.DataSource == null && dataGridViewMasterInformation.SelectedRows.Count == 0)) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgSelectRecord; } else { int resultOperation = 0; MasterLogic masterLogic = new MasterLogic(); int iDColumnIndex = (int)AppEnum.TabMasterModel.ID; int informationID = (int)dataGridViewMasterInformation.SelectedRows[0].Cells[iDColumnIndex].Value; switch (comboBoxMasterInformation.SelectedItem.ToString()) { case "Author": resultOperation = masterLogic.updateAuthor(textBoxName.Text, informationID); break; case "Category": resultOperation = masterLogic.updateCategory(textBoxName.Text, informationID); break; case "Language": resultOperation = masterLogic.updateLanguage(textBoxName.Text, informationID); break; } 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.buttonList_Click(sender, e); } } } else if (radioDelete.Checked) { if ((textBoxName.Text.Length == 0) || (dataGridViewMasterInformation.DataSource == null && dataGridViewMasterInformation.SelectedRows.Count == 0)) { labelSystemMessage.ForeColor = System.Drawing.Color.Red; labelSystemMessage.Text = Constants.msgSelectRecord; } else { int resultOperation = 0; MasterLogic masterLogic = new MasterLogic(); int iDColumnIndex = (int)AppEnum.TabMasterModel.ID; int informationID = (int)dataGridViewMasterInformation.SelectedRows[0].Cells[iDColumnIndex].Value; switch (comboBoxMasterInformation.SelectedItem.ToString()) { case "Author": resultOperation = masterLogic.DeleteAuthor(informationID); break; case "Category": resultOperation = masterLogic.DeleteCategory(informationID); break; case "Language": resultOperation = masterLogic.DeleteLanguage(informationID); break; } 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.buttonList_Click(sender, e); } } } else { labelSystemMessage.Text = Constants.msgSelectRecord; } } catch (BusinessLogicException 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; } }