private void PatientAssesment_Load(object sender, EventArgs e)
        {
            
            DatabaseConnector dc = new DatabaseConnector();
            dictionary = createGetPatientDictionary(PatientAssesmentPatientId);
            dtPatient = dc.getData("GetPatient", dictionary);
            label11.Text = dtPatient.Rows[0][0].ToString();

            String regDate = dtPatient.Rows[0][1].ToString();
            DateTime dte1 = Convert.ToDateTime(regDate);
            label13.Text = dte1.Year.ToString() + "-" + dte1.Month + "-" + dte1.Day;
           
            label5.Text = dtPatient.Rows[0][2].ToString();
            label4.Text = dtPatient.Rows[0][3].ToString();

            String dob = dtPatient.Rows[0][4].ToString();
            DateTime dte2 = Convert.ToDateTime(dob);
            label8.Text = dte2.Year.ToString() + "-" + dte2.Month + "-" + dte2.Day;

            label9.Text = dtPatient.Rows[0][5].ToString();
            textBox1.Enabled = false;
            txt_cheifcomplaint.Enabled = false;

           this.getPatientEMRDatesTableAdapter.Fill(dataSetGetEMRDatesIntoComboBox.GetPatientEMRDates, patid);
        }
        private void getAllDoctors(String Date) {
            Dictionary<String, String> param = new Dictionary<string, string>();
            param.Add("date", Date);
            DatabaseConnector dconn = new DatabaseConnector();
            doctors = dconn.getData("getAllDoctor2", param);

            cmbDoctor.DataSource = doctors;
            cmbDoctor.DisplayMember = "doctorName";
            cmbDoctor.ValueMember = "doctorID";
        }
 public void addToSchedule(String ScheduleID, String DoctorID, String DoctorName, String Date, String PatientID, String LastName, String FirstName)
 {
     Dictionary<String, String> param = new Dictionary<string, string>();
     param.Add("scheduleID", ScheduleID);
     param.Add("doctorID", DoctorID);
     param.Add("doctorName", DoctorName);
     param.Add("date", Date);
     param.Add("patientID", PatientID);
     param.Add("lastName", LastName);
     param.Add("firstName", FirstName);
     DatabaseConnector dconn = new DatabaseConnector();
     DataTable result = dconn.getData("addToSchedule", param);
 }
Example #4
0
        public Dictionary<String, String> getEmployee(String employeeID)
        {
            Dictionary<String, String> param = new Dictionary<string, string>();
            param.Add("employeeID", employeeID);
            DatabaseConnector dconn = new DatabaseConnector();
            DataTable results = dconn.getData("getEmployeeByID", param);

            Dictionary<String, String> r = new Dictionary<string, string>();
            r.Add("userName", results.Rows[0]["userName"].ToString());
            r.Add("role", results.Rows[0]["role"].ToString());
            r.Add("firstName", results.Rows[0]["firstName"].ToString());
            r.Add("lastName", results.Rows[0]["lastName"].ToString());
            r.Add("gender", results.Rows[0]["gender"].ToString());
            return r;
        }
Example #5
0
        private void ScheduleList_Load(object sender, EventArgs e)
        {
            lblDoctorID.Text = doctorID.ToString();
            lblDoctorName.Text = doctorName;

            dc = new DatabaseConnector();

            dictionary = createDoctorDayScheduleDictionary(today, doctorID.ToString());
            dtSchedule = createGetDoctorDaySchedule(dictionary);

    
 
     dataGridView1.DataSource = dtSchedule;

           
        }
        private void AddtoDoctorList_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dataSetGetAllDoctor.GetAllDoctor' table. You can move, or remove it, as needed.
            dc = new DatabaseConnector();
           
            dictionary1 = createPatientDictionary(patientID.ToString());
            dictionary2 = createDoctorNameDictionary(today);
            
            
            
            dtPatient = createGetPatient(dictionary1);
            dtDoctorName = createGetDoctorName(dictionary2);

          
        


            lblPatientID.Text = dtPatient.Rows[0][0].ToString();

            String regDate = dtPatient.Rows[0][1].ToString();
            DateTime dte1 = Convert.ToDateTime(regDate);
            lblRegistedDate.Text = dte1.Year.ToString() + "-" + dte1.Month + "-" + dte1.Day;
            
            lblLName.Text = dtPatient.Rows[0][2].ToString();
            lblFName.Text = dtPatient.Rows[0][3].ToString();

            String dob  = dtPatient.Rows[0][4].ToString();
            DateTime dte2 = Convert.ToDateTime(dob);
            lblDOB.Text = dte2.Year.ToString() + "-" + dte2.Month + "-" + dte2.Day;
           
            lblGender.Text = dtPatient.Rows[0][5].ToString();

            label1.Text = "Date: " + System.DateTime.Today.ToShortDateString();

           for (int i = 0; i < dtDoctorName.Rows.Count; i++)
           comboBox1.Items.Add(dtDoctorName.Rows[i][0].ToString());

            
            


        }
