コード例 #1
0
        public void patientInfo(Patient patient)
        {
            try{
                string pid              = patient.getPatientID();
                string pfname           = patient.getFirstName();
                string psurname         = patient.getSurname();
                string paddress         = patient.getAddress();
                string pnic             = patient.getNIC();
                int    pcontactno       = patient.getContactNo();
                int    pregistrationfee = patient.getRegistrationFee();

                conn.Open();

                SqlCommand cmd = new SqlCommand("insert into patient_registration values('" + pid + "','" + pfname + "','" + psurname + "','" + paddress + "','" + pnic + "','" + pcontactno + "','" + pregistrationfee + "')", conn);

                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                var sqlException = ex.InnerException as System.Data.SqlClient.SqlException;

                if (sqlException.Number == 2601 || sqlException.Number == 2627)
                {
                }
                conn.Close();
            }
        }
コード例 #2
0
        public void deletePatientInfo(Patient patient)
        {
            string pid              = patient.getPatientID();
            string pfname           = patient.getFirstName();
            string psurname         = patient.getSurname();
            string paddress         = patient.getAddress();
            string pnic             = patient.getNIC();
            int    pcontactno       = patient.getContactNo();
            int    pregistrationfee = patient.getRegistrationFee();

            conn.Open();

            SqlCommand cmd = new SqlCommand("delete from patient_registration where patientid='" + pid + "'", conn);

            cmd.ExecuteNonQuery();

            conn.Close();
        }
コード例 #3
0
        public void updatePatientInfo(Patient patient)
        {
            string pid              = patient.getPatientID();
            string pfname           = patient.getFirstName();
            string psurname         = patient.getSurname();
            string paddress         = patient.getAddress();
            string pnic             = patient.getNIC();
            int    pcontactno       = patient.getContactNo();
            int    pregistrationfee = patient.getRegistrationFee();

            conn.Open();

            SqlCommand cmd = new SqlCommand("update patient_registration set patientid='" + pid + "',fname='" + pfname + "',surname='" + psurname + "',address='" + paddress + "',nic='" + pnic + "',contactno='" + pcontactno + "',registrationfee='" + pregistrationfee + "' where patientid='" + pid + "'", conn);

            cmd.ExecuteNonQuery();

            conn.Close();
        }
コード例 #4
0
        private void btnPatientRegistrationSearchPatient_Click(object sender, EventArgs e)
        {
            try
            {
                string     patientid = txtPatientRegistrationPatientID.Text;
                PatientDBO pdbo      = new PatientDBO();
                Patient    patient   = pdbo.findPatient(patientid);

                txtPatientRegistrationPatientID.Text       = patient.getPatientID();
                txtPatientRegistrationFirstName.Text       = patient.getFirstName();
                txtPatientRegistrationSurname.Text         = patient.getSurname();
                txtPatientRegistrationAddress.Text         = patient.getAddress();
                txtPatientRegistrationNIC.Text             = patient.getNIC();
                txtPatientRegistrationContactNo.Text       = patient.getContactNo().ToString();
                txtPatientRegistrationRegistrationFee.Text = patient.getRegistrationFee().ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Couldn't find any records or details of such a Patient.", "Incorrect Entry", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }