public static bool patientFields(frmPatientRecordTabs frmPatient) { if (hasErrors(frmPatient)) { return(true); } return(false); }
// Open Patient information private void btnOpen_Click(object sender, EventArgs e) { try { if (selectedPatient != null) { CloseCurrentOpenView(currentViewOpened); string message = selectedPatient.FirstName + selectedPatient.LastName + " Record is now open. ID : " + selectedPatient.PatientID; Status(message, Color.Transparent); patientInfoRibbonController = new PatientInfoRibbonController(this, new frmPatientInfoRibbon()); patientRecordTabsViewController = new PatientRecordTabsViewController(this, new frmPatientRecordTabs()); AddToContainer(patientRecordTabsViewController, MIDDLE); AddToContainer(patientInfoRibbonController, RIGHT); patienRibbon = patientInfoRibbonController.ribbon; frmPatientTabs = patientRecordTabsViewController.frmPatientRecordTabs; // Disable Tabs frmPatientTabs.tabPatientRecord.TabPages.Remove(frmPatientTabs.tabOrderTests); frmPatientTabs.tabPatientRecord.TabPages.Remove(frmPatientTabs.tabDiagnosis); //add patient ribbon AddPatientRibonInfo(selectedPatient); patienRibbon.btnSearchPatient.Click += new EventHandler(btnSearchPatient_Click); //Fill View appointments selectedPatientAppointments = eClinicalsController.GetAllAppointmentsByPatientID(selectedPatientID); frmPatientTabs.dgViewAppointments_ViewAppointments.DataSource = selectedPatientAppointments; patientRecordTabsViewController.fillPatientInfo(selectedPatient); frmPatientTabs.dgTestResults_TestResults.DataSource = eClinicalsController.GetTestResults(selectedPatientID); ExtensionGridView.RemoveAppointmentIdColumns(frmPatientTabs.dgViewAppointments_ViewAppointments); } else { Status("No Patient Selected", Color.Yellow); } } catch (Exception ex) { MessageBox.Show(ex.Message + " Error in : " + ex.TargetSite); Status(ex.Message + " Error in : " + ex.TargetSite, Color.Red); } try { currentNurse = eClinicalsController.GetNurseByID(currentUser.ContactID); Status("Current Nures: " + currentNurse.FirstName, Color.Yellow); } catch (Exception ex) { Status(ex.Message + " Error in : " + ex.TargetSite, Color.Red); } }
private static bool hasErrors(frmPatientRecordTabs frmPatient) { if (frmPatient == null) { throw new System.ArgumentException("Parameter cannot be null", "frmPatient"); } errorMessage = ""; if (frmPatient.firstName == "") { errorMessage = "Name not valid"; frmPatient.lblError_firstName.Text = errorMessage; } else { frmPatient.lblError_firstName.Text = ""; } if (frmPatient.lastName == "") { errorMessage = "name not valid"; frmPatient.lblError_lastName.Text = errorMessage; } else { frmPatient.lblError_lastName.Text = ""; } if (frmPatient.city == "") { errorMessage = "City is not valid"; frmPatient.lblError_city.Text = errorMessage; } else { frmPatient.lblError_city.Text = ""; } if (frmPatient.streetAddress == "") { errorMessage = "Address is not valid"; frmPatient.lblError_address.Text = errorMessage; } else { frmPatient.lblError_address.Text = ""; } if (!RegExCheckUtil.IsPhoneNumber(frmPatient.phone) || frmPatient.phone == "") { errorMessage = "Phone is not valid"; frmPatient.lblError_phone.Text = errorMessage; } else { frmPatient.lblError_phone.Text = ""; } if (frmPatient.phone.Length > 6 & frmPatient.phone.Length < 11) { frmPatient.lblError_phone.Text = ""; } else { errorMessage = "Phone is not valid #######"; frmPatient.lblError_phone.Text = errorMessage; } if (!RegExCheckUtil.IsSSN(frmPatient.ssn) || frmPatient.ssn == "") { errorMessage = "SSN is not valid"; frmPatient.lblError_ssn.Text = errorMessage; } else { frmPatient.lblError_ssn.Text = ""; } if (!RegExCheckUtil.IsUsorCanadianZipCode(frmPatient.zip) || frmPatient.zip == "") { errorMessage = "Zip is not valid"; frmPatient.lblError_zip.Text = errorMessage; } else { frmPatient.lblError_zip.Text = ""; } if (errorMessage == "") { return(true); } return(false); }