Esempio n. 1
0
        public Characters()
        {
            InitializeComponent();
            apiService = DependencyResolver.Get<IAPIService>();

            UpdateGrid();
        }
 public NearBySearchService(IGoogleAPI googleAPI, IAPIService aPIService)
 {
     GoogleAPI  = googleAPI;
     APIService = aPIService;
 }
Esempio n. 3
0
 public HomeController(IAPIService apiService, ILogService logService, IHunCamService hunCamService)
 {
     this.apiService    = apiService;
     this.logService    = logService;
     this.hunCamService = hunCamService;
 }
Esempio n. 4
0
        protected override async void OnStart()
        {
            // Handle when your app starts
            issuesToBeUploaded = MongoCache.ReadOfflineIssue();
            eventsToBeUploaded = MongoCache.ReadOfflineEvent();

            if (issuesToBeUploaded != null)
            {
                newRecordResponse = new NewRecordResponse();
                aPIService        = RestService.For <IAPIService>(Constants.mongoDBBaseUrl);
                int currentIssue = 0;

                if (issuesToBeUploaded.Count > 0)
                {
                    try
                    {
                        foreach (var issue in issuesToBeUploaded)
                        {
                            newRecordResponse = await aPIService.InsertNewIssue(Constants.mongoDBBName, Constants.mongoDBCollectionIssues, Constants.mongoDBKey, issue);

                            if (!string.IsNullOrEmpty(newRecordResponse._id.oid))
                            {
                                // This is Success.

                                /*
                                 * First, we get the issue list from application settings and then we iterate over each and every saved instance.
                                 * Now, when we have success, we remove that item, so that it doesn't appear again in the list.
                                 * Now, we need to increment the issue count.
                                 */
                                issuesToBeUploaded.RemoveAt(currentIssue);
                                currentIssue++;
                            }
                            else
                            {
                                // This is Failure.
                                Console.WriteLine("Failure Occurred. Moving To Next One.");
                            }
                        }
                        foreach (var item in issuesToBeUploaded)
                        {
                            MongoCache.WriteOfflineIssue(item);
                        }
                    }
                    catch (Exception ex)
                    {
                        // Move On.
                        Console.WriteLine("Error While Uploading Issue Backlog : " + ex.Message);
                    }
                }
            } // Issue Uploaded

            if (eventsToBeUploaded != null)
            {
                newEventResponse = new Event();
                aPIService       = RestService.For <IAPIService>(Constants.mongoDBBaseUrl);
                int currentEvent = 0;

                if (eventsToBeUploaded.Count > 0)
                {
                    try
                    {
                        foreach (var eventVal in eventsToBeUploaded)
                        {
                            newEventResponse = await aPIService.InsertNewEvent(Constants.mongoDBBName, Constants.mongoDBCollectionEvents, Constants.mongoDBKey, eventVal);

                            if (!string.IsNullOrEmpty(newEventResponse._id.oid))
                            {
                                // This is Success.

                                /*
                                 * First, we get the event list from application settings and then we iterate over each and every saved instance.
                                 * Now, when we have success, we remove that item, so that it doesn't appear again in the list.
                                 * Now, we need to increment the issue count.
                                 */
                                eventsToBeUploaded.RemoveAt(currentEvent);
                                currentEvent++;
                            }
                            else
                            {
                                // This is Failure.
                                Console.WriteLine("Failure Occurred. Moving To Next One.");
                            }
                        }

                        foreach (var item in eventsToBeUploaded)
                        {
                            MongoCache.WriteOfflineEvent(item);
                        }
                    }
                    catch (Exception ex)
                    {
                        // Move On.
                        Console.WriteLine("Error While Uploading Event Backlog : " + ex.Message);
                    }
                }
            } // Event Uploaded
        }
Esempio n. 5
0
 public FilmyController(IAPIService service)
 {
     _service = service;
 }
 public EndPointController(ISignatureVerifier signatureVerifier, IAPIService apiService)
 {
     _signatureVerifier = signatureVerifier ?? throw new ArgumentNullException(nameof(signatureVerifier));
     _apiService        = apiService ?? throw new ArgumentNullException(nameof(apiService));
 }
