Exemplo n.º 1
0
 private void GetStations()
 {
     using (var freeWheelEntities = new DB.FreeWheelEntities())
     {
         stationList = (from s in freeWheelEntities.STATION
                        select s).ToList();
     }
 }
Exemplo n.º 2
0
 private void GetAllCells()
 {
     using (var freeWheelEntities = new DB.FreeWheelEntities())
     {
         cellsList = (from c in freeWheelEntities.CELLS
                      select c.CELL_ID).ToList();
     }
 }
Exemplo n.º 3
0
 private void GetAllMarkets()
 {
     using (var freeWheelEntities = new DB.FreeWheelEntities())
     {
         marketList = (from m in freeWheelEntities.MARKET
                       select m.MARKET_ID).ToList();
     }
 }
Exemplo n.º 4
0
 private void FetchData()
 {
     using (var freeWheelEntities = new DB.FreeWheelEntities())
     {
         pgmNameList = (from p in freeWheelEntities.PROGRAM
                        select p.PROGRAM_NAME).ToList();
     }
 }
Exemplo n.º 5
0
 private void GetAllMarketPops()
 {
     using (var freeWheelEntities = new DB.FreeWheelEntities())
     {
         marketPopList = (from m in freeWheelEntities.MARKET_POP
                          select new MarketPop {
             MarketId = m.MARKET_ID, CellsId = m.CELL_ID
         }).ToList();
     }
 }
Exemplo n.º 6
0
        private void InsertMissingItems(List <DB.MARKET_POP> missingItems)
        {
            Console.WriteLine($"Total # of missing records in MARKET_POP table: {missingItems.Count}");
            Console.WriteLine("Press <ENTER> to insert missing data into MARKET_POP table, or press any other ket to exit");

            if (Console.ReadKey().Key == ConsoleKey.Enter)
            {
                Console.WriteLine("Inserting data...");

                using (var freeWheelEntities = new DB.FreeWheelEntities())
                {
                    freeWheelEntities.MARKET_POP.AddRange(missingItems);
                    freeWheelEntities.SaveChanges();
                }

                Console.WriteLine("Data insert completed. Press any key to exit.");
            }
        }
Exemplo n.º 7
0
        private void DisplayProgram(int stationId)
        {
            if (stationId <= stationList.Count)
            {
                var stationName = stationList[stationId - 1].STATION_NAME;

                using (var freeWheelEntities = new DB.FreeWheelEntities())
                {
                    var programDetails = (from p in freeWheelEntities.PROGRAM
                                          join s in freeWheelEntities.STATION on p.STATION_ID equals s.STATION_ID
                                          where s.STATION_NAME.Equals(stationName)
                                          select new { s.STATION_NAME, p.PROGRAM_NAME, p.FLIGHT_DATE })
                                         .GroupBy(g => g.FLIGHT_DATE).OrderByDescending(g => g.Key).ToList();

                    if (programDetails != null && programDetails.Count > 0)
                    {
                        var programList = programDetails[0].ToList();

                        programList.Sort((a, b) => a.PROGRAM_NAME.CompareTo(b.PROGRAM_NAME));

                        Console.WriteLine("Program Details");
                        Console.WriteLine("```````````````");

                        Console.WriteLine($"{programList[0].STATION_NAME} || {programList[0].PROGRAM_NAME} || {programList[0].FLIGHT_DATE.Value.ToString("MMM dd, yyyy")}");
                    }
                    else
                    {
                        Console.WriteLine("Sorry, no programs found for the requested station");
                    }
                }
            }
            else
            {
                Console.WriteLine($"Sorry, requested station# {stationId} is not available!");
            }
        }