Example #1
0
        private void UserStatistics_Load(object sender, EventArgs e)
        {
            dateTimePicker1.CustomFormat = "dd-MMM-yyyy hh:mm:ss";
            dateTimePicker2.CustomFormat = "dd-MMM-yyyy hh:mm:ss";

            if (snsNumber != 0)
            {
                MessageBox.Show("You selected the user " + p.FirstName);
                groupBox1.Visible = true;
                groupBox2.Visible = true;
                groupBox3.Visible = true;
                groupBox4.Visible = true;
                groupBox5.Visible = true;

                nameN.Text = p.FirstName + " " + p.LastName;
                snsN.Text  = Convert.ToString(p.SNS);
                btdN.Text  = Convert.ToString(p.Birthdate.Day + "/" + p.Birthdate.Month + "/" + p.Birthdate.Year);
                ageN.Text  = Convert.ToString(p.Age);

                // a limitação da vizualização dos registos para o parametro global como a stora sugeriu
                // assim apenas vai buscar os valores de um utente dos ultimos 3 messes para o calculo da estatistica
                var b = web.listBPs(snsNumber, DateTime.Now.AddMonths(-3), DateTime.Now);
                var h = web.listHRs(snsNumber, DateTime.Now.AddMonths(-3), DateTime.Now);
                var s = web.listSPOes(snsNumber, DateTime.Now.AddMonths(-3), DateTime.Now);
                update(b, s, h);
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            // duas formas de limpar labels
            nameN.Text = "";
            snsN.Text  = "";
            ageN.Text  = "";
            btdN.Text  = "";

            //2ªforma
            bpmax.ResetText();
            bpmed.ResetText();
            bpmin.ResetText();
            spomax.ResetText();
            spomed.ResetText();
            spomin.ResetText();
            hrmax.ResetText();
            hrmed.ResetText();
            hrmin.ResetText();

            //validate junto do web service se o utente existe
            //se existir mostrar mensagem de boas vindas



            if (!int.TryParse(textBox1.Text, out parsedValue))
            {
                MessageBox.Show("Please insert a valid SNS number!");
                return;
            }
            else
            {
                snsNumber = Convert.ToInt32(textBox1.Text);



                web = new ServiceHealthClient();
                p   = web.ValidatePatient(snsNumber);


                if (p != null)
                {
                    MessageBox.Show("You selected the user " + p.FirstName);
                    groupBox1.Visible = true;
                    groupBox2.Visible = true;
                    groupBox3.Visible = true;
                    groupBox4.Visible = true;
                    groupBox5.Visible = true;

                    nameN.Text = p.FirstName + " " + p.LastName;
                    snsN.Text  = Convert.ToString(p.SNS);
                    btdN.Text  = Convert.ToString(p.Birthdate.Day + "/" + p.Birthdate.Month + "/" + p.Birthdate.Year);
                    ageN.Text  = Convert.ToString(p.Age);

                    var b = web.listBPs(snsNumber, DateTime.Now.AddDays(-3), DateTime.Now);
                    var h = web.listHRs(snsNumber, DateTime.Now.AddDays(-3), DateTime.Now);
                    var s = web.listSPOes(snsNumber, DateTime.Now.AddDays(-3), DateTime.Now);
                    update(b, s, h);
                }
            }
        }
        private void updateValues(int sns, DateTime dn, DateTime da)
        {
            chart1.Series["BloodPressure"].Points.Clear();
            chart1.Series["HeartRate"].Points.Clear();
            chart1.Series["OxygenSaturation"].Points.Clear();
            listView2.Items.Clear();

            var b = web.listBPs(sns, da, dn);

            foreach (BPs item in b)
            {
                chart1.Series["BloodPressure"].Points.AddXY(item.Date.ToOADate(), item.Value1);

                ListViewItem val = new ListViewItem(Convert.ToString("Blood Pressure"), 0);
                val.SubItems.Add(Convert.ToString(item.Date));
                val.SubItems.Add(Convert.ToString(item.Value1 + "-" + item.Value2));

                listView2.Items.Add(val);
            }
            var h = web.listHRs(sns, da, dn);

            foreach (HRs item in h)
            {
                chart1.Series["HeartRate"].Points.AddXY(item.Date, item.Value);
                ListViewItem val = new ListViewItem(Convert.ToString("Heart Rate"), 0);
                val.SubItems.Add(Convert.ToString(item.Date));
                val.SubItems.Add(Convert.ToString(item.Value));

                listView2.Items.Add(val);
            }
            var s = web.listSPOes(sns, da, dn);

            foreach (SPOes item in s)
            {
                chart1.Series["OxygenSaturation"].Points.AddXY(item.Date, item.Value);
                ListViewItem val = new ListViewItem(Convert.ToString("Oxygen Saturation"), 0);
                val.SubItems.Add(Convert.ToString(item.Date));
                val.SubItems.Add(Convert.ToString(item.Value));

                listView2.Items.Add(val);
            }
        }