public void AddStatisticsValue(StatisticsType type, int value)
        {
            var aClass = new RouteAirlinerClass(
                AirlinerClass.ClassType.EconomyClass,
                RouteAirlinerClass.SeatingType.FreeSeating,
                0);

            AddStatisticsValue(aClass, type, value);
        }
 //returns the total value for a statistics type
 public double GetStatisticsValue(StatisticsType type)
 {
     if (StatValues != null
         && StatValues.Exists(s => s.Stat != null && s.Stat.Shortname == type.Shortname))
     {
         return StatValues.Where(s => s.Stat != null && s.Stat.Shortname == type.Shortname)
                          .Sum(s => s.Value);
     }
     return 0;
 }
        //returns the value for a statistics type for an airline for a year
        public double GetStatisticsValue(int year, Airline airline, StatisticsType type)
        {
            AirportStatisticsValue item =
                Stats.Find(s => s.Year == year && s.Airline == airline && s.Stat.Shortname == type.Shortname);

            if (item == null)
            {
                return 0;
            }
            return item.Value;
        }
        //returns the value for a statistics type for a route class
        public long GetStatisticsValue(RouteAirlinerClass aClass, StatisticsType type)
        {
            RouteStatisticsItem item =
                Stats.Find(i => i.Type.Shortname == type.Shortname && i.RouteClass.Type == aClass.Type);

            if (item == null)
            {
                return 0;
            }
            return item.Value;
        }
        //returns the value for a statistics type for a year
        public double GetStatisticsValue(int year, StatisticsType type)
        {
            var stats = new List<StatisticsValue>(StatValues);

            StatisticsValue item =
                stats.FirstOrDefault(s => s.Stat != null && s.Year == year && s.Stat.Shortname == type.Shortname);

            if (item == null)
            {
                return 0;
            }
            return item.Value;
        }
        public void AddStatisticsValue(int year, StatisticsType type, double value)
        {
            StatisticsValue item = StatValues.Find(s => s.Year == year && s.Stat.Shortname == type.Shortname);

            if (item == null)
            {
                StatValues.Add(new StatisticsValue(year, type, value));
            }
            else
            {
                item.Value += value;
            }
        }
        public void AddStatisticsValue(int year, Airline airline, StatisticsType type, int value)
        {
            AirportStatisticsValue item =
                Stats.Find(s => s.Year == year && s.Airline == airline && s.Stat.Shortname == type.Shortname);

            if (item == null)
            {
                Stats.Add(new AirportStatisticsValue(airline, year, type, value));
            }
            else
            {
                item.Value += value;
            }
        }
        public void AddStatisticsValue(RouteAirlinerClass aClass, StatisticsType type, int value)
        {
            RouteStatisticsItem item = Stats.Find(
                i => i.Type.Shortname == type.Shortname && i.RouteClass == aClass);

            if (item == null)
            {
                Stats.Add(new RouteStatisticsItem(aClass, type, value));
            }
            else
            {
                item.Value += value;
            }
        }
 public double GetTotalValue(int year, StatisticsType type)
 {
     return Stats.Where(s => s.Year == year && s.Stat.Shortname == type.Shortname).Sum(s => s.Value);
 }
Esempio n. 10
0
 public AirlineStatisticsMVVM(Models.Airlines.Airline airline, StatisticsType type)
 {
     Type = type;
     Airline = airline;
 }
        public long GetStatisticsValue(StatisticsType type)
        {
            var aClass = new RouteAirlinerClass(
                AirlinerClass.ClassType.EconomyClass,
                RouteAirlinerClass.SeatingType.FreeSeating,
                0);

            return GetStatisticsValue(aClass, type);
        }
 public StatisticsValue(int year, StatisticsType stat, double value)
 {
     Value = value;
     Stat = stat;
     Year = year;
 }
 public RouteStatisticsItem(RouteAirlinerClass routeClass, StatisticsType type, int value)
 {
     RouteClass = routeClass;
     Type = type;
     Value = value;
 }
        public long GetTotalValue(StatisticsType type)
        {
            long value;

            lock (Stats)
            {
                value = Stats.Where(s => s.Type.Shortname == type.Shortname).Sum(s => s.Value);
            }

            return value;
        }
 public FleetAirlinerStatisticsMVVM(FleetAirliner airliner, StatisticsType type)
 {
     Type = type;
     Airliner = airliner;
 }
 public AirportStatisticsValue(Airline airline, int year, StatisticsType stat, int value)
     : base(year, stat, value)
 {
     Airline = airline;
 }
 public AirportStatisticsValue(Airline airline, int year, StatisticsType stat)
     : this(airline, year, stat, 0)
 {
 }
 public static void AddStatisticsType(StatisticsType type)
 {
     _types.Add(type.Shortname, type);
 }