private bool isValidWithdrawal()
        {
            string temp = tbAmount.Text;

            return(Validator.IsPresent(temp) &&
                   Validator.IsDecimal(temp));
        }
        private bool isValidTransfer(decimal max)
        {
            string temp = tbAmount.Text;

            return(Validator.IsPresent(temp) &&
                   Validator.IsDecimal(temp) &&
                   Validator.IsInRange(Convert.ToDecimal(temp), 0.00m, max));
        }
Example #3
0
        private bool isValidDeposit()
        {
            string temp = tbAmount.Text;

            return(Validator.IsPresent(temp) &&
                   Validator.IsDecimal(temp) &&
                   Validator.IsAboveMin(Convert.ToDecimal(temp), 0.00m));
        }
Example #4
0
        //set validation
        public bool isValid(UserProfile userProfile)
        {
            //set validation for transfer funds
            if (txtTarget.Visible == true)
            {
                return
                    (Validator.IsFill(txtAccount) &&
                     Validator.IsFill(txtAmount) &&
                     Validator.IsFill(txtTarget) &&


                     Validator.IsDigit(txtAccount) &&
                     Validator.IsAllowedNumberCharacters(txtAccount, 8) &&
                     Validator.IsSourceAccount(txtAccount, userProfile) &&

                     Validator.IsDecimal(txtAmount) &&
                     Validator.IsNonnegative(txtAmount) &&

                     Validator.IsDigit(txtTarget) &&
                     Validator.IsAllowedNumberCharacters(txtTarget, 8) &&
                     Validator.IsTargetAccount(txtAccount, txtTarget, userProfile) &&

                     Validator.IsMoneyFormate(txtAmount) &&
                     Validator.IsWithinRange(txtAmount, userProfile.
                                             checkBalance(txtAccount.Text)));
            }

            //set validation for check balance
            else if (lbTitle.Text == "Check Balance")
            {
                return
                    (Validator.IsFill(txtAccount) &&

                     Validator.IsDigit(txtAccount) &&
                     Validator.IsAllowedNumberCharacters(txtAccount, 8) &&
                     Validator.IsSourceAccount(txtAccount, userProfile));
            }

            //validation for withdrawal
            else if (lbTitle.Text == "Withdrawal")
            {
                return
                    (Validator.IsFill(txtAccount) &&
                     Validator.IsFill(txtAmount) &&

                     Validator.IsDigit(txtAccount) &&
                     Validator.IsAllowedNumberCharacters(txtAccount, 8) &&
                     Validator.IsSourceAccount(txtAccount, userProfile) &&

                     Validator.IsDecimal(txtAmount) &&
                     Validator.IsNonnegative(txtAmount) &&

                     Validator.IsMoneyFormate(txtAmount) &&
                     Validator.IsWithinRange(txtAmount, userProfile.
                                             checkBalance(txtAccount.Text)));
            }

            //set validation for deposit
            else
            {
                return
                    (Validator.IsFill(txtAccount) &&
                     Validator.IsFill(txtAmount) &&

                     Validator.IsDigit(txtAccount) &&
                     Validator.IsAllowedNumberCharacters(txtAccount, 8) &&
                     Validator.IsSourceAccount(txtAccount, userProfile) &&

                     Validator.IsDecimal(txtAmount) &&
                     Validator.IsNonnegative(txtAmount) &&
                     Validator.IsMoneyFormate(txtAmount));
            }
        }