Example #1
0
        /// <summary>
        /// Insert a record with the values from <paramref name="text"/> to <c>LOCALISED_STRING</c>
        /// </summary>
        /// <param name="text">
        /// The text.
        /// </param>
        /// <param name="dbCommand">
        /// The DB command.
        /// </param>
        /// <param name="languageParameter">
        /// The language Parameter.
        /// </param>
        /// <param name="textParameter">
        /// The text Parameter.
        /// </param>
        private static void InsertCommon(ITextTypeWrapper text, IDbCommand dbCommand, IDataParameter languageParameter, IDataParameter textParameter)
        {
            languageParameter.Value = GetLanguage(text);
            textParameter.Value     = text.Value;

            dbCommand.ExecuteNonQuery();
        }
 public FooterMessageCore(string code, Severity severity, ITextTypeWrapper textType)
 {
     this._code = code;
     this._severity = severity;
     if (code == null)
     {
         throw new ArgumentException("FooterMessage - Code is mandatory");
     }
     if (textType == null)
     {
         throw new ArgumentException("FooterMessage - At least on e text is required");
     }
     this._footerText = new List<ITextTypeWrapper>();
     this._footerText.Add(textType);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TextTypeWrapperMutableCore"/> class.
 /// </summary>
 /// <param name="textType">
 /// The text type. 
 /// </param>
 public TextTypeWrapperMutableCore(ITextTypeWrapper textType)
     : base(textType)
 {
     this.locale = textType.Locale;
     this.valueren = textType.Value;
 }
Example #4
0
 /// <summary>
 /// Gets the text type from the specified <paramref name="textTypeWrapper"/>
 /// </summary>
 /// <param name="textTypeWrapper">
 /// The text type wrapper.
 /// </param>
 /// <returns>
 /// the text type from the specified <paramref name="textTypeWrapper"/>
 /// </returns>
 internal TextType GetTextType(ITextTypeWrapper textTypeWrapper)
 {
     var textType = new TextType { lang = textTypeWrapper.Locale, TypedValue = textTypeWrapper.Value };
     return textType;
 }
 /// <summary>
 /// This is an internal method that is used to write a <see cref="ITextTypeWrapper"/>
 ///     The method create a xml element named by the name parameter.
 ///     It will only write the xml element if the <see cref="ITextTypeWrapper.Value"/> is not null or empty
 /// </summary>
 /// <param name="prefix">
 /// The namespace prefix that should be used
 /// </param>
 /// <param name="textObject">
 /// The <see cref="ITextTypeWrapper"/> object containing the data to be written
 /// </param>
 /// <param name="name">
 /// The name of the xml element
 /// </param>
 protected void WriteTextType(string prefix, ITextTypeWrapper textObject, ElementNameTable name)
 {
     string value = textObject.Value;
     string locale = textObject.Locale;
     this.WriteTextType(new NamespacePrefixPair(prefix), name, value, locale);
 }
 /// <summary>
 /// This is an internal method that is used to write a <see cref="ITextTypeWrapper"/>
 ///     The method create a xml element named by the name parameter.
 ///     It will only write the xml element if the <see cref="ITextTypeWrapper"/> is not null or empty
 /// </summary>
 /// <param name="textObject">
 /// The <see cref="ITextTypeWrapper"/> object containing the data to be written
 /// </param>
 /// <param name="name">
 /// The name of the xml element
 /// </param>
 protected void WriteTextType(ITextTypeWrapper textObject, ElementNameTable name)
 {
     this.WriteTextType(NamespacePrefixPair.Empty, textObject, name);
 }
 /// <summary>
 /// Returns the normalized language.
 /// </summary>
 /// <param name="text">
 /// The text.
 /// </param>
 /// <returns>
 /// The normalized language.
 /// </returns>
 private static string GetLanguage(ITextTypeWrapper text)
 {
     return string.IsNullOrEmpty(text.Locale) ? "en" : text.Locale.ToLowerInvariant();
 }
Example #8
0
 public void AddName(ITextTypeWrapper name)
 {
     this._name.Add(name);
 }
Example #9
0
 public void AddSource(ITextTypeWrapper source)
 {
     this._source.Add(source);
 }
Example #10
0
 /// <summary>
 /// Returns the normalized language.
 /// </summary>
 /// <param name="text">
 /// The text.
 /// </param>
 /// <returns>
 /// The normalized language.
 /// </returns>
 private static string GetLanguage(ITextTypeWrapper text)
 {
     return(string.IsNullOrEmpty(text.Locale) ? "en" : text.Locale.ToLowerInvariant());
 }
        public void TestValidateTextType()
        {
            var textTypes = new ITextTypeWrapper[][]
                                                 {
                                                     new[] { new TextTypeWrapperImpl("en", "Test1", null) },
                                                     new[] { new TextTypeWrapperImpl("en", "Test1", null), new TextTypeWrapperImpl("el", "Test1", null) },
                                                     new[] { new TextTypeWrapperImpl("en", "This is a test.", null), new TextTypeWrapperImpl("el", "δοκιμή αλαλαλαλαα", null), new TextTypeWrapperImpl("de", "Teste. Straß. Können Sie nichts.", null) }
                                                 };

            foreach (var textTypeWrapper in textTypes)
            {
                ValidationUtil.ValidateTextType(textTypeWrapper, null);
            }

            textTypes = new ITextTypeWrapper[][]
                                                 {
                                                     new[] { new TextTypeWrapperImpl("en", "Test1", null), new TextTypeWrapperImpl("en", "Test1", null) },
                                                     new[] { new TextTypeWrapperImpl("en", "This is a test.", null), new TextTypeWrapperImpl("el", "δοκιμή αλαλαλαλαα", null), new TextTypeWrapperImpl("en", "Teste. Straß. Können Sie nichts.", null) },
                                                     new[] { new TextTypeWrapperImpl("en", "This is a test.", null), new TextTypeWrapperImpl("en", "δοκιμή αλαλαλαλαα", null), new TextTypeWrapperImpl("de", "Teste. Straß. Können Sie nichts.", null) }
                                                 };
            foreach (var textTypeWrapper in textTypes)
            {
                Assert.Throws<SdmxSemmanticException>(() => ValidationUtil.ValidateTextType(textTypeWrapper, null));
            }
        }
 /// <summary>
 ///     Builds the receivers.
 /// </summary>
 /// <returns>The senders </returns>
 private static IList<IParty> BuildReceivers()
 {
     var receiverNames = new ITextTypeWrapper[] { new TextTypeWrapperImpl("en", "receiver name", null) };
     var mutableContactReceiver = new ContactMutableObjectCore();
     mutableContactReceiver.AddEmail("*****@*****.**");
     IList<IContact> receiverContacts = new IContact[] { new ContactCore(mutableContactReceiver) };
     string timeZone = "+02:00";
     var receiver = new PartyCore(receiverNames, "RC0", receiverContacts, timeZone);
     return new IParty[] { receiver };
 }
        /// <summary>
        /// Insert a record with the values from <paramref name="text"/> to <c>LOCALISED_STRING</c>
        /// </summary>
        /// <param name="text">
        /// The text.
        /// </param>
        /// <param name="dbCommand">
        /// The DB command.
        /// </param>
        /// <param name="languageParameter">
        /// The language Parameter.
        /// </param>
        /// <param name="textParameter">
        /// The text Parameter.
        /// </param>
        private static void InsertCommon(ITextTypeWrapper text, IDbCommand dbCommand, IDataParameter languageParameter, IDataParameter textParameter)
        {
            languageParameter.Value = GetLanguage(text);
            textParameter.Value = text.Value;

            dbCommand.ExecuteNonQuery();
        }