コード例 #1
0
        public async Task <IHttpActionResult> GetMyStations()
        {
            string token  = Request.Headers.GetValues("Authorization").FirstOrDefault();
            int    userId = JwtHelper.Instance.GetUserId(token);

            IStationDao   stationDao  = AdoFactory.Instance.GetStationDao("wetr");
            IAddressDao   addressDao  = AdoFactory.Instance.GetAddressDao("wetr");
            ICommunityDao communitDao = AdoFactory.Instance.GetCommunityDao("wetr");
            IDistrictDao  districtDao = AdoFactory.Instance.GetDistrictDao("wetr");
            IProvinceDao  provinceDao = AdoFactory.Instance.GetProvinceDao("wetr");
            ICountryDao   countryDao  = AdoFactory.Instance.GetCountryDao("wetr");

            IEnumerable <Station> myStations = null;

            myStations = await stationDao.FindByUserIdAsync(userId);

            List <StationDTO> convertedStations = new List <StationDTO>();

            /* Infer location ids for convenience */
            foreach (var s in myStations)
            {
                StationDTO station = new StationDTO(s);

                station.CommunityId = (await addressDao.FindByIdAsync(station.AddressId)).CommunityId;
                station.DistrictId  = (await communitDao.FindByIdAsync(station.CommunityId)).DistrictId;
                station.ProvinceId  = (await districtDao.FindByIdAsync(station.DistrictId)).ProvinceId;
                station.CountryId   = (await provinceDao.FindByIdAsync(station.ProvinceId)).CountryId;
                station.Location    = (await addressDao.FindByIdAsync(station.AddressId)).Location;

                convertedStations.Add(station);
            }

            return(Content(HttpStatusCode.OK, convertedStations));
        }
コード例 #2
0
        public async Task <IHttpActionResult> GetStation(int id)
        {
            IStationDao   stationDao  = AdoFactory.Instance.GetStationDao("wetr");
            IAddressDao   addressDao  = AdoFactory.Instance.GetAddressDao("wetr");
            ICommunityDao communitDao = AdoFactory.Instance.GetCommunityDao("wetr");
            IDistrictDao  districtDao = AdoFactory.Instance.GetDistrictDao("wetr");
            IProvinceDao  provinceDao = AdoFactory.Instance.GetProvinceDao("wetr");
            ICountryDao   countryDao  = AdoFactory.Instance.GetCountryDao("wetr");

            Station myStations = await stationDao.FindByIdAsync(id);

            if (myStations == null)
            {
                return(Content(HttpStatusCode.BadRequest, new object()));
            }

            StationDTO station = new StationDTO(myStations);

            station.CommunityId = (await addressDao.FindByIdAsync(station.AddressId)).CommunityId;
            station.DistrictId  = (await communitDao.FindByIdAsync(station.CommunityId)).DistrictId;
            station.ProvinceId  = (await districtDao.FindByIdAsync(station.DistrictId)).ProvinceId;
            station.CountryId   = (await provinceDao.FindByIdAsync(station.ProvinceId)).CountryId;
            station.Location    = (await addressDao.FindByIdAsync(station.AddressId)).Location;

            return(Content(HttpStatusCode.OK, station));
        }
コード例 #3
0
        /// <summary>
        /// Location rule
        /// </summary>
        /// <param name="address"></param>
        /// <param name="isOnline"></param>
        public LocationRule(Address address)
        {
            IStateDao   stateDao   = Ioc.GetObject <IStateDao>("stateDao");
            ICountryDao countryDao = Ioc.GetObject <ICountryDao>("countryDao");

            Init(stateDao.GetLookUp(), countryDao.GetLookUp(), address, address.IsOnline);
        }
コード例 #4
0
 private void Init(ILocationShortNameDao shortNameDao, IStateDao stateDao, ICityDao cityDao, ICountryDao countryDao)
 {
     _shortNameDao = shortNameDao;
     //_zipCodeDao = zipCodeDao;
     _stateDao   = stateDao;
     _cityDao    = cityDao;
     _countryDao = countryDao;
 }
コード例 #5
0
 public static void ClassInitialize(TestContext testContext)
 {
     db = new MYSQLDatabase("Server = localhost; Database = ufotest; Uid = root;");
     catdao = new CategoryDao(db);
     coudao = new CountryDao(db);
     adao = new ArtistDao(db);
     couS = ServiceFactory.CreateCountryService(db);
 }
