Example #1
0
 /// <summary>
 /// Returns the meter data by the given meter id.
 /// </summary>
 /// <param name="data">resource cost data</param>
 /// <param name="meterId">id of the meter</param>
 /// <returns>the meter that matches the meterId</returns>
 public static Meter GetMeterById(this ResourceCostData data, string meterId)
 {
     return(data.Costs.GetMeterById(meterId));
 }
Example #2
0
 /// <summary>
 /// Returns the resource names of all used resources.
 /// </summary>
 /// <param name="data">resource cost data</param>
 /// <returns>Resource names</returns>
 public static IEnumerable <string> GetResourceNames(this ResourceCostData data)
 {
     return(data.Costs.GetResourceNames());
 }
Example #3
0
        /// <summary>
        /// Returns all costs by resource name and meter name
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static Dictionary <string, Dictionary <string, IEnumerable <ResourceCosts> > > GetCostsByResourceNameAndMeterName(this ResourceCostData data)
        {
            var result = from costsByResourceName in data.GetCostsByResourceName()
                         from costsByMeterName in costsByResourceName.Value.GetCostsByMeterName()
                         select new
            {
                ResourceName = costsByResourceName.Key,
                MeterName    = costsByMeterName.Key,
                Costs        = costsByMeterName.Value
            };

            var asdf = result.ToDictionary(
                key => key.ResourceName,
                value => result.ToDictionary(
                    kkey => value.MeterName,
                    vvalue => value.Costs));

            return(asdf);
        }