private bool DataValidation() { if (!ValidateData.ValidateID(Patient_ID_textBox.Text)) { Error.SetError(Patient_ID_textBox, "Please enter valid ID"); return(false); } Error.Clear(); if (!ValidateData.ValidateAge(Age_textBox.Text)) { Error.SetError(Age_textBox, "Please enter valid Age"); return(false); } Error.Clear(); if (!ValidateData.ValidateSex(Sex_Combobox.Text)) { Error.SetError(Sex_Combobox, "Please enter valid Sex"); return(false); } Error.Clear(); if (!ValidateData.ValidateDate(DateOfBirth_textBox.Text)) { MessageBox.Show("Please enter a valid Date of Birth, ex: 1/1/2016"); Error.SetError(DateOfBirth_textBox, "Please enter valid Birth date"); return(false); } Error.Clear(); if (!ValidateData.ValidateDate(Visit_date_textBox.Text)) { MessageBox.Show("Please enter a valid Visit of Birth, ex: 1/1/2016"); Error.SetError(Visit_date_textBox, "Please enter valid Visit date"); return(false); } Error.Clear(); if (!ValidateData.ValidateName(Patient_name_textBox.Text)) { Error.SetError(Patient_name_textBox, "Please enter valid Name"); return(false); } Error.Clear(); if (!ValidateData.ValidateNumber(Homenum_textBox.Text)) { MessageBox.Show("Please enter a valid Home number"); Error.SetError(Homenum_textBox, "Please enter valid Home Number"); return(false); } Error.Clear(); if (!ValidateData.ValidateNumber(Mobile_textBox.Text)) { MessageBox.Show("Please enter a valid Mobile number"); Error.SetError(Mobile_textBox, "Please enter valid Mobile Number"); return(false); } Error.Clear(); if (!ValidateData.ValidateRelativeMarriage(Realative_Marriage_comboBox.Text)) { Error.SetError(Realative_Marriage_comboBox, "Please enter valid Relative Marriage"); return(false); } Error.Clear(); if (!ValidateData.ValidateNullField(Address_textBox.Text)) { MessageBox.Show("Please enter a valid Address"); Error.SetError(Address_textBox, "Please enter valid Address"); return(false); } Error.Clear(); if (!ValidateData.ValidateNullField(Chief_Complaint_textBox.Text)) { MessageBox.Show("Please enter a valid Chief Complaint"); Error.SetError(Chief_Complaint_textBox, "Please enter valid Chief Complaint"); return(false); } Error.Clear(); if (!ValidateData.ValidateNullField(Medical_alert_textBox.Text)) { MessageBox.Show("Please enter a valid Medical Complaint"); Error.SetError(Medical_alert_textBox, "Please enter valid Medical Alert"); return(false); } Error.Clear(); if (!ValidateData.ValidatePatientImage(Patient_Photo_pictureBox)) { Error.SetError(AddPatientPhoto_button, "Please enter valid Patient Photo"); return(false); } Error.Clear(); if (!ValidateData.ValidateXrayImage(Patient_Xray_images)) { Error.SetError(AddPatientXray_button, "Please attach Patient X-rays"); return(false); } Error.Clear(); return(true); }
// Search In ranges private void Search_In_Range_button_Click(object sender, EventArgs e) { String Option = Search_In_Range_comboBox.Text; String SearchKeyFROM, SearchKeyTO, SQLcommand; #region Data Validation if (!ValidateData.ValidateComboBoxItem(Option, new List <String> { "Patient_ID", "Age", "Visit_date", "Birth_date", "DMF", "_dmf", "DEF" })) { Error.SetError(Search_In_Range_comboBox, "Please"); return; } Error.Clear(); SearchKeyFROM = Search_IR_from_textBox.Text; SearchKeyTO = Search_IR_to_textBox.Text; if (Option == "Patient_ID" && (!ValidateData.ValidateIDField(SearchKeyFROM) || !ValidateData.ValidateIDField(SearchKeyTO))) { Error.SetError(SIR_SK_Label, "Enter valid ID"); return; } else if (Option == "Age" && (!ValidateData.ValidateAge(SearchKeyFROM) || !ValidateData.ValidateAge(SearchKeyTO))) { Error.SetError(SIR_SK_Label, "Enter Valid age"); return; } else if (Option == "Visit_date" && (!ValidateData.ValidateDate(SearchKeyFROM) || !ValidateData.ValidateDate(SearchKeyTO))) { MessageBox.Show("Please enter valid Visit date, ex: 1/2/2002 "); Error.SetError(SIR_SK_Label, "Enter valid visit date"); return; } else if (Option == "Birth_date" && (!ValidateData.ValidateDate(SearchKeyFROM) || !ValidateData.ValidateDate(SearchKeyTO))) { MessageBox.Show("Please enter valid Birth date, ex: 1/2/2002 "); Error.SetError(SIR_SK_Label, "Enter valid visit date"); return; } else if (Option == "DMF" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO))) { MessageBox.Show("Please enter valid DMF values"); Error.SetError(SIR_SK_Label, "Enter valid DMF values"); return; } else if (Option == "_dmf" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO))) { MessageBox.Show("Please enter valid dmf values"); Error.SetError(SIR_SK_Label, "Enter valid DMF values"); return; } else if (Option == "DEF" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO))) { MessageBox.Show("Please enter valid DEF values"); Error.SetError(SIR_SK_Label, "Enter valid DEF values"); return; } Error.Clear(); #endregion ///////////////////////////////////// // Fetch Data from DB SQLcommand = Get_Search_InRange_SQLcommand(Option, SearchKeyFROM, SearchKeyTO); if (SQLcommand.Length != 0) { Search_Result newResult = new Search_Result(SQLcommand); if (newResult.ShowForm == true) { newResult.Show(); } else { Error.SetError(Set_Search_2P_Button, "Search keys is not exist in your database"); return; } } else { MessageBox.Show("SQL COMMAND STRING IS EMPTY"); } Error.Clear(); }