コード例 #6
0
 public SQLeBasedCurrencyConverter()
 {
     //IDaoFactory factory = new DaoFactorySQLe(); // requires project reference
     instantDao      = DaoFactorySQLe.InstantDao;
     currencyTypeDao = DaoFactorySQLe.CurrencyTypeDao;
     exchangeRateDao = DaoFactorySQLe.ExchangeRateDao;
     countryDao      = DaoFactorySQLe.CountryDao;
 }
コード例 #7
0
 public LocationController(ICommandBus bus, ICountryDao _countryDao, INeighbourhoodDao _neighbourhoodDao, IStateDao _stateDao, ICityDao _cityDao) : base()
 {
     this.bus               = bus;
     this._CountryDao       = _countryDao;
     this._NeighbourhoodDao = _neighbourhoodDao;
     this._StateDao         = _stateDao;
     this._CityDao          = _cityDao;
 }
コード例 #8
0
 public CountryService(IDatabase db)
 {
     if (db is MYSQLDatabase) {
         couDao = new CountryDao(db);
         aDao = new ArtistDao(db);
     } else {
         throw new NotSupportedException("Database not supported");
     }
 }
コード例 #9
0
 public DaoProvider(ICountryDao countryDao, ILocationDao locationDao, IRaceDao raceDao, IRunDao runDao,
                    ISensorMeasurementDao sensorMeasurementDao, ISkierDao skierDao)
 {
     CountryDao           = countryDao;
     LocationDao          = locationDao;
     RaceDao              = raceDao;
     RunDao               = runDao;
     SensorMeasurementDao = sensorMeasurementDao;
     SkierDao             = skierDao;
 }
コード例 #10
0
ファイル: Commander.cs プロジェクト: Pham0uz/UFO
 public Commander(IDatabase database)
 {
     this.database = database;
     this.artistDao = DALFactory.CreateArtistDao(database);
     this.categoryDao = DALFactory.CreateCategoryDao(database);
     this.countryDao = DALFactory.CreateCountryDao(database);
     this.performanceDao = DALFactory.CreatePerformanceDao(database);
     this.userDao = DALFactory.CreateUserDao(database);
     this.venueDao = DALFactory.CreateVenueDao(database);
 }
コード例 #11
0
ファイル: AddressManager.cs プロジェクト: AndreasRoither/Wetr
 public AddressManager(ICountryDao countryDao,
                       IProvinceDao provinceDao,
                       IDistrictDao districtDao,
                       ICommunityDao communityDao,
                       IAddressDao addressDao
                       )
 {
     this.countryDao   = countryDao;
     this.communityDao = communityDao;
     this.provinceDao  = provinceDao;
     this.districtDao  = districtDao;
     this.addressDao   = addressDao;
 }
コード例 #12
0
        public static DaoProvider GetPartialDaoProvider(ICountryDao countryDao = null, ILocationDao locationDao = null,
                                                        IRaceDao raceDao       = null, IRunDao runDao = null,
                                                        ISensorMeasurementDao sensorMeasurementDao = null, ISkierDao skierDao = null)
        {
            // var connectionFactory = new ConnectionFactory(Environment.Testing);
            //
            // ICountryDao countryDao = new CountryDao(connectionFactory);
            // ILocationDao locationDao = new LocationDao(connectionFactory);
            // IRaceDao raceDao = new RaceDao(connectionFactory);
            // IRunDao runDao = new RunDao(connectionFactory);
            // ISensorMeasurementDao sensorMeasurementDao = new SensorMeasurementDao(connectionFactory);
            // ISkierDao skierDao = new SkierDao(connectionFactory);

            return(new DaoProvider(countryDao, locationDao, raceDao, runDao, sensorMeasurementDao, skierDao));
        }
コード例 #13
0
        public DataGenerator(string providerName, string connectionString)
        {
            var connectionFactory =
                new ConcreteConnectionFactory(DbUtil.GetProviderFactory(providerName), connectionString);
            var statementFactory = new StatementFactory("hurace");

            _countryDao    = new CountryDao(connectionFactory, statementFactory);
            _locationDao   = new LocationDao(connectionFactory, statementFactory);
            _skierDao      = new SkierDao(connectionFactory, statementFactory);
            _disciplineDao = new DisciplineDao(connectionFactory, statementFactory);
            _raceDao       = new RaceDao(connectionFactory, statementFactory);
            _startListDao  = new StartListDao(connectionFactory, statementFactory);
            _raceDataDao   = new RaceDataDao(connectionFactory, statementFactory);
            _sensorDao     = new SensorDao(connectionFactory, statementFactory);
            _timeDataDao   = new TimeDataDao(connectionFactory, statementFactory);
            _raceDataDao   = new RaceDataDao(connectionFactory, statementFactory);
            _raceEventDao  = new RaceEventDao(connectionFactory, statementFactory);
            _skierEventDao = new SkierEventDao(connectionFactory, statementFactory);
            _seasonDao     = new SeasonDao(connectionFactory, statementFactory);
        }
