/// <summary> /// This method override the Isvalid() method defined for the base -- Markup Item to validate the name. /// </summary> /// <param name="markupType">Markup type code.</param> /// <param name="errorMessages">Exception messages.</param> /// <param name="CheckFRTA">Flag indicates if the system should check to see if the name is FRTA compliant.</param> /// <returns>Returns true, if the measure unit is valid.</returns> public override bool IsValid(MarkupItem.MarkupTypeCode markupType, out ArrayList errorMessages, bool CheckFRTA) { bool isValid = base.IsValid(markupType, out errorMessages, CheckFRTA); if (!isValid) { return(false); } // always validate measure 1 isValid = Measure1.IsValid(markupType, errorMessages); if (IsComplexType()) { if (CalculationType == CalculationTypeCode.NA) { errorMessages.Add(StringResourceUtility.GetString("Common.Error.ChooseCalculationType")); isValid = false; } // validate measure 2 if (!Measure2.IsValid(markupType, errorMessages)) { isValid = false; } } return(isValid); }
/// <summary> /// This method override the Isvalid() method defined for the base -- Markup Item to validate the name. /// Specially, this method doesn't check for FRTA compliance as other markup items. /// </summary> /// <param name="markupType">Markup type code.</param> /// <param name="errorMessages">Exception messages.</param> /// <returns>Returns true, if the scenario is valid.</returns> public bool IsValid(MarkupItem.MarkupTypeCode markupType, ArrayList errorMessages) { string invalidString = @" ~`!@#$%^&*()+={}[]|\/;’'<>?,."; char[] invalidCharacters = invalidString.ToCharArray(0, invalidString.Length - 1); bool isValid = true; if (MeasureType == MeasureTypeCode.Unknown) { errorMessages.Add(StringResourceUtility.GetString("Common.Error.MeasureTypeMustBeSelected")); isValid = false; } if ((ValueName == null) || (ValueName.Length <= 0)) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.InvalidValueName", invalidString)); isValid = false; } else { if (ValueName.IndexOfAny(invalidCharacters, 0, ValueName.Length) >= 0) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.InvalidValueName", invalidString)); isValid = false; } } return(isValid); }
/// <summary> /// This method override the Isvalid() method defined for the base -- Markup Item to validate the name. /// We need to be more restricting that the xbrl spec with respect to /// segments and scenarios as we create ssu.xsd for all the segments and /// scenarios and create elements for both type and value /// hence both element and value needs to adhere to the xml element name limitations /// </summary> /// <param name="segmentType">Markup type code.</param> /// <param name="errorMessages">Exception messages.</param> /// <param name="CheckFRTA">Flag indicates if the system should check to see if the name is FRTA compliant.</param> /// <returns>Returns true, if the segment is valid.</returns> public override bool IsValid(MarkupItem.MarkupTypeCode segmentType, out ArrayList errorMessages, bool CheckFRTA) { string invalidStringType = @" ~`!@#$%^&*()+={}[]|\/;’'<>?,."; char[] invalidCharactersType = invalidStringType.ToCharArray(0, invalidStringType.Length - 1); string invalidStringName = @" ~`!@#$%^&*()+={}[]|\/;’'<>?,."; char[] invalidCharactersName = invalidStringName.ToCharArray(0, invalidStringName.Length - 1); bool isValid = base.IsValid(segmentType, out errorMessages, CheckFRTA); if ((ValueName == null) || (ValueName.Length <= 0)) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.InvalidValueName", invalidStringName)); isValid = false; } else { if (ValueName.IndexOfAny(invalidCharactersName, 0, ValueName.Length) >= 0) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.InvalidValueName", invalidStringName)); isValid = false; } //Bug 923 - check that it does not start with a number if (char.IsDigit(Convert.ToChar(ValueName.Substring(0, 1)))) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.ValueNameStartsWithDigit")); isValid = false; } } if ((ValueType == null) || (ValueType.Length <= 0)) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.InvalidValueType", invalidStringType)); isValid = false; } else { if (ValueType.IndexOfAny(invalidCharactersType, 0, ValueType.Length) >= 0) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.InvalidValueType", invalidStringType)); isValid = false; } //Bug 923 - check that it does not start with a number if (char.IsDigit(Convert.ToChar(ValueType.Substring(0, 1)))) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.ValueTypeStartsWithDigit")); isValid = false; } } return(isValid); }
/// <summary> /// This method overrides the IsValid() method defined for the base -- Markup Item to validate the name. /// </summary> /// <param name="segmentType">Markup type code.</param> /// <param name="errorMessages">Exception messages.</param> /// <param name="CheckFRTA">Flag indicates if the system should check to see if the name is FRTA compliant.</param> /// <returns>True if the name of this <see cref="Precision"/> is valid.</returns> public override bool IsValid(MarkupItem.MarkupTypeCode segmentType, out ArrayList errorMessages, bool CheckFRTA) { bool isValid = base.IsValid(segmentType, out errorMessages, CheckFRTA); return(isValid); }
/// <summary> /// This method override the Isvalid() method defined for the base -- Markup Item to validate the name. /// We need to be more restricting that the xbrl spec with respect to /// segments and scenarios as we create ssu.xsd for all the segments and /// scenarios and create elements for both type and value /// hence both element and value needs to adhere to the xml element name limitations /// </summary> /// <param name="scenarioType">Markup type code.</param> /// <param name="errorMessages">Exception messages.</param> /// <param name="CheckFRTA">Flag indicates if the system should check to see if the name is FRTA compliant.</param> /// <returns>Returns true, if the scenario is valid.</returns> public override bool IsValid(MarkupItem.MarkupTypeCode scenarioType, out ArrayList errorMessages, bool CheckFRTA) { //we need to be more restricting that the xbrl spec with respect to //segments and scenarios as we create ssu.xsd for all the segments and //scenarios and create elements for both type and value //hence both element and value needs to adhere to the xml element name limitations //type does not allow forward slash also //3731 string invalidStringType = @" ~`!@#$%^&*()+={}[]|\/;’'<>?,."; char[] invalidCharactersType = invalidStringType.ToCharArray(0, invalidStringType.Length - 1); string invalidStringName = @" ~`!@#$%^&*()+={}[]|\/;’'<>?,."; char[] invalidCharactersName = invalidStringName.ToCharArray(0, invalidStringName.Length - 1); bool isValid = base.IsValid(scenarioType, out errorMessages, CheckFRTA); if ((ValueName == null) || (ValueName.Length <= 0)) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.InvalidValueName", invalidStringName)); isValid = false; } else { if (ValueName.IndexOfAny(invalidCharactersName, 0, ValueName.Length) >= 0) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.InvalidValueName", invalidStringName)); isValid = false; } //Bug 923 - check that it does not start with a number if (char.IsDigit(Convert.ToChar(ValueName.Substring(0, 1)))) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.ValueNameStartsWithDigit")); isValid = false; } } if ((ValueType == null) || (ValueType.Length <= 0)) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.InvalidValueType", invalidStringType)); isValid = false; } else { if (ValueType.IndexOfAny(invalidCharactersType, 0, ValueType.Length) >= 0) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.InvalidValueType", invalidStringType)); isValid = false; } //Bug 923 - check that it does not start with a number if (char.IsDigit(Convert.ToChar(ValueType.Substring(0, 1)))) { errorMessages.Add(TraceUtility.FormatStringResource("Common.Error.ValueTypeStartsWithDigit")); isValid = false; } } return(isValid); }