131 lines
4.0 KiB
C#
131 lines
4.0 KiB
C#
using ManagerService.DTOs;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace ManagerService.Data
|
|
{
|
|
/// <summary>
|
|
/// Configuration Information
|
|
/// </summary>
|
|
public class OldConfiguration
|
|
{
|
|
[BsonId]
|
|
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
|
|
public string Id { get; set; }
|
|
|
|
[BsonElement("Label")]
|
|
[BsonRequired]
|
|
public string Label { get; set; }
|
|
|
|
[BsonElement("Title")]
|
|
[BsonRequired]
|
|
public List<TranslationDTO> Title { get; set; }
|
|
|
|
[BsonElement("ImageId")]
|
|
public string ImageId { get; set; }
|
|
|
|
[BsonElement("ImageSource")]
|
|
public string ImageSource { get; set; }
|
|
|
|
[BsonElement("PrimaryColor")]
|
|
public string PrimaryColor { get; set; }
|
|
|
|
[BsonElement("SecondaryColor")]
|
|
public string SecondaryColor { get; set; }
|
|
|
|
[BsonElement("Languages")]
|
|
public List<string> Languages { get; set; } // fr, en, de, nl => Sélection dans une liste déjà établie dans l'application !
|
|
|
|
[BsonElement("DateCreation")]
|
|
public DateTime DateCreation { get; set; }
|
|
|
|
[BsonElement("IsMobile")]
|
|
public bool IsMobile { get; set; }
|
|
|
|
[BsonElement("IsTablet")]
|
|
public bool IsTablet { get; set; }
|
|
|
|
[BsonElement("IsOffline")]
|
|
public bool IsOffline { get; set; }
|
|
|
|
[BsonElement("InstanceId")]
|
|
[BsonRequired]
|
|
public string InstanceId { get; set; }
|
|
|
|
[BsonElement("LoaderImageId")]
|
|
public string LoaderImageId { get; set; }
|
|
|
|
[BsonElement("LoaderImageUrl")]
|
|
public string LoaderImageUrl { get; set; }
|
|
|
|
[BsonElement("WeatherCity")]
|
|
public string WeatherCity { get; set; }
|
|
|
|
[BsonElement("WeatherUpdatedDate")]
|
|
public DateTimeOffset? WeatherUpdatedDate { get; set; }
|
|
|
|
[BsonElement("WeatherResult")]
|
|
public string WeatherResult { get; set; }
|
|
|
|
[BsonElement("IsDate")]
|
|
public bool IsDate { get; set; }
|
|
|
|
[BsonElement("IsHour")]
|
|
public bool IsHour { get; set; }
|
|
|
|
[BsonElement("IsSectionImageBackground")]
|
|
public bool IsSectionImageBackground { get; set; }
|
|
|
|
[BsonElement("RoundedValue")]
|
|
public int? RoundedValue { get; set; }
|
|
|
|
[BsonElement("ScreenPercentageSectionsMainPage")]
|
|
public int? ScreenPercentageSectionsMainPage { get; set; }
|
|
|
|
public ConfigurationDTO ToDTO(List<string> sectionIds)
|
|
{
|
|
return new ConfigurationDTO()
|
|
{
|
|
Id = Id,
|
|
InstanceId = InstanceId,
|
|
Label = Label,
|
|
Title = Title,
|
|
ImageId = ImageId,
|
|
ImageSource = ImageSource,
|
|
PrimaryColor = PrimaryColor,
|
|
SecondaryColor = SecondaryColor,
|
|
Languages = Languages,
|
|
DateCreation = DateCreation,
|
|
IsOffline = IsOffline,
|
|
LoaderImageId = LoaderImageId,
|
|
LoaderImageUrl = LoaderImageUrl,
|
|
sectionIds = sectionIds
|
|
};
|
|
}
|
|
|
|
public ExportConfigurationDTO ToExportDTO(List<SectionDTO> sections, List<ResourceDTO> resources) {
|
|
return new ExportConfigurationDTO()
|
|
{
|
|
Id = Id,
|
|
InstanceId = InstanceId,
|
|
Label = Label,
|
|
Title = Title,
|
|
ImageId = ImageId,
|
|
ImageSource = ImageSource,
|
|
PrimaryColor = PrimaryColor,
|
|
SecondaryColor = SecondaryColor,
|
|
Languages = Languages,
|
|
DateCreation = DateCreation,
|
|
IsOffline = IsOffline,
|
|
LoaderImageId = LoaderImageId,
|
|
LoaderImageUrl = LoaderImageUrl,
|
|
sections = sections,
|
|
resources = resources,
|
|
sectionIds = sections.Select(s => s.id).ToList()
|
|
};
|
|
}
|
|
}
|
|
}
|