public bool storePatientInfo(bpatientInfo patient)
        {
            string strSQL = "Insert into Patient_general_info values('" + patient.firstName + "', '" + patient.middleName + "','" + patient.lastName + "', '" + patient.fatherName + "','" + patient.occupation + "','" + patient.office + "','" + patient.religion + "','" + patient.ethnicity + "' ,'" + patient.streetAddress2 + "','" + patient.city2 + "','" + patient.state2 + "','" + patient.zipcode2 + "','" + patient.streetAddress3 + "','" + patient.city3 + "','" + patient.state3 + "','" + patient.zipcode3 + "','" + patient.phoneHomeCode + "','" + patient.phoneOfficeCode + "','" + patient.phoneMobileCode + "','" + patient.phoneHome + "','" + patient.phoneOffice + "','" + patient.phoneMobile + "','" + patient.email + "','" + patient.eFirstName + "','" + patient.eMiddleName + "','" + patient.eLastName + "','" + patient.eHomestreet + "','" + patient.eHomeCity + "','" + patient.eHomeState + "','" + patient.eHomeZip + "','" + patient.eOfficeStreet + "','" + patient.eOfficeCity + "','" + patient.eOfficeState + "','" + patient.eOfficeZip + "','" + patient.eHomePhoneCode + "','" + patient.eOfficePhoneCode + "','" + patient.eMobilePhoneCode + "','" + patient.ePhoneHome + "','" + patient.ePhoneOffice + "','" + patient.ePhoneMobile + "' ,'" + patient.eEmail + "','" + patient.dob + "','" + patient.gender + "')";//select SCOPE_IDENTITY()";
            //    string str = "select mrn from Patient_general_info where P_firstName='" + patient.firstName + "'and P_middleName='" + patient.middleName + "' and P_lastName='" + patient.lastName + "'";

            string     cmdstr = "select SCOPE_IDENTITY()";
            SqlCommand cmd    = new SqlCommand(strSQL, con);

            cmd.ExecuteNonQuery();


            SqlDataAdapter adapter = new SqlDataAdapter(cmdstr, con);
            DataSet        ds      = new DataSet();

            adapter.Fill(ds);
            string sindhu = ds.Tables[0].Rows[0].ItemArray[0].ToString();
            int    s      = Convert.ToInt16(sindhu);

            MessageBox.Show("This is the new MRN for the patient:" + sindhu);

            string     st1  = "Insert into History_table values('" + s + "','','','','','')";
            SqlCommand cmd1 = new SqlCommand(st1, con);

            cmd1.ExecuteNonQuery();


            return(true);
        }
        public bool updatePatientInfo(bpatientInfo patient)
        {
            string mrnstr = Convert.ToString(patient.mrn);

            MessageBox.Show(mrnstr);
            string     strSQL = "update  Patient_general_info set P_firstName='" + patient.firstName + "', P_middleName='" + patient.middleName + "', P_lastName='" + patient.lastName + "',P_relativeName= '" + patient.fatherName + "', P_occupation='" + patient.occupation + "', P_office='" + patient.office + "',P_religion='" + patient.religion + "',P_ethinicity='" + patient.ethnicity + "' ,P_HstreetAddress='" + patient.streetAddress2 + "',P_Hcity='" + patient.city2 + "',P_Hstate='" + patient.state2 + "',P_HzipCode='" + patient.zipcode2 + "',P_OstreetAddress='" + patient.streetAddress3 + "',P_Ocity='" + patient.city3 + "',P_Ostate='" + patient.state3 + "',P_OzipCode='" + patient.zipcode3 + "',P_Hcode='" + patient.phoneHomeCode + "',P_Ocode='" + patient.phoneOfficeCode + "',P_Mcode='" + patient.phoneMobileCode + "',P_Hphone='" + patient.phoneHome + "',P_Ophone='" + patient.phoneOffice + "',P_Mphone='" + patient.phoneMobile + "',P_email='" + patient.email + "',P_emerFirstName='" + patient.eFirstName + "',P_emerMiddleName='" + patient.eMiddleName + "',P_emerLastName='" + patient.eLastName + "',P_emerHstreetAddress='" + patient.eHomestreet + "',P_emerHcity='" + patient.eHomeCity + "',P_emerHstate='" + patient.eHomeState + "',P_emerHzipcode='" + patient.eHomeZip + "',P_emerOstreetAddress='" + patient.eOfficeStreet + "',P_emerOcity='" + patient.eOfficeCity + "',P_emerOState='" + patient.eOfficeState + "',P_emerOzipcode='" + patient.eOfficeZip + "',P_emerHcode='" + patient.eHomePhoneCode + "',P_emerOcode='" + patient.eOfficePhoneCode + "',P_emerMcode='" + patient.eMobilePhoneCode + "',P_emerHphone='" + patient.ePhoneHome + "',P_emerOphone='" + patient.ePhoneOffice + "',P_emerMphone='" + patient.ePhoneMobile + "',P_dob='" + patient.dob + "',P_gender='" + patient.gender + "' where mrn='" + patient.mrn + "'";
            SqlCommand cmd    = new SqlCommand(strSQL, con);

            cmd.ExecuteNonQuery();
            return(true);
        }
