コード例 #1
0
 static bool ValidateString(string value, SystemTreeListTag systemColumnTag, ref string errorText)
 {
     if (EM_Helpers.ContainsIllegalChar(value, ref errorText, _additionallyAllowedChar_TypeString))
     {
         return(false);
     }
     return(true);
 }
コード例 #2
0
        static bool ValidateFormula(string value, SystemTreeListTag systemColumnTag, ref string errorText)
        {
            if (EM_Helpers.ContainsIllegalChar(value, ref errorText, _additionallyAllowedChar_TypeFormula))
            {
                return(false);
            }
            Dictionary <char, char> parenthesesPairsToCheck = new Dictionary <char, char>();

            parenthesesPairsToCheck.Add('(', ')');
            if (!DoParenthesesMatch(value, ref errorText, parenthesesPairsToCheck))
            {
                return(false);
            }
            return(true);
        }
コード例 #3
0
        static bool IsValidSystemName(string systemName, TreeList countryTreeList, CountryConfigFacade countryConfigFacade = null)
        {
            string errorText = string.Empty;

            if (EM_Helpers.ContainsIllegalChar(systemName, ref errorText))
            {
                Tools.UserInfoHandler.ShowError(errorText);
                return(false);
            }

            if (IsExistingSystemName(systemName, countryTreeList, countryConfigFacade) == true)
            {
                Tools.UserInfoHandler.ShowError("System '" + systemName + "' already exists. Please choose another name.");
                return(false);
            }

            return(true);
        }
コード例 #4
0
        internal static bool IsValidPolicyName(ref string policyName, string countryShortcut, TreeList countryTreeList, string currentName = "")
        {
            countryShortcut = countryShortcut.ToLower();
            if (countryShortcut.Substring(0, 1) != "_")
            {
                countryShortcut = "_" + countryShortcut;
            }

            string errorText = string.Empty;

            if (EM_Helpers.ContainsIllegalChar(policyName, ref errorText))
            {
                Tools.UserInfoHandler.ShowError(errorText);
                return(false);
            }

            if (policyName.Length < countryShortcut.Length || policyName.Substring(policyName.Length - countryShortcut.Length).ToLower() != countryShortcut)
            {
                DialogResult dialogResult = Tools.UserInfoHandler.GetInfo("Policy name should by convention end with the country's shortcut.\n\n" +
                                                                          "Should the policy be named '" + policyName + countryShortcut + "'?", MessageBoxButtons.YesNoCancel);
                if (dialogResult == DialogResult.Cancel)
                {
                    return(false);
                }
                if (dialogResult == DialogResult.Yes)
                {
                    policyName += countryShortcut;
                }
            }

            if (countryTreeList != null &&
                !(currentName != string.Empty && currentName.ToLower() == policyName.ToLower()) && // allows for lower-upper-case renaming (e.g. tin_sl to TIN_sl)
                IsExistingPolicyName(countryTreeList, policyName) == true)
            {
                Tools.UserInfoHandler.ShowError("Policy '" + policyName + "' already exists. Please choose another name.");
                return(false);
            }

            return(true);
        }