private bool ValidateControls() { try { if (string.IsNullOrEmpty(txtTransactionType.Text.Trim())) { ConfirmAlertBox1.ShowMessage("Please supply an Expense Type.", ConfirmAlertBox.PopupMessageType.Error); txtTransactionType.Focus(); mpeProcessTypesOfExpensesPopup.Show(); return(false); } if (DataCheck.IsNumeric(txtTransactionType.Text.Trim())) { ConfirmAlertBox1.ShowMessage("Invalid entry!", ConfirmAlertBox.PopupMessageType.Error); txtTransactionType.Focus(); mpeProcessTypesOfExpensesPopup.Show(); return(false); } return(true); } catch { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); return(false); } }
private bool ValidateControls() { ErrorDisplayProcessExpenseCategory.ClearError(); if (string.IsNullOrEmpty(txtTitle.Text.Trim())) { ErrorDisplayProcessExpenseCategory.ShowError("Please supply an Expense Category."); txtTitle.Focus(); mpeProcessExpenseCategory.Show(); return(false); } if (string.IsNullOrEmpty(txtCode.Text.Trim())) { ErrorDisplayProcessExpenseCategory.ShowError("Please supply a code for the category."); txtCode.Focus(); mpeProcessExpenseCategory.Show(); return(false); } if (!DataCheck.IsNumeric(txtCode.Text.Trim())) { ErrorDisplayProcessExpenseCategory.ShowError("Invalid entry!"); txtCode.Focus(); mpeProcessExpenseCategory.Show(); return(false); } return(true); }
protected void DgPortalUsersEditCommand(Object source, DataGridCommandEventArgs e) { if (!(Page.User.IsInRole("PortalAdmin") || Page.User.IsInRole("SiteAdmin"))) { ErrorDisplay1.ShowError("Sorry: You do not have access to this module!"); return; } ErrorDisplay1.ClearError(); dgPortalUsers.SelectedIndex = e.Item.ItemIndex; var userId = (DataCheck.IsNumeric(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (userId < 1) { ErrorDisplay1.ShowError("Invalid Selection"); return; } Session["_selectedUser"] = null; if (!BindUSer(userId)) { return; } btnSubmit.CommandArgument = "2"; // Update Item btnSubmit.Text = "Update User"; mpeDisplayJobDetails.Show(); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { if (!filterContext.HttpContext.User.Identity.IsAuthenticated) { filterContext.Controller.ViewBag.UserAuthInfo = null; base.OnActionExecuting(filterContext); return; } var frmId = (FormsIdentity)filterContext.HttpContext.User.Identity; var usData = frmId.Ticket.UserData; if (string.IsNullOrEmpty(usData)) { filterContext.Controller.ViewBag.UserAuthInfo = null; base.OnActionExecuting(filterContext); return; } var userDataSplit = usData.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (!userDataSplit.Any() || userDataSplit.Length != 3) { filterContext.Controller.ViewBag.UserAuthInfo = null; base.OnActionExecuting(filterContext); return; } if (!DataCheck.IsNumeric(userDataSplit[0].Trim())) { filterContext.Controller.ViewBag.UserAuthInfo = null; base.OnActionExecuting(filterContext); return; } var roles = userDataSplit[2].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); var identity = new FormsIdentity(frmId.Ticket); var principal = new StcPrincipal(identity, roles); var userData = new UserData { UserId = long.Parse(userDataSplit[0].Trim()), Username = frmId.Name, Email = userDataSplit[1].Trim(), Roles = roles, }; if (!MvcApplication.SetUserData(userData)) { filterContext.Controller.ViewBag.UserAuthInfo = null; base.OnActionExecuting(filterContext); return; } filterContext.Controller.ViewBag.UserAuthInfo = userData; filterContext.HttpContext.User = principal; base.OnActionExecuting(filterContext); }
protected void DgUserInitiatedTransactionsItemCommand(object source, DataGridCommandEventArgs e) { try { dgUserInitiatedTransactions.SelectedIndex = e.Item.ItemIndex; long id = (DataCheck.IsNumeric(dgUserInitiatedTransactions.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgUserInitiatedTransactions.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid Record Selection!", ConfirmAlertBox.PopupMessageType.Error); return; } var transaction = ServiceProvider.Instance().GetExpenseTransactionServices().GetExpenseTransaction(id); if (transaction == null || transaction.ExpenseTransactionId < 1) { ConfirmAlertBox1.ShowMessage("Invalid record selection.", ConfirmAlertBox.PopupMessageType.Error); return; } LoadTransactionItems(transaction); } catch { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin. Please try again soon or contact your site Admin.", ConfirmAlertBox.PopupMessageType.Error); } }
protected void DgAllTransactionPaymentsCommand(object source, DataGridCommandEventArgs e) { try { dgAllTransactionPayments.SelectedIndex = e.Item.ItemIndex; long id = (DataCheck.IsNumeric(dgAllTransactionPayments.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgAllTransactionPayments.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid Record Selection!", ConfirmAlertBox.PopupMessageType.Error); return; } var expenseTransactionPayment = ServiceProvider.Instance().GetExpenseTransactionPaymentServices().GetExpenseTransactionPayment(id); if (expenseTransactionPayment == null || expenseTransactionPayment.ExpenseTransactionId < 1) { ConfirmAlertBox1.ShowMessage("Invalid record selection.", ConfirmAlertBox.PopupMessageType.Error); return; } LoadTransactionPaymentHistory(expenseTransactionPayment.ExpenseTransactionId); //dvTransactionPayments.Visible = false; //dvTransactionPaymentHistory.Visible = true; dvView.Visible = true; dvAllContent.Visible = false; } catch { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); } }
private void LoadTransactionsFooter() { try { if (dgExpenseItem.Items.Count > 0) { //int subTotalQuantity = 0; //int subTotalApprovedQuantity = 0; double subTotalUnitPrice = 0; double subTotalApprovedPrice = 0; for (var i = 0; i < dgExpenseItem.Items.Count; i++) { //subTotalQuantity += DataCheck.IsNumeric(((Label)dgExpenseItem.Items[i].FindControl("lblQuantity")).Text) // ? int.Parse(((Label)dgExpenseItem.Items[i].FindControl("lblQuantity")).Text) : 0; //subTotalApprovedQuantity += DataCheck.IsNumeric(((Label)dgExpenseItem.Items[i].FindControl("lblApprovedQuantity")).Text) // ? int.Parse(((Label)dgExpenseItem.Items[i].FindControl("lblApprovedQuantity")).Text) : 0; subTotalUnitPrice += DataCheck.IsNumeric(((Label)dgExpenseItem.Items[i].FindControl("lblUnitPrice")).Text) ? float.Parse(((Label)dgExpenseItem.Items[i].FindControl("lblUnitPrice")).Text) : 0; subTotalApprovedPrice += DataCheck.IsNumeric(((Label)dgExpenseItem.Items[i].FindControl("lblApprovedUnitPrice")).Text) ? float.Parse(((Label)dgExpenseItem.Items[i].FindControl("lblApprovedUnitPrice")).Text) : 0; } foreach (var item in dgExpenseItem.Controls[0].Controls) { if (item.GetType() == typeof(DataGridItem)) { var itmType = ((DataGridItem)item).ItemType; if (itmType == ListItemType.Footer) { //if (((DataGridItem)item).FindControl("lblTotalQuantity") != null) //{ // ((Label)((DataGridItem)item).FindControl("lblTotalQuantity")).Text = subTotalQuantity.ToString(CultureInfo.InvariantCulture); //} //if (((DataGridItem)item).FindControl("lblTotalApprovedQuantity") != null) //{ // ((Label)((DataGridItem)item).FindControl("lblTotalApprovedQuantity")).Text = subTotalApprovedQuantity.ToString(CultureInfo.InvariantCulture); //} if (((DataGridItem)item).FindControl("lblTotalUnitPrice") != null) { ((Label)((DataGridItem)item).FindControl("lblTotalUnitPrice")).Text = "N" + NumberMap.GroupToDigits(subTotalUnitPrice.ToString(CultureInfo.InvariantCulture)); } if (((DataGridItem)item).FindControl("lblTotalApprovedUnitPrice") != null) { ((Label)((DataGridItem)item).FindControl("lblTotalApprovedUnitPrice")).Text = "N" + NumberMap.GroupToDigits(subTotalApprovedPrice.ToString(CultureInfo.InvariantCulture)); } } } } } } catch { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); } }
protected void DgPaymentHistoryCommand(object source, DataGridCommandEventArgs e) { try { if (Session["_paymentHistoryList"] == null) { ErrorDisplay1.ShowError("Transaction Payment History is empty or session has expired."); return; } var expenseTransactionPaymentHistoryList = Session["_paymentHistoryList"] as List <StaffExpenseTransactionPaymentHistory>; if (expenseTransactionPaymentHistoryList == null || !expenseTransactionPaymentHistoryList.Any()) { ErrorDisplay1.ShowError("Transaction Payment History is empty or session has expired."); return; } dgPaymentHistory.SelectedIndex = e.Item.ItemIndex; long id = (DataCheck.IsNumeric(dgPaymentHistory.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgPaymentHistory.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ErrorDisplay1.ShowError("Invalid Record Selection!"); return; } var transactionHistory = expenseTransactionPaymentHistoryList.Find(m => m.StaffExpenseTransactionPaymentHistoryId == id); if (transactionHistory == null || transactionHistory.StaffExpenseTransactionPaymentHistoryId < 1) { ErrorDisplay1.ShowError("Invalid selection"); return; } if (transactionHistory.Comment == null) { ErrorDisplay1.ShowError("There is no comment for the selected transaction"); } else { lgTransactionTitle.InnerHtml = transactionHistory.StaffExpenseTransaction.ExpenseTitle; txtHistoryComment.Text = transactionHistory.Comment; mpePaymentCommentPopup.PopupControlID = dvTransactionComment.ID; mpePaymentCommentPopup.CancelControlID = btnCloseComment.ID; mpePaymentCommentPopup.Show(); } } catch { ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); } }
internal static bool shouldClearCache(string itemName) { try { var status = ConfigurationManager.AppSettings.Get(itemName); return(!string.IsNullOrEmpty(status) && DataCheck.IsNumeric(status) && int.Parse(status) == 1); } catch (Exception) { return(true); } }
protected void DgExpenseTransactionEditCommand(object source, DataGridCommandEventArgs e) { try { if (Session["_transactionItems"] == null) { ConfirmAlertBox1.ShowMessage("Session has expired.", ConfirmAlertBox.PopupMessageType.Error); return; } var transactionItems = Session["_transactionItems"] as List <TransactionItem>; if (transactionItems == null || !transactionItems.Any()) { ConfirmAlertBox1.ShowMessage("Session has expired.", ConfirmAlertBox.PopupMessageType.Error); return; } dgExpenseItem.SelectedIndex = e.Item.ItemIndex; var id = (DataCheck.IsNumeric(dgExpenseItem.DataKeys[e.Item.ItemIndex].ToString())) ? int.Parse(dgExpenseItem.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid Record Selection!", ConfirmAlertBox.PopupMessageType.Error); return; } var transactionItem = transactionItems.Find(m => m.TransactionItemId == id); if (transactionItem == null || transactionItem.TransactionItemId < 1) { ConfirmAlertBox1.ShowMessage("Invalid selection.", ConfirmAlertBox.PopupMessageType.Error); return; } textApprouvedQuantity.Value = string.Empty; textApprovedUnitPrice.Value = string.Empty; btnUpdateTransactionItem.Text = "Update"; ddlExpenseItem.SelectedValue = transactionItem.ExpenseItem.ExpenseItemId.ToString(CultureInfo.InvariantCulture); ddlExpenseType.SelectedValue = transactionItem.ExpenseTypeId.ToString(CultureInfo.InvariantCulture); txtQuantity.Text = transactionItem.RequestedQuantity.ToString(CultureInfo.InvariantCulture); txtUnitPrice.Text = transactionItem.RequestedUnitPrice.ToString(CultureInfo.InvariantCulture); txtTotalRequestedPrice.Value = transactionItem.TotalPrice.ToString(CultureInfo.InvariantCulture); btnUpdateTransactionItem.Text = "Update"; mpeExpenseItemsPopup.Show(); Session["_transactionItem"] = transactionItem; } catch { ConfirmAlertBox1.ShowMessage("The Edit process could not be initiated. Please try again.", ConfirmAlertBox.PopupMessageType.Error); } }
private void LoadTransactionPaymentFooter() { try { if (dgAllTransactionPayments.Items.Count > 0) { double expAmountPayableTotal = 0; double expAmountPaidTotal = 0; double totalBalance = 0; for (var i = 0; i < dgAllTransactionPayments.Items.Count; i++) { expAmountPayableTotal += DataCheck.IsNumeric(((Label)dgAllTransactionPayments.Items[i].FindControl("lblTotalAmountPaid")).Text) ? double.Parse(((Label)dgAllTransactionPayments.Items[i].FindControl("lblTotalAmountPaid")).Text) : 0; expAmountPaidTotal += DataCheck.IsNumeric(((Label)dgAllTransactionPayments.Items[i].FindControl("lblAmountPaid")).Text) ? double.Parse(((Label)dgAllTransactionPayments.Items[i].FindControl("lblAmountPaid")).Text) : 0; totalBalance += DataCheck.IsNumeric(((Label)dgAllTransactionPayments.Items[i].FindControl("lblBalance")).Text) ? double.Parse(((Label)dgAllTransactionPayments.Items[i].FindControl("lblBalance")).Text) : 0; } foreach (var item in dgAllTransactionPayments.Controls[0].Controls) { if (item.GetType() == typeof(DataGridItem)) { var itmType = ((DataGridItem)item).ItemType; if (itmType == ListItemType.Footer) { if (((DataGridItem)item).FindControl("lblTotalAmountPaidFooter") != null) { ((Label)((DataGridItem)item).FindControl("lblTotalAmountPaidFooter")).Text = "N" + NumberMap.GroupToDigits(expAmountPayableTotal.ToString(CultureInfo.InvariantCulture)); } if (((DataGridItem)item).FindControl("lblAmountPaidFooter") != null) { ((Label)((DataGridItem)item).FindControl("lblAmountPaidFooter")).Text = "N" + NumberMap.GroupToDigits(expAmountPaidTotal.ToString(CultureInfo.InvariantCulture)); } if (((DataGridItem)item).FindControl("lblBalanceFooter") != null) { ((Label)((DataGridItem)item).FindControl("lblBalanceFooter")).Text = "N" + NumberMap.GroupToDigits(totalBalance.ToString(CultureInfo.InvariantCulture)); } } } } } } 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); } }
private void LoadTransactionsFooter() { try { if (dgAllTransactionPayments.Items.Count > 0) { double totalBalance = 0; double totalAmountPaid = 0; double totalAmountPayable = 0; // lblTotalAmountPaid lblAmountPaid lblBalance lblTotalAmountPaidFooter lblAmountPaidFooter lblBalanceFooter for (var i = 0; i < dgAllTransactionPayments.Items.Count; i++) { totalBalance += DataCheck.IsNumeric(((Label)dgAllTransactionPayments.Items[i].FindControl("lblBalance")).Text) ? double.Parse(((Label)dgAllTransactionPayments.Items[i].FindControl("lblBalance")).Text.Replace(",", string.Empty)) : 0; totalAmountPaid += DataCheck.IsNumeric(((Label)dgAllTransactionPayments.Items[i].FindControl("lblAmountPaid")).Text) ? double.Parse(((Label)dgAllTransactionPayments.Items[i].FindControl("lblAmountPaid")).Text.Replace(",", string.Empty)) : 0; totalAmountPayable += DataCheck.IsNumeric(((Label)dgAllTransactionPayments.Items[i].FindControl("lblTotalAmountPaid")).Text) ? double.Parse(((Label)dgAllTransactionPayments.Items[i].FindControl("lblTotalAmountPaid")).Text.Replace(",", string.Empty)) : 0; } foreach (var item in dgAllTransactionPayments.Controls[0].Controls) { if (item.GetType() == typeof(DataGridItem)) { var itmType = ((DataGridItem)item).ItemType; if (itmType == ListItemType.Footer) { if (((DataGridItem)item).FindControl("lblBalanceFooter") != null) { ((Label)((DataGridItem)item).FindControl("lblBalanceFooter")).Text = "N" + NumberMap.GroupToDigits(totalBalance.ToString(CultureInfo.InvariantCulture)); } if (((DataGridItem)item).FindControl("lblAmountPaidFooter") != null) { ((Label)((DataGridItem)item).FindControl("lblAmountPaidFooter")).Text = "N" + NumberMap.GroupToDigits(totalAmountPaid.ToString(CultureInfo.InvariantCulture)); } if (((DataGridItem)item).FindControl("lblTotalAmountPaidFooter") != null) { ((Label)((DataGridItem)item).FindControl("lblTotalAmountPaidFooter")).Text = "N" + NumberMap.GroupToDigits(totalAmountPayable.ToString(CultureInfo.InvariantCulture)); } } } } } } catch { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); } }
protected void DgAllTransactionPaymentsCommand(object source, DataGridCommandEventArgs e) { ErrorDisplay1.ClearError(); try { if (Session["_expensePaymentsList"] == null) { ErrorDisplay1.ShowError("Expense Transaction Payment list is empty or session has expired."); return; } var expenseTransactionPaymentList = Session["_expensePaymentsList"] as List <StaffExpenseTransactionPayment>; if (expenseTransactionPaymentList == null || !expenseTransactionPaymentList.Any()) { ErrorDisplay1.ShowError("Expense Transaction Payment list is empty or session has expired."); return; } dgAllTransactionPayments.SelectedIndex = e.Item.ItemIndex; long id = (DataCheck.IsNumeric(dgAllTransactionPayments.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgAllTransactionPayments.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ErrorDisplay1.ShowError("Invalid Record Selection!"); return; } var expenseTransactionPayment = expenseTransactionPaymentList.Find(m => m.StaffExpenseTransactionPaymentId == id); if (expenseTransactionPayment == null || expenseTransactionPayment.StaffExpenseTransactionId < 1) { ErrorDisplay1.ShowError("Invalid record selection."); return; } if (e.CommandName == "ViewHistory") { LoadTransactionPaymentHistory(expenseTransactionPayment.StaffExpenseTransactionId); dvTransactionPayments.Visible = false; dvTransactionPaymentHistory.Visible = true; } } catch { ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); } }
protected void DgUserInitiatedTransactionsItemCommand(object source, DataGridCommandEventArgs e) { try { dgUserInitiatedTransactions.SelectedIndex = e.Item.ItemIndex; long id = (DataCheck.IsNumeric(dgUserInitiatedTransactions.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgUserInitiatedTransactions.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid Record Selection!", ConfirmAlertBox.PopupMessageType.Error); return; } var transaction = ServiceProvider.Instance().GetExpenseTransactionServices().GetExpenseTransaction(id); if (transaction == null || transaction.ExpenseTransactionId < 1) { ConfirmAlertBox1.ShowMessage("Invalid record selection.", ConfirmAlertBox.PopupMessageType.Error); return; } if (e.CommandName == "viewDetails") { LoadTransactionItems(transaction); return; } if (e.CommandName == "viewComment") { if (transaction.Status == 0) { ConfirmAlertBox1.ShowMessage("Transaction is still pending.", ConfirmAlertBox.PopupMessageType.Error); return; } txtRejComment.Text = string.Empty; txtRejComment.Text = transaction.ApproverComment; lgCommentTitle.InnerText = transaction.ExpenseTitle; mpeExpenseItemsPopup.CancelControlID = "closerejection"; mpeExpenseItemsPopup.PopupControlID = "dvRejection"; mpeExpenseItemsPopup.Show(); } } catch { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin. Please try again soon or contact your site Admin.", ConfirmAlertBox.PopupMessageType.Error); } }
protected void DgPortalUsersDeleteCommand(Object source, DataGridCommandEventArgs e) { ErrorDisplay1.ClearError(); if (!Page.User.IsInRole("PortalAdmin")) { ErrorDisplay1.ShowError("Sorry: You are not authorized to delete a user"); return; } try { dgPortalUsers.SelectedIndex = e.Item.ItemIndex; var userId = (DataCheck.IsNumeric(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (userId < 1) { ErrorDisplay1.ShowError("Invalid Selection"); return; } string mName = ((LinkButton)dgPortalUsers.SelectedItem.FindControl("lblUserName")).Text; if (mName.Length < 2) { ErrorDisplay1.ShowError("No User Item Selected"); return; } if (HttpContext.Current.User.Identity.Name.ToLower() == mName.ToLower()) { ErrorDisplay1.ShowError("You cannot delete the current user!"); return; } var mUser = Membership.GetUser(mName, false); if (mUser == null) { ErrorDisplay1.ShowError("Username not found!"); return; } mUser.IsApproved = false; Membership.UpdateUser(mUser); //Membership.DeleteUser(mName); //new PortalServiceManager().DeletePortalUser(userId); BindUsersList(); ErrorDisplay1.ShowSuccess("User Record Was Deleted"); } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError(ex.Message); } }
private bool ValidateTransactionPaymentControl() { ErrorDisplay1.ClearError(); ErrorDisplayCompletePayment.ClearError(); try { if (string.IsNullOrEmpty(txtAmountPaid.Value.Trim())) { ErrorDisplayCompletePayment.ShowError("Please supply the amount to be paid."); txtAmountPaid.Focus(); mpeSelectDateRangePopup.Show(); return(false); } if (txtAmountPaid.Value.Trim().Contains('-') || txtAmountPaid.Value.Trim().Contains('+') || txtAmountPaid.Value.Trim().Contains('*') || txtAmountPaid.Value.Trim().Contains('/')) { ErrorDisplayCompletePayment.ShowError("Invalid entry!"); txtAmountPaid.Focus(); mpeSelectDateRangePopup.Show(); return(false); } if (double.Parse(txtAmountPaid.Value.Trim()) > double.Parse(txtBalance.Text.Trim())) { ErrorDisplayCompletePayment.ShowError("Please enter an amount less than or equal to the Expense Transaction balance."); mpeSelectDateRangePopup.Show(); return(false); } if (!DataCheck.IsNumeric(txtAmountPaid.Value.Trim())) { ErrorDisplayCompletePayment.ShowError("Invalid entry!"); txtAmountPaid.Focus(); mpeSelectDateRangePopup.Show(); return(false); } return(true); } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); return(false); } }
protected void DgAssetTypesEditCommand(object source, DataGridCommandEventArgs e) { ErrorDisplay1.ClearError(); ErrorDisplayProcessAssetType.ClearError(); txtAssetType.Text = string.Empty; ddlAssetCategory.SelectedIndex = 0; chkAssetType.Checked = false; try { dgAssetTypes.SelectedIndex = e.Item.ItemIndex; var assetTypeId = (DataCheck.IsNumeric(dgAssetTypes.DataKeys[e.Item.ItemIndex].ToString())) ? int.Parse(dgAssetTypes.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (assetTypeId < 1) { ErrorDisplay1.ShowError("Invalid AssetType Selection"); return; } var assetType = ServiceProvider.Instance().GetAssetTypeServices().GetAssetType(assetTypeId); if (assetType == null) { ErrorDisplay1.ShowError("Invalid selection!"); return; } if (assetType.AssetTypeId < 1) { ErrorDisplay1.ShowError("Invalid selection!"); return; } ddlAssetCategory.SelectedValue = assetType.AssetCategoryId.ToString(CultureInfo.InvariantCulture); txtAssetType.Text = assetType.Name; chkAssetType.Checked = assetType.Status == 1; btnSubmitAssetType.CommandArgument = "2"; //update btnSubmitAssetType.Text = "Update"; lgAssetTypeTitle.InnerHtml = "Update Asset Type information"; mpeProcessAssetType.Show(); Session["_assetType"] = assetType; } catch { ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin. Please try again soon or contact the Admin."); } }
protected void DgUnitsEditCommand(object source, DataGridCommandEventArgs e) { txtName.Text = string.Empty; try { dgUnits.SelectedIndex = e.Item.ItemIndex; var id = (DataCheck.IsNumeric(dgUnits.DataKeys[e.Item.ItemIndex].ToString())) ? int.Parse(dgUnits.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid Selection", ConfirmAlertBox.PopupMessageType.Error); return; } var unit = ServiceProvider.Instance().GetUnitServices().GetUnit(id); if (unit == null) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } if (unit.UnitId < 1) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } txtName.Text = unit.Name; ddlDepartment.SelectedValue = unit.DepartmentId.ToString(CultureInfo.InvariantCulture); chkUnit.Checked = unit.Status == 1; btnProcessUnit.CommandArgument = "2"; btnProcessUnit.Text = "Update"; lgTitle.InnerText = "Update Unit"; mpeProcessUnit.Show(); Session["_unit"] = unit; } catch (Exception ex) { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); } }
protected void DgAccountsHeadEditCommand(object source, DataGridCommandEventArgs e) { ErrorDisplayProcessAccountsHead.ClearError(); LoadExpenseCategories(); txtTitle.Text = string.Empty; txtDescription.Text = string.Empty; ddlExpenseCategory.SelectedIndex = 0; chkAccountsHead.Checked = false; try { dgAccountsHead.SelectedIndex = e.Item.ItemIndex; var accountsHeadId = (DataCheck.IsNumeric(dgAccountsHead.DataKeys[e.Item.ItemIndex].ToString())) ? int.Parse(dgAccountsHead.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (accountsHeadId < 1) { ConfirmAlertBox1.ShowMessage("Invalid AccountsHead Selection", ConfirmAlertBox.PopupMessageType.Error); return; } var accountsHead = ServiceProvider.Instance().GetAccountsHeadServices().GetAccountsHead(accountsHeadId); if (accountsHead == null || accountsHead.AccountsHeadId < 1) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } ddlExpenseCategory.SelectedValue = accountsHead.ExpenseCategoryId.ToString(CultureInfo.InvariantCulture); txtTitle.Text = accountsHead.Title; txtDescription.Text = accountsHead.Description; chkAccountsHead.Checked = accountsHead.Status == 1; btnSubmitAccountsHead.CommandArgument = "2"; //update btnSubmitAccountsHead.Text = "Update"; lgAccountsTitle.InnerHtml = "Update Accounts Head information"; mpeProcessAccountsHead.Show(); Session["_accountsHead"] = accountsHead; } 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); } }
protected void DgBeneficiaryTypesEditCommand(object source, DataGridCommandEventArgs e) { txtName.Text = string.Empty; try { dgBeneficiaryTypes.SelectedIndex = e.Item.ItemIndex; var id = (DataCheck.IsNumeric(dgBeneficiaryTypes.DataKeys[e.Item.ItemIndex].ToString())) ? int.Parse(dgBeneficiaryTypes.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid Selection", ConfirmAlertBox.PopupMessageType.Error); return; } var beneficiaryType = ServiceProvider.Instance().GetBeneficiaryTypeServices().GetBeneficiaryType(id); if (beneficiaryType == null) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } if (beneficiaryType.BeneficiaryTypeId < 1) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } txtName.Text = beneficiaryType.Name; chkBeneficiaryType.Checked = beneficiaryType.Status == 1; btnProcessBeneficiaryType.CommandArgument = "2"; btnProcessBeneficiaryType.Text = "Update"; mpeProcessBeneficiaryType.Show(); Session["_beneficiaryType"] = beneficiaryType; } catch (Exception ex) { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); } }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { if (value == null || string.IsNullOrEmpty(value.ToString())) { return(new ValidationResult(ErrorMessageString)); } if (value.ToString().Length != 8) { return(new ValidationResult("Invalid Passcode! Passcode must 8 digits")); } if (!DataCheck.IsNumeric(value.ToString())) { return(new ValidationResult("Invalid Passcode! Passcode must be numeric")); } if (int.Parse(value.ToString()) < 1) { return(new ValidationResult("Invalid Passcode! Passcode cannot be all-zero")); } return(ValidationResult.Success); }
protected void DgPortalUsersItemCommand(object source, DataGridCommandEventArgs e) { dgPortalUsers.SelectedIndex = e.Item.ItemIndex; var id = (DataCheck.IsNumeric(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString())) ? int.Parse(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid Record Selection!", ConfirmAlertBox.PopupMessageType.Error); return; } var portalUser = new PortalServiceManager().GetPortalUserById(id); if (portalUser == null || portalUser.PortalUserId < 1) { ConfirmAlertBox1.ShowMessage("Invalid record selection.", ConfirmAlertBox.PopupMessageType.Error); return; } var user = Membership.GetUser(portalUser.UserId); if (user == null) { ConfirmAlertBox1.ShowMessage("Invalid record selection.", ConfirmAlertBox.PopupMessageType.Error); return; } var status = (portalUser.Status) ? 1 : 0; var email = user.Email; var delegateService = new ApprovalDelegateService(); if (!delegateService.AddDelegateApprover(portalUser.PortalUserId, status, email)) { ConfirmAlertBox1.ShowMessage("User could not be added as an Approver. Please try again later or contact the Administrator.", ConfirmAlertBox.PopupMessageType.Error); return; } ConfirmAlertBox1.ShowSuccessAlert("User was successfully assigned the Approver role."); }
protected void DgExpenseItemEditCommand(object source, DataGridCommandEventArgs e) { ErrorDisplayProcessTransactionItems.ClearError(); try { dgExpenseItem.SelectedIndex = e.Item.ItemIndex; var id = (DataCheck.IsNumeric(dgExpenseItem.DataKeys[e.Item.ItemIndex].ToString())) ? int.Parse(dgExpenseItem.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid ExpenseItem Selection", ConfirmAlertBox.PopupMessageType.Error); return; } var expenseItem = ServiceProvider.Instance().GetExpenseItemServices().GetExpenseItem(id); if (expenseItem == null || expenseItem.ExpenseItemId < 1) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } ccdExpenseCategory.SelectedValue = expenseItem.ExpenseCategoryId.ToString(CultureInfo.InvariantCulture); ccdAccountsHead.SelectedValue = expenseItem.AccountsHeadId.ToString(CultureInfo.InvariantCulture); txtTitle.Text = expenseItem.Title; txtDescription.Text = expenseItem.Description; chkActivateTransactionItem.Checked = expenseItem.Status == 1; lgTitleScope.InnerHtml = "Update Expense Item"; Session["_expenseItem"] = expenseItem; btnProcessTransactionItems.CommandArgument = "2"; btnProcessTransactionItems.Text = "Update"; mpeExpenseItemsPopup.Show(); } catch { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); } }
private bool ValidateControls() { ErrorDisplay1.ClearError(); ErrorDisplayProcessAssetCategory.ClearError(); if (string.IsNullOrEmpty(txtName.Text.Trim())) { ErrorDisplayProcessAssetCategory.ShowError("Please supply an Asset Category."); txtName.Focus(); mpeProcessAssetCategory.Show(); return(false); } if (string.IsNullOrEmpty(txtCode.Text.Trim())) { ErrorDisplayProcessAssetCategory.ShowError("Please supply a code for the Asset Category."); txtCode.Focus(); mpeProcessAssetCategory.Show(); return(false); } //Use reg validator to check name //if (RegExValidation.IsNameValid(txtName.Text.Trim())) //{ // ErrorDisplayProcessAssetCategory.ShowError("Invalid entry!"); // txtName.Focus(); // mpeProcessAssetCategory.Show(); // return false; //} if (!DataCheck.IsNumeric(txtCode.Text.Trim())) { ErrorDisplayProcessAssetCategory.ShowError("Invalid entry!"); txtCode.Focus(); mpeProcessAssetCategory.Show(); return(false); } return(true); }
protected void DgUnitsDeleteCommand(object source, DataGridCommandEventArgs e) { try { dgUnits.SelectedIndex = e.Item.ItemIndex; var id = (DataCheck.IsNumeric(dgUnits.DataKeys[e.Item.ItemIndex].ToString())) ? int.Parse(dgUnits.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid Selection", ConfirmAlertBox.PopupMessageType.Error); return; } if (!ServiceProvider.Instance().GetUnitServices().DeleteUnit(id)) { ConfirmAlertBox1.ShowMessage("The requested operation could not be completed. The Unit is likely being referenced by a Beneficiary.", ConfirmAlertBox.PopupMessageType.Error); return; } if (!LoadUnits()) { ConfirmAlertBox1.ShowMessage("Unit information was successfully deleted but an error was encountered while trying to refresh the list.\n Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); return; } ConfirmAlertBox1.ShowSuccessAlert("Unit information was successfully deleted."); } catch (Exception) { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); } }
protected void DgDepartmentsEditCommand(object source, DataGridCommandEventArgs e) { ErrorDisplayProcessDepartment.ClearError(); txtName.Text = string.Empty; try { if (Session["_departmentsList"] == null) { ConfirmAlertBox1.ShowMessage("Department list is empty or session has expired!", ConfirmAlertBox.PopupMessageType.Error); return; } var expenseaCategoriesList = (List <Department>)Session["_departmentsList"]; if (expenseaCategoriesList == null) { ConfirmAlertBox1.ShowMessage("Department list is empty or session has expired!", ConfirmAlertBox.PopupMessageType.Error); return; } if (!expenseaCategoriesList.Any()) { ConfirmAlertBox1.ShowMessage("Department list is empty or session has expired!", ConfirmAlertBox.PopupMessageType.Error); return; } dgDepartments.SelectedIndex = e.Item.ItemIndex; var id = (DataCheck.IsNumeric(dgDepartments.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgDepartments.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid Selection", ConfirmAlertBox.PopupMessageType.Error); return; } var department = expenseaCategoriesList.Find(m => m.DepartmentId == id); if (department == null) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } if (department.DepartmentId < 1) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } txtName.Text = department.Name; chkDepartment.Checked = department.Status == 1; btnProcessDepartment.CommandArgument = "2"; btnProcessDepartment.Text = "Update"; lgTitle.InnerText = "Update Department"; mpeProcessDepartment.Show(); Session["_department"] = department; } catch (Exception ex) { ErrorDisplayProcessDepartment.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); } }
protected void DgDepartmentsDeleteCommand(object source, DataGridCommandEventArgs e) { ErrorDisplayProcessDepartment.ClearError(); try { if (Session["_departmentsList"] == null) { ConfirmAlertBox1.ShowMessage("Department list is empty or session has expired!", ConfirmAlertBox.PopupMessageType.Error); return; } var departmentsList = Session["_departmentsList"] as List <Department>; if (departmentsList == null || !departmentsList.Any()) { ConfirmAlertBox1.ShowMessage("Department list is empty or session has expired!", ConfirmAlertBox.PopupMessageType.Error); return; } dgDepartments.SelectedIndex = e.Item.ItemIndex; var id = (DataCheck.IsNumeric(dgDepartments.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgDepartments.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid Selection", ConfirmAlertBox.PopupMessageType.Error); return; } var department = departmentsList.Find(m => m.DepartmentId == id); if (department == null) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } if (department.DepartmentId < 1) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } if (!ServiceProvider.Instance().GetDepartmentServices().DeleteDepartment(department.DepartmentId)) { ConfirmAlertBox1.ShowMessage("The requested operation could not be completed. The Department is likely being referenced by a Beneficiary.", ConfirmAlertBox.PopupMessageType.Error); return; } if (!LoadDepartments()) { ConfirmAlertBox1.ShowMessage("Department information was successfully deleted but an error was encountered while trying to refresh the list.\n Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); return; } ConfirmAlertBox1.ShowSuccessAlert("Department information was successfully deleted."); } catch (Exception) { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); } }
protected void DgExpCatCollectionsEditCommand(object source, DataGridCommandEventArgs e) { ErrorDisplayProcessExpenseCategory.ClearError(); txtTitle.Text = string.Empty; try { if (Session["_expenseCategoriesList"] == null) { ConfirmAlertBox1.ShowMessage("Expense Category list is empty or session has expired!", ConfirmAlertBox.PopupMessageType.Error); return; } var expenseaCategoriesList = Session["_expenseCategoriesList"] as List <ExpenseCategory>; if (expenseaCategoriesList == null || !expenseaCategoriesList.Any()) { ConfirmAlertBox1.ShowMessage("Expense Category list is empty or session has expired!", ConfirmAlertBox.PopupMessageType.Error); return; } dgExpCatCollections.SelectedIndex = e.Item.ItemIndex; var id = (DataCheck.IsNumeric(dgExpCatCollections.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgExpCatCollections.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (id < 1) { ConfirmAlertBox1.ShowMessage("Invalid Selection", ConfirmAlertBox.PopupMessageType.Error); return; } var expenseCategory = expenseaCategoriesList.Find(m => m.ExpenseCategoryId == id); if (expenseCategory == null) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } if (expenseCategory.ExpenseCategoryId < 1) { ConfirmAlertBox1.ShowMessage("Invalid selection!", ConfirmAlertBox.PopupMessageType.Error); return; } txtTitle.Text = expenseCategory.Title; txtCode.Text = expenseCategory.Code; chkCategory.Checked = expenseCategory.Status == 1; btnProcessCategory.CommandArgument = "2"; btnProcessCategory.Text = "Update"; mpeProcessExpenseCategory.Show(); Session["_expenseCategory"] = expenseCategory; } catch (Exception ex) { ErrorDisplayProcessExpenseCategory.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); } }
private bool ValidateTransactionItemsControls() { try { if (int.Parse(ddlExpenseItem.SelectedValue) < 1) { ConfirmAlertBox1.ShowMessage("Please select Expense Item.", ConfirmAlertBox.PopupMessageType.Error); ddlExpenseItem.Focus(); return(false); } if (int.Parse(ddlExpenseType.SelectedValue) < 1) { ConfirmAlertBox1.ShowMessage("Please select Expense an Expense Type.", ConfirmAlertBox.PopupMessageType.Error); ddlExpenseType.Focus(); return(false); } if (string.IsNullOrEmpty(txtQuantity.Text.Trim())) { ConfirmAlertBox1.ShowMessage("Please supply the Item quantity.", ConfirmAlertBox.PopupMessageType.Error); txtQuantity.Focus(); return(false); } if (string.IsNullOrEmpty(txtUnitPrice.Text.Trim())) { ConfirmAlertBox1.ShowMessage("Please supply the Price per item.", ConfirmAlertBox.PopupMessageType.Error); txtUnitPrice.Focus(); return(false); } if (!DataCheck.IsNumeric(txtUnitPrice.Text.Trim())) { ConfirmAlertBox1.ShowMessage("Invalid entry!", ConfirmAlertBox.PopupMessageType.Error); txtUnitPrice.Focus(); return(false); } if (!DataCheck.IsNumeric(txtQuantity.Text.Trim())) { ConfirmAlertBox1.ShowMessage("Invalid entry!", ConfirmAlertBox.PopupMessageType.Error); txtQuantity.Focus(); return(false); } if (!string.IsNullOrEmpty(textApprouvedQuantity.Value.Trim())) { if (!DataCheck.IsNumeric(textApprouvedQuantity.Value.Trim())) { ConfirmAlertBox1.ShowMessage("Invalid entry!", ConfirmAlertBox.PopupMessageType.Error); txtQuantity.Focus(); return(false); } } if (!string.IsNullOrEmpty(textApprovedUnitPrice.Value.Trim())) { if (!DataCheck.IsNumeric(textApprovedUnitPrice.Value.Replace(",", string.Empty).Replace(".", string.Empty).Trim())) { ConfirmAlertBox1.ShowMessage("Invalid entry!", ConfirmAlertBox.PopupMessageType.Error); txtQuantity.Focus(); return(false); } } return(true); } catch (Exception) { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); return(false); } }
protected void DgPortalUsersDeleteCommand(Object source, DataGridCommandEventArgs e) { ErrorDisplay1.ClearError(); //if (!Page.User.IsInRole("PortalAdmin")) //{ // ErrorDisplay1.ShowError("Sorry: You are not authorized to delete a user"); // return; //} try { dgPortalUsers.SelectedIndex = e.Item.ItemIndex; var portaluserId = (DataCheck.IsNumeric(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString())) ? long.Parse(dgPortalUsers.DataKeys[e.Item.ItemIndex].ToString()) : 0; if (portaluserId < 1) { ErrorDisplay1.ShowError("Invalid Selection"); return; } int userId = int.Parse(((HiddenField)dgPortalUsers.SelectedItem.FindControl("hndUId")).Value.ToString(CultureInfo.InvariantCulture)); if (userId < 1) { ErrorDisplay1.ShowError("No User Item Selected"); return; } string userName = ((Label)dgPortalUsers.SelectedItem.FindControl("lblUserName")).Text; if (userName.Length < 2) { ErrorDisplay1.ShowError("Invalid UserName!"); return; } var mUser = Membership.GetUser(userName, false); if (mUser == null) { ErrorDisplay1.ShowError("Username not found!"); return; } //if (HttpContext.Current.User.Identity.Name.ToLower() == mName.ToLower()) //{ // ErrorDisplay1.ShowError("You cannot delete the current user!"); // return; //} var ret = new PortalServiceManager().UpdateLockedUser(userId); if (!ret) { ErrorDisplay1.ShowError("Unsuccessful Reset Operation!"); return; } string newPassword; try { newPassword = mUser.ResetPassword(); } catch (MembershipPasswordException ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError("Invalid password answer. Please re-enter and try again."); return; } var body = string.Format("Password reset. Your new password is: {0}", Server.HtmlEncode(newPassword)); if (Mailsender(mUser.Email, "ExpenseManager : User Credential Reset.", body)) { BindUsersList(); ErrorDisplay1.ShowSuccess("User Record has been Reset"); } } catch (Exception ex) { ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message); ErrorDisplay1.ShowError(ex.Message); } }