Esempio n. 7
0
        public PokemonRegionViewModel(INavigationService navigationService, IAPIService apiService, IGruposRegionRepository gruposRegionRepository,
                                      IGrupoPokemonsRepository grupoPokemonsRepository)
            : base(navigationService)
        {
            _apiService              = apiService;
            _navigationService       = navigationService;
            _gruposRegionRepository  = gruposRegionRepository;
            _grupoPokemonsRepository = grupoPokemonsRepository;

            #region Commands Logic

            CancelCreation = new Command(async() =>
            {
                await _navigationService.GoBackAsync();
            });

            SaveGroup = new Command(async() =>
            {
                try
                {
                    UserDialogs.Instance.ShowLoading(null, MaskType.None);


                    //validate pokemons number
                    if (PokemonsCounter < 3 || PokemonsCounter > 6)
                    {
                        UserDialogs.Instance.HideLoading();

                        await App.Current.MainPage.DisplayAlert("Error",
                                                                "You must add at min. 3 pokemons or max. 6 pokemons", "ok");
                        return;
                    }

                    var result1 = false;
                    var result2 = false;
                    if (CrossConnectivity.Current.IsConnected)
                    {
                        if (IsCreate)
                        {
                            //Create Group group first
                            var group = new GruposRegion
                            {
                                GrupoId            = await _gruposRegionRepository.GetLastID() + 1,
                                GrupoName          = GroupName,
                                GrupoTipo          = GroupType,
                                PokedexDescription = PokedexDescription,
                                Image         = "",
                                Region        = PokedexInfo.FirstOrDefault().name,
                                UserId        = await SecureStorage.GetAsync("UserId"),
                                Token         = Convert.ToBase64String(Guid.NewGuid().ToByteArray()),
                                GrupoIdFather = null
                            };

                            result1 = await _gruposRegionRepository.SaveData(group);

                            if (result1)
                            {
                                //then we add pokemons related
                                var data = PokemonList.Where(x => x.IsSelected).Select(x =>
                                                                                       new GrupoPokemons
                                {
                                    GroupId = group.GrupoId,
                                    Pokemon = x.name
                                });

                                result2 = await _grupoPokemonsRepository.SaveDataRange(data);
                            }

                            if (result1 && result2)
                            {
                                await App.Current.MainPage.DisplayAlert("Success",
                                                                        "Your group was created successfully", "ok");

                                var navigationParams = new NavigationParameters();
                                navigationParams.Add("RegionName", group.Region);
                                await navigationService.GoBackAsync(navigationParams);
                            }
                            else
                            {
                                UserDialogs.Instance.HideLoading();

                                ErrorAlert();
                                await navigationService.GoBackAsync();
                            }
                        }
                        else
                        {
                            GruposRegion.GrupoName          = GroupName;
                            GruposRegion.GrupoTipo          = GroupType;
                            GruposRegion.PokedexDescription = PokedexDescription;

                            result1 = await _gruposRegionRepository.UpdateData(GruposRegion);

                            if (result1)
                            {
                                //then we add pokemons related and delete pokemons non related

                                var oldValues = (await _grupoPokemonsRepository.GetDataByGrupoId(GruposRegion.GrupoId)).ToList();

                                var data = PokemonList.Where(x => x.IsSelected).Select(x =>
                                                                                       new GrupoPokemons
                                {
                                    GroupId = GruposRegion.GrupoId,
                                    Pokemon = x.name
                                });

                                //if old data does not appear, it means it was no unselected
                                foreach (var item in oldValues)
                                {
                                    if (!data.Select(x => x.Pokemon).Contains(item.Pokemon))
                                    {
                                        await _grupoPokemonsRepository.DeleteData(item.Id, string.Empty, string.Empty);
                                    }
                                }

                                //if new data does not appear, it means it must be added

                                foreach (var item in data)
                                {
                                    if (!oldValues.Select(x => x.Pokemon).Contains(item.Pokemon))
                                    {
                                        item.Id = await _gruposRegionRepository.GetLastID() + 1;
                                        await _grupoPokemonsRepository.SaveData(item);
                                    }
                                }

                                result2 = true;
                            }

                            if (result1 && result2)
                            {
                                UserDialogs.Instance.HideLoading();

                                await App.Current.MainPage.DisplayAlert("Success",
                                                                        "Your group was modified successfully", "ok");

                                var navigationParams = new NavigationParameters();
                                navigationParams.Add("GrupoId", GruposRegion.GrupoId);
                                await navigationService.GoBackAsync(navigationParams);
                            }
                            else
                            {
                                UserDialogs.Instance.HideLoading();

                                ErrorAlert();
                                await navigationService.GoBackAsync();
                            }
                        }
                    }
                    else
                    {
                        NoInternetAlert();
                    }
                }
                catch (Exception ex)
                {
                    ErrorAlert();
                    await navigationService.GoBackAsync();
                }
            });
            #endregion
        }
