Esempio n. 1
0
        public static void GroupImportedHandler(object sender, EntityImportedEventArgs <GroupWithLoggingData> e, LoggerAction log, bool isVerboseMode, bool flush)
        {
            bool isOutputRequired = true;

            switch (e.Status)
            {
            case EntityImportStatus.Added:
            case EntityImportStatus.Updated:
            case EntityImportStatus.MovedExisting:
            case EntityImportStatus.MovedUpdated:
            case EntityImportStatus.Existing:
                isOutputRequired = isVerboseMode;
                break;
            }
            if (isOutputRequired)
            {
                log($"Imported with status {e.Status} <{e.Entity.Group.Name}> <{e.Entity.Group.Reference}> {(e.Status == EntityImportStatus.MovedExisting || e.Status == EntityImportStatus.MovedUpdated ? $"from <{e.Entity.NameOfParentInDB}> <{e.Entity.SreferenceOfParentInDB}> to" : "child of")} <{e.Entity.Group.Parent.Name}> <{e.Entity.Group.Parent.Reference}>.{(e.Exception == null ? "" : $" {(EntityImportStatus.Failed == e.Status ? "exception: " : "")}{e.Exception.Message}")}");
                if (e.Status == EntityImportStatus.CannotDeleteNotEmpty)
                {
                    LogOffendingAssets(e.Entity.Group, e.Entity.Relations, log);
                }
                if (flush)
                {
                    Console.Out.Flush();
                }
            }
        }
Esempio n. 2
0
 public static void GroupRelationsPopulationFailureHandler(object sender, EntityImportedEventArgs <NameEntity> e, LoggerAction log, bool flush)
 {
     log($"Failed to populate {e.Entity.GetType()} with Id {e.Entity.Id}. Exception: {e.Exception.Message}");
     if (flush)
     {
         Console.Out.Flush();
     }
 }
Esempio n. 3
0
 static void Importer_GroupImported(object sender, EntityImportedEventArgs <GroupImporter.GroupWithLoggingData> e)
 {
     GroupImporter.GroupImportedHandler(sender, e, Console.WriteLine, isVerboseMode, true);
 }
Esempio n. 4
0
 /// <summary>
 /// Raises the <see cref="E:GroupRelatedNameEntityPopulationFailed" /> event.
 /// </summary>
 /// <param name="e">The <see cref="EntityImportedEventArgs{NameEntity}"/> instance containing the event data.</param>
 protected void OnGroupRelatedNameEntityPopulationFailed(EntityImportedEventArgs <NameEntity> e)
 {
     GroupRelatedNameEntityPopulationFailed?.Invoke(this, e);
 }
Esempio n. 5
0
 /// <summary>
 /// Raises the <see cref="E:EntityImported" /> event.
 /// </summary>
 /// <param name="e">The <see cref="EntityImportedEventArgs{Group}"/> instance containing the event data.</param>
 protected void OnEntityImported(EntityImportedEventArgs <GroupWithLoggingData> e)
 {
     EntityImported?.Invoke(this, e);
 }