public Station GetStationInfoWithMatrix(StationOptions stationOptions)
 {
     try
     {
         Station station = new Station(stationOptions);
         return station;
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(new Exception(string.Format("An error occurred while trying to load info for StationId: {0}", stationOptions.stationId), ex));
         throw new Exception("An error occurred while trying to load the Station info.");
     }
 }
Example #2
0
 /// <summary>TBD</summary>
 public void GetReportData()
 {
     DataSet reportData;
     using (IO io = new IO(WebCommon.DigitalAvailsConnectionString))
     {
         reportData = io.ExecuteDataSetQuery(IO.CreateCommandFromStoredProc("DigitalAvails_GetSpotMatrixForMarket",
         Param.CreateParam("MARKET", SqlDbType.VarChar, this.Market),
         Param.CreateParam("STARTMONTH", SqlDbType.Int, this.StartMonth),
         Param.CreateParam("STARTYEAR", SqlDbType.Int, this.StartYear),
         Param.CreateParam("NUMBEROFMONTHS", SqlDbType.Int, this.NumberOfMonths)));
     }
     //}
     //Load all the spots for the market
     //this.MarketSpotMatrix = Spot.LoadSpotMatrix(reportData.Tables[2]);
     this.MarketSpotMatrix = Spot.LoadSpotMatrix(reportData.Tables[2]);
     //Load all the spot type breakdowns for the market
     //this.MarketSpotTypeBreakdown = SpotTypeBreakdown.LoadSpotTypeBreakdown(reportData.Tables[3]);
     this.MarketSpotTypeBreakdown = SpotTypeBreakdown.LoadSpotTypeBreakdown(reportData.Tables[3]);
     //Load all the station spots for the market
     //this.MarketStationSpots = StationSpot.LoadStationSpots(reportData.Tables[1]);
     this.MarketStationSpots = StationSpot.LoadStationSpots(reportData.Tables[1]);
     //Load the stations
     this.MarketStations = new List<Station>();
     Station station;
     int stationId;
     foreach (DataRow stationRow in reportData.Tables[0].Rows)
     {
         stationId = (int)stationRow["StationId"];
         station = new Station();
         station.LoadStationData(stationRow);
         station.SpotMatrix = this.MarketSpotMatrix.Where(m => m.StationId == stationId).ToList();
         station.SpotTypeBreakdown = this.MarketSpotTypeBreakdown.Where(b => b.StationId == stationId).OrderBy(b => b.BreakdownOrder).ToList();
         station.StationSpots = this.MarketStationSpots.Where(s => s.StationId == stationId).OrderBy(s => s.Order).ToList();
         this.MarketStations.Add(station);
     }
     //Sort the station list
     this.MarketStations = this.MarketStations.OrderBy(s => s.Name).ToList();
     //Retrieve the Spot Types for this market
     this.MarketSpotTypes = SpotType.GetSpotTypesByMarket(this.Market);
 }