Esempio n. 8
0
 public ListofIssues()
 {
     InitializeComponent();
     aPIService = RestService.For <IAPIService>(Constants.mongoDBBaseUrl);
 }
Esempio n. 9
0
 public APIServiceTest()
 {
     _service = new APIService();
 }
Esempio n. 10
0
 public QualificationService(IUnitOfWork unitOfWork, IExceptionReporter exceptionReporter, ICacheProvider cacheService, IAPIService apiService)
     : base(unitOfWork, exceptionReporter)
 {
     _cacheService = cacheService;
     _apiService   = apiService;
 }
Esempio n. 11
0
 public APIDataBroker(IAPIService apiService, IJSONService jsonService)
 {
     _apiService  = apiService;
     _jsonService = jsonService;
 }
Esempio n. 12
0
 public IndividualController(IAPIService apiService)
 {
     _apiService = apiService ?? throw new ArgumentNullException(nameof(apiService));
 }
Esempio n. 13
0
 public GoogleService(IAPIService apiService, IConfiguration configuration)
 {
     _apiService    = apiService;
     _configuration = configuration;
 }
Esempio n. 14
0
 public StudentService(IUnitOfWork unitOfWork, IExceptionReporter exceptionReporter, IAPIService apiService)
     : base(unitOfWork, exceptionReporter)
 {
     _apiService = apiService;
 }
Esempio n. 15
0
 public DiscordModuleService(IAPIService apiService, IDiscordPayloadFactory discordPayloadFactory)
 {
     _apiService            = apiService;
     _discordPayloadFactory = discordPayloadFactory;
 }
 public MoedaRepository(IAPIService api)
 {
     _api = api;
 }
Esempio n. 17
0
 public UserFilterService(IAPIService apiService, IDistanceCalculationService distanceCalculationService)
 {
     this.apiService = apiService;
     this.distanceCalculationService = distanceCalculationService;
 }
Esempio n. 18
0
 public HomeController(IConfiguration config, IServiceLocator serviceLocator, IAPIService apiService)
 {
     Config         = config;
     ServiceLocator = serviceLocator;
     APIService     = apiService;
 }
 public DummySessionRepository(DummyApiContext context, IAPIService apiservice)
 {
     _context    = context;
     _apiservice = apiservice;
 }
Esempio n. 20
0
 public HomeController(IAPIService apiService)
 {
     this._apiService = apiService;
 }
Esempio n. 21
0
 public HomeController(ILogger <HomeController> logger, IAPIService service)
 {
     _logger  = logger;
     _service = service;
 }
Esempio n. 22
0
 private Trader(IAPIService stockApiService)
 {
     _stockApiService = stockApiService;
 }
Esempio n. 23
0
 public GoogleService(IMapService mapAPI, INearBySearchService nearBySearch, IAPIService aPIService)
 {
     MapAPI       = mapAPI;
     APIService   = aPIService;
     NearBySearch = nearBySearch;
 }
 public LekarskoUverenjeViewModel()
 {
     _apiService = new APIService();
 }
 public VideosController(IMapper mapper, IAPIService apiService)
 {
     _mapper     = mapper;
     _apiService = apiService;
 }
Esempio n. 26
0
 public HomeController()
 {
     apiService = new APIService(Client);
     distanceCalculationService = new DistanceCalculationService();
     userFilterService          = new UserFilterService(apiService, distanceCalculationService);
 }
Esempio n. 27
0
 public ResearchersController(ApplicationDbContext context, IAPIService apiCalls)
 {
     _context  = context;
     _apiCalls = apiCalls;
 }
Esempio n. 28
0
 public HomeController(IAPIService apiService, IUserFilterService userFilterService, IDistanceCalculationService distanceCalculationService)
 {
     this.apiService                 = apiService;
     this.userFilterService          = userFilterService;
     this.distanceCalculationService = distanceCalculationService;
 }
Esempio n. 29
0
 public LanguageViewModel(IAlertService alertService) : base(alertService)
 {
     languageService = new APIService();
     GetList         = new Command(Load);
 }
Esempio n. 30
0
 public GoogleService(IGoogleAPI googleAPI, IAPIService aPIService)
 {
     GoogleAPI  = googleAPI;
     APIService = aPIService;
 }
Esempio n. 31
0
 public APIManage()
 {
     InitializeComponent();
     apiService = DependencyResolver.Get<IAPIService>();
 }
 public DownloadsController(IMapper mapper, IAPIService apiService)
 {
     _mapper     = mapper;
     _apiService = apiService;
 }