private void PopulateClbDisease()
        {
            DataTable diseaseTable = DiseaseRepo.GetAllDisease();

            for (int ax = 1; ax < diseaseTable.Rows.Count; ax++)
            {
                clbDisease.Items.Add(diseaseTable.Rows[ax]["diseasename"].ToString());
            }
            DataTable allDiseaseTable = PatientDiseaseRepo.GetIndividualDisease(Convert.ToInt32(txtPersonID.Text));

            for (int ax = 0; ax < allDiseaseTable.Rows.Count; ax++)
            {
                if (clbDisease.Items.Contains(allDiseaseTable.Rows[ax]["diseasename"].ToString()))
                {
                    clbDisease.SetItemChecked(clbDisease.Items.IndexOf(allDiseaseTable.Rows[ax]["diseasename"].ToString()), true);
                }
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            PersonRepo p1 = new PersonRepo();

            p1.PersonID = Convert.ToInt32(this.txtPID.Text);

            DoctorRepo dr = new DoctorRepo();

            if (this.txtDoctorId.Text != "" && this.txtDoctorId.Text != null)
            {
                dr.DoctorID = Convert.ToInt32(this.txtDoctorId.Text);
            }

            EmployeeRepo er = new EmployeeRepo();

            er.EmpID = Convert.ToInt32(this.txtEmpId.Text);

            try
            {
                if (this.cmbDesignation.Text == "Doctor")
                {
                    // IF DOCTOR -> Delete from all table that contains doctor's reference first
                    CancelledAppointmentsRepo.RemoveParticularDoctorsAppointments(dr.DoctorID);
                    AppointmentRepo.RemoveParticularDoctorsAppointments(dr.DoctorID);
                    PatientDiseaseRepo.DeleteInfoBasedOnDoctor(dr.DoctorID);
                    LoginVerification.DeleteLoginInfo(er.EmpID);
                    // Afterwards delete from doctor table
                    dr.DeleteDoctor(dr.DoctorID);
                }

                int empdelete     = er.DeleteEmployee(er.EmpID);
                int persondeleted = p1.DeletePerson(p1.PersonID);

                this.PopulatePersonTable();
                MessageBox.Show("Successfully deleted!");
                this.ClearAll();
            }
            catch (Exception exc)
            {
                MessageBox.Show("error!" + exc);
            }
        }
Exemple #3
0
        private void btnConfirmAppointment_Click_1(object sender, EventArgs e)
        {
            dynamic diseaseList  = GetCheckedDiseases();
            dynamic medicineList = GetCheckedMedicine();

            if (txtPersonID.Text != "")
            {
                var answer = MessageBox.Show("Confirm Medicines", "Confirm", MessageBoxButtons.YesNo);
                if (answer == DialogResult.Yes)
                {
                    PatientDiseaseRepo.InsertPresonDisease(diseaseList, medicineList, Convert.ToInt32(txtPersonID.Text), Doctorid);
                    ClearInfo();
                    PopulateGridView();
                }
            }
            else
            {
                MessageBox.Show("No Patient is Selected");
            }
        }