Example #1
0
        public static InrDTO GenerateBoundaryData(ClientDTO client)
        {
            Random rnd    = new Random();
            InrDTO inrDto = new InrDTO()
            {
                client        = client,
                id            = new Guid().ToString(),
                lowerBoundary = Math.Round((decimal)rnd.NextDouble(0.7, 1.0), 2),
                targetValue   = Math.Round((decimal)rnd.NextDouble(1.0, 1.5), 2),
                upperBoundary = Math.Round((decimal)rnd.NextDouble(1.0, 2.0), 2)
            };

            return(inrDto);
        }
Example #2
0
        public static async Task <InrDTO> LoadInrData(string id)
        {
            string url = string.Format("https://eurocomfontyshealthservice.azurewebsites.net/api/inr/{0}/", id);

            using (HttpResponseMessage response = await APICaller.ApiClient.GetAsync(url))
            {
                if (response.IsSuccessStatusCode)
                {
                    InrDTO inrDTO = await response.Content.ReadAsAsync <InrDTO>();

                    return(inrDTO);
                }
                else
                {
                    throw new Exception(response.ReasonPhrase);
                }
            }
        }
Example #3
0
        public static InrDTO GetBoundaryData(string userID)
        {
            InrDTO inrDto = new InrDTO();

            using (ConnectionString connectionString = new ConnectionString())
            {
                connectionString.sqlConnection.Open();
                SqlCommand check = new SqlCommand("sp_BoundaryValues_GetById", connectionString.sqlConnection);
                check.CommandType = CommandType.StoredProcedure;
                check.Parameters.AddWithValue("@Id", userID);
                var reader = check.ExecuteReader();
                while (reader.Read())
                {
                    inrDto.id            = userID;
                    inrDto.upperBoundary = reader.GetDecimal(0);
                    inrDto.targetValue   = reader.GetDecimal(1);
                    inrDto.lowerBoundary = reader.GetDecimal(2);
                }
                connectionString.Dispose();
            }

            return(inrDto);
        }