Example #7
0
        public void addEmployee(String UserName, String Password, String HireDate, String Role, String FirstName, String LastName, String DateOfBirth, String Gender)
        {
            // error checking needed
            if (String.IsNullOrEmpty(UserName))
            {
                throw new System.ArgumentNullException("User Name");
            }
            else if (String.IsNullOrEmpty(Password))
            {
                throw new System.ArgumentNullException("Password");
            }
            if (String.IsNullOrEmpty(Role))
            {
                throw new System.ArgumentNullException("Role");
            }
            else if (String.IsNullOrEmpty(FirstName))
            {
                throw new System.ArgumentNullException("First Name");
            }
            else if (String.IsNullOrEmpty(FirstName))
            {
                throw new System.ArgumentNullException("Last Name");
            }
            else
            {
                Password = Encrypt.MD5(Password);

                Dictionary<String, String> param = new Dictionary<string, string>();
                param.Add("userName", UserName);
                param.Add("password", Password);
                param.Add("hireDate", HireDate);
                param.Add("role", Role);
                param.Add("firstName", FirstName);
                param.Add("lastName", LastName);
                param.Add("dateOfBirth", DateOfBirth);
                param.Add("gender", Gender);

                DatabaseConnector dconn = new DatabaseConnector();
                DataTable results = dconn.getData("addEmployee", param);
            }
        }
Example #8
0
        public void Login(String UserName, String Password)
        {
            if (String.IsNullOrEmpty(UserName))
            {
                throw new System.ArgumentNullException("UserName");
            }
            else if (String.IsNullOrEmpty(Password))
            {
                throw new System.ArgumentNullException("Password");
            }
            else {
                Password = Encrypt.MD5(Password);

                Dictionary<String, String> param = new Dictionary<string,string>();
                param.Add("userName", UserName);
                DatabaseConnector dconn = new DatabaseConnector();
                DataTable result = dconn.getData("getEmployeeByUser", param);

                if (result.Rows.Count == 1)
                {
                    String p = result.Rows[0]["password"].ToString();
                    if (Object.Equals(p, Password))
                    {
                        ID = (int)result.Rows[0]["employeeID"];
                        Role = (int)result.Rows[0]["role"];
                        FirstName = result.Rows[0]["firstName"].ToString();
                        LastName = result.Rows[0]["lastName"].ToString();
                    }
                    else
                    {
                        throw new System.ArgumentException("Passwords do not match.");
                    }
                }
                else
                {
                    throw new System.ArgumentException("UserName does not exist in system.");
                }
            }
        }
Example #9
0
        private void ViewPatientEMR_Load(object sender, EventArgs e)
        {
            //userControlGetPatientDetails1.mygetPatientId(viewEMRPatientId);
            // TODO: This line of code loads data into the 'gibersonDataSet2.GetAllAllergies' table. You can move, or remove it, as needed.
            //this.getAllAllergiesTableAdapter.Fill(this.gibersonDataSet2.GetAllAllergies);
            // TODO: This line of code loads data into the 'gibersonDataSet.Patient' table. You can move, or remove it, as needed.
            //UserControlGetPatientDetails userControl = new UserControlGetPatientDetails();
            //userControl.usercontrolPatientId=viewEMRPatientId;
            rdId.Hide();
            rdName.Hide();
            rdTime.Hide();
            
            label1.Text = viewEMRPatientId;
            patId = int.Parse(viewEMRPatientId);
            ViewPatientRadiologyGridView.Hide();

            dictionary= createPatientDictionary(patId.ToString());
            dc = new DatabaseConnector();
            dtPatient = createGetPatient(dictionary);
            
            label11.Text=dtPatient.Rows[0][0].ToString();

            String regDate = dtPatient.Rows[0][1].ToString();
            DateTime dte1 = Convert.ToDateTime(regDate);
            registedDate.Text = dte1.Year.ToString() + "-" + dte1.Month + "-" + dte1.Day;
            
            label5.Text = dtPatient.Rows[0][2].ToString();
            label4.Text = dtPatient.Rows[0][3].ToString();

            String sourceDateText = dtPatient.Rows[0][4].ToString();
            DateTime dte = Convert.ToDateTime(sourceDateText);
            sourceDateText = dte.Year.ToString() + "-" + dte.Month + "-" + dte.Day;

            label8.Text = sourceDateText;
            label9.Text = dtPatient.Rows[0][5].ToString(); 
         

        }
        public DataTable getPatientEMRAccordingToDate(Dictionary <String, String> dict, DatabaseConnector conn)
        {
            DataTable dataTable;

            dataTable = conn.getData("GetPatientEMRAccordingToDate", dict);
            return(dataTable);
        }
