public List<ItemStruct> getUnitListByDimenstionAndDataType(long dimensionId, long dataTypeId)
{
List<ItemStruct> UnitStructs = new List<ItemStruct>();
UnitManager unitmanager = new UnitManager();
List<Unit> units = new List<Unit>();
if(unitmanager.DimensionRepo.Get(dimensionId) != null)
units = unitmanager.DimensionRepo.Get(dimensionId).Units.ToList();
ItemStruct tempUnitStruct = new ItemStruct();
foreach (Unit u in units)
{
if (u.Name.ToLower() != "none")
{
foreach (DataType dt in u.AssociatedDataTypes)
{
if (dt.Id == dataTypeId)
{
tempUnitStruct.Id = u.Id;
tempUnitStruct.Name = u.Name;
UnitStructs.Add(tempUnitStruct);
break;
}
}
}
else
{
tempUnitStruct.Id = u.Id;
tempUnitStruct.Name = u.Name;
UnitStructs.Add(tempUnitStruct);
}
}
return UnitStructs;
}