init
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using DTS.Common.Import.Enums;
|
||||
using DTS.Slice.Users;
|
||||
using System;
|
||||
|
||||
namespace DTS.Common.Import.Persist
|
||||
{
|
||||
public class SaveUsers : SaveVariantBase
|
||||
{
|
||||
public IUIItems[] UIItems { get; set; }
|
||||
public User CurrentUser { get; set; }
|
||||
public SaveUsers(ImportObject importObject, IPersistCalculator persistCalculator, IImportNotification importNotification, Func<bool> isCancelled = null) :
|
||||
base(importObject, persistCalculator, importNotification, isCancelled)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Save()
|
||||
{
|
||||
_importNotification.SetStatus.Invoke(new ImportStatus { ExtraStatus = ImportExtraStatus.ReadingUsers, PossibleStatus = PossibleStatus.Importing });
|
||||
foreach (var user in _importObject.Users())
|
||||
{
|
||||
if (IsCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
System.Diagnostics.Trace.Assert(CurrentUser.IsAdmin, "importing users from a non admin user. [should have been prevented earlier up chain]");
|
||||
|
||||
UserCollection.UsersList.Commit(user,
|
||||
CurrentUser.UserName, UIItems);
|
||||
|
||||
_persistCalculator.AddDone();
|
||||
_importNotification.SetProgress(_persistCalculator.ProgressValue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user