private async void FillLabels() { NurseName = metric.NurseName; DeviceName = metric.Device; MetricType = metric.MetricType; MetricValue = metric.MetricValue; PatientName = metric.PatientName; updatedMetric = await _metricService.GetMetric(metric.ID); }
/// <summary> /// Get the value of a MetricType /// </summary> /// <typeparam name="T"></typeparam> /// <param name="metrics"></param> /// <param name="type"></param> /// <returns></returns> public static T GetMetricValue <T>(this IMetricService metrics, MetricType type) { var metric = metrics.GetMetric(type); if (metric == null) { return(default(T)); } if (metric.Value.GetType() != typeof(T)) { return((T)Convert.ChangeType(metric.Value, typeof(T))); } return((T)metric.Value); }
public async Task <IActionResult> GetMetricsById(long Id) { try { var response = await _metricService.GetMetric(Id); if (response.ResponseCode != ResponseCode.Ok) { return(Ok(WebApiResponses <MetricModel> .ErrorOccured(response.Message))); } return(Ok(WebApiResponses <MetricModel> .Successful(response.ResponseData))); } catch (Exception ex) { Log.Error(ex); return(Ok(WebApiResponses <MetricModel> .ErrorOccured(ex.Message))); } }
private async void FillList() { Metrics = new ObservableCollection <MetricListItem>(); metric = await _metricService.GetMetric(metricId); var nurse = await _nurseService.GetNurseAsync(metric.nurse_id); var patient = await _patientService.GetPatient(patientId); NurseName = $"Ingelogd als: {nurse.firstname} {nurse.lastname}"; if (metric.bloeddruk != "0") { var deviceName = await _deviceService.GetDeviceAsyncById(metric.device_bloeddruk); var listItem = new MetricListItem { MetricType = "Bloeddruk", MetricValue = $"{metric.bloeddruk} mmHg", Device = deviceName.name, NurseName = $"{nurse.firstname} {nurse.lastname}", ID = metric._id, PatientName = $"{patient.Firstname} {patient.Lastname}" }; Metrics.Add(listItem); } if (metric.gewicht != "0") { var deviceName = await _deviceService.GetDeviceAsyncById(metric.device_gewicht); var listItem = new MetricListItem { MetricType = "Gewicht", MetricValue = $"{metric.gewicht} kg", Device = deviceName.name, NurseName = $"{nurse.firstname} {nurse.lastname}", ID = metric._id, PatientName = $"{patient.Firstname} {patient.Lastname}" }; Metrics.Add(listItem); } if (metric.temperatuur != "0") { var deviceName = await _deviceService.GetDeviceAsyncById(metric.device_temperatuur); var listItem = new MetricListItem { MetricType = "Temperatuur", MetricValue = $"{metric.temperatuur} °C", Device = deviceName.name, NurseName = $"{nurse.firstname} {nurse.lastname}", ID = metric._id, PatientName = $"{patient.Firstname} {patient.Lastname}" }; Metrics.Add(listItem); } if (metric.pijnscore != "0") { var listItem = new MetricListItem { MetricType = "Pijnscore", MetricValue = $"{metric.pijnscore}", Device = "", NurseName = $"{nurse.firstname} {nurse.lastname}", ID = metric._id, PatientName = $"{patient.Firstname} {patient.Lastname}" }; Metrics.Add(listItem); } }