/// <summary> /// Criar validação para o formulario de registo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { ServiceRefHealth.ServiceHealthClient web = new ServiceHealthClient(); Patient p = new ServiceRefHealth.Patient(); try { p.FirstName = textBox1.Text; p.LastName = textBox2.Text; p.SNS = Int32.Parse(textBox3.Text); p.Birthdate = DateTime.Parse(dateTimePicker1.Text); } catch (Exception ex) { MessageBox.Show("Exception Message: " + ex.Message); } bool result = web.AddPatient(p); if (result == true) { MessageBox.Show("Registado com sucesso!"); Close(); } else { MessageBox.Show("Erro no registo!"); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); } }
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); } } }
public Alter(int snsNumber) { InitializeComponent(); checkBox1.Visible = false; web = new ServiceHealthClient(); p = web.ValidatePatient(snsNumber); if (snsNumber != 0) { p = web.ValidatePatient(snsNumber); MessageBox.Show("Selected the user: " + p.FirstName); textBox2.Visible = true; textBox3.Visible = true; textBox6.Visible = true; dateTimePicker1.Visible = true; checkBox1.Visible = true; button2.Visible = true; label2.Visible = true; label3.Visible = true; label4.Visible = true; label5.Visible = true; label6.Visible = true; textBox2.Text = p.FirstName; textBox3.Text = p.LastName; textBox6.Text = Convert.ToString(p.SNS); oldSNS = p.SNS; dateTimePicker1.Value = p.Birthdate; checkBox1.Checked = p.Activo; } }
private void buttonValidate_Click(object sender, EventArgs e) { if (!int.TryParse(sns.Text, out parsedValue)) { MessageBox.Show("Please insert a valid SNS number!"); return; } else { richTextBox2.Clear(); //validate junto do web service se o utente existe //se existir mostrar mensagem de boas vindas int snsNumber = int.Parse(sns.Text); System.Console.WriteLine(snsNumber); web = new ServiceHealthClient(); p = web.ValidatePatient(snsNumber); if (p != null) { MessageBox.Show("Bem vindo Sr.(a)" + p.FirstName); groupBox1.Visible = true; //gravar ultimo sns inserido que acedeu a aplicação com sucesso Properties.Settings.Default.snsH = snsNumber; Properties.Settings.Default.Save(); string dataU = "Name: " + p.FirstName + "." + Environment.NewLine + "Surname: " + p.LastName + "." + Environment.NewLine + "SNS: " + p.SNS + "." + Environment.NewLine + "Birthdate: " + p.Birthdate.Day + "/" + p.Birthdate.Month + "/" + p.Birthdate.Year + "." + Environment.NewLine + "Age: " + p.Age; richTextBox2.AppendText(dataU); button1.Enabled = true; button2.Enabled = true; button3.Visible = true; // se o utente fez login, então é um utente ativo na aplicação p.Activo = true; web.ActivatePatient(p); } else { MessageBox.Show("SNS Number doesn't exist! "); button1.Enabled = false; } } }
public ViewAlerts() { InitializeComponent(); ServiceHealthClient web = new ServiceHealthClient(); var b = web.listPatientWithAlertsBP(); var h = web.listPatientWithAlertsHR(); var s = web.listPatientWithAlertsSPO(); // juntar as 3 listas de valores com alertas // z = BloodPressure // y = HeartRate // z = Oxygen Saturations var listas = b.ZipDeTres(h, s, (w, y, z) => new { w, y, z }); // metodo implementado na class ExtendMethod.cs List <int> lastSNS = new List <int>(); foreach (var wyz in listas.Where(i => i.w.Date >= da || i.y.Date >= da || i.z.Date >= da).OrderBy(t => t.w.SNS).ThenBy(t => t.z.SNS).ThenBy(t => t.y.SNS)) { if (!lastSNS.Contains(wyz.w.SNS)) { ListViewItem bp = new ListViewItem(Convert.ToString(wyz.w.SNS), 0); bp.SubItems.Add(wyz.w.FirstName + " " + wyz.w.LastName); bp.SubItems.Add(Convert.ToString(wyz.w.Age)); listView1.Items.Add(bp); lastSNS.Add(wyz.w.SNS); } if (!lastSNS.Contains(wyz.y.SNS)) { ListViewItem bp = new ListViewItem(Convert.ToString(wyz.y.SNS), 0); bp.SubItems.Add(wyz.y.FirstName + " " + wyz.y.LastName); listView1.Items.Add(bp); bp.SubItems.Add(Convert.ToString(wyz.y.Age)); lastSNS.Add(wyz.y.SNS); } if (!lastSNS.Contains(wyz.z.SNS)) { ListViewItem bp = new ListViewItem(Convert.ToString(wyz.z.SNS), 0); bp.SubItems.Add(wyz.z.FirstName + " " + wyz.z.LastName); bp.SubItems.Add(Convert.ToString(wyz.z.Age)); listView1.Items.Add(bp); lastSNS.Add(wyz.z.SNS); } } }
public UserStatistics(int sns) { web = new ServiceHealthClient(); snsNumber = sns; if (snsNumber != 0) { p = web.ValidatePatient(sns); } InitializeComponent(); groupBox1.Visible = false; groupBox2.Visible = false; groupBox3.Visible = false; groupBox4.Visible = false; groupBox5.Visible = false; }
private void button1_Click(object sender, EventArgs e) { //inicio do ciclo de validação if (!int.TryParse(textBox1.Text, out parsedValue)) { MessageBox.Show("Please insert a valid SNS number!"); return; } else { int snsNumber = int.Parse(textBox1.Text); web = new ServiceHealthClient(); p = web.ValidatePatient(snsNumber); if (p != null) { MessageBox.Show("Selected the user " + p.FirstName); textBox2.Visible = true; textBox3.Visible = true; textBox6.Visible = true; dateTimePicker1.Visible = true; checkBox1.Visible = true; button2.Visible = true; label2.Visible = true; label3.Visible = true; label4.Visible = true; label5.Visible = true; label6.Visible = true; textBox2.Text = p.FirstName; textBox3.Text = p.LastName; textBox6.Text = Convert.ToString(p.SNS); oldSNS = p.SNS; dateTimePicker1.Value = p.Birthdate; checkBox1.Checked = p.Activo; } else { MessageBox.Show("Numero de SNS invalido!"); } } }
public ViewUser() { InitializeComponent(); ServiceHealthClient web = new ServiceHealthClient(); var p = web.listPatient(); foreach (Patient item in p) { ListViewItem ut = new ListViewItem(Convert.ToString(item.SNS), 0); ut.SubItems.Add(item.FirstName + " " + item.LastName); ut.SubItems.Add(Convert.ToString(item.Age)); ut.SubItems.Add(Convert.ToString(item.Birthdate)); ut.SubItems.Add(Convert.ToString(item.Activo)); listView1.Items.Add(ut); } }
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); } } }
public Events(int sns) { snsNumber = sns; InitializeComponent(); dateTimePicker1.CustomFormat = "dd-MMM-yyyy hh:mm:ss"; dateTimePicker2.CustomFormat = "dd-MMM-yyyy hh:mm:ss"; dateTimePicker1.Value = da; dateTimePicker2.Value = dn; checkBox1.Checked = true; checkBox2.Checked = true; checkBox3.Checked = true; web = new ServiceHealthClient(); checkBox5.Checked = true; checkBox6.Checked = true; if (sns != 0) { p = web.ValidatePatient(sns); updateValues(sns, da, dn); } }
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); } }
private void myProcessedMethod(string message) { var values = message.Split(';'); ServiceRefHealth.ServiceHealthClient web = new ServiceHealthClient(); BPs b = new ServiceRefHealth.BPs(); SPOes s = new ServiceRefHealth.SPOes(); HRs h = new ServiceRefHealth.HRs(); Alertas a = new ServiceRefHealth.Alertas(); //comunicar entre threads this.BeginInvoke(new MethodInvoker(delegate { if (values[0].Equals("BP")) { var valuesBP = values[1].Split('-'); label3.Text = values[1]; b.Value1 = Convert.ToInt32(valuesBP[0]); b.Value2 = Convert.ToInt32(valuesBP[1]); b.Date = Convert.ToDateTime(values[2]); b.SNS = Properties.Settings.Default.snsH; label6.Text = values[2]; //alertas para hiper e hipotensão if (b.Value1 > 180 || b.Value1 < 100 || b.Value2 < 60) { b.Alert = true; label3.ForeColor = System.Drawing.Color.Red; sSynth.Speak("Blood Pressure Alert!"); // fora da gama normal e dos limites criticos if (b.Value2 >= 30 && b.Value2 < 60 || b.Value1 > 180) { if (stopwatchBW.IsRunning) { if (stopwatchBW.ElapsedMilliseconds > 600000) { a.Date = Convert.ToDateTime(values[2]); a.SNS = Properties.Settings.Default.snsH; a.Bp = b; a.Alert = "BP"; a.Tipo = "WarningContinuous"; web.AddAlerts(a); stopwatchBW.Restart(); } } else { stopwatchBW.Start(); } if (stopwatchBC.IsRunning) { if (stopwatchBC.ElapsedMilliseconds > 3600000) { a.Date = Convert.ToDateTime(values[2]); a.SNS = Properties.Settings.Default.snsH; a.Bp = b; a.Alert = "BP"; a.Tipo = "CriticalContinous"; web.AddAlerts(a); stopwatchBC.Restart(); } } else { stopwatchBC.Start(); } if (stopwatchBW2.IsRunning) { if (stopwatchBW2.ElapsedMilliseconds > 1800000 && NB >= 600000) { a.Date = Convert.ToDateTime(values[2]); a.SNS = Properties.Settings.Default.snsH; a.Bp = b; a.Alert = "BP"; a.Tipo = "WarningIntermitente"; web.AddAlerts(a); stopwatchBW2.Restart(); NB = 0; } if (stopwatchBW2.ElapsedMilliseconds > 1800000 && NB < 600000) { NB = 0; stopwatchBW2.Restart(); } else { NB += MyHealth.Properties.Settings.Default.ndelay * 3; } } else { stopwatchBW2.Start(); NB += MyHealth.Properties.Settings.Default.ndelay * 3; } } } else { b.Alert = false; label3.ForeColor = System.Drawing.Color.Green; } web.AddValuesBP(b); } if (values[0].Equals("SPO2")) { label4.Text = values[1]; s.Value = Convert.ToInt32(values[1]); s.Date = Convert.ToDateTime(values[2]);// + "-" + values[3] + "-" + values[4]); s.SNS = Properties.Settings.Default.snsH; label7.Text = values[2]; if (s.Value < 90) { s.Alert = true; label4.ForeColor = System.Drawing.Color.Red; sSynth.Speak("Oxygen Saturation Alert!"); if (s.Value > 80 && s.Value < 90) { if (stopwatchSW.IsRunning) { if (stopwatchSW.ElapsedMilliseconds > 600000) { a.Date = Convert.ToDateTime(values[2]); a.SNS = Properties.Settings.Default.snsH; a.Spoe = s; a.Alert = "SPO"; a.Tipo = "WarningContinuous"; web.AddAlerts(a); stopwatchSW.Restart(); } } else { stopwatchSW.Start(); } if (stopwatchSC.IsRunning) { if (stopwatchSC.ElapsedMilliseconds > 3600000) { a.Date = Convert.ToDateTime(values[2]); a.SNS = Properties.Settings.Default.snsH; a.Spoe = s; a.Alert = "SPO"; a.Tipo = "CriticalContinous"; web.AddAlerts(a); stopwatchSC.Restart(); } } else { stopwatchSC.Start(); } if (stopwatchSW2.IsRunning) { if (stopwatchSW2.ElapsedMilliseconds > 1800000 && NS >= 600000) { a.Date = Convert.ToDateTime(values[2]); a.SNS = Properties.Settings.Default.snsH; a.Spoe = s; a.Alert = "SPO"; a.Tipo = "WarningIntermitente"; web.AddAlerts(a); stopwatchSW2.Restart(); NS = 0; } if (stopwatchSW2.ElapsedMilliseconds > 1800000 && NS < 600000) { NS = 0; stopwatchSW2.Restart(); } else { NS += MyHealth.Properties.Settings.Default.ndelay * 3; } } else { stopwatchSW2.Start(); NS += MyHealth.Properties.Settings.Default.ndelay * 3; } } } else { s.Alert = false; label4.ForeColor = System.Drawing.Color.Green; } web.AddValuesSPO(s); } if (values[0].Equals("HR")) { label5.Text = values[1]; h.Value = Convert.ToInt32(values[1]); h.Date = Convert.ToDateTime(values[2]);// + "-" + values[3] + "-" + values[4]); h.SNS = Properties.Settings.Default.snsH; label8.Text = values[2]; if (h.Value < 60 || h.Value > 120) { h.Alert = true; label5.ForeColor = System.Drawing.Color.Red; sSynth.Speak("Heart Rate Alert!"); if (h.Value < 60 && h.Value >= 30 || h.Value > 120 && h.Value <= 180) { if (stopwatchHW.IsRunning) { if (stopwatchHW.ElapsedMilliseconds > 600000) { a.Date = Convert.ToDateTime(values[2]); a.SNS = Properties.Settings.Default.snsH; a.Hr = h; a.Alert = "HR"; a.Tipo = "WarningContinuous"; web.AddAlerts(a); stopwatchHW.Restart(); } } else { stopwatchHW.Start(); } if (stopwatchHC.IsRunning) { if (stopwatchHC.ElapsedMilliseconds > 3600000) { a.Date = Convert.ToDateTime(values[2]); a.SNS = Properties.Settings.Default.snsH; a.Hr = h; a.Alert = "HR"; a.Tipo = "CriticalContinous"; web.AddAlerts(a); stopwatchHC.Restart(); } } else { stopwatchHC.Start(); } if (stopwatchHW2.IsRunning) { if (stopwatchHW2.ElapsedMilliseconds > 1800000 && NH >= 600000) { a.Date = Convert.ToDateTime(values[2]); a.SNS = Properties.Settings.Default.snsH; a.Hr = h; a.Alert = "HR"; a.Tipo = "WarningIntermitente"; web.AddAlerts(a); stopwatchSW2.Restart(); NH = 0; } if (stopwatchHW2.ElapsedMilliseconds > 1800000 && NH < 600000) { NH = 0; stopwatchHW2.Restart(); } else { NH += MyHealth.Properties.Settings.Default.ndelay * 3; } } else { stopwatchHW2.Start(); NH += MyHealth.Properties.Settings.Default.ndelay * 3; } } } else { h.Alert = false; label5.ForeColor = System.Drawing.Color.Green; } web.AddValuesHR(h); } } )); }