aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StatsModel.cs
blob: ab2119573912af911e78e6bc291dc5b394863b52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using LiveCharts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Enumerations;
using Tango.Core;

namespace Tango.FSE.Statistics.Models
{
    public class StatsModel : ExtendedObject
    {
        public int TotalRuns { get; set; }
        public int TotalDyeingLength { get; set; }
        public int AverageDyeingLength { get; set; }
        public TimeSpan TotalDyeingTime { get; set; }
        public TimeSpan AverageDyeingTime { get; set; }
        public Func<ChartPoint, string> StatusCounts { get; set; } = (point) => { return point.Y.ToString(); };
        public Func<ChartPoint, string> QuantityCounts { get; set; } = (point) => { return (Convert.ToUInt64(point.Y) / 1000000000d).ToString("0.00"); };
        public double CompletedRuns { get; set; }
        public double FailedRuns { get; set; }
        public double AbortedRuns { get; set; }

        private List<LiquidQuantityModel> _liquidQuantities;
        public List<LiquidQuantityModel> LiquidQuantities
        {
            get { return _liquidQuantities; }
            set { _liquidQuantities = value; RaisePropertyChangedAuto(); }
        }

        public StatsModel()
        {
            var liquidQuantities = new List<LiquidQuantityModel>();

            foreach (var item in Enum.GetValues(typeof(LiquidTypes)).Cast<int>())
            {
                liquidQuantities.Add(new LiquidQuantityModel()
                {
                    LiquidType = new Tango.BL.Entities.LiquidType() { Code = item },
                    Quantity = 1
                });
            }

            LiquidQuantities = liquidQuantities;

            FailedRuns = 1;
            CompletedRuns = 1;
            AbortedRuns = 1;
        }
    }
}