private bool UpdateTransactionType() { try { if (Session["_expenseType"] == null) { ConfirmAlertBox1.ShowMessage("Expense Types list is empty or session has expired.", ConfirmAlertBox.PopupMessageType.Error); return(false); } var expenseType = (ExpenseType)Session["_expenseType"]; if (expenseType == null) { ConfirmAlertBox1.ShowMessage("Invalid record selection.", ConfirmAlertBox.PopupMessageType.Error); return(false); } if (expenseType.ExpenseTypeId < 1) { ConfirmAlertBox1.ShowMessage("Invalid record selection.", ConfirmAlertBox.PopupMessageType.Error); return(false); } expenseType.Name = txtTransactionType.Text.Trim(); expenseType.Status = chkTransactionType.Checked ? 1 : 0; var k = ServiceProvider.Instance().GetExpenseTypeServices().UpdateExpenseTypeCheckDuplicate(expenseType); if (k < 1) { if (k == -3) { ErrorDisplayTransactionType.ShowError("Expense Type information already exists!"); txtTransactionType.Focus(); mpeProcessTypesOfExpensesPopup.Show(); return(false); } ErrorDisplayTransactionType.ShowError("The Expense Type information Could not be updated."); txtTransactionType.Focus(); mpeProcessTypesOfExpensesPopup.Show(); return(false); } return(true); } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); return(false); } }
private bool AddTransactionType() { try { var transactionType = new ExpenseType { Name = txtTransactionType.Text.Trim(), Status = chkTransactionType.Checked ? 1 : 0 }; var k = ServiceProvider.Instance().GetExpenseTypeServices().AddExpenseTypeCheckDuplicate(transactionType); if (k < 1) { if (k == -3) { ErrorDisplayTransactionType.ShowError("Expense Type information already exists!"); txtTransactionType.Focus(); mpeProcessTypesOfExpensesPopup.Show(); return(false); } ErrorDisplayTransactionType.ShowError("The Expense Type information Could not be added."); txtTransactionType.Focus(); mpeProcessTypesOfExpensesPopup.Show(); return(false); } return(true); } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); return(false); } }