34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
|
|
using DTS.SensorDB;
|
|||
|
|
using DTS.Slice.Users;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using static System.Net.Mime.MediaTypeNames;
|
|||
|
|
|
|||
|
|
namespace DTS.Common.Import.Persist
|
|||
|
|
{
|
|||
|
|
public class SaveSensorModels : SaveVariantBase
|
|||
|
|
{
|
|||
|
|
public User CurrentUser { get; set; }
|
|||
|
|
public SaveSensorModels(ImportObject importObject, IPersistCalculator persistCalculator, IImportNotification importNotification, Func<bool> isCancelled = null) :
|
|||
|
|
base(importObject, persistCalculator, importNotification, isCancelled)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void Save()
|
|||
|
|
{
|
|||
|
|
foreach (var st in _importObject.SensorModels())
|
|||
|
|
{
|
|||
|
|
if (IsCancelled()) { return; }
|
|||
|
|
SensorModelCollection.SensorModelList.Commit(st, CurrentUser.UserName);
|
|||
|
|
_persistCalculator.AddDone();
|
|||
|
|
_importNotification.SetProgress(_persistCalculator.ProgressValue);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|