コード例 #1
0
 /// <summary>
 /// Returns a SQL Script that will Set the <paramref name="column"/> column in the Table
 /// to the values of the associated Extended String field.
 /// The Values will only be set for rows that contain the extended data.
 /// </summary>
 /// <param name="column">The destination Code column</param>
 public string CopyToColumn(string column)
 {
     return(string.Format(CreateStringFromExtendedString,
                          ExtendedFieldDataScriptor.UsingTableScriptor.TableName,
                          column,
                          Util.Clean(Util.PullValue(ExtendedFieldDataScriptor.Key)),//create value script to get value and strip whitespace/double quotes
                          ExtendedFieldDataScriptor.Key));
 }
コード例 #2
0
        /// <summary>
        /// Returns a SQL Script that will test setting the <paramref name="column"/> column in the Table
        /// to the values of the associated Extended String field.
        /// Any conversion failures will be returned with the offending data.
        /// Note: to get specific Report or Summary data (case number, etc.), supply the report or summary context as an optional parameter
        /// </summary>
        /// <param name="column">The destination Code column</param>
        /// <param name="contextName">The database context (optional)</param>
        public string CopyToColumn(string column)
        {
            string contextName = ExtendedFieldDataScriptor.UsingTableScriptor.Context;

            //if a context was specified, we can give more specific information back about any conversion failures
            switch (contextName)
            {
            case ContextNames.Reports:
                return(string.Format(
                           ProcessExtractedStringWithContextScript,
                           ExtendedFieldDataScriptor.UsingTableScriptor.TableName,
                           column,
                           Util.Clean(Util.PullValue(ExtendedFieldDataScriptor.Key)),//create value script to get value and strip whitespace/double quotes
                           ExtendedFieldDataScriptor.Key,
                           "dbo.Reports",
                           "Report_Id"));

            case ContextNames.Summaries:
                return(string.Format(
                           ProcessExtractedStringWithContextScript,
                           ExtendedFieldDataScriptor.UsingTableScriptor.TableName,
                           column,
                           Util.Clean(Util.PullValue(ExtendedFieldDataScriptor.Key)),//create value script to get value and strip whitespace/double quotes
                           ExtendedFieldDataScriptor.Key,
                           "dbo.Summaries",
                           "Summary_Id"));

            case ContextNames.Administration:
            case ContextNames.Audit:
            case ContextNames.ExternalApi:
            case ContextNames.Media:
            case ContextNames.Messaging:
            case ContextNames.Metadata:
            case ContextNames.RecentInfo:
            default:
                return(string.Format(ProcessExtractedStringWithoutContextScript,
                                     ExtendedFieldDataScriptor.UsingTableScriptor.TableName,
                                     column,
                                     Util.Clean(Util.PullValue(ExtendedFieldDataScriptor.Key)),//create value script to get value and strip whitespace/double quotes
                                     ExtendedFieldDataScriptor.Key));
            }
        }