public Search_Result(String SQLCOMMAND)
 {
     InitializeComponent();
     sqlCommand = SQLCOMMAND;
     ShowForm = true;
     BS = new BindingSource();
     myDSC = new DataSourceConnection();
     ViewData();
 }
 public Statistics()
 {
     InitializeComponent();
     ValidateData = new Data_Validator();
     Stats = new DCEntities();
     Error = new ErrorProvider();
     BS = new BindingSource();
     con = new DataSourceConnection();
     IntializeComboboxes();
 }
 public Edit_Patient(int Patient_ID, int Age, String Patient_Name, String Home_no, String Mobile_no, String Address, String Cheif_comp, String Medical_Alr,
     String Comments, String Sex, String RelativeMarriage, DateTime VisitDate, DateTime BirthDate, byte[] PatientPhoto, List<Bitmap> xray_images, List<String> xrayimagesNames,
     Double D, Double M, Double F, Double d, Double m, Double f, Double _D, Double E, Double _F, List<List<String>> DiagnosisAndTPs_table, List<List<String>> DatesAndProc_table)
 {
     InitializeComponent();
     EPatient_ID = Patient_ID;
     EAge = Age;
     EPatient_Name = Patient_Name;
     EHome_no = Home_no;
     EMobile_no = Mobile_no;
     EAddress = Address;
     ECheif_comp = Cheif_comp;
     EMedical_Alr = Medical_Alr;
     EComments = Comments;
     ESex = Sex;
     ERelativeMarriage = RelativeMarriage;
     EVisitDate = VisitDate;
     EBirthDate = BirthDate;
     EPatientPhoto = PatientPhoto;
     Xray_images = xray_images;
     XrayimagesNames = xrayimagesNames;
     ED = D;
     EM = M;
     EF = F;
     Ed = d;
     Em = m;
     Ef = f;
     E_D = _D;
     EE = E;
     E_F = _F;
     ID = EPatient_ID;
     this.Name = "Edit " + EPatient_Name + " Profile";
     EDiagnosisAndTPs_table = DiagnosisAndTPs_table;
     EDatesAndProc_table = DatesAndProc_table;
     Patient_Xray_images = new List<Bitmap>();
     XrayImagesNames = new List<String>();
     con = new DataSourceConnection();
     BS = new BindingSource();
     ValidateData = new Data_Validator();
     Error = new ErrorProvider();
     DataUpdater = new DCEntities();
     Patient = new Patient_info();
     Updated_DiagnosisAndTPs_table = new List<List<String>>();
     Updated_DatesAndProc_table = new List<List<String>>();
     DiagnosisAndTPsIsChanged = false;
     DatesAndProceduresIsChanged = false;
     DiagnosisAndTPsIsPressed = false;
     DatesAndProceduresIsPressed = false;
     AddnewXrayImagesIsPressed = false;
     AddnewPatient_saveAndConfirm_button.Visible = false;
     AddNewPatientSaveAndConfirmIsPressed = false;
     XrayViewerImageIndex = 0;
     IntializeComboBoxes();
     FillFormData();
 }
 public Database_Browser()
 {
     InitializeComponent();
     this.Text = "Database Browser";
     cont = new DCEntities();
     myDSconnection = new DataSourceConnection();
     newBS = new BindingSource();
     NumberOfPatients = (from P in Login_Form.context.Patient_info select P).Count();
     NormalConnection();
     DataSourceCon("SELECT * FROM Patient_info");
 }
 public Search()
 {
     InitializeComponent();
     SearchContext = new DCEntities();
     Patient = new Patient_info();
     Diagnose = new Diagnosis();
     Date = new Date();
     con = new DataSourceConnection();
     BS = new BindingSource();
     ValidateData = new Data_Validator();
     Error = new ErrorProvider();
     TableNames = new Dictionary<String, String>();
     SearchOptions = new List<String>();
     
     IntializeLists();
 }
 public Add_new_Patient()
 {
     InitializeComponent();
     Patient_Xray_images = new List<Bitmap>();
     Diagnosis = new List<String>();
     Treatment_plans = new List<String>();
     XrayImagesNames = new List<String>();
     Con = new DataSourceConnection();
     BSS = new BindingSource();
     Check = new DataTable();
     ValidateData = new Data_Validator();
     Error = new ErrorProvider();
     DataEntiry = new DCEntities();
     DiagnosisAndTP_DataValidation = false;
     DatesAndProc_DataValidation = false;
     NewPatientWasAdded = false;
     AddnewPatient_saveAndConfirm_button.Visible = false;
     FillComboBoxes();
 }
        // Check if Search key is exist
        private bool Check_IfExist(String Option, String SearchKey)
        {
            DataSourceConnection Check = new DataSourceConnection();
            DataTable _Check = new DataTable();
            if (Option == "Diagnose")
            {

                _Check = Check.GetData("Select Diagnose from Diagnosis where Diagnose LIKE '%" + SearchKey + "%'");
                
                if (_Check.Rows.Count == 0)
                {
                    MessageBox.Show("This Diagnose is not exist on your database");
                    return false;
                }

            }
            else if (Option == "Procedures")
            {
                _Check = Check.GetData("Select Procedures from Dates where Procedures LIKE '%" + SearchKey + "%'");
                if (_Check.Rows.Count == 0)
                {
                    MessageBox.Show("This Procedure is not exist on your database");
                    return false;
                }
            }
            if (Option == "Visit_date")
            {
                DateTime temp = DateTime.Parse(SearchKey);
                if (!SearchContext.Patient_info.Any(i => i.Visit_date == temp))
                {
                    MessageBox.Show("This Visit date is not exist on your database");
                    return false;
                }
            }
            else if (Option == "Doctor_name")
            {
                _Check = Check.GetData("Select Doctor_name from Dates where Doctor_name LIKE '%" + SearchKey + "%'");
                if (_Check.Rows.Count == 0)
                {
                    MessageBox.Show("This Doctor Name is not exist on your database");
                    return false;
                }
            }
            else if (Option == "Sex")
            {
                if (!SearchContext.Patient_info.Any(i => i.Sex == SearchKey))
                {
                    MessageBox.Show("This Sex is not exist on your database");
                    return false;
                }
            }
            else if (Option == "Relative_marriage")
            {
                if (!SearchContext.Patient_info.Any(i => i.Relative_marriage == SearchKey))
                {
                    MessageBox.Show("This Relative Marriage is not exist on your database");
                    return false;
                }
            }
            else if (Option == "Patient_name")
            {
                _Check = Check.GetData("Select Patient_name from Patient_info where Patient_name LIKE '%" + SearchKey + "%'");
                if (_Check.Rows.Count == 0)
                {
                    MessageBox.Show("This Patient Name is not exist on your database");
                    return false;
                }
            }
            else if (Option == "Age")
            {
                int temp = Int32.Parse(SearchKey);
                if (!SearchContext.Patient_info.Any(i => i.Age == temp))
                {
                    MessageBox.Show("This Age is not exist on your database");
                    return false;
                }
            }
            return true;

        }