Пример #1
0
 private void ClearControls()
 {
     ErrorDisplayProcessExpenseCategory.ClearError();
     txtTitle.Text       = string.Empty;
     txtCode.Text        = string.Empty;
     chkCategory.Checked = false;
 }
Пример #2
0
        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);
        }
Пример #3
0
        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);
            }
        }