Exemple #3
0
        public bool update(bpatientInfo p)
        {
            dbregistration dReg = new dbregistration();

            if (dReg.updatePatientInfo(p))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        public bool register(bpatientInfo pInfo)
        {
            dbregistration dReg = new dbregistration();

            if (dReg.storePatientInfo(pInfo))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public void validateRegistrationForm(bpatientInfo patient, out bool gen, out bool emer)//registration form validation
        {
            gen = emer = true;

            if (patient.firstName == "" || patient.lastName == "" || patient.fatherName == "" || patient.state2 == "" || patient.zipcode2 == "" || patient.phoneHome == "" || patient.phoneHomeCode == "" || patient.city2 == "")
            {
                gen = false;
            }
            else if (patient.eFirstName == "" || patient.eLastName == "" || patient.eHomestreet == "" || patient.eHomeCity == "" || patient.eHomeState == "" || patient.eHomeZip == "" || patient.eHomePhoneCode == "" || patient.ePhoneHome == "")
            {
                emer = false;
            }

            /* else
             * {
             *   gen = true;
             *   emer = true;
             * }*/
        }
        private void bSave1_Click_2(object sender, EventArgs e)
        {
            bool             gen, emer;
            f_PatientDetails current = this;


            bpatientInfo      patient = new bpatientInfo();
            bRegistration     reg     = new bRegistration();
            validationOfForms val     = new validationOfForms();

            //patient.male=rbMale.
            if (rbMale.Checked)
            {
                patient.gender = "Male";
            }
            else if (rbFemale.Checked)
            {
                patient.gender = "Female";
            }

            patient.dob = cMonth.Text + '/' + cDay.Text + '/' + cYear.Text;


            patient.firstName  = tFirstName.Text;
            patient.middleName = tMiddleName.Text;
            patient.lastName   = tLastName.Text;


            patient.fatherName = tFatherName.Text;
            patient.occupation = tOccupation.Text;

            //patient.mrn = Convert.ToInt32(tb_mrn.Text);
            patient.office    = tOffice.Text;
            patient.religion  = cReligion.Text;
            patient.ethnicity = tEthnicity.Text;
            patient.email     = tEmail.Text;


            patient.streetAddress2 = tStreetAddress2.Text;
            patient.city2          = tCity2.Text;
            patient.state2         = tState2.Text;
            patient.zipcode2       = tZipCode2.Text;

            patient.streetAddress3 = tStreetAddress3.Text;
            patient.city3          = tCity3.Text;
            patient.state3         = tState3.Text;
            patient.zipcode3       = tZipCode3.Text;


            patient.phoneHomeCode   = tHomePhoneCode.Text;
            patient.phoneOfficeCode = tOfficePhoneCode.Text;
            patient.phoneMobileCode = tMobileCode.Text;
            patient.phoneHome       = tHomePhone.Text;
            patient.phoneMobile     = tMobilePhone.Text;
            patient.phoneOffice     = tOfficePhone.Text;


            patient.eEmail           = tEmail1.Text;
            patient.eFirstName       = tFirstName1.Text;
            patient.eMiddleName      = tMiddleName1.Text;
            patient.eLastName        = tLastName1.Text;
            patient.eHomestreet      = tStreetAddress.Text;
            patient.eHomeCity        = tCity.Text;
            patient.eHomeState       = tState.Text;
            patient.eHomeZip         = tZipCode.Text;
            patient.eOfficeStreet    = tStreetAddress1.Text;
            patient.eOfficeCity      = tCity1.Text;
            patient.eOfficeState     = tState1.Text;
            patient.eOfficeZip       = tZipCode1.Text;
            patient.eHomePhoneCode   = tHomePhone1.Text;
            patient.eOfficePhoneCode = tOfficePhoneCode1.Text;
            patient.eMobilePhoneCode = tMobileCode.Text;
            patient.ePhoneHome       = tHomePhone.Text;
            patient.ePhoneOffice     = tOfficePhone1.Text;
            patient.ePhoneMobile     = tMobilePhone1.Text;


            val.validateRegistrationForm(patient, out gen, out emer);


            if (gen && emer)
            {
                reg.register(patient);

                MessageBox.Show("Successful Registration!!");

                //f_ReceptionHome rec = new f_ReceptionHome();
                //rec.Show();
                current.Dispose();
            }
            else if (gen)
            {
                tabEmergency.Show();
                tabEmergency.BringToFront();
                manEcity.Show();
                manEfirstName.Show();
                manEhomePhone.Show();
                manElastName.Show();
                manEstate.Show();
                manEstreet.Show();
                manEzip.Show();
                tabEmergency.Show();


                MessageBox.Show("\tFields are invalid!\nEnter the compulsory fields marked with *");
            }

            else
            {
                tabGeneral.Show();
                tabGeneral.BringToFront();

                mandatoryFirstName.Show();
                mandatoryFatherName.Show();
                mandatoryGender.Show();
                mandatoryHomeAddress.Show();
                mandatoryHomePhone.Show();
                mandatoryDOB.Show();
                mandatoryLastName.Show();
                mandatoryZip.Show();
                MessageBox.Show("enter the general items");
            }
        }