Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            nameN.Text = "";
            snsN.Text  = "";
            ageN.Text  = "";
            btdN.Text  = "";
            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)
                {
                    updateValues(snsNumber, da, dn);
                    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.listUserAlertsBPs(snsNumber, DateTime.Now.AddDays(-3), DateTime.Now);
                    var h = web.listUserAlertsHRs(snsNumber, DateTime.Now.AddDays(-3), DateTime.Now);
                    var s = web.listUserAlertsSPOes(snsNumber, DateTime.Now.AddDays(-3), DateTime.Now);
                }
            }
        }
Example #2
0
        private void updateValues(int sns, DateTime da, DateTime dn)
        {
            if (sns != 0)
            {
                listView1.Items.Clear();
                web = new ServiceHealthClient();
                var a = web.listAlertasUtente(sns, da, dn);
                var b = web.listUserAlertsBPs(sns, da, dn);
                var h = web.listUserAlertsHRs(sns, da, dn);
                var s = web.listUserAlertsSPOes(sns, da, dn);
                if (checkBox6.Checked == true)
                {
                    if (checkBox1.Checked)
                    {
                        foreach (Alertas item in a.Where(i => i.Alert == "BP"))
                        {
                            ListViewItem val = new ListViewItem((item.Tipo), 0);
                            val.SubItems.Add(item.Alert);
                            val.SubItems.Add(Convert.ToString(item.Date));


                            listView1.Items.Add(val);
                        }
                    }

                    if (checkBox2.Checked)
                    {
                        foreach (Alertas item in a.Where(i => i.Alert == "HR"))
                        {
                            ListViewItem val = new ListViewItem((item.Tipo), 0);
                            val.SubItems.Add(item.Alert);
                            val.SubItems.Add(Convert.ToString(item.Date));


                            listView1.Items.Add(val);
                        }
                    }

                    if (checkBox3.Checked)
                    {
                        foreach (Alertas item in a.Where(i => i.Alert == "SPO"))
                        {
                            ListViewItem val = new ListViewItem((item.Tipo), 0);
                            val.SubItems.Add(item.Alert);
                            val.SubItems.Add(Convert.ToString(item.Date));


                            listView1.Items.Add(val);
                        }
                    }
                }
                if (checkBox5.Checked == true)
                {
                    if (b.Any() && checkBox1.Checked == true)
                    {
                        List <BPs> bps = b.OrderBy(i => i.Date).ToList();
                        foreach (BPs item in bps)
                        {
                            if (item.Value2 < 60)
                            {
                                ListViewItem val = new ListViewItem("CriticalEvent! Limit Value", 0);
                                val.SubItems.Add("BP");
                                val.SubItems.Add(Convert.ToString(item.Date));

                                listView1.Items.Add(val);
                            }
                        }
                    }
                    if (h.Any() && checkBox2.Checked == true)
                    {
                        List <HRs> hrs = h.OrderBy(i => i.Date).ToList();
                        foreach (HRs item in hrs)
                        {
                            if (item.Value < 30 || item.Value > 180)
                            {
                                ListViewItem val = new ListViewItem("CriticalEvent! Limit Value", 0);
                                val.SubItems.Add("HR");
                                val.SubItems.Add(Convert.ToString(item.Date));

                                listView1.Items.Add(val);
                            }
                        }
                    }
                    if (s.Any() && checkBox3.Checked == true)
                    {
                        List <SPOes> sps = s.OrderBy(i => i.Date).ToList();
                        foreach (SPOes item in sps)
                        {
                            if (item.Value < 80)
                            {
                                ListViewItem val = new ListViewItem("CriticalEvent! Limit Value", 0);
                                val.SubItems.Add("SPO");
                                val.SubItems.Add(Convert.ToString(item.Date));

                                listView1.Items.Add(val);
                            }
                        }
                    }
                }


                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);
            }
        }