Exemplo n.º 1
0
        private void onElapsedTime(object source, ElapsedEventArgs e)
        {
            logger.Info("Starting syncronization.");

            try
            {
                RestApi.IApiClient        apiClient  = RestApi.ApiClientFactory.Create(RestApi.ApiClientTypes.Curl);
                DataStore.AmcasRepository repository = new DataStore.AmcasRepository();

                do
                {
                    List <DataModel.Application> apiApplications = apiClient.GetAllApplications(DataModel.MedicalInstitutions.NovaSoutheastern);
                    logger.Info("Applications retrieved from REST API: {0}", apiApplications.Count);
                    repository.SyncApplications(apiApplications);
                    List <DataModel.Application> repositoryApplications = repository.GetApplicationList();
                    logger.Info("Applications available in database: {0}", repositoryApplications.Count);
                    logger.Info("Batch indicator: {0}", apiClient.BatchIndicator);
                }while (apiClient.BatchIndicator);
                logger.Info("Syncronization completed.");
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
 private void updateRepositoryApplications()
 {
     repositoryApplications    = repository.GetApplicationList();
     bindingSource2.DataSource = new BindingList <DataModel.Application>(repositoryApplications);
     dataGridView2.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
 }