コード例 #1
0
    private void GetInfectionStats()
    {
        int non = 0, symp = 0, asymp = 0;

        foreach (GameObject person in people)
        {
            Covid covid = person.GetComponent <Covid>();
            if (covid.status == InfectionStatus.NotInfected)
            {
                non++;
            }
            else if (covid.status == InfectionStatus.Symptomatic)
            {
                symp++;
            }
            else
            {
                asymp++;
            }
        }

        numUninfected   = non;
        numSymptomatic  = symp;
        numAsymptomatic = asymp;
    }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Death,Recovered,Confirmed,CountryId")] Covid covid)
        {
            if (id != covid.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(covid);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CovidExists(covid.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Nome", covid.CountryId);
            return(View(covid));
        }
コード例 #3
0
        // POST: api/Covids
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <Covid> PostCovid(Covid covid)
        {
            _context.Covid.Add(covid);
            await _context.SaveChangesAsync();

            return(covid);
        }
コード例 #4
0
        public async System.Threading.Tasks.Task <ActionResult> Covid(string country)
        {
            var viewModel = new Covid()
            {
                Country = country
            };
            string result = "";

            if (country != null && country != "")
            {
                var client  = new HttpClient();
                var request = new HttpRequestMessage
                {
                    Method     = HttpMethod.Get,
                    RequestUri = new Uri($"https://rapidapi.p.rapidapi.com/v1/total?country={country}"),
                    Headers    =
                    {
                        { "x-rapidapi-host", "covid-19-coronavirus-statistics.p.rapidapi.com"     },
                        { "x-rapidapi-key",  "4b0f134ed5mshcc390618454924fp13e12ajsn613f77890a43" },
                    },
                };
                using (var response = await client.SendAsync(request))
                {
                    response.EnsureSuccessStatusCode();
                    var body = await response.Content.ReadAsStringAsync();

                    result = body;
                }

                viewModel.Roo = JsonConvert.DeserializeObject <Roo>(result);
            }


            return(View(viewModel));
        }
コード例 #5
0
        public override async Task HandleAsync(IUpdateContext context, UpdateDelegate next, string[] args,
                                               CancellationToken cancellationToken)
        {
            _telegramService = new TelegramService(context);
            var txt     = _telegramService.Message.Text;
            var partTxt = txt.SplitText(" ").ToArray();
            var part1   = partTxt.ValueOfIndex(1); // Country

            await _telegramService.SendTextAsync("🔍 Getting information..");

            var sendText = "";

            if (part1.IsNullOrEmpty())
            {
                Log.Information("Getting Covid info Global");
                // var sendText = await CovidHelper.GetCovidUpdatesAsync();
                sendText = await Covid.GetCovidAll();
            }
            else
            {
                Log.Information($"Getting Covid info by Region: {part1}");
                sendText = await Covid.GetCovidByCountry(part1);
            }

            await _telegramService.EditAsync(sendText);
        }
コード例 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("IdCovid,ProcentageVaccination")] Covid covid)
        {
            if (id != covid.IdCovid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(covid);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CovidExists(covid.IdCovid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCovid"] = new SelectList(_context.Country, "IdCountry", "Name", covid.IdCovid);
            return(View(covid));
        }
コード例 #7
0
            protected override void OnPostExecute(string result)
            {
                try
                {
                    base.OnPostExecute(result);

                    if (result.Contains("Error:"))
                    {
                        return;
                    }
                    covid = JsonConvert.DeserializeObject <Covid>(result);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("Exception : " + ex.Message);
                    return;
                }
                //Add Data
                foreach (var item in covid.Countries)
                {
                    Content obj = new Content();
                    obj.country        = item.country.ToString();
                    obj.totalconfirmed = item.TotalConfirmed.ToString();
                    obj.newconfirmed   = item.NewConfirmed.ToString();
                    obj.totaldeaths    = item.TotalDeaths.ToString();
                    obj.newdeaths      = item.NewDeaths.ToString();
                    obj.totalrecovered = item.TotalRecovered.ToString();
                    obj.newrecovered   = item.NewRecovered.ToString();
                    conlist.Add(obj);
                }
                DataAdapter adapter = new DataAdapter(activity, conlist);

                activity.mainList.Adapter    = adapter;
                activity.mainList.ItemClick += listView_ItemClick;
            }
コード例 #8
0
        public async Task <int> PutCovid(uint id, Covid covid)
        {
            if (id != covid.ForecastId)
            {
                return(-2);
            }

            _context.Entry(covid).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CovidExists(id))
                {
                    return(-1);
                }
                else
                {
                    throw;
                }
            }

            return(0);
        }
コード例 #9
0
        public async Task <IActionResult> SaveCovid(Covid covid)
        {
            await covidService.SaveCovid(covid);

            //IQueryable<Covid> covids = covidService.GetList();
            //return Ok(covids);
            return(Ok(covidService.GetCovidCharts()));
        }