Example #11
0
        private void ViewDemography_Load(object sender, EventArgs e)
        {
            dictionary = createDictionary(patientId.ToString());

            dc = new DatabaseConnector();

            dtPatient         = dc.getData("GetPatient", dictionary);
            dtPatientEmail    = dc.getData("GetPatientEmail", dictionary);
            dtPatientAddress  = dc.getData("GetPatientAddress", dictionary);
            dtPatientPhone    = dc.getData("GetPatientPhone", dictionary);
            dtReferenceDoctor = dc.getData("GetPatientDoctor", dictionary);
            dtAllergy         = dc.getData("GetAllery", dictionary);
            dtInsurance       = dc.getData("GetPatientOHIPInsurance", dictionary);

            lblLastName.Text  = dtPatient.Rows[0][2].ToString();
            lblFirstName.Text = dtPatient.Rows[0][3].ToString();
            string   dob = dtPatient.Rows[0][4].ToString();
            DateTime dt  = Convert.ToDateTime(dob);

            dob               = dt.Year.ToString() + "-" + dt.Month + "-" + dt.Day;
            lblDOB.Text       = dob;
            lblGender.Text    = dtPatient.Rows[0][5].ToString();
            lblPatientID.Text = patientId.ToString();


            if (try1() != 0)
            {
                lblReferralDoctor.Text = dtReferenceDoctor.Rows[0][2].ToString();
                lblBillingCode.Text    = dtReferenceDoctor.Rows[0][1].ToString();
            }

            if (try2() != 0)
            {
                lblAllergyName.Text     = dtAllergy.Rows[0][1].ToString();
                lblAllergyCategory.Text = dtAllergy.Rows[0][2].ToString();
            }

            lblInsNo.Text = dtInsurance.Rows[0][2].ToString() + " " + dtInsurance.Rows[0][3].ToString();

            string   date = dtInsurance.Rows[0][4].ToString();
            DateTime edt  = Convert.ToDateTime(date);

            date            = edt.Year.ToString() + "-" + edt.Month + "-" + edt.Day;
            lblExpDate.Text = date;

            if (try3() != 0)
            {
                lblAddressType.Text = dtPatientAddress.Rows[0][2].ToString();
                lblAddress.Text     = dtPatientAddress.Rows[0][3].ToString();
                lblCity.Text        = dtPatientAddress.Rows[0][4].ToString();
                lblProvince.Text    = dtPatientAddress.Rows[0][5].ToString();
                lblPostalCode.Text  = dtPatientAddress.Rows[0][6].ToString();
            }

            if (try4() != 0)
            {
                lblPhone.Text     = dtPatientPhone.Rows[0][3].ToString();
                lblPhoneType.Text = dtPatientPhone.Rows[0][2].ToString();
            }

            if (try5() != 0)
            {
                lblEmailType.Text = dtPatientEmail.Rows[0][2].ToString();
                lblEmail.Text     = dtPatientEmail.Rows[0][3].ToString();
            }
        }
