コード例 #1
0
ファイル: Program.cs プロジェクト: rgalinas26/TechElevMats
        static void Main(string[] args)
        {
            // Select all countries
            //GetAllCountries();

            // Get a count of all countries
            //GetCountryCount();

            // Select cities that belong to a country code
            //GetCitiesForCountryCode("USA");


            //Console.ReadKey();
            //return;

            //IConfigurationBuilder builder = new ConfigurationBuilder()
            //    .SetBasePath(Directory.GetCurrentDirectory())
            //    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            //IConfigurationRoot configuration = builder.Build();
            //string connectionString = configuration.GetConnectionString("World");


            ICityDAO     cityDAO     = null;
            ICountryDAO  countryDAO  = new CountrySqlDAO(connectionString);
            ILanguageDAO languageDAO = null;

            WorldGeographyCLI cli = new WorldGeographyCLI(cityDAO, countryDAO, languageDAO);

            cli.RunCLI();
        }
コード例 #2
0
        /// <summary>
        /// Constructor adds items to the top-level menu
        /// </summary>
        public CountryMenu(Country country, ICityDAO cityDAO, ICountryLanguageDAO countryLanguageDAO)
        {
            // Update this constructor to accept appropriate daos, and save them in local variables.
            this.cityDAO            = cityDAO;
            this.countryLanguageDAO = countryLanguageDAO;

            // Save the country (which will be used for all country queries
            this.country = country;

            // This code is just protection because before we complete the code, Country may be null
            if (country == null)
            {
                country = new Country();
            }

            // Add options to this menu
            AddOption($"List Cities in {country.Name}", ListCities)
            .AddOption($"List Languages in {country.Name}", ListLanguages)
            .AddOption($"Add a city to {country.Name}", AddCity)
            .AddOption("Remove a city", RemoveCity)
            .AddOption("Back", Exit);

            Configure(cfg =>
            {
                cfg.ItemForegroundColor         = ConsoleColor.DarkGreen;
                cfg.SelectedItemForegroundColor = ConsoleColor.Green;
            });
        }
コード例 #3
0
 public UserInterface(string connectionString)
 {
     this.connectionString = connectionString;
     venueDAO       = new VenueSqlDAO(connectionString);
     cityDAO        = new CitySqlDAO(connectionString);
     spaceDAO       = new SpaceSqlDAO(connectionString);
     reservationDAO = new ReservationSqlDAO(connectionString);
 }
コード例 #4
0
        static void Main(string[] args)
        {
            //IConfigurationBuilder builder = new ConfigurationBuilder()
            //    .SetBasePath(Directory.GetCurrentDirectory())
            //    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            //IConfigurationRoot configuration = builder.Build();
            //string connectionString = configuration.GetConnectionString("World");


            ICityDAO     cityDAO     = null;
            ICountryDAO  countryDAO  = null;
            ILanguageDAO languageDAO = null;

            WorldGeographyCLI cli = new WorldGeographyCLI(cityDAO, countryDAO, languageDAO);

            cli.RunCLI();
        }
コード例 #5
0
        /// <summary>
        /// Constructor adds items to the top-level menu
        /// </summary>
        public WorldDBMenu(ICountryDAO countryDAO, ICityDAO cityDAO)
        {
            this.CountryDao = countryDAO;
            this.cityDAO    = cityDAO;
            // TODO 05a: Change this constructor to require country dao
            // TODO 15a: Change this constructor to require country-language dao

            // TODO 05d: Assign the Interfaces to protected variables so we can use them later

            // Add options to this menu
            AddOption("List Countries", ListCountries)
            .AddOption("List Countries on a continent", ListCountriesForContinent)
            .AddOption("Select a country", SelectACountry)
            .AddOption("Quit", Exit);

            Configure(cfg =>
            {
                cfg.ItemForegroundColor         = ConsoleColor.Yellow;
                cfg.SelectedItemForegroundColor = ConsoleColor.Green;
            });
        }
コード例 #6
0
 public CityController(ICityDAO dao)
 {
     this.dao = dao;
 }
コード例 #7
0
 public WorldGeographyCLI(ICityDAO cityDAO, ICountryDAO countryDAO, ILanguageDAO languageDAO)
 {
     this.cityDAO     = cityDAO;
     this.languageDAO = languageDAO;
     this.countryDAO  = countryDAO;
 }
