private void Button3_Click(object sender, EventArgs e) { if (Application.OpenForms["SchedulingCalendar"] as SchedulingCalendar != null) { SchedulingCalendar s = (SchedulingCalendar)Application.OpenForms["SchedulingCalendar"]; s.Close(); } if (Application.OpenForms["NewPatient"] as NewPatient == null) { NewPatient newPatient = new NewPatient(this) { MdiParent = this }; Center(newPatient); newPatient.Show(); } }
private void Button3_Click(object sender, EventArgs e) { for (int i = Application.OpenForms.Count - 1; i >= 0; i--) { if (Application.OpenForms[i] != this && Application.OpenForms[i].Name != "WelcomeHomePage") { Application.OpenForms[i].Close(); } } if (Application.OpenForms["NewPatient"] as NewPatient == null) { NewPatient newPatient = new NewPatient(this) { MdiParent = this }; Center(newPatient); newPatient.Show(); } }
private void PatientListView1_RowClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && PatientListView1[e.ColumnIndex, e.RowIndex] is DataGridViewButtonCell && e.ColumnIndex == 0) { this.PatientListView1.Rows[e.RowIndex].Selected = true; int selectedPatientID = (int)this.PatientListView1["PatientID", e.RowIndex].Value; EMRDatabaseDataSet.PatientDataTable selectedPatient = this.patientTableAdapter.GetDataByPatientID(selectedPatientID); string name = (String)selectedPatient[0]["FirstName"] + " " + (String)selectedPatient[0]["LastName"]; string phoneNumber = (String)selectedPatient[0]["PhoneNumber"]; string gender = (String)selectedPatient[0]["Gender"]; string age = (String)selectedPatient[0]["Age"]; string maritalStatus = (String)selectedPatient[0]["MaritalStatus"]; DateTime DOB = (DateTime)selectedPatient[0]["DOB"]; if (Application.OpenForms["PatientHomePage"] as PatientHomePage == null) { PatientHomePage patientHome = new PatientHomePage(name, phoneNumber, gender, age, maritalStatus, DOB, selectedPatientID, this.providerMain) { MdiParent = (ProviderMain)this.MdiParent }; for (int i = Application.OpenForms.Count - 1; i >= 0; i--) { if (Application.OpenForms[i].Name != "ProviderMain" && Application.OpenForms[i].Name != "WelcomeHomePage" && Application.OpenForms[i].Name != "SchedulerMain") { Application.OpenForms[i].Close(); } } patientHome.Show(); } Console.WriteLine("clicked"); } else if (e.RowIndex >= 0 && PatientListView1[e.ColumnIndex, e.RowIndex] is DataGridViewButtonCell) { this.PatientListView1.Rows[e.RowIndex].Selected = true; int selectedPatientID = (int)this.PatientListView1["PatientID", e.RowIndex].Value; EMRDatabaseDataSet.PatientDataTable selectedPatient = this.patientTableAdapter.GetDataByPatientID(selectedPatientID); string firstName = (String)selectedPatient[0]["FirstName"]; string lastName = (String)selectedPatient[0]["LastName"]; string phoneNumber = ""; if (selectedPatient[0]["PhoneNumber"].GetType() != typeof(DBNull)) { phoneNumber = (String)selectedPatient[0]["PhoneNumber"]; } string gender = (String)selectedPatient[0]["Gender"]; string age = (String)selectedPatient[0]["Age"]; string pregnancyStatus = ""; if (selectedPatient[0]["PregnancyStatus"].GetType() != typeof(DBNull)) { pregnancyStatus = (String)selectedPatient[0]["PregnancyStatus"]; } string maritalStatus = (String)selectedPatient[0]["MaritalStatus"]; string height = (String)selectedPatient[0]["Height"]; string weight = (String)selectedPatient[0]["Weight"]; string nationality = (String)selectedPatient[0]["Nationality"]; DateTime DOB = (DateTime)selectedPatient[0]["DOB"]; for (int i = Application.OpenForms.Count - 1; i >= 0; i--) { if (Application.OpenForms[i] != this && Application.OpenForms[i].Name != "WelcomeHomePage" && Application.OpenForms[i].Name != "ProviderMain" && Application.OpenForms[i].Name != "SchedulerMain") { Application.OpenForms[i].Close(); } } this.Hide(); if (Application.OpenForms["NewPatient"] as NewPatient == null) { if (parentType == "provider") { NewPatient update = new NewPatient(providerMain, selectedPatientID) { MdiParent = (ProviderMain)this.MdiParent, }; update.FirstNameBox.Text = firstName; update.LastNameBox.Text = lastName; update.PhoneNumberBox.Text = phoneNumber; if (gender == "Male") { update.MaleCheckBox.Checked = true; } else { update.FemaleCheckBox.Checked = true; if (pregnancyStatus == "Pregnant") { update.PregnantBox.Checked = true; } else { update.NotPregnantBox.Checked = true; } } if (maritalStatus == "Single") { update.SingleBox.Checked = true; } else { update.MarriedBox.Checked = true; } update.HeightBox.Text = height; update.WeightBox.Text = weight; update.NationalityBox.Text = nationality; update.Focus(); this.Close(); this.Dispose(); update.Show(); } if (parentType == "scheduler") { NewPatient update = new NewPatient(schedulerMain, selectedPatientID) { MdiParent = (ProviderMain)this.MdiParent, }; this.Hide(); update.FirstNameBox.Text = firstName; update.LastNameBox.Text = lastName; update.PhoneNumberBox.Text = phoneNumber; if (gender == "Male") { update.MaleCheckBox.Checked = true; } else { update.FemaleCheckBox.Checked = true; if (pregnancyStatus == "Pregnant") { update.PregnantBox.Checked = true; } else { update.NotPregnantBox.Checked = true; } } if (maritalStatus == "Single") { update.SingleBox.Checked = true; } else { update.MarriedBox.Checked = true; } update.HeightBox.Text = height; update.WeightBox.Text = weight; update.NationalityBox.Text = nationality; update.Focus(); this.Close(); this.Dispose(); update.Show(); } } } }