Example #12
0
        private void ViewDemography_Load(object sender, EventArgs e)
        {
            dictionary = createDictionary(patientId.ToString());

            dc = new DatabaseConnector();

            dtPatient = dc.getData("GetPatient", dictionary);
            dtPatientEmail = dc.getData("GetPatientEmail", dictionary);
            dtPatientAddress = dc.getData("GetPatientAddress", dictionary);
            dtPatientPhone = dc.getData("GetPatientPhone", dictionary);
            dtReferenceDoctor = dc.getData("GetPatientDoctor", dictionary);
            dtAllergy = dc.getData("GetAllery", dictionary);
            dtInsurance = dc.getData("GetPatientOHIPInsurance", dictionary);

            lblLastName.Text = dtPatient.Rows[0][2].ToString();
            lblFirstName.Text = dtPatient.Rows[0][3].ToString();
            string dob = dtPatient.Rows[0][4].ToString();
            DateTime dt = Convert.ToDateTime(dob);
            dob = dt.Year.ToString() + "-" + dt.Month + "-" + dt.Day;
            lblDOB.Text = dob;
            lblGender.Text = dtPatient.Rows[0][5].ToString();
            lblPatientID.Text = patientId.ToString();


            if (try1() != 0)
            {
                lblReferralDoctor.Text = dtReferenceDoctor.Rows[0][2].ToString();
                lblBillingCode.Text = dtReferenceDoctor.Rows[0][1].ToString();
            }

            if (try2() != 0)
            {

                lblAllergyName.Text = dtAllergy.Rows[0][1].ToString();
                lblAllergyCategory.Text = dtAllergy.Rows[0][2].ToString();
            }

            lblInsNo.Text = dtInsurance.Rows[0][2].ToString() + " " + dtInsurance.Rows[0][3].ToString();

            string date = dtInsurance.Rows[0][4].ToString();
            DateTime edt = Convert.ToDateTime(date);
            date = edt.Year.ToString() + "-" + edt.Month + "-" + edt.Day;
            lblExpDate.Text = date;

            if (try3() != 0)
            {
                lblAddressType.Text = dtPatientAddress.Rows[0][2].ToString();
                lblAddress.Text = dtPatientAddress.Rows[0][3].ToString();
                lblCity.Text = dtPatientAddress.Rows[0][4].ToString();
                lblProvince.Text = dtPatientAddress.Rows[0][5].ToString();
                lblPostalCode.Text = dtPatientAddress.Rows[0][6].ToString();
            }

            if (try4() != 0)
            {
                lblPhone.Text = dtPatientPhone.Rows[0][3].ToString();
                lblPhoneType.Text = dtPatientPhone.Rows[0][2].ToString();
            }

            if (try5() != 0)
            {
                lblEmailType.Text = dtPatientEmail.Rows[0][2].ToString();
                lblEmail.Text = dtPatientEmail.Rows[0][3].ToString();
            }

        }
Example #13
0
        public void editEmployee(String employeeID, String UserName, String Password, String Role, String FirstName, String LastName, String Gender)
        {
            // more error checking needed
            if (String.IsNullOrEmpty(employeeID))
            {
                throw new System.ArgumentNullException("employeeID");
            }
            else if (String.IsNullOrEmpty(UserName))
            {
                throw new System.ArgumentNullException("User Name");
            }
            else if (String.IsNullOrEmpty(Password))
            {
                throw new System.ArgumentNullException("Password");
            }
            if (String.IsNullOrEmpty(Role))
            {
                throw new System.ArgumentNullException("Role");
            }
            else if (String.IsNullOrEmpty(FirstName))
            {
                throw new System.ArgumentNullException("First Name");
            }
            else if (String.IsNullOrEmpty(FirstName))
            {
                throw new System.ArgumentNullException("Last Name");
            }
            else
            {
                Dictionary<String, String> param = new Dictionary<string, string>();
                param.Add("employeeID", employeeID);
                param.Add("userName", UserName);
                param.Add("role", Role);
                param.Add("firstName", FirstName);
                param.Add("lastName", LastName);
                param.Add("gender", Gender);

                DatabaseConnector dconn = new DatabaseConnector();
                DataTable results = dconn.getData("editEmployee", param);

                if (!String.IsNullOrEmpty(Password))
                {
                    Password = Encrypt.MD5(Password);

                    param = new Dictionary<string, string>();
                    param.Add("employeeID", employeeID);
                    param.Add("password", Password);

                    dconn = new DatabaseConnector();
                    results = dconn.getData("editEmployeePassword", param);
                }
            }
        }
