using System.ComponentModel.DataAnnotations; namespace IStation { /// /// /// public class AvgStatisticsS1ViewModel : AvgStatisticsViewModel { public AvgStatisticsS1ViewModel() { } public AvgStatisticsS1ViewModel(AvgStatisticsViewModel rhs):base(rhs) { } [Display(Name = "11#")] public double? Pump11Pd { get; set; } [Display(Name = "12#")] public double? Pump12Pd { get; set; } [Display(Name = "13#")] public double? Pump13Pd { get; set; } [Display(Name = "14#")] public double? Pump14Pd { get; set; } [Display(Name = "15#")] public double? Pump15Pd { get; set; } [Display(Name = "16#")] public double? Pump16Pd { get; set; } [Display(Name = "17#")] public double? Pump17Pd { get; set; } [Display(Name = "18#")] public double? Pump18Pd { get; set; } public void Round() { this.Pump11Pd = Round(this.Pump11Pd, 4); this.Pump12Pd = Round(this.Pump12Pd, 4); this.Pump13Pd = Round(this.Pump13Pd, 4); this.Pump14Pd = Round(this.Pump14Pd, 4); this.Pump15Pd = Round(this.Pump15Pd, 4); this.Pump16Pd = Round(this.Pump16Pd, 4); this.Pump17Pd = Round(this.Pump17Pd, 4); this.Pump18Pd = Round(this.Pump18Pd, 4); } /// /// Round /// /// /// private double? Round(double? t, int digits, bool filter_zero = false) { if (t.HasValue && t.Value != 0) { t = Math.Round(t.Value, digits); } if (filter_zero && t == 0) { return null; } return t; } } }