public void displayData(string[] patientData) { DbConnector dbConn = new DbConnector(); dbConn.connect(); Patient ptient = new Patient(); ptient.Wing = patientData[0]; ptient.Floor = patientData[1]; ptient.Bay = patientData[2]; ptient.Bed = patientData[3]; label15.Text = patientData[0]; label16.Text = patientData[1]; label17.Text = patientData[2]; label18.Text = patientData[3]; PatientHandler patHnd = new PatientHandler(); string checkId = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientId"); string checkName = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientName"); string checkAge = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientAge"); string checkGender = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientGender"); label11.Text = checkId; label12.Text = checkName; label13.Text = checkAge; label14.Text = checkGender; latestValues(); }
private void button10_Click(object sender, EventArgs e) { if (label41.ForeColor == Color.Green && (comboBox7.SelectedItem).ToString() != "- SELECT -" && (comboBox8.SelectedItem).ToString() != "- SELECT -") { DbConnector dbConn = new DbConnector(); dbConn.connect(); OnShift oShift = new OnShift(); OnShiftHandler oShiftHnd = new OnShiftHandler(); oShift.StaffId = textBox21.Text; oShift.DateOnShift = (comboBox7.SelectedItem).ToString(); oShift.TimeOnShift = (comboBox8.SelectedItem).ToString(); oShift.DateAndTimeDeregistered = DateTime.Now.ToString(); bool deregistered = oShiftHnd.deregisterShift(dbConn.getConn(), oShift); if (deregistered == true) { MessageBox.Show("Shift date and time deregistered successfully !"); textBox21_TextChanged(null, e); dateTimePicker1_ValueChanged(null, e); } else { MessageBox.Show("Failed to register shift date and time..."); } } else { MessageBox.Show("Please insert valid information."); } }
private void comboBox4_SelectedIndexChanged(object sender, EventArgs e) { if ((comboBox4.SelectedItem).ToString() != "- SELECT -") { comboBox5.Enabled = true; DbConnector dbConn = new DbConnector(); dbConn.connect(); BedSide bed = new BedSide(); bed.Wing = (comboBox2.SelectedItem).ToString(); bed.Floor = (comboBox3.SelectedItem).ToString(); bed.Bay = (comboBox4.SelectedItem).ToString(); BedSideHandler bedHnd = new BedSideHandler(); comboBox5.DataSource = bedHnd.showBed(dbConn.getConn(), bed); } else { comboBox5.Enabled = false; comboBox5.SelectedIndex = 0; } }
private void textBox20_TextChanged(object sender, EventArgs e) { if (textBox20.Text == "") { label36.Text = "Validate Medical Staff ID"; label36.ForeColor = Color.Black; label36.Visible = false; } else { DbConnector dbConn = new DbConnector(); dbConn.connect(); MedicalStaffHandler mStaffHnd = new MedicalStaffHandler(); bool goCheckStaffId = mStaffHnd.checkStaffId(dbConn.getConn(), textBox20.Text); if (goCheckStaffId == true) { label36.Text = "Valid Staff ID"; label36.ForeColor = Color.Green; label36.Visible = true; dateTimePicker1_ValueChanged(null, e); } else if (goCheckStaffId == false) { label36.Text = "Invalid Staff ID"; label36.ForeColor = Color.Red; label36.Visible = true; } } }
private void textBox21_TextChanged(object sender, EventArgs e) { if (textBox21.Text == "") { label41.Text = "Validate Medical Staff ID"; label41.ForeColor = Color.Black; label41.Visible = false; comboBox7.Enabled = false; comboBox8.Enabled = false; } else { DbConnector dbConn = new DbConnector(); dbConn.connect(); MedicalStaffHandler mStaffHnd = new MedicalStaffHandler(); bool goCheckStaffId = mStaffHnd.checkStaffId(dbConn.getConn(), textBox21.Text); if (goCheckStaffId == true) { label41.Text = "Valid Staff ID"; label41.ForeColor = Color.Green; label41.Visible = true; comboBox7.Enabled = true; OnShift oShift = new OnShift(); OnShiftHandler oShiftHnd = new OnShiftHandler(); oShift.StaffId = textBox21.Text; comboBox7.DataSource = oShiftHnd.showDate(dbConn.getConn(), oShift); } else if (goCheckStaffId == false) { label41.Text = "Invalid Staff ID"; label41.ForeColor = Color.Red; label41.Visible = true; comboBox7.Enabled = false; comboBox8.Enabled = false; comboBox7.SelectedIndex = 0; comboBox8.SelectedIndex = 0; } } }
public void getBasicPatientDetails() { if ((comboBox1.SelectedItem).ToString() != " - SELECT WING - " && (comboBox2.SelectedItem).ToString() != " - SELECT FLOOR - " && (comboBox3.SelectedItem).ToString() != " - SELECT BAY - " && (comboBox4.SelectedItem).ToString() != " - SELECT BED - ") { DbConnector dbConn = new DbConnector(); dbConn.connect(); Patient ptient = new Patient(); ptient.Wing = (comboBox1.SelectedItem).ToString(); ptient.Floor = (comboBox2.SelectedItem).ToString(); ptient.Bay = (comboBox3.SelectedItem).ToString(); ptient.Bed = (comboBox4.SelectedItem).ToString(); PatientHandler patHnd = new PatientHandler(); string checkId = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientId"); string checkName = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientName"); string checkAge = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientAge"); string checkGender = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientGender"); label1.Text = checkId; label2.Text = checkName; label3.Text = checkAge; label4.Text = checkGender; label34.Text = (comboBox1.SelectedItem).ToString() + " → " + (comboBox2.SelectedItem).ToString() + " → " + (comboBox3.SelectedItem).ToString(); label36.Text = (comboBox4.SelectedItem).ToString().Remove(0, 4); } else { label1.Text = "No record found"; label2.Text = "No record found"; label3.Text = "No record found"; label4.Text = "No record found"; label34.Text = "- Wing → Floor - → Bay - "; label36.Text = "-"; } }
private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { CheckBox[] checkedList = new CheckBox[24] { checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6, checkBox12, checkBox11, checkBox10, checkBox9, checkBox8, checkBox7, checkBox24, checkBox23, checkBox22, checkBox21, checkBox20, checkBox19, checkBox18, checkBox17, checkBox16, checkBox15, checkBox14, checkBox13 }; if (textBox20.Text != "" && label36.ForeColor == Color.Green) { DbConnector dbConn = new DbConnector(); dbConn.connect(); OnShift oShift = new OnShift(); OnShiftHandler oShiftHnd = new OnShiftHandler(); for (int x = 0; x < checkedList.Count(); x++) { oShift.StaffId = textBox20.Text; oShift.DateOnShift = (dateTimePicker1.Value).ToString("dd/MM/yyyy"); oShift.TimeOnShift = checkedList[x].Text; bool registered = oShiftHnd.checkShift(dbConn.getConn(), oShift); if (registered == true) { checkedList[x].Checked = true; checkedList[x].Enabled = false; } else { checkedList[x].Checked = false; checkedList[x].Enabled = true; } } } else { for (int x = 0; x < checkedList.Count(); x++) { checkedList[x].Checked = false; checkedList[x].Enabled = false; } } }
public void patientDBtable(int num) { DbConnector dbConn = new DbConnector(); dbConn.connect(); Patient ptient = new Patient(); PatientHandler patientHnd = new PatientHandler(); if (num == 1) { ptient.Name = textBox13.Text; } else if (num == 2) { ptient.Wing = "%"; ptient.Floor = "%"; ptient.Bay = "%"; ptient.Bed = "%"; } dataGridView1.DataSource = patientHnd.listPatient(dbConn.getConn(), ptient, num); dataGridView1.Columns[0].HeaderText = "ID"; dataGridView1.Columns[1].HeaderText = "NAME"; dataGridView1.Columns[2].HeaderText = "AGE"; dataGridView1.Columns[3].HeaderText = "GENDER"; dataGridView1.Columns[4].HeaderText = "BEDSIDE ID"; dataGridView1.Columns[5].HeaderText = "WING"; dataGridView1.Columns[6].HeaderText = "FLOOR"; dataGridView1.Columns[7].HeaderText = "BAY"; dataGridView1.Columns[8].HeaderText = "BED"; dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; }
public void medicalStaffDBtable(int num) { DbConnector dbConn = new DbConnector(); dbConn.connect(); MedicalStaff mStaff = new MedicalStaff(); MedicalStaffHandler mStaffHnd = new MedicalStaffHandler(); if (num == 1) { mStaff.Name = textBox13.Text; } else if (num == 2) { mStaff.Career = "%"; } dataGridView2.DataSource = mStaffHnd.listStaff(dbConn.getConn(), mStaff, num); dataGridView2.Columns[0].HeaderText = "ID"; dataGridView2.Columns[1].HeaderText = "STAFF ID"; dataGridView2.Columns[2].HeaderText = "NAME"; dataGridView2.Columns[3].HeaderText = "PASSWORD"; dataGridView2.Columns[4].HeaderText = "CAREER TYPE"; dataGridView2.Columns[5].HeaderText = "EMAIL"; dataGridView2.Columns[6].HeaderText = "CONTACT NUMBER"; dataGridView2.Columns[7].HeaderText = "PAGER NUMBER"; dataGridView2.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView2.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView2.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView2.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView2.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView2.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView2.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView2.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView2.Columns[6].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView2.Columns[7].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; }
private void comboBox7_SelectedIndexChanged(object sender, EventArgs e) { if ((comboBox7.SelectedItem).ToString() != "- SELECT -") { comboBox8.Enabled = true; DbConnector dbConn = new DbConnector(); dbConn.connect(); OnShift oShift = new OnShift(); OnShiftHandler oShiftHnd = new OnShiftHandler(); oShift.StaffId = textBox21.Text; oShift.DateOnShift = (comboBox7.SelectedItem).ToString(); comboBox8.DataSource = oShiftHnd.showTime(dbConn.getConn(), oShift); } else { comboBox8.Enabled = false; comboBox8.SelectedIndex = 0; } }
//Onclick "Login" button verify username & password and navigate to Bedside System Page private void button1_Click(object sender, EventArgs e) { DbConnector dbConn = new DbConnector(); dbConn.connect(); MedicalStaff mStaff = new MedicalStaff(); MedicalStaffHandler mStaffHnd = new MedicalStaffHandler(); mStaff.Staffid = textBox1.Text; mStaff.Password = textBox2.Text; if ((mStaffHnd.checkMedicalStaffLoginDetail(dbConn.getConn(), mStaff)) == true) { Central_Station central_station = new Central_Station(); central_station.Show(); //this.Close(); } else { MessageBox.Show("Invalid Username or Password."); } }
//Start or Halt button for module readings monitor public void button2_Click(object sender, EventArgs e) { if (button2.Text == "Halt") { DialogResult result = MessageBox.Show("Are you sure to terminate the module readings ?", "Alert !", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (result == DialogResult.Yes) { haltMonitor(); if (label1.Text != "No Record Found") { MessageBox.Show("Closed running process"); DbConnector dbConn = new DbConnector(); dbConn.connect(); PatientReadings pRead = new PatientReadings(); PatientReadingsHandler pReadHnd = new PatientReadingsHandler(); pRead.PatientId = Int32.Parse((label1.Text).ToString()); pRead.PulseRate = 999; pRead.BreathingRate = 999; pRead.Systolic = 999; pRead.Diastolic = 999; pRead.Temperature = 999; pRead.DateTime = DateTime.Now.ToString(); pReadHnd.addPatientReading(dbConn.getConn(), pRead); } } } else if (button2.Text == "Start") { startMonitor(); } }
public void pictureBox1_Click(object sender, EventArgs e) { string wingSelected = (comboBox1.SelectedItem).ToString(); string floorSelected = (comboBox2.SelectedItem).ToString(); string baySelected = (comboBox3.SelectedItem).ToString(); string bedSelected = (comboBox4.SelectedItem).ToString(); DbConnector dbConn = new DbConnector(); dbConn.connect(); Patient ptient = new Patient(); ptient.Wing = wingSelected; ptient.Floor = floorSelected; ptient.Bay = baySelected; ptient.Bed = bedSelected; PatientHandler patHnd = new PatientHandler(); string checkId = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientId"); if (checkId != "No record found") { string[] patientData = new string[4] { wingSelected, floorSelected, baySelected, bedSelected }; PatientModuleReadingsConfiguration passPatientData = new PatientModuleReadingsConfiguration(); passPatientData.Show(); passPatientData.displayData(patientData); } else { MessageBox.Show("No patient found !"); } }
//Stop beep sound and monitor while closing public void Bedside_System_FormClosed(object sender, FormClosedEventArgs e) { run_Monitor.Stop(); player.Stop(); if (button2.Text == "Halt" && label1.Text != "No Record Found") { DbConnector dbConn = new DbConnector(); dbConn.connect(); PatientReadings pRead = new PatientReadings(); PatientReadingsHandler pReadHnd = new PatientReadingsHandler(); pRead.PatientId = Int32.Parse((label1.Text).ToString()); pRead.PulseRate = 999; pRead.BreathingRate = 999; pRead.Systolic = 999; pRead.Diastolic = 999; pRead.Temperature = 999; pRead.DateTime = DateTime.Now.ToString(); pReadHnd.addPatientReading(dbConn.getConn(), pRead); } }
private void textBox22_TextChanged(object sender, EventArgs e) { if (textBox22.Text != "") { if (Int32.TryParse(textBox22.Text, out int theId) && Int32.Parse(textBox22.Text) >= 0) { DbConnector dbConn = new DbConnector(); dbConn.connect(); PatientHandler patHnd = new PatientHandler(); label51.Text = patHnd.getPatientDetailsById(dbConn.getConn(), Int32.Parse(textBox22.Text), "patientName"); label52.Text = patHnd.getPatientDetailsById(dbConn.getConn(), Int32.Parse(textBox22.Text), "patientAge"); label53.Text = patHnd.getPatientDetailsById(dbConn.getConn(), Int32.Parse(textBox22.Text), "patientGender"); if (label51.Text == "No record found") { label47.Text = "Invalid Patient ID"; label47.ForeColor = Color.Red; label47.Visible = true; button11.Enabled = false; button12.Enabled = false; button13.Enabled = false; button14.Enabled = false; } else { label47.Text = "Valid Patient ID"; label47.ForeColor = Color.Green; label47.Visible = true; button11.Enabled = true; button12.Enabled = true; button13.Enabled = true; button14.Enabled = true; } } else { label47.Text = "Invalid Patient ID"; label47.ForeColor = Color.Red; label47.Visible = true; button11.Enabled = false; button12.Enabled = false; button13.Enabled = false; button14.Enabled = false; } } else { label51.Text = "No record found"; label52.Text = "No record found"; label53.Text = "No record found"; button11.Enabled = false; button12.Enabled = false; button13.Enabled = false; button14.Enabled = false; label47.Text = "Validate Medical Staff ID"; label47.ForeColor = Color.Black; label47.Visible = false; } }
//Display realtime data of different modules in line graph format public void displayGraph(string module, bool reset, string condition) { DbConnector dbConn = new DbConnector(); dbConn.connect(); PatientReadingsHandler pReadingsHnd = new PatientReadingsHandler(); ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); int maxReading = 0; float maxReadingT = 0; int counter = 0; //Set default value to variables var chart = chart1.ChartAreas[0]; var chartChosen = chart1; var chartColor = Color.Silver; double xMin = 0.0; double xMax = 10.0; double yMin = 0.0; double yMax = 20.0; double xInt = 5; double yInt = 5; switch (module) { case "Pulse Rate": chart = chart1.ChartAreas[0]; chartChosen = chart1; if ((label1.Text).ToString() != "No record found") { maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", (label1.Text).ToString())); } break; case "Breathing Rate": chart = chart2.ChartAreas[0]; chartChosen = chart2; if ((label1.Text).ToString() != "No record found") { maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMax", (label1.Text).ToString())); } break; case "Blood Pressure": chart = chart3.ChartAreas[0]; chartChosen = chart3; if ((label1.Text).ToString() != "No record found") { maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMax", (label1.Text).ToString())); } break; case "Temperature": chart = chart4.ChartAreas[0]; chartChosen = chart4; if ((label1.Text).ToString() != "No record found") { maxReadingT = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMax", (label1.Text).ToString())); } break; } if (condition == "Init") { chartColor = Color.Silver; } else if (condition == "Normal") { chartColor = Color.FromArgb(8, 255, 86); } else if (condition == "Risky") { chartColor = Color.FromArgb(255, 214, 8); } else if (condition == "Critical") { chartColor = Color.FromArgb(255, 8, 8); } if (reset == false) { chart.AxisX.IntervalType = DateTimeIntervalType.Number; chart.AxisX.LabelStyle.Format = ""; chart.AxisY.LabelStyle.Format = ""; chart.AxisY.LabelStyle.IsEndLabelVisible = true; chart.AxisX.Minimum = xMin; chart.AxisX.Maximum = xMax; chart.AxisY.Minimum = yMin; chart.AxisY.Maximum = yMax; chart.AxisX.Interval = xInt; chart.AxisY.Interval = yInt; chartChosen.Series.Add(module); chartChosen.Series[module].ChartType = SeriesChartType.Line; chartChosen.Series[module].BorderWidth = 3; chartChosen.Series[module].Color = chartColor; chartChosen.Series[module].Points.AddXY(1, 10); chartChosen.Series[module].Points.AddXY(10, 10); } else if (reset == true && condition == "Init") { while (chartChosen.Series.Count > 0) { chartChosen.Series.RemoveAt(0); } } else if (reset == true && condition != "Init") { while (chartChosen.Series.Count > 0) { chartChosen.Series.RemoveAt(0); } chart.AxisX.IntervalType = DateTimeIntervalType.Number; chart.AxisX.LabelStyle.Format = ""; chart.AxisY.LabelStyle.Format = ""; chart.AxisY.LabelStyle.IsEndLabelVisible = true; if (module == "Temperature") { //Minimum Value chart.AxisX.Minimum = 0; chart.AxisY.Minimum = 0; //Maximum Value chart.AxisX.Maximum = double.NaN; chart.AxisY.Maximum = maxReadingT + 20; } else { //Minimum Value chart.AxisX.Minimum = 0; chart.AxisY.Minimum = 0; //Maximum Value chart.AxisX.Maximum = double.NaN; chart.AxisY.Maximum = maxReading + 20; } chart.AxisX.Interval = 1; chart.AxisY.Interval = 1; chart.AxisX.IsMarginVisible = false; chartChosen.Series.Add(module); chartChosen.Series[module].ChartType = SeriesChartType.Line; chartChosen.Series[module].BorderWidth = 3; chartChosen.Series[module].Color = chartColor; for (int x = 0; x < realCounter; x++) { chartChosen.Series[module].Points.AddXY(x, readingsList[x]); chartChosen.Series[module].Points.AddXY(x + 0.5, 0); if (x > 10) { zoomPosition = realCounter - 10; chart.AxisX.ScaleView.Zoom(zoomPosition, realCounter); } else { chart.AxisX.ScaleView.Zoom(1, 11); } } } }
public void runMonitor(object sender, EventArgs e) { var pulseRate = checkBox1.Checked; var breathingRate = checkBox2.Checked; var bloodPressure = checkBox3.Checked; var temperature = checkBox4.Checked; var criticalColor = Color.FromArgb(255, 8, 8); var inRiskColor = Color.FromArgb(255, 214, 8); var normalColor = Color.FromArgb(8, 255, 86); line = sr.ReadLine(); if (line == null) { sr = new StreamReader("CSV/ModuleReadingsA.csv"); line = sr.ReadLine(); } DbConnector dbConn = new DbConnector(); dbConn.connect(); Patient ptient = new Patient(); PatientHandler patHnd = new PatientHandler(); ptient.Wing = (comboBox1.SelectedItem).ToString(); ptient.Floor = (comboBox2.SelectedItem).ToString(); ptient.Bay = (comboBox3.SelectedItem).ToString(); ptient.Bed = (comboBox4.SelectedItem).ToString(); string getPatientId = patHnd.getPatientDetails(dbConn.getConn(), ptient, "patientId"); int minPulse = 60; int maxPulse = 100; int minBreath = 12; int maxBreath = 20; int minSystolic = 80; int maxSystolic = 120; int minDiastolic = 60; int maxDiastolic = 80; float minTemp = 35.2F; float maxTemp = 36.1F; int pulseIntervalTime = 1; int breathIntervalTime = 1; int bloodPressureIntervalTime = 1; int temperatureIntervalTime = 1; if (getPatientId != "No record found") { ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); minPulse = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", getPatientId)); maxPulse = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", getPatientId)); pulseIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRIntTime", getPatientId)); minBreath = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMin", getPatientId)); maxBreath = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMax", getPatientId)); breathIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRIntTime", getPatientId)); minSystolic = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMin", getPatientId)); maxSystolic = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMax", getPatientId)); minDiastolic = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", getPatientId)); maxDiastolic = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", getPatientId)); bloodPressureIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "bloodPIntTime", getPatientId)); minTemp = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMin", getPatientId)); maxTemp = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMax", getPatientId)); temperatureIntervalTime = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempIntTime", getPatientId)); } PatientReadings pRead = new PatientReadings(); PatientReadingsHandler pReadHnd = new PatientReadingsHandler(); try { string[] data = line.Split(','); readingsList.Add(Int32.Parse(data[0])); //Pulse Rate Readings if (counter == pulseRateCounter && pulseRate != false) { label10.Text = data[0]; label14.Text = (maxPulse).ToString(); label15.Text = (minPulse).ToString(); if (Int32.Parse(data[0]) == 0) { labelBorder(10, "Critical"); label14.ForeColor = criticalColor; label15.ForeColor = criticalColor; } else if (Int32.Parse(data[0]) > maxPulse || Int32.Parse(data[0]) < minPulse) { labelBorder(10, "Risky"); if (Int32.Parse(data[0]) > maxPulse) { label14.ForeColor = inRiskColor; label15.ForeColor = normalColor; } else { label14.ForeColor = normalColor; label15.ForeColor = inRiskColor; } } else if (Int32.Parse(data[0]) >= minPulse && Int32.Parse(data[0]) <= maxPulse) { labelBorder(10, "Normal"); label14.ForeColor = normalColor; label15.ForeColor = normalColor; } pulseRateCounter = pulseRateCounter + pulseIntervalTime; } //Breathing Rate Readings if (counter == breathingRateCounter && breathingRate != false) { label11.Text = data[1]; label16.Text = (maxBreath).ToString(); label17.Text = (minBreath).ToString(); if (Int32.Parse(data[1]) == 0) { labelBorder(11, "Critical"); label16.ForeColor = criticalColor; label17.ForeColor = criticalColor; } else if ((Int32.Parse(data[1]) > maxBreath || Int32.Parse(data[1]) < minBreath)) { labelBorder(11, "Risky"); if (Int32.Parse(data[1]) > maxBreath) { label16.ForeColor = inRiskColor; label17.ForeColor = normalColor; } else { label16.ForeColor = normalColor; label17.ForeColor = inRiskColor; } } else if (Int32.Parse(data[1]) >= minBreath && Int32.Parse(data[1]) <= maxBreath) { labelBorder(11, "Normal"); label16.ForeColor = normalColor; label17.ForeColor = normalColor; } breathingRateCounter = breathingRateCounter + breathIntervalTime; } //Blood Pressure Readings if (counter == bloodPressureCounter && bloodPressure != false) { label12.Text = data[2] + "/" + data[3]; label18.Text = (maxSystolic).ToString(); label19.Text = (minSystolic).ToString(); label20.Text = (maxDiastolic).ToString(); label21.Text = (minDiastolic).ToString(); if (Int32.Parse(data[2]) == 0 || (Int32.Parse(data[3]) == 0)) { labelBorder(12, "Critical"); label18.ForeColor = criticalColor; label19.ForeColor = criticalColor; label20.ForeColor = criticalColor; label21.ForeColor = criticalColor; } else if ((Int32.Parse(data[2]) > maxSystolic || Int32.Parse(data[2]) < minSystolic) || (Int32.Parse(data[3]) > maxDiastolic || Int32.Parse(data[3]) < minDiastolic)) { labelBorder(12, "Risky"); if (Int32.Parse(data[2]) > maxSystolic) { label18.ForeColor = inRiskColor; label19.ForeColor = normalColor; } else if (Int32.Parse(data[2]) < minSystolic) { label18.ForeColor = normalColor; label19.ForeColor = inRiskColor; } if (Int32.Parse(data[3]) > maxDiastolic) { label20.ForeColor = inRiskColor; label21.ForeColor = normalColor; } else if (Int32.Parse(data[3]) < minDiastolic) { label20.ForeColor = normalColor; label21.ForeColor = inRiskColor; } } else if (Int32.Parse(data[2]) >= minSystolic && Int32.Parse(data[2]) <= maxSystolic && Int32.Parse(data[3]) >= minSystolic && Int32.Parse(data[3]) <= maxSystolic) { labelBorder(12, "Normal"); label18.ForeColor = normalColor; label19.ForeColor = normalColor; label20.ForeColor = normalColor; label21.ForeColor = normalColor; } bloodPressureCounter = bloodPressureCounter + bloodPressureIntervalTime; } //Temperature Readings if (counter == temperatureCounter && temperature != false) { label13.Text = data[4] + "°C"; label22.Text = (maxTemp).ToString(); label23.Text = (minTemp).ToString(); if (float.Parse(data[4]) == 0) { labelBorder(13, "Critical"); label22.ForeColor = criticalColor; label23.ForeColor = criticalColor; } else if (float.Parse(data[4]) > maxTemp || float.Parse(data[4]) < minTemp) { labelBorder(13, "Risky"); if (float.Parse(data[4]) > maxTemp) { label22.ForeColor = inRiskColor; label23.ForeColor = normalColor; } else { label22.ForeColor = normalColor; label23.ForeColor = inRiskColor; } } else if (float.Parse(data[4]) >= minTemp && float.Parse(data[4]) <= maxTemp) { labelBorder(13, "Normal"); label22.ForeColor = normalColor; label23.ForeColor = normalColor; } temperatureCounter = temperatureCounter + temperatureIntervalTime; } if (getPatientId != "No record found") { pRead.PatientId = Int32.Parse(getPatientId); pRead.PulseRate = Int32.Parse(data[0]); pRead.BreathingRate = Int32.Parse(data[1]); pRead.Systolic = Int32.Parse(data[2]); pRead.Diastolic = Int32.Parse(data[3]); pRead.Temperature = float.Parse(data[4]); pRead.DateTime = DateTime.Now.ToString(); pReadHnd.addPatientReading(dbConn.getConn(), pRead); } } catch (Exception ex) { Console.WriteLine("DID NOT RECEIVE ANY DETECTION OF THE READING : " + ex); run_Monitor.Stop(); } if (counter == 5) { counter = 0; pulseRateCounter = 0; bloodPressureCounter = 0; breathingRateCounter = 0; temperatureCounter = 0; } else { counter++; } realCounter++; }
private void button9_Click(object sender, EventArgs e) { CheckBox[] checkedList = new CheckBox[24] { checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6, checkBox12, checkBox11, checkBox10, checkBox9, checkBox8, checkBox7, checkBox24, checkBox23, checkBox22, checkBox21, checkBox20, checkBox19, checkBox18, checkBox17, checkBox16, checkBox15, checkBox14, checkBox13 }; bool isChecked = false; for (int x = 0; x < checkedList.Count(); x++) { if (checkedList[x].Checked == true) { isChecked = true; } } if (label36.ForeColor == Color.Green && isChecked == true) { DbConnector dbConn = new DbConnector(); dbConn.connect(); OnShift oShift = new OnShift(); OnShiftHandler oShiftHnd = new OnShiftHandler(); for (int x = 0; x < checkedList.Count(); x++) { if (checkedList[x].Checked == true && checkedList[x].Enabled == true) { oShift.StaffId = textBox20.Text; oShift.DateOnShift = (dateTimePicker1.Value).ToString("dd/MM/yyyy"); oShift.TimeOnShift = checkedList[x].Text; oShift.DateAndTimeRegistered = DateTime.Now.ToString(); oShift.DateAndTimeDeregistered = "-"; bool registered = oShiftHnd.registerShift(dbConn.getConn(), oShift); } } MessageBox.Show("Shift date and time registered successfully !"); for (int x = 0; x < checkedList.Count(); x++) { checkedList[x].Checked = false; } textBox21_TextChanged(null, e); dateTimePicker1_ValueChanged(null, e); } else { if (isChecked != true) { MessageBox.Show("Please select at least one time slot to continue."); } else { MessageBox.Show("Please insert valid staff's ID."); } } }
private void button1_Click(object sender, EventArgs e) { DbConnector dbConn = new DbConnector(); dbConn.connect(); string checkId = label11.Text; ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); if (textBox3.Text == mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", checkId) && textBox4.Text == mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", checkId) && textBox23.Text == mRHand.getModuleReading(dbConn.getConn(), "pulseRIntTime", checkId) && textBox6.Text == mRHand.getModuleReading(dbConn.getConn(), "breathRMin", checkId) && textBox5.Text == mRHand.getModuleReading(dbConn.getConn(), "breathRMax", checkId) && textBox24.Text == mRHand.getModuleReading(dbConn.getConn(), "breathRIntTime", checkId) && textBox8.Text == mRHand.getModuleReading(dbConn.getConn(), "systolicMin", checkId) && textBox7.Text == mRHand.getModuleReading(dbConn.getConn(), "systolicMax", checkId) && textBox9.Text == mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", checkId) && textBox10.Text == mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", checkId) && textBox25.Text == mRHand.getModuleReading(dbConn.getConn(), "bloodPIntTime", checkId) && textBox11.Text == mRHand.getModuleReading(dbConn.getConn(), "tempMin", checkId) && textBox12.Text == mRHand.getModuleReading(dbConn.getConn(), "tempMax", checkId) && textBox26.Text == mRHand.getModuleReading(dbConn.getConn(), "tempIntTime", checkId)) { MessageBox.Show("No changes detected"); } else { ModuleReadings mConfig = new ModuleReadings(); string thePatientId = checkId; mConfig.MinPulse = Int32.Parse(textBox3.Text); mConfig.MaxPulse = Int32.Parse(textBox4.Text); mConfig.MinBreath = Int32.Parse(textBox6.Text); mConfig.MaxBreath = Int32.Parse(textBox5.Text); mConfig.MinSystolic = Int32.Parse(textBox8.Text); mConfig.MaxSystolic = Int32.Parse(textBox7.Text); mConfig.MinDiastolic = Int32.Parse(textBox9.Text); mConfig.MaxDiastolic = Int32.Parse(textBox10.Text); mConfig.MinTemp = float.Parse(textBox11.Text); mConfig.MaxTemp = float.Parse(textBox12.Text); mConfig.PulseIntTime = Int32.Parse(textBox23.Text); mConfig.BreathIntTime = Int32.Parse(textBox24.Text); mConfig.PressureIntTime = Int32.Parse(textBox25.Text); mConfig.TempIntTime = Int32.Parse(textBox26.Text); mConfig.PRModifiedTime = DateTime.Now.ToString(); mConfig.BRModifiedTime = DateTime.Now.ToString(); mConfig.BPModifiedTime = DateTime.Now.ToString(); mConfig.TempModifiedTime = DateTime.Now.ToString(); mRHand.updatePatientBedsideId(dbConn.getConn(), mConfig, Int32.Parse(thePatientId), "New"); MessageBox.Show("Module Reading Changed Successfully !"); } }
//Add new patient button private void button5_Click(object sender, EventArgs e) { DbConnector dbConn = new DbConnector(); dbConn.connect(); Patient ptient = new Patient(); ModuleReadings mConfig = new ModuleReadings(); if (textBox1.Text != "" && textBox2.Text != "" && (comboBox1.SelectedItem).ToString() != "- SELECT -" && (comboBox2.SelectedItem).ToString() != "- SELECT -" && (comboBox3.SelectedItem).ToString() != "- SELECT -" && (comboBox4.SelectedItem).ToString() != "- SELECT -" && (comboBox5.SelectedItem).ToString() != "- SELECT -" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text != "" && textBox8.Text != "" && textBox9.Text != "" && textBox10.Text != "" && textBox11.Text != "" && textBox12.Text != "") { if (int.TryParse(textBox2.Text, out int theAge) && Int32.Parse(textBox2.Text) < 150) { ptient.Name = textBox1.Text; ptient.Age = Int32.Parse(textBox2.Text); ptient.Gender = (comboBox1.SelectedItem).ToString(); ptient.Wing = (comboBox2.SelectedItem).ToString(); ptient.Floor = (comboBox3.SelectedItem).ToString(); ptient.Bay = (comboBox4.SelectedItem).ToString(); ptient.Bed = (comboBox5.SelectedItem).ToString(); mConfig.MinPulse = Int32.Parse(textBox3.Text); mConfig.MaxPulse = Int32.Parse(textBox4.Text); mConfig.MinBreath = Int32.Parse(textBox6.Text); mConfig.MaxBreath = Int32.Parse(textBox5.Text); mConfig.MinSystolic = Int32.Parse(textBox8.Text); mConfig.MaxSystolic = Int32.Parse(textBox7.Text); mConfig.MinDiastolic = Int32.Parse(textBox9.Text); mConfig.MaxDiastolic = Int32.Parse(textBox10.Text); mConfig.MinTemp = float.Parse(textBox11.Text); mConfig.MaxTemp = float.Parse(textBox12.Text); mConfig.PulseIntTime = Int32.Parse(textBox23.Text); mConfig.BreathIntTime = Int32.Parse(textBox24.Text); mConfig.PressureIntTime = Int32.Parse(textBox25.Text); mConfig.TempIntTime = Int32.Parse(textBox26.Text); mConfig.PRModifiedTime = DateTime.Now.ToString(); mConfig.BRModifiedTime = DateTime.Now.ToString(); mConfig.BPModifiedTime = DateTime.Now.ToString(); mConfig.TempModifiedTime = DateTime.Now.ToString(); PatientHandler patHnd = new PatientHandler(); int recordCnt = patHnd.addNewPatient(dbConn.getConn(), ptient); patHnd.updatePatientBedsideIdAndReadings(dbConn.getConn(), ptient, mConfig); MessageBox.Show(recordCnt + " Patient Registered Successfully !"); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = "60"; textBox4.Text = "100"; textBox5.Text = "20"; textBox6.Text = "12"; textBox7.Text = "120"; textBox8.Text = "80"; textBox9.Text = "60"; textBox10.Text = "80"; textBox11.Text = "35.2"; textBox12.Text = "36.9"; textBox23.Text = "1"; textBox24.Text = "2"; textBox25.Text = "3"; textBox26.Text = "5"; comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 0; comboBox3.SelectedIndex = 0; comboBox4.SelectedIndex = 0; comboBox5.SelectedIndex = 0; patientDBtable(1); } else { MessageBox.Show("Invalid format for Age !"); } } else { MessageBox.Show("Please fill up all fields to register."); } }
public void latestValues() { DbConnector dbConn = new DbConnector(); dbConn.connect(); string checkId = label11.Text; ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); //Pulse Rate textBox3.Text = mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", checkId); textBox4.Text = mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", checkId); textBox23.Text = mRHand.getModuleReading(dbConn.getConn(), "pulseRIntTime", checkId); //Breathing Rate textBox6.Text = mRHand.getModuleReading(dbConn.getConn(), "breathRMin", checkId); textBox5.Text = mRHand.getModuleReading(dbConn.getConn(), "breathRMax", checkId); textBox24.Text = mRHand.getModuleReading(dbConn.getConn(), "breathRIntTime", checkId); //Blood Pressure textBox8.Text = mRHand.getModuleReading(dbConn.getConn(), "systolicMin", checkId); textBox7.Text = mRHand.getModuleReading(dbConn.getConn(), "systolicMax", checkId); textBox9.Text = mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", checkId); textBox10.Text = mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", checkId); textBox25.Text = mRHand.getModuleReading(dbConn.getConn(), "bloodPIntTime", checkId); //Temperature textBox11.Text = mRHand.getModuleReading(dbConn.getConn(), "tempMin", checkId); textBox12.Text = mRHand.getModuleReading(dbConn.getConn(), "tempMax", checkId); textBox26.Text = mRHand.getModuleReading(dbConn.getConn(), "tempIntTime", checkId); }
//Add new medical staff button private void button7_Click(object sender, EventArgs e) { DbConnector dbConn = new DbConnector(); dbConn.connect(); MedicalStaff mStaff = new MedicalStaff(); MedicalStaffHandler mStaffHnd = new MedicalStaffHandler(); bool verifyCareer = false; if (textBox14.Text != "" && textBox15.Text != "" && textBox16.Text != "" && (comboBox6.SelectedItem).ToString() != "- SELECT CAREER -") { if ((comboBox6.SelectedItem).ToString() == "Consultant") { if (textBox17.Text != "") { verifyCareer = true; } else { MessageBox.Show("Invalid format for Email !"); } } else if ((comboBox6.SelectedItem).ToString() == "Doctor" || (comboBox6.SelectedItem).ToString() == "Nurse") { if (int.TryParse(textBox18.Text, out int theContact)) { if (int.TryParse(textBox19.Text, out int thePager)) { verifyCareer = true; } else { MessageBox.Show("Invalid format for Pager Number !"); } } else { MessageBox.Show("Invalid format for Contact Number!"); } } else { MessageBox.Show("Please select a type of career."); } if (verifyCareer == true) { mStaff.Staffid = textBox14.Text; mStaff.Name = textBox15.Text; mStaff.Password = textBox16.Text; mStaff.Email = textBox17.Text; mStaff.Contact = textBox18.Text; mStaff.Pager = textBox19.Text; mStaff.Career = (comboBox6.SelectedItem).ToString(); int recordCnt = mStaffHnd.addNewMedicalStaff(dbConn.getConn(), mStaff); MessageBox.Show(recordCnt + " Medical Staff Registered Successfully !"); textBox14.Text = ""; textBox15.Text = ""; textBox16.Text = ""; textBox17.Text = ""; textBox18.Text = ""; textBox19.Text = ""; comboBox6.SelectedIndex = 0; medicalStaffDBtable(1); } } else { MessageBox.Show("Please fill up all fields to register."); } }
public void getData(string[] allData) { this.Text = "Patient ID: " + allData[0] + " (" + allData[1] + ")"; DbConnector dbConn = new DbConnector(); dbConn.connect(); //Graph Section if (allData[4] != "Blood Pressure") { int xBlockSize = 10; int yBlockSize = 20; chart1.Visible = true; chart2.Visible = false; PatientReadingsHandler pReadingsHnd = new PatientReadingsHandler(); ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); string what = ""; int minReading = 0; int maxReading = 0; float minReadingT = 0; float maxReadingT = 0; int counter = 0; var chart = chart1.ChartAreas[0]; int timeInterval = 1; int readingsInterval = 1; int startOffset = -2; int endOffset = 2; if (allData[4] == "Pulse Rate") { what = "pulseRate"; minReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", allData[0].ToString())); maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", allData[0].ToString())); } else if (allData[4] == "Breathing Rate") { what = "breathingRate"; minReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMin", allData[0].ToString())); maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMax", allData[0].ToString())); } else if (allData[4] == "Temperature") { what = "temperature"; minReadingT = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMin", allData[0].ToString())); maxReadingT = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMax", allData[0].ToString())); } foreach (var Txt in pReadingsHnd.getReadings(dbConn.getConn(), Int32.Parse(allData[0]), what)) { CustomLabel dateTimeLabel = new CustomLabel(startOffset, endOffset, (Txt.DateTime).ToString(), 0, LabelMarkStyle.None); if (what == "temperature") { chart1.Series["Module Readings"].Points.AddXY(counter, float.Parse((Txt.FloatRate).ToString())); } else { chart1.Series["Module Readings"].Points.AddXY(counter, Int32.Parse((Txt.IntRate).ToString())); } chart.AxisX.CustomLabels.Add(dateTimeLabel); startOffset = startOffset + 1; endOffset = endOffset + 1; counter++; } chart1.Series["Module Readings"].IsValueShownAsLabel = true; chart.AxisX.LabelStyle.Angle = -45; chart.AxisY.Title = allData[4]; chart.AxisX.Title = "Date and Time"; if (allData[4] == "Temperature") { //Minimum Value chart1.Series["Minimum"].Points.AddXY(0, minReadingT); chart1.Series["Minimum"].Points.AddXY(counter, minReadingT); //Maximum Value chart1.Series["Maximum"].Points.AddXY(0, maxReadingT); chart1.Series["Maximum"].Points.AddXY(counter, maxReadingT); } else { //Minimum Value chart1.Series["Minimum"].Points.AddXY(0, minReading); chart1.Series["Minimum"].Points.AddXY(counter, minReading); //Maximum Value chart1.Series["Maximum"].Points.AddXY(0, maxReading); chart1.Series["Maximum"].Points.AddXY(counter, maxReading); } //Set view range chart.AxisX.Minimum = 0; //chart.AxisX.Maximum = double.NaN; chart.AxisY.Minimum = 0; //chart.AxisY.Maximum = double.NaN; chart.AxisX.Interval = timeInterval; chart.AxisY.Interval = readingsInterval; //Enable autoscroll chart.CursorX.AutoScroll = true; chart.CursorY.AutoScroll = true; //Zoom to [0, xBlockSize] chart.AxisX.ScaleView.Zoomable = true; chart.AxisX.ScaleView.SizeType = DateTimeIntervalType.Number; chart.AxisY.ScaleView.Zoomable = true; chart.AxisY.ScaleView.SizeType = DateTimeIntervalType.Number; int position = 1; int size = xBlockSize; int ysize = yBlockSize; chart.AxisX.ScaleView.Zoom(position, size); chart.AxisY.ScaleView.Zoom(0, ysize); //Disable zoom-reset button (only scrollbar's arrows are available) chart.AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; chart.AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; // set scrollbar small change to blockSize (e.g. 100) chart.AxisX.ScaleView.SmallScrollSize = xBlockSize; chart.AxisY.ScaleView.SmallScrollSize = yBlockSize; } else { chart1.Visible = false; chart2.Visible = true; int xBlockSize = 10; int yBlockSize = 20; string what = "bloodPressure"; PatientReadingsHandler pReadingsHnd = new PatientReadingsHandler(); ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); int counter = 0; int startOffset = -2; int endOffset = 2; var chart = chart2.ChartAreas[0]; int timeInterval = 1; int readingsInterval = 1; int minReadingS = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMin", allData[0].ToString())); int maxReadingS = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMax", allData[0].ToString())); int minReadingD = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", allData[0].ToString())); int maxReadingD = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", allData[0].ToString())); foreach (var Txt in pReadingsHnd.getReadings(dbConn.getConn(), Int32.Parse(allData[0]), what)) { CustomLabel dateTimeLabel = new CustomLabel(startOffset, endOffset, (Txt.DateTime).ToString(), 0, LabelMarkStyle.None); chart2.Series["Systolic"].Points.AddXY(counter, Int32.Parse((Txt.IntRate).ToString())); chart2.Series["Diastolic"].Points.AddXY(counter, Int32.Parse((Txt.IntRate2).ToString())); chart.AxisX.CustomLabels.Add(dateTimeLabel); startOffset = startOffset + 1; endOffset = endOffset + 1; counter++; } chart2.Series["Systolic"].IsValueShownAsLabel = true; chart2.Series["Diastolic"].IsValueShownAsLabel = true; chart.AxisX.LabelStyle.Angle = -45; chart.AxisY.Title = "Blood Pressure Readings"; chart.AxisX.Title = "Date and Time"; //Minimum Value chart2.Series["Minimum (Systolic)"].Points.AddXY(0, minReadingS); chart2.Series["Minimum (Systolic)"].Points.AddXY(counter, minReadingS); chart2.Series["Minimum (Diastolic)"].Points.AddXY(0, minReadingD); chart2.Series["Minimum (Diastolic)"].Points.AddXY(counter, minReadingD); //Maximum Value chart2.Series["Maximum (Systolic)"].Points.AddXY(0, maxReadingS); chart2.Series["Maximum (Systolic)"].Points.AddXY(counter, maxReadingS); chart2.Series["Maximum (Diastolic)"].Points.AddXY(0, maxReadingD); chart2.Series["Maximum (Diastolic)"].Points.AddXY(counter, maxReadingD); //Set view range chart.AxisX.Minimum = 0; //chart.AxisX.Maximum = double.NaN; chart.AxisY.Minimum = 0; //chart.AxisY.Maximum = double.NaN; chart.AxisX.Interval = timeInterval; chart.AxisY.Interval = readingsInterval; //Enable autoscroll chart.CursorX.AutoScroll = true; chart.CursorY.AutoScroll = true; //Zoom to [0, xBlockSize] chart.AxisX.ScaleView.Zoomable = true; chart.AxisX.ScaleView.SizeType = DateTimeIntervalType.Number; chart.AxisY.ScaleView.Zoomable = true; chart.AxisY.ScaleView.SizeType = DateTimeIntervalType.Number; int position = 1; int size = xBlockSize; int ysize = yBlockSize; chart.AxisX.ScaleView.Zoom(position, size); chart.AxisY.ScaleView.Zoom(0, ysize); //Disable zoom-reset button (only scrollbar's arrows are available) chart.AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; chart.AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; // set scrollbar small change to blockSize (e.g. 100) chart.AxisX.ScaleView.SmallScrollSize = xBlockSize; chart.AxisY.ScaleView.SmallScrollSize = yBlockSize; } }
public void getData(string[] allData) { passData = allData; label5.Text = allData[0]; label6.Text = allData[1]; label7.Text = allData[2]; label8.Text = allData[3]; label9.Text = allData[4]; DbConnector dbConn = new DbConnector(); dbConn.connect(); ModuleReadingsHandler mReadingsHnd = new ModuleReadingsHandler(); //Table Section if(allData[4] == "Pulse Rate" || allData[4] == "Breathing Rate") { dataGridView1.DataSource = mReadingsHnd.listModules(dbConn.getConn(), Int32.Parse(allData[0]), allData[4]); dataGridView1.Columns[0].HeaderText = "NO."; dataGridView1.Columns[17].HeaderText = "MINIMUM READING"; dataGridView1.Columns[18].HeaderText = "MAXIMUM READING"; dataGridView1.Columns[19].HeaderText = "TIME INTERVAL (SECOND(S))"; dataGridView1.Columns[20].HeaderText = "LAST MODIFIED"; dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[17].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[18].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[19].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[20].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns.Remove("PatientId"); dataGridView1.Columns.Remove("MinPulse"); dataGridView1.Columns.Remove("MaxPulse"); dataGridView1.Columns.Remove("PulseIntTime"); dataGridView1.Columns.Remove("MinBreath"); dataGridView1.Columns.Remove("MaxBreath"); dataGridView1.Columns.Remove("BreathIntTime"); dataGridView1.Columns.Remove("MinSystolic"); dataGridView1.Columns.Remove("MaxSystolic"); dataGridView1.Columns.Remove("MinDiastolic"); dataGridView1.Columns.Remove("MaxDiastolic"); dataGridView1.Columns.Remove("PressureIntTime"); dataGridView1.Columns.Remove("MinTemp"); dataGridView1.Columns.Remove("MaxTemp"); dataGridView1.Columns.Remove("TempIntTime"); dataGridView1.Columns.Remove("Selected"); dataGridView1.Columns.Remove("BRModifiedTime"); dataGridView1.Columns.Remove("BPModifiedTime"); dataGridView1.Columns.Remove("TempModifiedTime"); } if (allData[4] == "Blood Pressure") { dataGridView1.DataSource = mReadingsHnd.listModules(dbConn.getConn(), Int32.Parse(allData[0]), allData[4]); dataGridView1.Columns[0].HeaderText = "NO."; dataGridView1.Columns[8].HeaderText = "MINIMUM READING (SYSTOLIC)"; dataGridView1.Columns[9].HeaderText = "MAXIMUM READING (SYSTOLIC)"; dataGridView1.Columns[10].HeaderText = "MINIMUM READING (DIASTOLIC)"; dataGridView1.Columns[11].HeaderText = "MAXIMUM READING (DIASTOLIC)"; dataGridView1.Columns[12].HeaderText = "TIME INTERVAL (SECOND(S))"; dataGridView1.Columns[22].HeaderText = "LAST MODIFIED"; dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[8].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[9].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[10].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[11].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[12].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[22].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns.Remove("PatientId"); dataGridView1.Columns.Remove("MinPulse"); dataGridView1.Columns.Remove("MaxPulse"); dataGridView1.Columns.Remove("PulseIntTime"); dataGridView1.Columns.Remove("MinBreath"); dataGridView1.Columns.Remove("MaxBreath"); dataGridView1.Columns.Remove("BreathIntTime"); dataGridView1.Columns.Remove("MinTemp"); dataGridView1.Columns.Remove("MaxTemp"); dataGridView1.Columns.Remove("TempIntTime"); dataGridView1.Columns.Remove("Selected"); dataGridView1.Columns.Remove("BothMin"); dataGridView1.Columns.Remove("BothMax"); dataGridView1.Columns.Remove("SelectedNum"); dataGridView1.Columns.Remove("BRModifiedTime"); dataGridView1.Columns.Remove("PRModifiedTime"); dataGridView1.Columns.Remove("TempModifiedTime"); } if (allData[4] == "Temperature") { dataGridView1.DataSource = mReadingsHnd.listModules(dbConn.getConn(), Int32.Parse(allData[0]), allData[4]); dataGridView1.Columns[0].HeaderText = "NO."; dataGridView1.Columns[13].HeaderText = "MINIMUM READING"; dataGridView1.Columns[14].HeaderText = "MAXIMUM READING"; dataGridView1.Columns[15].HeaderText = "TIME INTERVAL (SECOND(S))"; dataGridView1.Columns[23].HeaderText = "LAST MODIFIED"; dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[13].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[14].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[15].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[23].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns.Remove("PatientId"); dataGridView1.Columns.Remove("MinPulse"); dataGridView1.Columns.Remove("MaxPulse"); dataGridView1.Columns.Remove("PulseIntTime"); dataGridView1.Columns.Remove("MinBreath"); dataGridView1.Columns.Remove("MaxBreath"); dataGridView1.Columns.Remove("BreathIntTime"); dataGridView1.Columns.Remove("MinSystolic"); dataGridView1.Columns.Remove("MaxSystolic"); dataGridView1.Columns.Remove("MinDiastolic"); dataGridView1.Columns.Remove("MaxDiastolic"); dataGridView1.Columns.Remove("PressureIntTime"); dataGridView1.Columns.Remove("BothMin"); dataGridView1.Columns.Remove("BothMax"); dataGridView1.Columns.Remove("SelectedNum"); dataGridView1.Columns.Remove("Selected"); dataGridView1.Columns.Remove("BRModifiedTime"); dataGridView1.Columns.Remove("BPModifiedTime"); dataGridView1.Columns.Remove("PRModifiedTime"); } //Graph Section if (allData[4] != "Blood Pressure") { int xBlockSize = 8; int yBlockSize = 10; chart1.Visible = true; chart2.Visible = false; PatientReadingsHandler pReadingsHnd = new PatientReadingsHandler(); ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); string what = ""; int minReading = 0; int maxReading = 0; float minReadingT = 0; float maxReadingT = 0; int counter = 0; var chart = chart1.ChartAreas[0]; int timeInterval = 1; int readingsInterval = 1; int startOffset = -2; int endOffset = 2; if (allData[4] == "Pulse Rate") { what = "pulseRate"; minReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", allData[0].ToString())); maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", allData[0].ToString())); } else if(allData[4] == "Breathing Rate") { what = "breathingRate"; minReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMin", allData[0].ToString())); maxReading = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "breathRMax", allData[0].ToString())); } else if(allData[4] == "Temperature") { what = "temperature"; minReadingT = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMin", allData[0].ToString())); maxReadingT = float.Parse(mRHand.getModuleReading(dbConn.getConn(), "tempMax", allData[0].ToString())); } foreach (var Txt in pReadingsHnd.getReadings(dbConn.getConn(), Int32.Parse(allData[0]), what)) { CustomLabel dateTimeLabel = new CustomLabel(startOffset, endOffset, (Txt.DateTime).ToString(), 0, LabelMarkStyle.None); if(what == "temperature") { chart1.Series["Module Readings"].Points.AddXY(counter, float.Parse((Txt.FloatRate).ToString())); } else { chart1.Series["Module Readings"].Points.AddXY(counter, Int32.Parse((Txt.IntRate).ToString())); } chart.AxisX.CustomLabels.Add(dateTimeLabel); startOffset = startOffset + 1; endOffset = endOffset + 1; counter++; } chart1.Series["Module Readings"].IsValueShownAsLabel = true; chart.AxisX.LabelStyle.Angle = -45; chart.AxisY.Title = label9.Text; chart.AxisX.Title = "Date and Time"; if (allData[4] == "Temperature") { //Minimum Value chart1.Series["Minimum"].Points.AddXY(0, minReadingT); chart1.Series["Minimum"].Points.AddXY(counter, minReadingT); //Maximum Value chart1.Series["Maximum"].Points.AddXY(0, maxReadingT); chart1.Series["Maximum"].Points.AddXY(counter, maxReadingT); } else { //Minimum Value chart1.Series["Minimum"].Points.AddXY(0, minReading); chart1.Series["Minimum"].Points.AddXY(counter, minReading); //Maximum Value chart1.Series["Maximum"].Points.AddXY(0, maxReading); chart1.Series["Maximum"].Points.AddXY(counter, maxReading); } //Set view range chart.AxisX.Minimum = 0; //chart.AxisX.Maximum = double.NaN; chart.AxisY.Minimum = 0; //chart.AxisY.Maximum = double.NaN; chart.AxisX.Interval = timeInterval; chart.AxisY.Interval = readingsInterval; //Enable autoscroll chart.CursorX.AutoScroll = true; chart.CursorY.AutoScroll = true; //Zoom to [0, xBlockSize] chart.AxisX.ScaleView.Zoomable = true; chart.AxisX.ScaleView.SizeType = DateTimeIntervalType.Number; chart.AxisY.ScaleView.Zoomable = true; chart.AxisY.ScaleView.SizeType = DateTimeIntervalType.Number; int position = 1; int size = xBlockSize; int ysize = yBlockSize; chart.AxisX.ScaleView.Zoom(position, size); chart.AxisY.ScaleView.Zoom(0, ysize); //Disable zoom-reset button (only scrollbar's arrows are available) chart.AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; chart.AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; // set scrollbar small change to blockSize (e.g. 100) chart.AxisX.ScaleView.SmallScrollSize = xBlockSize; chart.AxisY.ScaleView.SmallScrollSize = yBlockSize; } else { chart1.Visible = false; chart2.Visible = true; int xBlockSize = 8; int yBlockSize = 10; string what = "bloodPressure"; PatientReadingsHandler pReadingsHnd = new PatientReadingsHandler(); ModuleReadingsHandler mRHand = new ModuleReadingsHandler(); int counter = 0; int startOffset = -2; int endOffset = 2; var chart = chart2.ChartAreas[0]; int timeInterval = 1; int readingsInterval = 1; int minReadingS = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMin", allData[0].ToString())); int maxReadingS = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "systolicMax", allData[0].ToString())); int minReadingD = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", allData[0].ToString())); int maxReadingD = Int32.Parse(mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", allData[0].ToString())); foreach (var Txt in pReadingsHnd.getReadings(dbConn.getConn(), Int32.Parse(allData[0]), what)) { CustomLabel dateTimeLabel = new CustomLabel(startOffset, endOffset, (Txt.DateTime).ToString(), 0, LabelMarkStyle.None); chart2.Series["Systolic"].Points.AddXY(counter, Int32.Parse((Txt.IntRate).ToString())); chart2.Series["Diastolic"].Points.AddXY(counter, Int32.Parse((Txt.IntRate2).ToString())); chart.AxisX.CustomLabels.Add(dateTimeLabel); startOffset = startOffset + 1; endOffset = endOffset + 1; counter++; } chart2.Series["Systolic"].IsValueShownAsLabel = true; chart2.Series["Diastolic"].IsValueShownAsLabel = true; chart.AxisX.LabelStyle.Angle = -45; chart.AxisY.Title = "Blood Pressure Readings"; chart.AxisX.Title = "Date and Time"; //Minimum Value chart2.Series["Minimum (Systolic)"].Points.AddXY(0, minReadingS); chart2.Series["Minimum (Systolic)"].Points.AddXY(counter, minReadingS); chart2.Series["Minimum (Diastolic)"].Points.AddXY(0, minReadingD); chart2.Series["Minimum (Diastolic)"].Points.AddXY(counter, minReadingD); //Maximum Value chart2.Series["Maximum (Systolic)"].Points.AddXY(0, maxReadingS); chart2.Series["Maximum (Systolic)"].Points.AddXY(counter, maxReadingS); chart2.Series["Maximum (Diastolic)"].Points.AddXY(0, maxReadingD); chart2.Series["Maximum (Diastolic)"].Points.AddXY(counter, maxReadingD); //Set view range chart.AxisX.Minimum = 0; //chart.AxisX.Maximum = double.NaN; chart.AxisY.Minimum = 0; //chart.AxisY.Maximum = double.NaN; chart.AxisX.Interval = timeInterval; chart.AxisY.Interval = readingsInterval; //Enable autoscroll chart.CursorX.AutoScroll = true; chart.CursorY.AutoScroll = true; //Zoom to [0, xBlockSize] chart.AxisX.ScaleView.Zoomable = true; chart.AxisX.ScaleView.SizeType = DateTimeIntervalType.Number; chart.AxisY.ScaleView.Zoomable = true; chart.AxisY.ScaleView.SizeType = DateTimeIntervalType.Number; int position = 1; int size = xBlockSize; int ysize = yBlockSize; chart.AxisX.ScaleView.Zoom(position, size); chart.AxisY.ScaleView.Zoom(0, ysize); //Disable zoom-reset button (only scrollbar's arrows are available) chart.AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; chart.AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll; // set scrollbar small change to blockSize (e.g. 100) chart.AxisX.ScaleView.SmallScrollSize = xBlockSize; chart.AxisY.ScaleView.SmallScrollSize = yBlockSize; } }