This is the function:
private decimal? CalculateMe(int? kat0, int? kat1, int? kat2, int? numberOfPlants)
{
if (numberOfPlants == null || numberOfPlants == 0 || kat0 == null || kat1 == null || kat2 == null)
return null;
return ((kat1 + kat2 * 2) / (numberOfPlants * 2)) * 100;
}
This function always returns zero! Even if an explicit cast is written Convert.ToDecimal
, the function returns zero.
return Convert.ToDecimal(((kat1 + kat2 * 2) / (numberOfPlants * 2)) * 100);