Example #14
0
        private void btnAddRecord_Click(object sender, EventArgs e)
        {
            bool DOB_valid;
            bool exp_valid;
            bool pass = false;

            //check whether Insurance numer exits
            dictionary = new Dictionary <string, string>();
            dictionary.Add("@insuranceNumber", txtInsuranceNumber.Text);
            dc          = new DatabaseConnector();
            dtInsurance = dc.getData("CheckInsuranceExists", dictionary);
            int ins_exist = int.Parse(dtInsurance.Rows[0][0].ToString());

            //create new patient
            Patient patient = new Patient();

            patient.firstName = txtFirstName.Text;
            patient.lastName  = txtLastName.Text;
            patient.dob       = txtDOB.Text;
            patient.gender    = cmbxGender.GetItemText(cmbxGender.SelectedItem);

            //create new insurance
            Insurance insurance = new Insurance();

            insurance.timestamp   = System.DateTime.Today.ToShortDateString();
            insurance.insNumber   = txtInsuranceNumber.Text;
            insurance.versionCode = txtVersionCode.Text;
            insurance.expDate     = txtInsuranceExpDate.Text;

            //create new allergy
            Allergy allergy = new Allergy();

            allergy.name     = txtAllergyName.Text;
            allergy.category = txtAllergyCatergory.Text;

            //create new allergy-patient
            PatientAllergy ptAllgergy = new PatientAllergy();

            //
            Doctor doctor = new Doctor();

            doctor.billingCode = txtDoctorBillingCode.Text;
            doctor.name        = txtReferralDoctor.Text;

            //
            ReferralDoctor refDoctor = new ReferralDoctor();


            //ins number : number only
            //ins vc : character only
            //no blank: name, dob

            Phone phone = new Phone();

            phone.type        = cmbxPhoneType.GetItemText(cmbxPhoneType.SelectedItem);
            phone.phoneNumber = txtPhoneNumber.Text;

            Email email = new Email();

            email.type  = cmbxEmailType.GetItemText(cmbxEmailType.SelectedItem);
            email.email = txtEmail.Text;

            Address address = new Address();

            address.type       = cmbxAddressType.GetItemText(cmbxAddressType.SelectedItem);
            address.address    = txtAddress.Text;
            address.city       = txtCity.Text;
            address.province   = txtProvince.Text;
            address.postalCode = txtPostalCode.Text;

            DOB_valid = DOB_validation();
            exp_valid = exp_validation();

            if (DOB_valid == true && exp_valid == true && ins_exist == 0 && txtInsuranceNumber.TextLength == 10)
            {
                pass = true;
            }

            if (pass == true)
            {
                insertPatient(patient);

                patient.patientID   = getPtIdfromPatienTbl();
                insurance.patientID = patient.patientID;
                phone.patientID     = patient.patientID;
                email.patientID     = patient.patientID;
                address.patientID   = patient.patientID;


                insertInsurance(insurance);

                if (txtAllergyCatergory.Text != "" && txtAllergyName.Text != "")
                {
                    if (getAllergyIdfromAllergyTbl1() != 0)
                    {
                        ptAllgergy.patientId = patient.patientID;
                        ptAllgergy.allergyId = getAllergyIdfromAllergyTbl1();
                        insertPatientAllergy(ptAllgergy);
                    }
                    else
                    {
                        insertAllergy(allergy);
                        ptAllgergy.patientId = patient.patientID;
                        ptAllgergy.allergyId = getAllergyIdfromAllergyTbl2();
                        insertPatientAllergy(ptAllgergy);
                    }
                }

                if (txtPhoneNumber.Text != "")
                {
                    insertPhone(phone);
                }
                if (txtAddress.Text != "")
                {
                    insertAdress(address);
                }
                if (txtEmail.Text != "")
                {
                    insertEmail(email);
                }

                if (txtReferralDoctor.Text != "")
                {
                    refDoctor.patientID = patient.patientID;
                    refDoctor.doctorID  = getDoctorIdfromDoctorTbl1();
                    insertReferralDoctor(refDoctor);
                }

                /*   if (txtDoctorBillingCode.Text != "" && txtReferralDoctor.Text != "")
                 * {
                 *
                 *     if (getDoctorIdfromDoctorTbl1() != 0)
                 *     {
                 *         refDoctor.patientID = patient.patientID;
                 *         refDoctor.doctorID = getDoctorIdfromDoctorTbl1();
                 *         insertReferralDoctor(refDoctor);
                 *     }
                 *     else
                 *     {
                 *         insertDoctor(doctor);
                 *         refDoctor.patientID = patient.patientID;
                 *         refDoctor.doctorID = getDoctorIdfromDoctorTbl2();
                 *         insertReferralDoctor(refDoctor);
                 *     }
                 * }*/



                clearText();
                MessageBox.Show("Patient was registed");
                DialogResult result = MessageBox.Show("Go to patient demography?", "Patient registed", MessageBoxButtons.OKCancel,
                                                      MessageBoxIcon.Question);

                if (result == DialogResult.OK)
                {
                    this.Hide();
                    ViewDemography viewDemo = new ViewDemography();
                    viewDemo.patientId = patient.patientID;
                    viewDemo.Show();
                }
                else if (result == DialogResult.Cancel)
                {
                    this.Close();
                }
            }

            else if (txtInsuranceNumber.TextLength != 10)   //number incorrect of left blank
            {
                MessageBox.Show("Please insert correct insurance number");
            }
            else if (ins_exist != 0)
            {
                MessageBox.Show("Insurance Number already exists");
            }
            else if (DOB_valid == false)
            {
                MessageBox.Show("D.O.B not valid");
            }

            else if (exp_valid == false)
            {
                MessageBox.Show("Insurance Expiry Date not valid");
            }
        }
