private static void getLevels(ref int? DemandLevel, ref int? SupplyLevel, Dictionary<String, int?> Levels, Listing StationListing)
{
try
{
DemandLevel = null;
if (!String.IsNullOrEmpty(StationListing.DemandLevel))
if (!Levels.TryGetValue(StationListing.DemandLevel, out DemandLevel))
{
dsEliteDB.tblevellocalizationRow[] LocRow = (dsEliteDB.tblevellocalizationRow[])Program.Data.BaseData.tblevellocalization.Select(String.Format("locname = '{0}'", StationListing.DemandLevel));
if (LocRow.GetUpperBound(0) >= 0)
{
DemandLevel = LocRow[0].economylevel_id;
Levels.Add(StationListing.DemandLevel, LocRow[0].economylevel_id);
}
}
SupplyLevel = null;
if (!String.IsNullOrEmpty(StationListing.SupplyLevel))
if (!Levels.TryGetValue(StationListing.SupplyLevel, out SupplyLevel))
{
dsEliteDB.tblevellocalizationRow[] LocRow = (dsEliteDB.tblevellocalizationRow[])Program.Data.BaseData.tblevellocalization.Select(String.Format("locname = '{0}'", StationListing.SupplyLevel));
if (LocRow.GetUpperBound(0) >= 0)
{
SupplyLevel = LocRow[0].economylevel_id;
Levels.Add(StationListing.SupplyLevel, LocRow[0].economylevel_id);
}
}
}
catch (Exception ex)
{
throw new Exception("Error while caching levels", ex);
}
}