Files
marechai/Cicm.Database/Models/Screen.cs

45 lines
1.4 KiB
C#
Raw Normal View History

2019-06-01 22:13:01 +01:00
using System.Collections.Generic;
2019-06-01 23:48:54 +01:00
using System.ComponentModel;
2019-06-01 22:13:01 +01:00
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Cicm.Database.Models
{
public class Screen : BaseModel<int>
{
[Range(1, 131072)]
2019-06-01 23:48:54 +01:00
[DisplayName("Width (mm)")]
2019-06-01 22:13:01 +01:00
public double? Width { get; set; }
[Range(1, 131072)]
2019-06-01 23:48:54 +01:00
[DisplayName("Height (mm)")]
2019-06-01 22:13:01 +01:00
public double? Height { get; set; }
[Required]
2019-06-01 23:48:54 +01:00
[DisplayName("Diagonal (inches)")]
2019-06-01 22:13:01 +01:00
public double Diagonal { get; set; }
[Required]
2019-06-01 23:55:06 +01:00
[DisplayName("Native resolution")]
2019-06-01 22:13:01 +01:00
public virtual Resolution NativeResolution { get; set; }
[Range(2, 281474976710656)]
2019-06-01 23:48:54 +01:00
[DisplayName("Effective colors")]
2019-06-01 22:13:01 +01:00
public long? EffectiveColors { get; set; }
[Required]
public string Type { get; set; }
[NotMapped]
public long? Colors => EffectiveColors ?? NativeResolution.Colors;
2019-06-01 23:48:54 +01:00
[NotMapped]
public string Size
{
get
{
if(Width != null && Height != null) return $"{Width}x{Height} mm";
return "Unknown";
}
}
2019-06-01 22:13:01 +01:00
public virtual ICollection<ResolutionsByScreen> Resolutions { get; set; }
public virtual ICollection<ScreensByMachine> ScreensByMachines { get; set; }
}
}