Example #15
0
 public void getEmployees()
 {
     Dictionary<String, String> param = new Dictionary<string,string>();
     DatabaseConnector dconn = new DatabaseConnector();
     EmployeeTable = dconn.getData("getEmployees", param);
 }
Example #16
0
 public void deleteEmployee(String employeeID)
 {
     if (String.IsNullOrEmpty(employeeID))
     {
         throw new System.ArgumentNullException("employeeID");
     }
     else
     {
         Dictionary<String, String> param = new Dictionary<string, string>();
         param.Add("employeeID", employeeID);
         DatabaseConnector dconn = new DatabaseConnector();
         DataTable results = dconn.getData("deleteEmployee", param);
     }
 }
        private void CreateDemForm_Load(object sender, EventArgs e)
        {
           
            
            dictionary = new Dictionary<string, string>();
            dictionary.Add("@patientId", patientId.ToString());
            
            dc = new DatabaseConnector();
            dtPatient = dc.getData("GetPatient", dictionary);
            dtPatientEmail = dc.getData("GetPatientEmail", dictionary);
            dtPatientAddress = dc.getData("GetPatientAddress", dictionary);
            dtPatientPhone = dc.getData("GetPatientPhone", dictionary);
            dtReferenceDoctor = dc.getData("GetPatientDoctor", dictionary);
            dtAllergy = dc.getData("GetAllery", dictionary);
            dtPatientAddress = dc.getData("GetPatientAddress", dictionary);
            dtInsurance = dc.getData("GetPatientOHIPInsurance", dictionary);
        
            txtLname.Text = dtPatient.Rows[0][2].ToString();
            txtFname.Text = dtPatient.Rows[0][3].ToString();
            string sourceDateTex = dtPatient.Rows[0][4].ToString();
            DateTime dt = Convert.ToDateTime(sourceDateTex);
            sourceDateTex = dt.Year.ToString() + "-" + dt.Month + "-" + dt.Day;
            patDob.Text = sourceDateTex;
            cmbGender.Text = dtPatient.Rows[0][5].ToString();

            txtRefDoctor.Text = dtReferenceDoctor.Rows[0][0].ToString();
            txtBillingCode.Text = dtReferenceDoctor.Rows[0][1].ToString();

            txtAlergyName.Text = dtAllergy.Rows[0][1].ToString();
            txtAlergyCategory.Text = dtAllergy.Rows[0][2].ToString();

            txtInsNum.Text = dtInsurance.Rows[0][2].ToString();
            txtInsVersion.Text = dtInsurance.Rows[0][3].ToString();

            string sourceDateText = dtInsurance.Rows[0][4].ToString(); 
            DateTime dte = Convert.ToDateTime(sourceDateText);
            sourceDateText = dte.Year.ToString() + "-" + dte.Month + "-" + dte.Day;
            txtExpDate.Text = sourceDateText;
          

            cmbAddType.Text=dtPatientAddress.Rows[0][2].ToString();
            txtAdd.Text=dtPatientAddress.Rows[0][3].ToString();
            txtCity.Text = dtPatientAddress.Rows[0][4].ToString();
            txtProvince.Text = dtPatientAddress.Rows[0][5].ToString();
            txtPostalCode.Text = dtPatientAddress.Rows[0][6].ToString();
            txtCountry.Text = dtPatientAddress.Rows[0][7].ToString();

            txtPhone.Text=dtPatientPhone.Rows[0][3].ToString();
            cmbPhoneType.Text = dtPatientPhone.Rows[0][2].ToString();
            
           

            txtEmail.Text = dtPatientEmail.Rows[0][3].ToString();
            cmbEmailType.Text = dtPatientEmail.Rows[0][2].ToString();
           
            

        }