コード例 #14
0
        public async Task <IHttpActionResult> GetStations(int communityId)
        {
            IStationDao   stationDao  = AdoFactory.Instance.GetStationDao("wetr");
            IAddressDao   addressDao  = AdoFactory.Instance.GetAddressDao("wetr");
            ICommunityDao communitDao = AdoFactory.Instance.GetCommunityDao("wetr");
            IDistrictDao  districtDao = AdoFactory.Instance.GetDistrictDao("wetr");
            IProvinceDao  provinceDao = AdoFactory.Instance.GetProvinceDao("wetr");
            ICountryDao   countryDao  = AdoFactory.Instance.GetCountryDao("wetr");

            IEnumerable <Station> stations = null;

            stations = await stationDao.FindAllAsync();

            List <StationDTO> convertedStations = new List <StationDTO>();

            /* Infer location ids for convenience */
            foreach (var s in stations)
            {
                StationDTO station = new StationDTO(s);

                station.CommunityId = (await addressDao.FindByIdAsync(station.AddressId)).CommunityId;
                station.DistrictId  = (await communitDao.FindByIdAsync(station.CommunityId)).DistrictId;
                station.ProvinceId  = (await districtDao.FindByIdAsync(station.DistrictId)).ProvinceId;
                station.CountryId   = (await provinceDao.FindByIdAsync(station.ProvinceId)).CountryId;
                station.Location    = (await addressDao.FindByIdAsync(station.AddressId)).Location;

                convertedStations.Add(station);
            }

            if (communityId != 0)
            {
                convertedStations.RemoveAll(s => s.CommunityId != communityId);
            }

            return(Content(HttpStatusCode.OK, convertedStations));
        }
コード例 #15
0
 public SystemDomainValuesController(ICommandBus bus, ICurrencyDao _CurrencyDao, ILanguageDao _LanguageDao, ICountryDao _countryDao,
                                     INeighbourhoodDao _neighbourhoodDao, IStateDao _stateDao, ICityDao _cityDao,
                                     IPersonDao _PersonDao, IPersonOriginTypeDao _personOriginTypeDao, IPersonProfileDao _personProfileDao,
                                     IPersonStatusDao _personStatusDao, IPersonTypeDao _personTypeDao, IPersonAddressDao _personAddressDao,
                                     IPersonExpertiseDao _personExpertiseDao, IFileTempDao fileTemp, ISecuritySourceDao _SecurityDao) : base()
 {
     this.bus                  = bus;
     this._CurrencyDao         = _CurrencyDao;
     this._LanguageDao         = _LanguageDao;
     this._CountryDao          = _countryDao;
     this._NeighbourhoodDao    = _neighbourhoodDao;
     this._StateDao            = _stateDao;
     this._CityDao             = _cityDao;
     this._PersonDao           = _PersonDao;
     this._PersonOriginTypeDao = _personOriginTypeDao;
     this._PersonProfileDao    = _personProfileDao;
     this._PersonStatusDao     = _personStatusDao;
     this._PersonTypeDao       = _personTypeDao;
     this._PersonAddressDao    = _personAddressDao;
     this._listFileTemp        = new List <int>();
     this._FileTemp            = fileTemp;
     this._PersonExpertiseDao  = _personExpertiseDao;
     this._SecurityDao         = _SecurityDao;
 }
コード例 #16
0
 /// <summary>
 /// Constuctor that also takes in the short name dao.
 /// </summary>
 /// <param name="shortNameDao"></param>
 /// <param name="zipCodeDao"></param>
 /// <param name="stateDao"></param>
 public LocationService(ICountryDao countryDao, IStateDao stateDao, ICityDao cityDao, ILocationShortNameDao shortNameDao)
 {
     Init(shortNameDao, stateDao, cityDao, countryDao);
 }
コード例 #17
0
 public CountryService(ICountryDao countryDao) => _countryDao = countryDao;
コード例 #18
0
 public void Startup()
 {
     adao = new ArtistDao(db);
     catDao = new CategoryDao(db);
     couDao = new CountryDao(db);
     pDao = new PerformanceDao(db);
     pDao.DeleteAllPerformances();
     adao.DeleteAllArtists();
     catDao.DeleteAllCategories();
     couDao.DeleteAllCountries();
     foreach (var item in RepresentativeData.GetDefaultCategories()) {
         catDao.CreateCategory(item.Shortcut, item.Name);
     }
     foreach (var item in RepresentativeData.GetDefaultCountries()) {
         couDao.CreateCountry(item.Name, item.FlagPath);
     }
 }
コード例 #19
0
ファイル: DataController.cs プロジェクト: AndreasRoither/Wetr
        public async Task <IHttpActionResult> GetCountries()
        {
            ICountryDao dao = AdoFactory.Instance.GetCountryDao("wetr");

            return(Ok(await dao.FindAllAsync()));
        }
コード例 #20
0
 public CountryLogic(ICountryDao countryDao, ICountryValidationLogic countryValidation)
 {
     this.countries  = countryDao;
     this.validation = countryValidation;
 }
コード例 #21
0
ファイル: CountryLogic.cs プロジェクト: Tec4Gen/OOP_Practicle
 public CountryLogic(ICountryDao countryLogic)
 {
     _countryLogic = countryLogic;
 }
コード例 #22
0
 public void Startup()
 {
     catdao = new CategoryDao(db);
     coudao = new CountryDao(db);
     adao = new ArtistDao(db);
     vdao = new VenueDao(db);
     pdao = new PerformanceDao(db);
     aS = ServiceFactory.CreateArtistService(db);
     category = RepresentativeData.GetDefaultCategories()[0];
     country = RepresentativeData.GetDefaultCountries()[0];
     category = catdao.CreateCategory(category.Shortcut, category.Name);
     country = coudao.CreateCountry(country.Name, country.FlagPath);
 }
コード例 #23
0
        public void Startup()
        {
            vdao = new VenueDao(db);
            catDao = new CategoryDao(db);
            couDao = new CountryDao(db);
            adao = new ArtistDao(db);
            pdao = new PerformanceDao(db);

            pdao.DeleteAllPerformances();
            vdao.DeleteAllVenues();
            adao.DeleteAllArtists();
            catDao.DeleteAllCategories();
            couDao.DeleteAllCountries();

            foreach (var item in RepresentativeData.GetDefaultVenues()) {
                vdao.CreateVenue(item.Name, item.Shortcut, item.Latitude, item.Longitude);
            }
            foreach (var item in RepresentativeData.GetDefaultCategories()) {
                catDao.CreateCategory(item.Shortcut, item.Name);
            }
            foreach (var item in RepresentativeData.GetDefaultCountries()) {
                couDao.CreateCountry(item.Name, item.FlagPath);
            }

            foreach (var item in RepresentativeData.GetDefaultArtists()) {
                adao.CreateArtist(item.Name, item.Email, item.CategoryId,
                    item.CountryId, item.PicturePath, item.VideoPath);
            }
        }
コード例 #24
0
 /// <summary>
 ///     Erstellt eine neue Instanz des Country Services
 /// </summary>
 /// <param name="countryDao"></param>
 public CountryService(ICountryDao countryDao)
 {
     _countryDao = countryDao;
 }
コード例 #25
0
        public void Startup()
        {
            pdao = new PerformanceDao(db);
            adoa = new ArtistDao(db);
            countrydao = new CountryDao(db);
            categorydao = new CategoryDao(db);
            vdao = new VenueDao(db);
            ps = ServiceFactory.CreatePerformanceService(db);

            pdao.DeleteAllPerformances();
            adoa.DeleteAllArtists();
            countrydao.DeleteAllCountries();
            categorydao.DeleteAllCategories();
            vdao.DeleteAllVenues();
        }
コード例 #26
0
ファイル: SkierService.cs プロジェクト: FelixStumvoll/hurace
 public SkierService(ISkierDao skierDao, ICountryDao countryDao, IGenderDao genderDao)
 {
     _skierDao   = skierDao;
     _countryDao = countryDao;
     _genderDao  = genderDao;
 }
コード例 #27
0
ファイル: CountryDaoTests.cs プロジェクト: Pham0uz/UFO
 public void MyTestInitialize()
 {
     cDao = DALFactory.CreateCountryDao(database);
 }