示例#1
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);
            }
        }