102 lines
3.0 KiB
C#
102 lines
3.0 KiB
C#
using Manager.Interfaces.DTO;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Manager.Interfaces.Models
|
|
{
|
|
/// <summary>
|
|
/// Configuration Information
|
|
/// </summary>
|
|
public class Configuration
|
|
{
|
|
[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; }
|
|
|
|
public ConfigurationDTO ToDTO(List<string> sectionIds)
|
|
{
|
|
return new ConfigurationDTO()
|
|
{
|
|
id = Id,
|
|
label = Label,
|
|
title = Title,
|
|
imageId = ImageId,
|
|
imageSource = ImageSource,
|
|
dateCreation = DateCreation,
|
|
primaryColor = PrimaryColor,
|
|
languages = Languages,
|
|
secondaryColor = SecondaryColor,
|
|
isMobile = IsMobile,
|
|
isTablet = IsTablet,
|
|
isOffline = IsOffline,
|
|
instanceId = InstanceId,
|
|
sectionIds = sectionIds
|
|
};
|
|
}
|
|
|
|
public ExportConfigurationDTO ToExportDTO(List<SectionDTO> sections, List<ResourceDTO> resources) {
|
|
return new ExportConfigurationDTO()
|
|
{
|
|
id = Id,
|
|
label = Label,
|
|
title= Title,
|
|
imageId = ImageId,
|
|
imageSource = ImageSource,
|
|
dateCreation = DateCreation,
|
|
primaryColor = PrimaryColor,
|
|
languages = Languages,
|
|
secondaryColor = SecondaryColor,
|
|
isMobile = IsMobile,
|
|
isTablet = IsTablet,
|
|
isOffline = IsOffline,
|
|
sections = sections,
|
|
resources = resources,
|
|
instanceId = InstanceId,
|
|
sectionIds = sections.Select(s => s.id).ToList()
|
|
};
|
|
}
|
|
}
|
|
}
|