コード例 #10
0
        public async Task <IActionResult> SaveCovid(Covid covid)
        {
            await _service.SaveCovid(covid);

            // IQueryable<Covid> covidList = _service.GetList();

            return(Ok(_service.GetCovidChartList()));
        }
コード例 #11
0
        public ActionResult DeleteConfirmed(int id)
        {
            Covid covid = db.Covids.Find(id);

            db.Covids.Remove(covid);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #12
0
ファイル: Covid2.cs プロジェクト: alexandrialin/Nexus-Reality
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag(gameObject.tag))
     {
         gameObject.SetActive(false);
         other.gameObject.SetActive(false);
         Covid.AddPoints();
     }
 }
コード例 #13
0
        public async Task <IActionResult> Create([Bind("Id,Death,Recovered,Confirmed,CountryId")] Covid covid)
        {
            if (ModelState.IsValid)
            {
                _context.Add(covid);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Nome", covid.CountryId);
            return(View(covid));
        }
コード例 #14
0
        public async Task <IActionResult> Create([Bind("IdCovid,ProcentageVaccination")] Covid covid)
        {
            if (ModelState.IsValid)
            {
                _context.Add(covid);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCovid"] = new SelectList(_context.Country, "IdCountry", "Name", covid.IdCovid);
            return(View(covid));
        }
コード例 #15
0
 public IActionResult Registrar(Covid covid)
 {
     if (ModelState.IsValid)
     {
         //grabado DB
         covid.Autor = "Daniel Chacón";
         _context.Add(covid);
         _context.SaveChanges();
         covid.Respuesta = "Gracias por su registro pronto estaremos en contacto con usted ";
     }
     return(View("Index", covid));
 }
コード例 #16
0
        public async Task <Covid> GetCovid(string zip)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("https://localcoviddata.com/covid19/v1/");
            HttpResponseMessage response = await client.GetAsync($"cases/newYorkTimes?zipCode={zip}&daysInPast=4");

            //install-package Microsoft.AspNet.WebAPI.Client
            Covid covid = await response.Content.ReadAsAsync <Covid>();

            return(covid);
        }
コード例 #17
0
 public ActionResult Edit([Bind(Include = "CovidId,PacienteId,FechaIngreso,Observacion,Medicamento,Tratamiento,EstadoId,FechaSalida")] Covid covid)
 {
     if (ModelState.IsValid)
     {
         db.Entry(covid).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EstadoId   = new SelectList(db.Estados, "EstadoId", "Tipo", covid.EstadoId);
     ViewBag.PacienteId = new SelectList(db.Pacientes, "PacienteId", "Cedula", covid.PacienteId);
     return(View(covid));
 }
コード例 #18
0
 public IActionResult Registrar(Covid covid)
 {
     if (ModelState.IsValid)
     {
         //grabado DB
         covid.Autor = "jesusbaños";
         _context.Add(covid);
         _context.SaveChanges();
         covid.Respuesta = "Su solicitud será enviada pronto, muchas gracias!";
     }
     return(View("Index", covid));
 }
コード例 #19
0
        public async Task <List <CovidChartViewModel> > AddCovidAsync(Covid covid)
        {
            await _appDbContext.Covids.AddAsync(covid);

            await _appDbContext.SaveChangesAsync();

            var covidsChartViewModel = await GetCovidListAsync();

            //Yeni bir vaka eklendiğinde bunu tüm clientlara bildiriyorum.
            await _covidHub.Clients.All.ReceiveCovidList(covidsChartViewModel);

            return(covidsChartViewModel);
        }
コード例 #20
0
        public void GetDataFilteredConfirmedCasesTest()
        {
            var covidObj = new Covid();

            var local_Filter = "Brasil";

            var sortingField = GetPropertyName(
                () => covidObj.Confirmados);

            var totalCases = _ICovidLogic.GetReportFromCountry(local_Filter, sortingField);

            Assert.AreNotEqual("No Content", totalCases);
        }
コード例 #21
0
        public List <Covid> get_data(int queryid, string qryparams)
        {
            List <Covid> covids = new List <Covid>();
            var          client = GetBigqueryClient();
            var          table  = client.GetTable("bigquery-public-data", "covid19_ecdc", "covid_19_geographic_distribution_worldwide");
            var          sql    = "";

            BigQueryParameter[] parameters = null;
            if (queryid == 1)
            {
                sql = $"SELECT * FROM {table}";
            }
            else if (queryid == 2)
            {
                sql        = $"SELECT * FROM {table} where date = @date";
                parameters = new[]
                {
                    new BigQueryParameter("date", BigQueryDbType.Date, qryparams),
                };
            }
            else
            {
                sql        = $"SELECT * FROM {table} where geo_id = @geoid";
                parameters = new[]
                {
                    new BigQueryParameter("geoid", BigQueryDbType.String, qryparams),
                };
            }


            var results = client.ExecuteQuery(sql, parameters);

            foreach (BigQueryRow row in results)
            {
                Covid s = new Covid();
                s.Date  = Convert.ToString(row["date"]);
                s.day   = Convert.ToInt32(row["day"]);
                s.month = Convert.ToInt32(row["month"]);
                s.year  = Convert.ToInt32(row["year"]);
                s.daily_confirmed_cases = Convert.ToInt32(row["daily_confirmed_cases"]);
                s.daily_deaths          = Convert.ToInt32(row["daily_deaths"]);
                s.confirmed_cases       = Convert.ToInt32(row["confirmed_cases"]);
                s.deaths = Convert.ToInt32(row["deaths"]);
                s.countries_and_territories = Convert.ToString(row["countries_and_territories"]);
                s.geo_id = Convert.ToString(row["geo_id"]);
                s.country_territory_code = Convert.ToString(row["country_territory_code"]);
                s.pop_data_2018          = Convert.ToInt32(row["pop_data_2018"]);
                covids.Add(s);
            }
            return(covids);
        }
コード例 #22
0
        // GET: Covids/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Covid covid = db.Covids.Find(id);

            if (covid == null)
            {
                return(HttpNotFound());
            }
            return(View(covid));
        }
コード例 #23
0
ファイル: CovidsController.cs プロジェクト: hardsree123/SCM
        public async Task <IActionResult> PutCovid(uint id, Covid covid)
        {
            int res = await _covideContext.PutCovid(id, covid);

            if (res.Equals(-2))
            {
                return(BadRequest());
            }
            else if (res.Equals(-1))
            {
                return(NotFound());
            }
            return(Ok());
        }
コード例 #24
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Covid covid = db.Covids.Find(id);

            if (covid == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EstadoId   = new SelectList(db.Estados, "EstadoId", "Tipo", covid.EstadoId);
            ViewBag.PacienteId = new SelectList(db.Pacientes, "PacienteId", "Cedula", covid.PacienteId);
            return(View(covid));
        }
コード例 #25
0
        public IActionResult InitializeCovid()
        {
            Random rnd = new Random();

            Enumerable.Range(1, 10).ToList().ForEach(x =>
            {
                foreach (ECity item in Enum.GetValues(typeof(ECity)))
                {
                    var newCovid = new Covid {
                        City = item, Count = rnd.Next(100, 1000), CovidDate = DateTime.Now.AddDays(x)
                    };
                    _service.SaveCovid(newCovid).Wait();
                    System.Threading.Thread.Sleep(1000);
                }
            });
            return(Ok("Covid19 Dataları veritabanına kaydedildi."));
        }
コード例 #26
0
        public IActionResult InitializeCovid()
        {
            Random random = new Random();

            Enumerable.Range(1, 5).ToList().ForEach(x =>
            {
                foreach (Ecity ecity in Enum.GetValues(typeof(Ecity)))
                {
                    var newCovid = new Covid
                    {
                        City      = ecity,
                        Count     = random.Next(50, 100),
                        CovidDate = DateTime.Now.AddDays(x)
                    };
                    covidService.SaveCovid(newCovid).Wait();
                }
            });

            return(Ok(covidService.GetCovidCharts()));
        }
コード例 #27
0
        public IActionResult InitializeCovid()
        {
            Random rnd = new Random();

            Enumerable.Range(1, 10).ToList().ForEach(x =>
            {
                foreach (CityEnum item in Enum.GetValues(typeof(CityEnum)))
                {
                    var newCovid = new Covid
                    {
                        City      = item,
                        Count     = rnd.Next(250, 2000),
                        CovidDate = DateTime.Now.AddDays(x),
                    };
                    _service.SaveCovid(newCovid).Wait();
                    System.Threading.Thread.Sleep(1000);
                }
            });

            return(Ok("Veriler başarıyla kaydedildi"));
        }
コード例 #28
0
        public IActionResult InitilazeCovid()
        {
            Random random = new Random();

            Enumerable.Range(1, 10).ToList().ForEach(randomValue =>
            {
                foreach (City city in Enum.GetValues(typeof(City)))
                {
                    var covid = new Covid
                    {
                        City          = city,
                        NumberOfCases = random.Next(100, 1000),
                        CovidDate     = DateTime.Now.AddDays(randomValue)
                    };

                    _covidService.AddCovidAsync(covid).Wait();

                    Thread.Sleep(TimeSpan.FromSeconds(2)); //2 saniye arayla verileri ekle.
                }
            });

            return(Ok());
        }
コード例 #29
0
 void Start()
 {
     _covidManager = FindObjectOfType <Covid>();
     _rotate       = GetComponent <RotateAround>();
 }
コード例 #30
0
ファイル: CovidController.cs プロジェクト: jefflimah/Covid
 public async Task <IActionResult> Post(Covid covid)
 {
     return(Ok("Efetuado com Sucesso!"));
 }