24 lines
779 B
C#
24 lines
779 B
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel.DataAnnotations;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Reflection;
|
|||
|
|
|||
|
namespace Weee.Models.ExtensionMethods
|
|||
|
{
|
|||
|
public static class MaterialExtension
|
|||
|
{
|
|||
|
public static decimal GetTotalPartsCarbonFootprint<T>(this ICollection<T> materials) where T : Material
|
|||
|
{
|
|||
|
decimal totalPartsCarbonFootprint = 0;
|
|||
|
|
|||
|
foreach (var material in materials) {
|
|||
|
if (material.RequestSent == null || material.RequestSent.RepliedByWhichLCA == null) continue;
|
|||
|
totalPartsCarbonFootprint += material.RequestSent.RepliedByWhichLCA.GetPrimaryAndSecondaryFabKgCO2e();
|
|||
|
}
|
|||
|
|
|||
|
return totalPartsCarbonFootprint;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|