private void btnSubmit_Click(object sender, RoutedEventArgs e) { string strDepartment; int intRecordsReturned; bool blnFatalError = false; try { strDepartment = txtDepartment.Text; if (strDepartment.Length < 4) { TheMessagesClass.ErrorMessage("The Department is not Long Enough"); return; } TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(strDepartment); intRecordsReturned = TheFindDepartmentByNameDataSet.FindDepartmentByName.Rows.Count; if (intRecordsReturned > 0) { TheMessagesClass.ErrorMessage("The Department Currently Exists"); return; } blnFatalError = TheDepartmentClass.InsertDepartment(strDepartment, gblnCustomerLine); if (blnFatalError == true) { throw new Exception(); } TheMessagesClass.InformationMessage("The Department has been Inserted"); ResetControls(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Department // Submit Button " + Ex.Message); TheSendEmailClass.SendEventLog(Ex.ToString()); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { //setting local variables string strDepartment; int intRecordsReturned; bool blnFatalError = false; try { strDepartment = txtDepartment.Text; if (strDepartment == "") { TheMessagesClass.ErrorMessage("Department Was Not Entered"); return; } TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(strDepartment); intRecordsReturned = TheFindDepartmentByNameDataSet.FindDepartmentByName.Rows.Count; if (intRecordsReturned > 0) { TheMessagesClass.ErrorMessage("Department was Already Added"); return; } blnFatalError = TheDepartmentClass.InsertDepartment(strDepartment, true); if (blnFatalError == true) { throw new Exception(); } TheMessagesClass.InformationMessage("The Department Was Added"); txtDepartment.Text = ""; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Add Department // Save Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }