Example #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));
        }
Example #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));
        }
Example #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);
        }
 private void Init(ILocationShortNameDao shortNameDao, IStateDao stateDao, ICityDao cityDao, ICountryDao countryDao)
 {
     _shortNameDao = shortNameDao;
     //_zipCodeDao = zipCodeDao;
     _stateDao   = stateDao;
     _cityDao    = cityDao;
     _countryDao = countryDao;
 }
 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);
 }
 public SQLeBasedCurrencyConverter()
 {
     //IDaoFactory factory = new DaoFactorySQLe(); // requires project reference
     instantDao      = DaoFactorySQLe.InstantDao;
     currencyTypeDao = DaoFactorySQLe.CurrencyTypeDao;
     exchangeRateDao = DaoFactorySQLe.ExchangeRateDao;
     countryDao      = DaoFactorySQLe.CountryDao;
 }
Example #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;
 }
 public CountryService(IDatabase db)
 {
     if (db is MYSQLDatabase) {
         couDao = new CountryDao(db);
         aDao = new ArtistDao(db);
     } else {
         throw new NotSupportedException("Database not supported");
     }
 }
 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;
 }
Example #10
0
 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);
 }
Example #11
0
 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;
 }
        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));
        }
Example #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);
        }
Example #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));
        }
Example #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;
 }
 /// <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);
 }
Example #17
0
 public CountryService(ICountryDao countryDao) => _countryDao = countryDao;
 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);
     }
 }
Example #19
0
        public async Task <IHttpActionResult> GetCountries()
        {
            ICountryDao dao = AdoFactory.Instance.GetCountryDao("wetr");

            return(Ok(await dao.FindAllAsync()));
        }
Example #20
0
 public CountryLogic(ICountryDao countryDao, ICountryValidationLogic countryValidation)
 {
     this.countries  = countryDao;
     this.validation = countryValidation;
 }
Example #21
0
 public CountryLogic(ICountryDao countryLogic)
 {
     _countryLogic = countryLogic;
 }
 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);
 }
        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);
            }
        }
Example #24
0
 /// <summary>
 ///     Erstellt eine neue Instanz des Country Services
 /// </summary>
 /// <param name="countryDao"></param>
 public CountryService(ICountryDao countryDao)
 {
     _countryDao = countryDao;
 }
        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();
        }
Example #26
0
 public SkierService(ISkierDao skierDao, ICountryDao countryDao, IGenderDao genderDao)
 {
     _skierDao   = skierDao;
     _countryDao = countryDao;
     _genderDao  = genderDao;
 }
Example #27
0
 public void MyTestInitialize()
 {
     cDao = DALFactory.CreateCountryDao(database);
 }