Example #1
0
        private bool DoValidations()
        {
            ValidationError = "";
            if (string.IsNullOrWhiteSpace(CurrentSettings.DisplayName))
            {
                ValidationError = "Please Enter a display name for terminal.";
                return(false);
            }

            if (string.IsNullOrWhiteSpace(CurrentSettings.TerminalIpAddress) || !ChefmateUtility.IsValidIpAddress(CurrentSettings.TerminalIpAddress))
            {
                ValidationError = "Please Enter a valid ip address for terminal.";
                return(false);
            }
            if (string.IsNullOrWhiteSpace(CurrentSettings.DbPath))
            {
                ValidationError = "Please Enter a path for database.";
                return(false);
            }

            if (string.IsNullOrWhiteSpace(CurrentSettings.TerminalIpAddress) || !ChefmateUtility.IsValidIpAddress(CurrentSettings.DbIpAddress))
            {
                ValidationError = "Please Enter a valid ip address for databse.";
                return(false);
            }
            if (CurrentSettings.SecondWarningTime == 0)
            {
                ValidationError = "Second warning time should be greater than 0.";
                return(false);
            }
            if (CurrentSettings.FirstWarningTime == 0)
            {
                ValidationError = "First warning time should be greater than 0.";
                return(false);
            }
            if (CurrentSettings.FirstWarningTime >= CurrentSettings.SecondWarningTime)
            {
                ValidationError = "First warning time can't be greater than or equal to second warning time.";
                return(false);
            }
            try
            {
                if (!CheckDataBase())
                {
                    ValidationError = "Database connection failed. Please enter valid ipaddress and path for database.";
                    return(false);
                }
            }
            catch (Exception)
            {
                ValidationError = "Database connection failed. Please enter valid ipaddress and path for database.";
                return(false);
            }

            return(true);
        }
Example #2
0
 private void CheckIpAddress(string ipAddress, string prop)
 {
     if (string.IsNullOrWhiteSpace(ipAddress) || !ChefmateUtility.IsValidIpAddress(ipAddress))
     {
         ValidationError = "Invalid " + prop;
     }
     else
     {
         ValidationError = String.Empty;
     }
 }
Example #3
0
        private bool DoValidations()
        {
            ValidationError = "";
            if (string.IsNullOrWhiteSpace(DisplayName))
            {
                ValidationError = "Please Enter a display name for terminal.";
                return(false);
            }

            if (string.IsNullOrWhiteSpace(TerminalIpAddress) || !ChefmateUtility.IsValidIpAddress(TerminalIpAddress))
            {
                ValidationError = "Please Enter a valid ip address for terminal.";
                return(false);
            }
            if (string.IsNullOrWhiteSpace(DbPath))
            {
                ValidationError = "Please Enter a path for database.";
                return(false);
            }

            if (string.IsNullOrWhiteSpace(DbIpAddress) || !ChefmateUtility.IsValidIpAddress(DbIpAddress))
            {
                ValidationError = "Please Enter a valid ip address for databse.";
                return(false);
            }
            try
            {
                if (!CheckDataBase())
                {
                    ValidationError = "Database connection failed. Please enter valid ipaddress and path for database.";
                    return(false);
                }
            }
            catch (Exception)
            {
                ValidationError = "Database connection failed. Please enter valid ipaddress and path for database.";
                return(false);
            }

            return(true);
        }