Changes in / [a6bbad1:58fa654]


Ignore:
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/ClientApp/src/app/counter/counter.component.html

    ra6bbad1 r58fa654  
    1010    <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Пронајди установа">
    1111  </mat-form-field>
    12     </div>   
    13   <table [dataSource]="dataSource" mat-table matSort class="mat-elevation-z8">
    14       <ng-container matColumnDef="id">
    15         <th mat-header-cell *matHeaderCellDef mat-sort-header> id </th>
    16         <td mat-cell *matCellDef="let facilities"> {{facilities.id}} </td>
    17       </ng-container>
    18 
    19       <ng-container matColumnDef="createdOn">
    20         <th mat-header-cell *matHeaderCellDef mat-sort-header> createdOn </th>
    21         <td mat-cell *matCellDef="let facilities"> {{facilities.createdOn}} </td>
    22       </ng-container>
    23      
    24       <ng-container matColumnDef="deletedOn">
    25         <th mat-header-cell *matHeaderCellDef mat-sort-header> deletedOn </th>
    26         <td mat-cell *matCellDef="let facilities"> {{facilities.deletedOn}} </td>
    27       </ng-container>
    28 
     12    </div>
     13    <table [dataSource]="dataSource" mat-table matSort class="mat-elevation-z8">
    2914      <ng-container matColumnDef="Име">
    3015        <th mat-header-cell *matHeaderCellDef mat-sort-header> Име </th>
     
    6045        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
    6146    </table>
    62     <mat-paginator #paginator [pageSize]="100" [pageSizeOptions]="[5, 10, 20, 100]"></mat-paginator>
     47    <mat-paginator #paginator [pageSize]="5" [pageSizeOptions]="[5, 10, 20, 100]"></mat-paginator>
    6348  </div>
    6449  </mat-tab>
  • Farmatiko/ClientApp/src/app/counter/counter.component.ts

    ra6bbad1 r58fa654  
    1 import { Component, OnInit, ViewChild, Inject, Input } from '@angular/core';
     1import { Component, OnInit, ViewChild, Inject } from '@angular/core';
    22import { HttpClient } from '@angular/common/http';
    33import { HealthFacilities } from '../models/HealthFacilities';
     
    1313})
    1414export class CounterComponent implements OnInit {
    15   @Input() facilities: HealthFacilities[];
     15  public facilities: HealthFacilities[];
    1616  public workers: HealthcareWorkers[];
    17   displayedColumns = ['id','createdOn','deletedOn','Име','Општина','Адреса', 'Тип', 'Е-пошта', 'Телефон'];
     17  displayedColumns = ['Име','Општина','Адреса', 'Тип', 'Е-пошта', 'Телефон'];
    1818  displayedColumnsWorkers = ['Име','Гранка','Установа', 'Назив'];
    1919  dataSource = new MatTableDataSource<HealthFacilities>();
    2020  dataSourceWorkers = new MatTableDataSource<HealthcareWorkers>();
    2121
    22   @ViewChild(MatPaginator, {static: false}) paginator: MatPaginator;
     22  @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
    2323  @ViewChild(MatSort) sort: MatSort;
    2424
     
    4141    this.dataSource.paginator = this.paginator;
    4242    this.dataSource.sort = this.sort;
     43    this.dataSourceWorkers.paginator = this.paginator;
     44    this.dataSourceWorkers.sort = this.sort;
    4345  }
    4446
  • Farmatiko/ClientApp/src/app/shared/material.module.ts

    ra6bbad1 r58fa654  
    7575    MatTabsModule,
    7676    MatToolbarModule,
    77     MatTooltipModule,
    78     MatFormFieldModule
     77    MatTooltipModule
    7978  ],
    8079  exports: [
     
    114113    MatTabsModule,
    115114    MatToolbarModule,
    116     MatTooltipModule,
    117     MatFormFieldModule
     115    MatTooltipModule
    118116  ]
    119117})
  • Farmatiko/Controllers/HealthFacilitiesController.cs

    ra6bbad1 r58fa654  
    2020        private IHealthFacilityService _healthFacilitiesService;
    2121        private IProcessJSONService _processJSONService;
     22        /*private IProcessJSONService _processJSONService;*/
     23        private string Path = @"C:\Users\dslez\Desktop\ustanovi.json";
    2224        public HealthFacilitiesController(IHealthFacilityService healthFacilitiesService, IProcessJSONService processJSONService)
    2325        {
     
    3032            return _healthFacilitiesService.GetAll();
    3133        }
    32         public void Index()
     34       /* public void Index()
     35       
    3336        {
    3437            _processJSONService.GetProcessedHealthFacilitiesFromJSON();
    35         }
     38        }*/
    3639    }
    3740}
  • Farmatiko/Farmatiko.csproj

    ra6bbad1 r58fa654  
    3535
    3636  <ItemGroup>
    37     <Compile Remove="Controllers\WeatherForecastController.cs" />
    38     <Compile Remove="WeatherForecast.cs" />
    39   </ItemGroup>
    40 
    41   <ItemGroup>
    4237    <ProjectReference Include="..\FarmatikoData\FarmatikoData.csproj" />
    4338    <ProjectReference Include="..\FarmatikoServices\FarmatikoServices.csproj" />
  • FarmatikoServices/Services/ProcessJSONService.cs

    ra6bbad1 r58fa654  
    1515    public class ProcessJSONService : IProcessJSONService
    1616    {
    17         //private IHealthFacilityRepository _healthFacilityRepository;
    18         private IPandemicRepository _pandemicRepository;
    19         //private IHealthcareWorkerRepository _healthcareWorkerRepository;
    20         //private IMedicineRepository _medicineRepository;
     17        private IHealthFacilityRepository _healthFacilityRepository;
    2118        //private readonly ILogger _logger;
    22         public ProcessJSONService(/*IHealthFacilityRepository healthFacilityRepository, */IPandemicRepository pandemicRepository/*,
    23             IHealthcareWorkerRepository healthcareWorkerRepository, IMedicineRepository medicineRepository*/)
     19        public ProcessJSONService(IHealthFacilityRepository healthFacilityRepository)
    2420        {
    2521            //_logger = logger;
    26             //_healthFacilityRepository = healthFacilityRepository;
    27             _pandemicRepository = pandemicRepository;
    28             //_healthcareWorkerRepository = healthcareWorkerRepository;
    29             //_medicineRepository = medicineRepository;
     22            _healthFacilityRepository = healthFacilityRepository;
    3023        }
    3124       
     
    3427            try
    3528            {
    36                 /*var client = new WebClient();
    37                 var json = client.DownloadString(@"C:\Users\Miki\Desktop\ustanovi.json");
     29                var client = new WebClient();
     30                var json = client.DownloadString(@"C:\Users\dslez\Desktop\ustanovi.json");
    3831
    3932                var jsonResponse = JObject.Parse(json);
    4033                var records = JArray.Parse(jsonResponse.GetValue("records").ToString());
     34
    4135
    4236                foreach(var rec in records)
     
    5650                    healthFacility.Phone = Phone;
    5751                    healthFacility.Type = Type;
     52                    var obje = healthFacility;
    5853                    _healthFacilityRepository.Add(healthFacility);
    5954                   
    60                 }*/
    61 
    62 
    63 
    64                 var client1 = new RestClient("https://api.covid19api.com/summary");
    65                 var response = client1.Execute(new RestRequest());
    66                 string original = response.Content;
    67                 var jsonResponsePandemic = JObject.Parse(original);
    68                 var global = JObject.Parse(jsonResponsePandemic.GetValue("Global").ToString());
    69                 var TotalConfirmed = long.Parse(global.GetValue("TotalConfirmed").ToString());
    70                 var TotalDeaths = long.Parse(global.GetValue("TotalDeaths").ToString());
    71                 var TotalRecovered = long.Parse(global.GetValue("TotalRecovered").ToString());
    72 
    73                 var mk = JArray.Parse(jsonResponsePandemic.GetValue("Countries").ToString());
    74                 dynamic objP = mk[100];
    75                 var TotalMk = Int32.Parse(objP.GetValue("TotalConfirmed").ToString());
    76                 var TotalDeathsMK = Int32.Parse(objP.GetValue("TotalDeaths").ToString());
    77                 var TotalRecoveredMK = Int32.Parse(objP.GetValue("TotalRecovered").ToString());
    78                 var NewMK = Int32.Parse(objP.GetValue("NewConfirmed").ToString());
    79 
    80                 Pandemic pandemic = new Pandemic();
    81                 pandemic.TotalGlobal = TotalConfirmed;
    82                 pandemic.ActiveGlobal = TotalConfirmed - (TotalRecovered + TotalDeaths);
    83                 pandemic.DeathsGlobal = TotalDeaths;
    84                 pandemic.TotalMK = TotalMk;
    85                 pandemic.ActiveMK = TotalMk - (TotalRecoveredMK + TotalDeathsMK);
    86                 pandemic.DeathsMK = TotalDeathsMK;
    87                 pandemic.NewMK = NewMK;
    88                 pandemic.Name = "Coronavirus";
    89                 _pandemicRepository.Add(pandemic);
    90 
    91 
    92 
    93                 /*var jsonW = client.DownloadString(@"C:\Users\Miki\Desktop\rabotnici.json");
    94 
    95                 var jsonResponseW = JObject.Parse(jsonW);
    96                 var recordsW = JArray.Parse(jsonResponseW.GetValue("records").ToString());
    97 
    98                 foreach (var rec in recordsW)
    99                 {
    100                     dynamic obj = JsonConvert.DeserializeObject(rec.ToString());
    101                     var Name = obj[4];
    102                     var Branch = obj[2];
    103                     HealthFacilities facility = new HealthFacilities();
    104                     facility.Name = obj[1];
    105                     facility.Municipality = "WorkerFacilityMunicipality";
    106                     facility.Address = "WorkerFacilityAddress";
    107                     var Title = obj[3];
    108                     HealthcareWorkers healthcareWorker = new HealthcareWorkers();
    109                     healthcareWorker.Name = Name;
    110                     healthcareWorker.Branch = Branch;
    111                     healthcareWorker.Facility = facility;
    112                     healthcareWorker.Title = Title;
    113                     _healthcareWorkerRepository.Add(healthcareWorker);
    11455                }
    11556
    11657
    11758
    118                 var jsonM = client.DownloadString(@"C:\Users\Miki\Desktop\lekovi.json");
    119 
    120                 var jsonResponseM = JObject.Parse(jsonM);
    121                 var recordsM = JArray.Parse(jsonResponseM.GetValue("records").ToString());
    122 
    123                 foreach (var rec in recordsM)
    124                 {
    125                     dynamic obj = JsonConvert.DeserializeObject(rec.ToString());
    126                     var Name = obj[1];
    127                     var Strength = obj[7];
    128                     var Form = obj[6];
    129                     var WayOfIssuing = obj[9];
    130                     var Manufacturer = obj[11];
    131                     var Price = float.Parse(obj[17]);
    132                     var Packaging = obj[8];
    133                     Medicine medicine = new Medicine();
    134                     medicine.Name = Name;
    135                     medicine.Strength = Strength;
    136                     medicine.Form = Form;
    137                     medicine.WayOfIssuing = WayOfIssuing;
    138                     medicine.Manufacturer = Manufacturer;
    139                     medicine.Price = Price;
    140                     medicine.Packaging = Packaging;
    141                     _medicineRepository.Add(medicine);
    142                 }*/
    143 
     59                /*var client1 = new RestClient("https://api.covid19api.com/summary");
     60                var response = client1.Execute(new RestRequest());
     61                string original = response.Content;
     62                var jsonResponse = JObject.Parse(original);
     63                var global = JObject.Parse(jsonResponse.GetValue("Global").ToString());
     64                var total = Int32.Parse(global.GetValue("TotalConfirmed").ToString());
     65                Pandemic pandemic = new Pandemic();
     66                pandemic.TotalGlobal = total;*/
    14467
    14568            }
Note: See TracChangeset for help on using the changeset viewer.