using System.ComponentModel.DataAnnotations; namespace IStation.Win.Schedule { public class StationScheduleVm { [Display(Name = "名称")] public string Name { get; set; } [Display(Name = "标志")] public eDockingStation Flag { get; set; } [Display(Name = "调度前流量")] public double? BeforeFlow { get; set; } [Display(Name = "目标流量")] public double? TargetFlow { get; set; } [Display(Name = "实时流量")] public double? RealTimeFlow { get; set; } [Display(Name = "流量偏差")] public double? FlowDeviation { get; set; } [Display(Name = "调度前压力")] public double? BeforePressure { get; set; } [Display(Name = "目标压力")] public double? TargetPressure { get; set; } [Display(Name = "实时压力")] public double? RealTimePressure { get; set; } [Display(Name = "压力偏差")] public double? PressureDeviation { get; set; } public void Round() { this.BeforeFlow = Round(this.BeforeFlow, 1); this.TargetFlow = Round(this.TargetFlow, 1); this.RealTimeFlow = Round(this.RealTimeFlow, 1); this.FlowDeviation = Round(this.FlowDeviation, 1); this.BeforePressure = Round(this.BeforePressure, 3); this.TargetPressure = Round(this.TargetPressure, 3); this.RealTimePressure = Round(this.RealTimePressure, 3); this.PressureDeviation = Round(this.PressureDeviation, 3); } private double? Round( double? value, int digits = 0) { if (value == null) return null; return Math.Round(value.Value, digits); } public void Clear() { this.RealTimeFlow=null; this.FlowDeviation = null; this.RealTimePressure = null; this.PressureDeviation = null; } } }