Example #18
0
        private void btnAddRecord_Click(object sender, EventArgs e)
        {
            bool DOB_valid;
            bool exp_valid;
            bool pass=false;

            //check whether Insurance numer exits
            dictionary = new Dictionary<string, string>();
            dictionary.Add("@insuranceNumber", txtInsuranceNumber.Text);
            dc = new DatabaseConnector();
            dtInsurance = dc.getData("CheckInsuranceExists", dictionary);
            int ins_exist = int.Parse(dtInsurance.Rows[0][0].ToString());

            //create new patient
            Patient patient = new Patient();
            patient.firstName = txtFirstName.Text;
            patient.lastName = txtLastName.Text;
            patient.dob = txtDOB.Text;
            patient.gender = cmbxGender.GetItemText(cmbxGender.SelectedItem);

            //create new insurance
            Insurance insurance = new Insurance();
            insurance.timestamp = System.DateTime.Today.ToShortDateString();
            insurance.insNumber = txtInsuranceNumber.Text;
            insurance.versionCode = txtVersionCode.Text;
            insurance.expDate = txtInsuranceExpDate.Text;

            //create new allergy
            Allergy allergy = new Allergy();
            allergy.name = txtAllergyName.Text;
            allergy.category = txtAllergyCatergory.Text;

            //create new allergy-patient
            PatientAllergy ptAllgergy = new PatientAllergy();

            //
            Doctor doctor = new Doctor();
            doctor.billingCode = txtDoctorBillingCode.Text;
            doctor.name = txtReferralDoctor.Text;

            //
            ReferralDoctor refDoctor = new ReferralDoctor();

                    
            //ins number : number only
            //ins vc : character only
            //no blank: name, dob

            Phone phone = new Phone();
            phone.type = cmbxPhoneType.GetItemText(cmbxPhoneType.SelectedItem);
            phone.phoneNumber = txtPhoneNumber.Text;

            Email email = new Email();
            email.type = cmbxEmailType.GetItemText(cmbxEmailType.SelectedItem);
            email.email = txtEmail.Text;

            Address address = new Address();
            address.type = cmbxAddressType.GetItemText(cmbxAddressType.SelectedItem);
            address.address = txtAddress.Text;
            address.city = txtCity.Text;
            address.province = txtProvince.Text;
            address.postalCode = txtPostalCode.Text;

            DOB_valid = DOB_validation();
            exp_valid = exp_validation();

            if (DOB_valid == true && exp_valid == true && ins_exist == 0 && txtInsuranceNumber.TextLength == 10)
            {
                pass = true;
            }

              if (pass == true )
              {
                  insertPatient(patient);

                  patient.patientID = getPtIdfromPatienTbl();
                  insurance.patientID = patient.patientID;
                  phone.patientID = patient.patientID;
                  email.patientID = patient.patientID;
                  address.patientID = patient.patientID;
                  

                  insertInsurance(insurance);

                  if (txtAllergyCatergory.Text != "" && txtAllergyName.Text != "")
                  {

                      if (getAllergyIdfromAllergyTbl1() != 0)
                      {
                          ptAllgergy.patientId = patient.patientID;
                          ptAllgergy.allergyId = getAllergyIdfromAllergyTbl1();
                          insertPatientAllergy(ptAllgergy);
                      }
                      else
                      {
                          insertAllergy(allergy);
                          ptAllgergy.patientId = patient.patientID;
                          ptAllgergy.allergyId = getAllergyIdfromAllergyTbl2();
                          insertPatientAllergy(ptAllgergy);
                      }
                  }
                    
                  if (txtPhoneNumber.Text != "")
                  insertPhone(phone);
                  if (txtAddress.Text != "")
                  insertAdress(address);
                  if (txtEmail.Text != "")
                  insertEmail(email);

                  if (txtReferralDoctor.Text != "")
                  {
                      refDoctor.patientID = patient.patientID;
                      refDoctor.doctorID = getDoctorIdfromDoctorTbl1();
                      insertReferralDoctor(refDoctor);
                  }

               /*   if (txtDoctorBillingCode.Text != "" && txtReferralDoctor.Text != "")
                  {

                      if (getDoctorIdfromDoctorTbl1() != 0)
                      {
                          refDoctor.patientID = patient.patientID;
                          refDoctor.doctorID = getDoctorIdfromDoctorTbl1();
                          insertReferralDoctor(refDoctor);
                      }
                      else
                      {
                          insertDoctor(doctor);
                          refDoctor.patientID = patient.patientID;
                          refDoctor.doctorID = getDoctorIdfromDoctorTbl2();
                          insertReferralDoctor(refDoctor);
                      }
                  }*/


                

                    clearText();
                    MessageBox.Show("Patient was registed");
                    DialogResult result = MessageBox.Show("Go to patient demography?", "Patient registed", MessageBoxButtons.OKCancel,
                    MessageBoxIcon.Question);

                   if (result == DialogResult.OK)
                   {
                         this.Hide();
                        ViewDemography viewDemo = new ViewDemography();
                        viewDemo.patientId = patient.patientID;
                       viewDemo.Show();        
                      
                                         
                      
                       
                   }
                   else if (result == DialogResult.Cancel)
                       this.Close();
              }

              else if (txtInsuranceNumber.TextLength != 10) //number incorrect of left blank
              {
                  MessageBox.Show("Please insert correct insurance number");
              }
              else if (ins_exist != 0)
              {
                  MessageBox.Show("Insurance Number already exists");
              }
              else if (DOB_valid == false)
              {
                  MessageBox.Show("D.O.B not valid");
              }

              else if (exp_valid == false)
              {
                  MessageBox.Show("Insurance Expiry Date not valid");
              }
              
 
       

            

            

           
        }
