// Search in range with two parameters private void Search_In_Range_2P_button_Click(object sender, EventArgs e) { String Option1 = Search_In_Range_2P_P1_comboBox.Text; String Option2 = Search_In_Range_2P_P2_comboBox.Text; String SearchKeyFROM1, SearchKeyTO1, SearchKeyFROM2, SearchKeyTO2, SQLcommand; #region Data Validation if (!ValidateData.ValidateComboBoxItem(Option1, new List<String> { "Patient_ID", "Age", "Visit_date", "Birth_date", "DMF", "_dmf", "DEF" })) { Error.SetError(Search_In_Range_2P_P1_comboBox, "Please"); return; } Error.Clear(); if (!ValidateData.ValidateComboBoxItem(Option2, new List<String> { "Patient_ID", "Age", "Visit_date", "Birth_date", "DMF", "_dmf", "DEF" })) { Error.SetError(Search_In_Range_2P_P2_comboBox, "Please"); return; } Error.Clear(); if (Option1 == Option2) { MessageBox.Show("Please choose different Search Parameters"); Error.SetError(Search_In_Range_2P_P1_comboBox, "plz"); Error.SetError(Search_In_Range_2P_P2_comboBox, "plz"); return; } Error.Clear(); /////////////////////////////////////////////// SearchKeyFROM1 = Search_IR_2P_P1_from_textBox.Text; SearchKeyTO1 = Search_IR_2P_P1_to_textBox.Text; if (Option1 == "Patient_ID" && (!ValidateData.ValidateIDField(SearchKeyFROM1) || !ValidateData.ValidateIDField(SearchKeyTO1))) { Error.SetError(SIR_2P_P1_SK_Label, "Enter valid ID"); return; } else if (Option1 == "Age" && (!ValidateData.ValidateAge(SearchKeyFROM1) || !ValidateData.ValidateAge(SearchKeyTO1))) { Error.SetError(SIR_2P_P1_SK_Label, "Enter Valid age"); return; } else if (Option1 == "Visit_date" && (!ValidateData.ValidateDate(SearchKeyFROM1) || !ValidateData.ValidateDate(SearchKeyTO1))) { MessageBox.Show("Please enter valid Visit date, ex: 1/2/2002 "); Error.SetError(SIR_2P_P1_SK_Label, "Enter valid visit date"); return; } else if (Option1 == "Birth_date" && (!ValidateData.ValidateDate(SearchKeyFROM1) || !ValidateData.ValidateDate(SearchKeyTO1))) { MessageBox.Show("Please enter valid Birth date, ex: 1/2/2002 "); Error.SetError(SIR_2P_P1_SK_Label, "Enter valid visit date"); return; } else if (Option1 == "DMF" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM1) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO1))) { MessageBox.Show("Please enter valid DMF values"); Error.SetError(SIR_2P_P1_SK_Label, "Enter valid DMF values"); return; } else if (Option1 == "_dmf" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM1) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO1))) { MessageBox.Show("Please enter valid dmf values"); Error.SetError(SIR_2P_P1_SK_Label, "Enter valid DMF values"); return; } else if (Option1 == "DEF" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM1) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO1))) { MessageBox.Show("Please enter valid DEF values"); Error.SetError(SIR_2P_P1_SK_Label, "Enter valid DEF values"); return; } Error.Clear(); // --------------------------------------------------------- SearchKeyFROM2 = Search_IR_2P_P2_from_textBox.Text; SearchKeyTO2 = Search_IR_2P_P2_to_textBox.Text; if (Option2 == "Patient_ID" && (!ValidateData.ValidateIDField(SearchKeyFROM2) || !ValidateData.ValidateIDField(SearchKeyTO2))) { Error.SetError(SIR_2P_P2_SK_Label, "Enter valid ID"); return; } else if (Option2 == "Age" && (!ValidateData.ValidateAge(SearchKeyFROM2) || !ValidateData.ValidateAge(SearchKeyTO2))) { Error.SetError(SIR_2P_P2_SK_Label, "Enter Valid age"); return; } else if (Option2 == "Visit_date" && (!ValidateData.ValidateDate(SearchKeyFROM2) || !ValidateData.ValidateDate(SearchKeyTO2))) { MessageBox.Show("Please enter valid Visit date, ex: 1/2/2002 "); Error.SetError(SIR_2P_P2_SK_Label, "Enter valid visit date"); return; } else if (Option2 == "Birth_date" && (!ValidateData.ValidateDate(SearchKeyFROM2) || !ValidateData.ValidateDate(SearchKeyTO2))) { MessageBox.Show("Please enter valid Birth date, ex: 1/2/2002 "); Error.SetError(SIR_2P_P2_SK_Label, "Enter valid visit date"); return; } else if (Option2 == "DMF" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM2) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO2))) { MessageBox.Show("Please enter valid DMF values"); Error.SetError(SIR_2P_P2_SK_Label, "Enter valid DMF values"); return; } else if (Option2 == "_dmf" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM2) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO2))) { MessageBox.Show("Please enter valid dmf values"); Error.SetError(SIR_2P_P2_SK_Label, "Enter valid DMF values"); return; } else if (Option2 == "DEF" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM2) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO2))) { MessageBox.Show("Please enter valid DEF values"); Error.SetError(SIR_2P_P2_SK_Label, "Enter valid DEF values"); return; } Error.Clear(); #endregion ///////////////////////////////////// // Fetch Data from DB SQLcommand = Get_Search_InRange_2P_SQLcommand(Option1,Option2, SearchKeyFROM1, SearchKeyTO1, SearchKeyFROM2, SearchKeyTO2); 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(); }
// Search for set of people with two parameters private void Set_Search_2P_Button_Click(object sender, EventArgs e) { String Option1 = Set_S_P1_comboBox.Text; String Option2 = Set_S_P2_comboBox.Text; String SearchKey1, SearchKey2, SQLcommand; #region Data Validation //Validate Options if (!ValidateData.ValidateComboBoxItem(Option1, SearchOptions)) { Error.SetError(Set_S_P1_comboBox, "Please"); return; } Error.Clear(); if (!ValidateData.ValidateComboBoxItem(Option2, SearchOptions)) { Error.SetError(Set_S_P2_comboBox, "Please"); return; } Error.Clear(); if (Option1 == Option2) { MessageBox.Show("Please choose different Search Parameters"); Error.SetError(Set_S_P1_comboBox, "plz"); Error.SetError(Set_S_P2_comboBox, "plz"); return; } Error.Clear(); // Get Search Keys Data if (Option1 == "Diagnose") SearchKey1 = SetK_P1_Diagnosis_comboBox.Text; else if (Option1 == "Procedures") SearchKey1 = SetK_P1_DAP_comboBox.Text; else if (Option1 == "Sex") SearchKey1 = SetK_P1_Sex_comboBox.Text; else if (Option1 == "Relative_marriage") SearchKey1 = SetK_P1_RM_comboBox.Text; else SearchKey1 = SetK_P1_textBox.Text; // ---------------------------------------- if (Option2 == "Diagnose") SearchKey2 = SetK_P2_Diagnosis_comboBox.Text; else if (Option2 == "Procedures") SearchKey2 = SetK_P2_DAP_comboBox.Text; else if (Option2 == "Sex") SearchKey2 = SetK_P2_Sex_comboBox.Text; else if (Option2 == "Relative_marriage") SearchKey2 = SetK_P2_RM_comboBox.Text; else SearchKey2 = SetK_P2_textBox.Text; // ------------------------------------- // Validate Search Keys if (!ValidateData.ValidateSetSearchKey(Option1, SearchKey1) || !Check_IfExist(Option1, SearchKey1)) { if (Option1 == "Diagnose") Error.SetError(SetK_P1_Diagnosis_comboBox, "Please enter valid data"); else if (Option1 == "Procedures") Error.SetError(SetK_P1_DAP_comboBox, "Please enter valid data"); else if (Option1 == "Sex") Error.SetError(SetK_P1_Sex_comboBox, "Please enter valid data"); else if (Option1 == "Relative_marriage") Error.SetError(SetK_P1_RM_comboBox, "Please enter valid data"); else Error.SetError(SetK_P1_textBox, "Please enter valid data"); return; } Error.Clear(); // --------------------------------------- if (!ValidateData.ValidateSetSearchKey(Option2, SearchKey2) || !Check_IfExist(Option2, SearchKey2)) { if (Option2 == "Diagnose") Error.SetError(SetK_P2_Diagnosis_comboBox, "Please enter valid data"); else if (Option2 == "Procedures") Error.SetError(SetK_P2_DAP_comboBox, "Please enter valid data"); else if (Option2 == "Sex") Error.SetError(SetK_P2_Sex_comboBox, "Please enter valid data"); else if (Option2 == "Relative_marriage") Error.SetError(SetK_P2_RM_comboBox, "Please enter valid data"); else Error.SetError(SetK_P2_textBox, "Please enter valid data"); return; } Error.Clear(); #endregion //-------------------------------------------------- // Fetch data using SQL Commands SQLcommand = Get_Set_Search_2P_SQLcommand(Option1, Option2, SearchKey1, SearchKey2); 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(); }
// Search for set of people private void Set_Search_button_Click(object sender, EventArgs e) { String Option = Set_Search_comboBox.Text; String SearchKey, SQLcommand; if (!ValidateData.ValidateComboBoxItem(Option, SearchOptions)) { Error.SetError(Set_Search_comboBox, "Please"); return; } Error.Clear(); if (Option == "Diagnose") SearchKey = Set_Search_Diagnosis_comboBox.Text; else if (Option == "Procedures") SearchKey = Set_Search_Procedures_comboBox.Text; else if (Option == "Sex") SearchKey = Set_Search_Sex_comboBox.Text; else if (Option == "Relative_marriage") SearchKey = Set_Search_RealativeM_comboBox.Text; else SearchKey = Set_Search_Key_textBox.Text; if (!ValidateData.ValidateSetSearchKey(Option, SearchKey) || !Check_IfExist(Option, SearchKey)) { if (Option == "Diagnose") Error.SetError(Set_Search_Diagnosis_comboBox, "Please enter valid data"); else if (Option == "Procedures") Error.SetError(Set_Search_Procedures_comboBox, "Please enter valid data"); else if (Option == "Sex") Error.SetError(Set_Search_Sex_comboBox, "Please enter valid data"); else if (Option == "Relative_marriage") Error.SetError(Set_Search_RealativeM_comboBox, "Please enter valid data"); else Error.SetError(Set_Search_Key_textBox, "Please enter valid data"); return; } Error.Clear(); //////////////////////////////////////////////////////// SQLcommand = Get_Set_Search_SQLcommand(Option, SearchKey); 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(); }
// Search in range with two parameters private void Search_In_Range_2P_button_Click(object sender, EventArgs e) { String Option1 = Search_In_Range_2P_P1_comboBox.Text; String Option2 = Search_In_Range_2P_P2_comboBox.Text; String SearchKeyFROM1, SearchKeyTO1, SearchKeyFROM2, SearchKeyTO2, SQLcommand; #region Data Validation if (!ValidateData.ValidateComboBoxItem(Option1, new List <String> { "Patient_ID", "Age", "Visit_date", "Birth_date", "DMF", "_dmf", "DEF" })) { Error.SetError(Search_In_Range_2P_P1_comboBox, "Please"); return; } Error.Clear(); if (!ValidateData.ValidateComboBoxItem(Option2, new List <String> { "Patient_ID", "Age", "Visit_date", "Birth_date", "DMF", "_dmf", "DEF" })) { Error.SetError(Search_In_Range_2P_P2_comboBox, "Please"); return; } Error.Clear(); if (Option1 == Option2) { MessageBox.Show("Please choose different Search Parameters"); Error.SetError(Search_In_Range_2P_P1_comboBox, "plz"); Error.SetError(Search_In_Range_2P_P2_comboBox, "plz"); return; } Error.Clear(); /////////////////////////////////////////////// SearchKeyFROM1 = Search_IR_2P_P1_from_textBox.Text; SearchKeyTO1 = Search_IR_2P_P1_to_textBox.Text; if (Option1 == "Patient_ID" && (!ValidateData.ValidateIDField(SearchKeyFROM1) || !ValidateData.ValidateIDField(SearchKeyTO1))) { Error.SetError(SIR_2P_P1_SK_Label, "Enter valid ID"); return; } else if (Option1 == "Age" && (!ValidateData.ValidateAge(SearchKeyFROM1) || !ValidateData.ValidateAge(SearchKeyTO1))) { Error.SetError(SIR_2P_P1_SK_Label, "Enter Valid age"); return; } else if (Option1 == "Visit_date" && (!ValidateData.ValidateDate(SearchKeyFROM1) || !ValidateData.ValidateDate(SearchKeyTO1))) { MessageBox.Show("Please enter valid Visit date, ex: 1/2/2002 "); Error.SetError(SIR_2P_P1_SK_Label, "Enter valid visit date"); return; } else if (Option1 == "Birth_date" && (!ValidateData.ValidateDate(SearchKeyFROM1) || !ValidateData.ValidateDate(SearchKeyTO1))) { MessageBox.Show("Please enter valid Birth date, ex: 1/2/2002 "); Error.SetError(SIR_2P_P1_SK_Label, "Enter valid visit date"); return; } else if (Option1 == "DMF" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM1) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO1))) { MessageBox.Show("Please enter valid DMF values"); Error.SetError(SIR_2P_P1_SK_Label, "Enter valid DMF values"); return; } else if (Option1 == "_dmf" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM1) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO1))) { MessageBox.Show("Please enter valid dmf values"); Error.SetError(SIR_2P_P1_SK_Label, "Enter valid DMF values"); return; } else if (Option1 == "DEF" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM1) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO1))) { MessageBox.Show("Please enter valid DEF values"); Error.SetError(SIR_2P_P1_SK_Label, "Enter valid DEF values"); return; } Error.Clear(); // --------------------------------------------------------- SearchKeyFROM2 = Search_IR_2P_P2_from_textBox.Text; SearchKeyTO2 = Search_IR_2P_P2_to_textBox.Text; if (Option2 == "Patient_ID" && (!ValidateData.ValidateIDField(SearchKeyFROM2) || !ValidateData.ValidateIDField(SearchKeyTO2))) { Error.SetError(SIR_2P_P2_SK_Label, "Enter valid ID"); return; } else if (Option2 == "Age" && (!ValidateData.ValidateAge(SearchKeyFROM2) || !ValidateData.ValidateAge(SearchKeyTO2))) { Error.SetError(SIR_2P_P2_SK_Label, "Enter Valid age"); return; } else if (Option2 == "Visit_date" && (!ValidateData.ValidateDate(SearchKeyFROM2) || !ValidateData.ValidateDate(SearchKeyTO2))) { MessageBox.Show("Please enter valid Visit date, ex: 1/2/2002 "); Error.SetError(SIR_2P_P2_SK_Label, "Enter valid visit date"); return; } else if (Option2 == "Birth_date" && (!ValidateData.ValidateDate(SearchKeyFROM2) || !ValidateData.ValidateDate(SearchKeyTO2))) { MessageBox.Show("Please enter valid Birth date, ex: 1/2/2002 "); Error.SetError(SIR_2P_P2_SK_Label, "Enter valid visit date"); return; } else if (Option2 == "DMF" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM2) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO2))) { MessageBox.Show("Please enter valid DMF values"); Error.SetError(SIR_2P_P2_SK_Label, "Enter valid DMF values"); return; } else if (Option2 == "_dmf" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM2) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO2))) { MessageBox.Show("Please enter valid dmf values"); Error.SetError(SIR_2P_P2_SK_Label, "Enter valid DMF values"); return; } else if (Option2 == "DEF" && (!ValidateData.ValidateDoubleSearchKEy(SearchKeyFROM2) || !ValidateData.ValidateDoubleSearchKEy(SearchKeyTO2))) { MessageBox.Show("Please enter valid DEF values"); Error.SetError(SIR_2P_P2_SK_Label, "Enter valid DEF values"); return; } Error.Clear(); #endregion ///////////////////////////////////// // Fetch Data from DB SQLcommand = Get_Search_InRange_2P_SQLcommand(Option1, Option2, SearchKeyFROM1, SearchKeyTO1, SearchKeyFROM2, SearchKeyTO2); 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(); }
// Search for set of people with two parameters private void Set_Search_2P_Button_Click(object sender, EventArgs e) { String Option1 = Set_S_P1_comboBox.Text; String Option2 = Set_S_P2_comboBox.Text; String SearchKey1, SearchKey2, SQLcommand; #region Data Validation //Validate Options if (!ValidateData.ValidateComboBoxItem(Option1, SearchOptions)) { Error.SetError(Set_S_P1_comboBox, "Please"); return; } Error.Clear(); if (!ValidateData.ValidateComboBoxItem(Option2, SearchOptions)) { Error.SetError(Set_S_P2_comboBox, "Please"); return; } Error.Clear(); if (Option1 == Option2) { MessageBox.Show("Please choose different Search Parameters"); Error.SetError(Set_S_P1_comboBox, "plz"); Error.SetError(Set_S_P2_comboBox, "plz"); return; } Error.Clear(); // Get Search Keys Data if (Option1 == "Diagnose") { SearchKey1 = SetK_P1_Diagnosis_comboBox.Text; } else if (Option1 == "Procedures") { SearchKey1 = SetK_P1_DAP_comboBox.Text; } else if (Option1 == "Sex") { SearchKey1 = SetK_P1_Sex_comboBox.Text; } else if (Option1 == "Relative_marriage") { SearchKey1 = SetK_P1_RM_comboBox.Text; } else { SearchKey1 = SetK_P1_textBox.Text; } // ---------------------------------------- if (Option2 == "Diagnose") { SearchKey2 = SetK_P2_Diagnosis_comboBox.Text; } else if (Option2 == "Procedures") { SearchKey2 = SetK_P2_DAP_comboBox.Text; } else if (Option2 == "Sex") { SearchKey2 = SetK_P2_Sex_comboBox.Text; } else if (Option2 == "Relative_marriage") { SearchKey2 = SetK_P2_RM_comboBox.Text; } else { SearchKey2 = SetK_P2_textBox.Text; } // ------------------------------------- // Validate Search Keys if (!ValidateData.ValidateSetSearchKey(Option1, SearchKey1) || !Check_IfExist(Option1, SearchKey1)) { if (Option1 == "Diagnose") { Error.SetError(SetK_P1_Diagnosis_comboBox, "Please enter valid data"); } else if (Option1 == "Procedures") { Error.SetError(SetK_P1_DAP_comboBox, "Please enter valid data"); } else if (Option1 == "Sex") { Error.SetError(SetK_P1_Sex_comboBox, "Please enter valid data"); } else if (Option1 == "Relative_marriage") { Error.SetError(SetK_P1_RM_comboBox, "Please enter valid data"); } else { Error.SetError(SetK_P1_textBox, "Please enter valid data"); } return; } Error.Clear(); // --------------------------------------- if (!ValidateData.ValidateSetSearchKey(Option2, SearchKey2) || !Check_IfExist(Option2, SearchKey2)) { if (Option2 == "Diagnose") { Error.SetError(SetK_P2_Diagnosis_comboBox, "Please enter valid data"); } else if (Option2 == "Procedures") { Error.SetError(SetK_P2_DAP_comboBox, "Please enter valid data"); } else if (Option2 == "Sex") { Error.SetError(SetK_P2_Sex_comboBox, "Please enter valid data"); } else if (Option2 == "Relative_marriage") { Error.SetError(SetK_P2_RM_comboBox, "Please enter valid data"); } else { Error.SetError(SetK_P2_textBox, "Please enter valid data"); } return; } Error.Clear(); #endregion //-------------------------------------------------- // Fetch data using SQL Commands SQLcommand = Get_Set_Search_2P_SQLcommand(Option1, Option2, SearchKey1, SearchKey2); 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(); }
// Search for set of people private void Set_Search_button_Click(object sender, EventArgs e) { String Option = Set_Search_comboBox.Text; String SearchKey, SQLcommand; if (!ValidateData.ValidateComboBoxItem(Option, SearchOptions)) { Error.SetError(Set_Search_comboBox, "Please"); return; } Error.Clear(); if (Option == "Diagnose") { SearchKey = Set_Search_Diagnosis_comboBox.Text; } else if (Option == "Procedures") { SearchKey = Set_Search_Procedures_comboBox.Text; } else if (Option == "Sex") { SearchKey = Set_Search_Sex_comboBox.Text; } else if (Option == "Relative_marriage") { SearchKey = Set_Search_RealativeM_comboBox.Text; } else { SearchKey = Set_Search_Key_textBox.Text; } if (!ValidateData.ValidateSetSearchKey(Option, SearchKey) || !Check_IfExist(Option, SearchKey)) { if (Option == "Diagnose") { Error.SetError(Set_Search_Diagnosis_comboBox, "Please enter valid data"); } else if (Option == "Procedures") { Error.SetError(Set_Search_Procedures_comboBox, "Please enter valid data"); } else if (Option == "Sex") { Error.SetError(Set_Search_Sex_comboBox, "Please enter valid data"); } else if (Option == "Relative_marriage") { Error.SetError(Set_Search_RealativeM_comboBox, "Please enter valid data"); } else { Error.SetError(Set_Search_Key_textBox, "Please enter valid data"); } return; } Error.Clear(); //////////////////////////////////////////////////////// SQLcommand = Get_Set_Search_SQLcommand(Option, SearchKey); 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(); }