コード例 #8
0
 public CityController(ICityDAO cityDao)
 {
     this.cityDao = cityDao;
 }
コード例 #9
0
 public CityController(ICityDAO cityDAO, ICountryDAO countryDAO)
 {
     this.cityDAO    = cityDAO;
     this.countryDAO = countryDAO;
 }
コード例 #10
0
 /// <summary>
 /// Parameterized Constructor
 /// </summary>
 /// <param name="cityDAO"></param>
 public CityManager(ICityDAO cityDAO)
 {
     this.cityDAO = cityDAO;
 }
コード例 #11
0
 public CountryController(ICityDAO cityDao, ICountryDAO countryDao, ILanguageDAO languageDao)
 {
     this.cityDao     = cityDao;
     this.countryDao  = countryDao;
     this.languageDao = languageDao;
 }
コード例 #12
0
 // DI: Step 2 - Add any necessary interfaces as parameters only if needed in this controller
 public WorldController(ICountryDAO countryDao, ICityDAO cityDao)
 {
     _countryDao = countryDao;
     _cityDao    = cityDao;
 }
コード例 #13
0
 // TODO 02 (Controller): Derive the city controller from AppController so we have access to authProvider
 // Note that we have to inject an IAuthProvider and pass it to the base contructor
 public CityController(ICityDAO cityDAO, ICountryDAO countryDAO, IAuthProvider authProvider) : base(authProvider)
 {
     this.cityDAO    = cityDAO;
     this.countryDAO = countryDAO;
 }
コード例 #14
0
 public HomeController(ICityDAO dao)
 {
     _dao = dao;
 }
コード例 #15
0
 public WorldController(ICountryDAO countryDAL, ICityDAO cityDAL)
 {
     this.countryDAL = countryDAL;
     this.cityDAL    = cityDAL;
 }
コード例 #16
0
 public Day1Controller(ICityDAO dao)
 {
     this.dao = dao;
 }
コード例 #17
0
 public WorldController(ICountryDAO countryDao, ICityDAO cityDao)
 {
     this.countryDao = countryDao;
     this.cityDao    = cityDao;
 }
コード例 #18
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 public CityManager()
 {
     cityDAO = CityDAOFactory.GetInstance().CreateCity();
 }
コード例 #19
0
ファイル: HomeController.cs プロジェクト: cnrivera/te-modules
 public HomeController(ICityDAO c)
 {
     this.cityDAO = c;
 }
コード例 #20
0
 public CityController(IAuthProvider authProvider, ICityDAO cityDAO) : base(authProvider)
 {
     this.cityDAO = cityDAO;
 }
コード例 #21
0
 /// <summary>
 /// Constructor adds items to the top-level menu
 /// </summary>
 public WorldDBMenu(ICityDAO cityDAO, ICountryDAO countryDAO, ILanguageDAO languageDAO) : base()
 {
     this.cityDAO     = cityDAO;
     this.languageDAO = languageDAO;
     this.countryDAO  = countryDAO;
 }
コード例 #22
0
 public CityController(ICityDAO cityDAO)
 {
     this.cityDAO = cityDAO;
 }
コード例 #23
0
 public Day2Controller(ICityDAO db)
 {
     _db = db;
 }
コード例 #24
0
 /// <summary>
 /// Constructor adds items to the top-level menu
 /// </summary>
 public CountryMenu(Country country, ICityDAO cityDAO, ICountryDAO countryDAO, ILanguageDAO languageDAO) :
     base(cityDAO, countryDAO, languageDAO)
 {
     // Save the country (which will be used for all country queries
     this.country = country;
 }
コード例 #25
0
 public HomeController(ICityDAO cityDAL)
 {
     this.cityDAL = cityDAL;
 }
コード例 #26
0
 // TODO 04 (Controller): implement dependency injection to get CityDAO
 /// <summary>
 /// Create a new CitiesController
 /// </summary>
 /// <param name="logger">Dunno, was included with MVC API project</param>
 /// <param name="cityDAO">A Data Access Object to get cities fomr the DB (or whereever)</param>
 public CitiesController(ILogger <CitiesController> logger, ICityDAO cityDAO)
 {
     _logger      = logger;
     this.cityDAO = cityDAO;
 }
コード例 #27
0
 public Day2Controller(ICityDAO icd)
 {
     cityDAO = icd;
 }