コード例 #1
0
        /// <summary>
        /// fires an SSIS event
        /// </summary>
        /// <param name="ComponentMetaData">componets SSIS metadata</param>
        /// <param name="eventType">event type</param>
        /// <param name="sqlType">sql type (always</param>
        /// <param name="description">SSIS event description</param>
        private static void Fire(IDTSComponentMetaData100 ComponentMetaData, Type eventType, int sqlType, string description)
        {
            bool cancel = false;

            switch (eventType)
            {
            case Type.Information:
                ComponentMetaData.FireInformation(sqlType, ComponentMetaData.Name, description, "", 0, ref cancel);
                break;

            case Type.Progress:
                throw new NotImplementedException("Progress messages are not implemented");

            case Type.Warning:
                ComponentMetaData.FireWarning(sqlType, ComponentMetaData.Name, description, string.Empty, 0);
                break;

            case Type.Error:
                ComponentMetaData.FireError(sqlType, ComponentMetaData.Name, description, string.Empty, 0, out cancel);
                break;

            default:
                ComponentMetaData.FireError(sqlType, ComponentMetaData.Name, description, string.Empty, 0, out cancel);
                break;
            }
        }
コード例 #2
0
 /// <summary>
 /// Валидация пользовательских парамтеров.
 /// </summary>
 public static DTSValidationStatus ValidateCustomProperties(this IDTSComponentMetaData100 metadata, IEnumerable <CustomProperty> properties)
 {
     foreach (var customProperty in properties.Where(p => p.Required))
     {
         if (metadata.CustomPropertyCollection[customProperty.Name].Value != null)
         {
             continue;
         }
         bool pbCancel;
         metadata.FireError(0, metadata.Name, $"Custom property \"{customProperty.Name}\" not set.", "", 0, out pbCancel);
         return(DTSValidationStatus.VS_ISBROKEN);
     }
     return(DTSValidationStatus.VS_ISVALID);
 }