예제 #1
0
 private void EditAddress_Click(object sender, EventArgs e)
 {
     using (addEditAddress frm = new addEditAddress(basePatient.Address, this))
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             ptAddressID.Text      = frm.getAddressID().ToString();
             basePatient.AddressID = frm.getAddressID();
             initAddress           = frm.getAddress();
         }
     }
 }
예제 #2
0
 private void EditAddress_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(dcName.Text) || String.IsNullOrEmpty(dcAddressID.Text) || String.IsNullOrEmpty(dcDateOfBirth.Text) ||
         String.IsNullOrEmpty(dcGender.Text) || String.IsNullOrEmpty(dcLastName.Text) || String.IsNullOrEmpty(dcPhoneNumber.Text) ||
         String.IsNullOrEmpty(dcSalary.Text) || String.IsNullOrEmpty(dcDiseaseID.Text))
     {
         MessageBox.Show("Please fill all other areas before adding address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     using (addEditAddress frm = new addEditAddress(baseDoctor.Address, this))
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             baseDoctor.AddressID = frm.getAddressID();
             dcAddressID.Text     = frm.getAddressID().ToString();
             initAddress          = frm.getAddress();
         }
     }
 }
예제 #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            switch (toolStripComboBox1.SelectedIndex)
            {
            case 0:
                MessageBox.Show("No table selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;

            case 1:
                using (addEditAddress frm = new addEditAddress(null, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        AddressBindingSource.DataSource = db.Addresses.ToList();
                    }
                }
                break;

            case 2:
                using (addEditDisease frm = new addEditDisease(null, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        diseaseBindingSource.DataSource = db.Diseases.ToList();
                    }
                }
                break;

            case 3:
                using (addEditPatient frm = new addEditPatient(null, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        PatientBindingSource.DataSource = db.Patients.ToList();
                        AddressBindingSource.DataSource = db.Addresses.ToList();
                    }
                }
                break;

            case 4:
                using (addEditDoctor frm = new addEditDoctor(null, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        DoctorBindingSource.DataSource  = db.Doctors.ToList();
                        AddressBindingSource.DataSource = db.Addresses.ToList();
                    }
                }
                break;

            case 5:
                using (addEditPrescription frm = new addEditPrescription(null, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        PrescriptionBindingSource.DataSource = db.Prescriptions.ToList();
                    }
                }
                break;

            case 6:
                using (addEditAppointment frm = new addEditAppointment(null, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        AppointmentBindingSource.DataSource = db.Appointments.ToList();
                    }
                }
                break;

            case 7:
                using (addEditPDR frm = new addEditPDR(null, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        PdrBindingSource.DataSource          = db.PatientDiseaseRelations.ToList();
                        AppointmentBindingSource.DataSource  = db.Appointments.ToList();
                        PrescriptionBindingSource.DataSource = db.Prescriptions.ToList();
                    }
                }
                break;

            default:
                MessageBox.Show("Cant Add on View Table", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;
            }
            dataGridView.Refresh();
            Program.detachAll();
        }
예제 #4
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            switch (toolStripComboBox1.SelectedIndex)
            {
            case 0:
                MessageBox.Show("No table selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;

            case 1:
                if (AddressBindingSource.Current == null)
                {
                    MessageBox.Show("No Address selected for editing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                using (addEditAddress frm = new addEditAddress(AddressBindingSource.Current as Address, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        AddressBindingSource.DataSource = db.Addresses.ToList();
                    }
                }
                break;

            case 2:
                if (diseaseBindingSource.Current == null)
                {
                    MessageBox.Show("No Disease selected for editing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                using (addEditDisease frm = new addEditDisease(diseaseBindingSource.Current as Disease, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        diseaseBindingSource.DataSource = db.Diseases.ToList();
                    }
                }
                break;

            case 3:
                if (PatientBindingSource.Current == null)
                {
                    MessageBox.Show("No Patient selected for editing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                using (addEditPatient frm = new addEditPatient(PatientBindingSource.Current as Patient, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        PatientBindingSource.DataSource = db.Patients.ToList();
                        AddressBindingSource.DataSource = db.Addresses.ToList();
                    }
                }
                break;

            case 4:
                if (DoctorBindingSource.Current == null)
                {
                    MessageBox.Show("No Doctor selected for editing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                using (addEditDoctor frm = new addEditDoctor(DoctorBindingSource.Current as Doctor, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        DoctorBindingSource.DataSource  = db.Doctors.ToList();
                        AddressBindingSource.DataSource = db.Addresses.ToList();
                    }
                }
                break;

            case 5:
                if (PrescriptionBindingSource.Current == null)
                {
                    MessageBox.Show("No Prescription selected for editing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                using (addEditPrescription frm = new addEditPrescription(PrescriptionBindingSource.Current as Prescription, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        PrescriptionBindingSource.DataSource = db.Prescriptions.ToList();
                    }
                }
                break;

            case 6:
                if (AppointmentBindingSource.Current == null)
                {
                    MessageBox.Show("No Appointment selected for editing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                using (addEditAppointment frm = new addEditAppointment(AppointmentBindingSource.Current as Appointment, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        AppointmentBindingSource.DataSource = db.Appointments.ToList();
                    }
                }
                break;

            case 7:
                if (PdrBindingSource.Current == null)
                {
                    MessageBox.Show("No PDR selected for editing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                using (addEditPDR frm = new addEditPDR(PdrBindingSource.Current as PatientDiseaseRelation, this))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        PdrBindingSource.DataSource          = db.PatientDiseaseRelations.ToList();
                        AppointmentBindingSource.DataSource  = db.Appointments.ToList();
                        PrescriptionBindingSource.DataSource = db.Prescriptions.ToList();
                    }
                }
                break;

            default:
                MessageBox.Show("Cant Edit on View Table", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;
            }
            dataGridView.Refresh();
            Program.detachAll();
        }