コード例 #1
0
        private string Validate(string propertyName)
        {
            // Return error message if there is error on else return empty or null string
            string validationMessage = string.Empty;

            if (_firstLoad)
            {
                return(validationMessage);
            }
            switch (propertyName)
            {
            case "Current":
                if (!double.TryParse(Current.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "Withdraw":
                if (!double.TryParse(Withdraw.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;
            }

            return(validationMessage);
        }
コード例 #2
0
        private string Validate(string propertyName)
        {
            // Return error message if there is error on else return empty or null string
            string validationMessage = string.Empty;

            if (_firstLoad)
            {
                return(validationMessage);
            }
            switch (propertyName)
            {
            case "Details":     // property name
                if (string.IsNullOrWhiteSpace(Details))
                {
                    validationMessage = "No Details Available";
                }
                break;

            case "Name":     // property name
                if (string.IsNullOrWhiteSpace(Name))
                {
                    validationMessage = "No Details Available";
                }
                break;

            case "MemberFather":     // property name
                if (string.IsNullOrWhiteSpace(Name))
                {
                    validationMessage = "No Details Available";
                }
                break;

            case "MemberMother":     // property name
                if (string.IsNullOrWhiteSpace(Name))
                {
                    validationMessage = "No Details Available";
                }
                break;

            case "AccountNo":
                if (!int.TryParse(AccountNo.ToString(), out uselessParseInt))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "Deposit":
                if (!double.TryParse(Deposit.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "Withdraw":
                if (!double.TryParse(Withdraw.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;
            }

            return(validationMessage);
        }