Example #19
0
        private int getDoctorIdfromDoctorTbl1()
        {
            try
            {
                dictionary = new Dictionary<string, string>();
                dictionary.Add("@billingCode", txtDoctorBillingCode.Text);
                dc = new DatabaseConnector();
                dtDoctor = dc.getData("GetDoctorID1", dictionary);
                int doctorID = int.Parse(dtDoctor.Rows[0][0].ToString());
                return doctorID;
            }
            catch
            {
                int doctorID = 0;
                return doctorID;

            }
        }
Example #20
0
        private int getAllergyIdfromAllergyTbl1()
        {
            try
            {
                dictionary = new Dictionary<string, string>();
                dictionary.Add("@allergyName", txtAllergyName.Text);
                dc = new DatabaseConnector();
                dtAllergy = dc.getData("GetAllergyID1", dictionary);
                int allergyID = int.Parse(dtAllergy.Rows[0][0].ToString());
                return allergyID;
            }
            catch
            {
                int allergyID = 0;
                return allergyID;

            }
        }
 private void btn_Save_Click(object sender, EventArgs e)
 {
     dictionary = createEmrRequest(PatientAssesmentPatientId,formatDate(Convert.ToDateTime(cmbEMRDates.Text)));
     dc = new DatabaseConnector();
     dtPatient = getPatientEMRAccordingToDate(dictionary,dc);
     
     textBox1.Text = dtPatient.Rows[0][3].ToString();
     label20.Text = dtPatient.Rows[0][4].ToString() +" mmhg";
     label19.Text = dtPatient.Rows[0][5].ToString()+ " per minute";
     label17.Text = dtPatient.Rows[0][6].ToString() +" per minute";
     label18.Text = dtPatient.Rows[0][7].ToString() + " degree C";
     label16.Text = dtPatient.Rows[0][8].ToString()+ " cms";
     label15.Text = dtPatient.Rows[0][9].ToString() + " pounds";
     label21.Text = dtPatient.Rows[0][10].ToString();
     txt_cheifcomplaint.Text = dtPatient.Rows[0][11].ToString();
 }
 public DataTable getPatientEMRAccordingToDate(Dictionary<String, String> dict, DatabaseConnector conn)
 {
     DataTable dataTable;
     dataTable= conn.getData("GetPatientEMRAccordingToDate", dict);
     return dataTable;
 }