Exemple #1
0
 /// <summary>
 /// Конвертер пакета информации из трансферной модели в модель базы данных
 /// </summary>
 public static PackageDataEntity ToPackageData(PackageDataRequestClient packageData, string identityName) =>
 new PackageDataEntity(packageData.Id.ToString(), StatusProcessingProject.InQueue,
                       DateTimeService.GetDateTimeNow(), identityName, String.Empty, 0,
                       packageData.FilesData.Select(ToFileData).ToList(),
                       ConvertingSettingsToRequest(packageData.ConvertingSettings)).
 Void(package =>
 {
     foreach (var fileData in package.FileDataEntities)
     {
         fileData.PackageDataEntity = package;
     }
 });
Exemple #2
0
        /// <summary>
        /// Поставить лайк
        /// </summary>
        public async Task <Unit> SendLike(string personId, string personFullName)
        {
            using var unitOfWork = _container.Resolve <IUnitOfWork>();
            var likeEntity = await unitOfWork.Session.GetAsync <LikeIdentityEntity>(personId);

            if (likeEntity == null)
            {
                var likeUpdateEntity = new LikeIdentityEntity(personId, personFullName, DateTimeService.GetDateTimeNow(), 1);
                await unitOfWork.Session.SaveOrUpdateAsync(likeUpdateEntity);
            }
            else
            {
                likeEntity.PersonFullname = personFullName;
                likeEntity.LastDateLike   = DateTimeService.GetDateTimeNow();
                likeEntity.LikeCount     += 1;
            }
            await unitOfWork.CommitAsync();

            return(Unit.Value);
        }
 /// <summary>
 /// Записать время доступа сервера
 /// </summary>
 public async Task UpdateLastClientAccess(string identity) =>
 await UpdateLastAccess(new ClientAccessEntity(identity, DateTimeService.GetDateTimeNow()));
 /// <summary>
 /// Получить статус сервера
 /// </summary>
 public static ServerActivityType GetServerActivityType(DateTime lastAccess, string currentPackage) =>
 !String.IsNullOrWhiteSpace(currentPackage)
         ? ServerActivityType.InProgress
         : (lastAccess - DateTimeService.GetDateTimeNow()).TotalHours <= LAST_ACTIVITY_TIMEOUT
             ? ServerActivityType.Empty
             : ServerActivityType.NotAvailable;