IBE.SQL.EliteDBIO.getLevels C# (CSharp) Method

getLevels() private static method

private static getLevels ( int &DemandLevel, int &SupplyLevel, int?>.Dictionary Levels, Listing StationListing ) : void
DemandLevel int
SupplyLevel int
Levels int?>.Dictionary
StationListing IBE.EDDB_Data.Listing
return void
        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);
            }
        }