Example #1
0
        private void buttonDeletePatient_Click(object sender, EventArgs e)
        {
            var isPatientSelected = (this.listViewPatients.SelectedItems.Count > 0) ? true : false;

            if (isPatientSelected)
            {
                // Get patient id
                var patientId = int.Parse(this.listViewPatients.SelectedItems[0].SubItems[3].Text);

                DialogResult okToProceed = MessageBox.Show("You are about to delete a patient", "Please confirm you would like to continue", MessageBoxButtons.YesNo);
                if (okToProceed == DialogResult.Yes)
                {
                    if (!AppointmentDAL.PatientHasAppointment(patientId))
                    {
                        PatientDAL.DeletePatient(patientId);
                        this.search();
                    }
                    else
                    {
                        MessageBox.Show("Patient has appointments and cannot be deleted");
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select a patient if you wish to delete.");
            }
        }
Example #2
0
        /// <summary>
        /// Deletes the given Patient and their Person from the db
        /// </summary>
        /// <param name="patient">Patient to delete</param>
        /// <returns>Whether or not the Patient was deleted</returns>
        public bool DeletePatient(Patient patient)
        {
            Person person = PersonDAL.GetPersonByPatientID(patient);

            using (TransactionScope scope = new TransactionScope())
            {
                PatientDAL.DeletePatient(patient);
                PersonDAL.DeletePerson(person);
                scope.Complete();
            }
            return(true);
        }
        protected void Ok_ServerClick(object sender, EventArgs e)
        {
            string UserName = Session["User"].ToString();
            int    ID       = Convert.ToInt32(HiddenFieldPatient.Value);

            oDAL   = new PatientDAL();
            oClass = new PatientModel();

            oClass.IsDeleted    = true;
            oClass.ReasonDelete = itemname.InnerText;
            string lbl = lblPatient.Text;

            oClass.ID = ID;
            oDAL.DeletePatient(UserName, oClass);
            PopulateGrid();
        }
Example #4
0
        static void Main(string[] args)
        {
            IDoctor  doctordal  = new DoctorDAL();
            IPatient patientdal = new PatientDAL();

            Console.WriteLine("Enter 1 For Create & save /n Eneter 2 for Delete /n Enter 3 for display patients");
            int    number = Convert.ToInt32(Console.ReadLine());
            string name   = string.Empty;
            string email  = string.Empty;
            uint   id;
            uint   type;

            switch (number)
            {
            case 1:
                //Create , Save and Assign patient to doctor
                Console.WriteLine("enter Patient Name");
                name = Console.ReadLine();
                Console.WriteLine("enter Patient email");
                email = Console.ReadLine();
                Console.WriteLine("enter Patient type \n Cardiologist \n Physcician \n Dietician \n Psychtraist");
                type = Convert.ToUInt16(Console.ReadLine());

                Patient patient = patientdal.CreatePatient(name, patientdal.GetPatients().Max(x => x.iD) + 1, email, (Constants.Speciality)type);

                if (patientdal.AddPatient(patient))
                {
                    doctordal.AssignPatient(patient);
                }

                break;

            case 2:
                //Delete patients
                Console.WriteLine("enter the id of patient");
                id = Convert.ToUInt16(Console.ReadLine());
                patientdal.DeletePatient(id);
                break;

            case 3:
                //Show Patient
                Console.WriteLine("Enter the id of patient");
                id = Convert.ToUInt16(Console.ReadLine());
                patientdal.ShowPatient(patientdal.GetPatients(id));
                break;
            }
        }
 public IActionResult DeletePat(int?id)
 {
     patientDAL.DeletePatient(id);
     return(RedirectToAction("Index"));
 }
Example #6
0
 public void DeletePatient(int id)
 {
     PatientDAL.DeletePatient(id);
 }