Beispiel #1
0
        /// <summary>
        /// Writes value of given column of given data row as identifier to given
        /// string builder with given prefix if this value was changed.
        /// </summary>
        /// <param name="row">Data row to extract value.</param>
        /// <param name="column">Column name to look for value.</param>
        /// <param name="prefix">Prefix to write before.</param>
        /// <param name="suffix">Suffix to write after.</param>
        /// <param name="target">String builder to write.</param>
        public static void WriteIdentifierIfChanged(DataRow row, string column, string prefix, string suffix, StringBuilder target)
        {
            if (row == null)
            {
                throw new ArgumentNullException("row");
            }
            if (String.IsNullOrEmpty(column))
            {
                throw new ArgumentException(Resources.Error_EmptyString, "column");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            if (DataInterpreter.HasChanged(row, column))
            {
                if (!String.IsNullOrEmpty(prefix))
                {
                    target.Append(prefix);
                }
                target.Append(EscapeAndQuoteIdentifier(DataInterpreter.GetString(row, column)));
                if (!String.IsNullOrEmpty(suffix))
                {
                    target.Append(suffix);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Writes value of given column of given data row to given string builder with
        /// given prefix if this value was changed.
        /// </summary>
        /// <param name="row">Data row to extract value.</param>
        /// <param name="column">Column name to look for value.</param>
        /// <param name="prefix">Prefix to write.</param>
        /// <param name="target">String builder to write.</param>
        /// <param name="suffix">Suffix to append after value.</param>
        /// <param name="quote">Indicates if value should be quoted.</param>
        public static void WriteIfChanged(DataRow row, string column, string prefix, StringBuilder target, string suffix, bool quote)
        {
            if (row == null)
            {
                throw new ArgumentNullException("row");
            }
            if (String.IsNullOrEmpty(column))
            {
                throw new ArgumentException(Resources.Error_EmptyString, "column");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            if (DataInterpreter.HasChanged(row, column))
            {
                if (!String.IsNullOrEmpty(prefix))
                {
                    target.Append(prefix);
                }
                WriteValue(row, column, target, quote);
                if (!String.IsNullOrEmpty(suffix))
                {
                    target.Append(suffix);
                }
            }
        }