public List <Appointment> GetAppointments()
        {
            var uDal   = new AppointmentDAL(_dbc);
            var result = uDal.GetAppointments().Result;

            return(result);
        }
        public int RemoveAppointment(int id)
        {
            var uDal   = new AppointmentDAL(_dbc);
            var result = uDal.RemoveAppointment(id).Result;

            return(result);
        }
예제 #3
0
        /// <summary>
        /// Deletes Record from Database.
        /// </summary>
        /// <param name="objDept">Object containing all data values.</param>
        /// <returns>boolean value True if Record is deleted successfully
        /// otherwise returns False.</returns>
        public static bool Delete(Appointment objAppoint)
        {
            bool recDel;

            recDel = AppointmentDAL.Delete(objAppoint.DBID);
            return(recDel);
        }
        public int UpdateAppointment(Appointment appt)
        {
            var uDal   = new AppointmentDAL(_dbc);
            var result = uDal.UpdateAppointment(appt).Result;

            return(result);
        }
예제 #5
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.");
            }
        }
        private bool validateAppointmentInfo(DateTime appointmentDateTime, int patientId, int doctorId, string reasons, Appointment ignoredAppointment = null)
        {
            if (appointmentDateTime < DateTime.Now)
            {
                MessageBox.Show("You cannot schedule an appointment in the past");
                return(false);
            }

            if (AppointmentDAL.HasMatchingAppointment(appointmentDateTime, patientId: patientId, ignoredAppointment: ignoredAppointment))
            {
                MessageBox.Show("The patient cannot be scheduled for 2 appointments at the same time!");
                return(false);
            }
            else if (AppointmentDAL.HasMatchingAppointment(appointmentDateTime, doctorId: doctorId, ignoredAppointment: ignoredAppointment))
            {
                MessageBox.Show("The doctor cannot be at 2 appointments at the same time!");
                return(false);
            }

            if (String.IsNullOrWhiteSpace(reasons))
            {
                MessageBox.Show("Please include appointment reasons.");
                return(false);
            }
            else if (reasons.Length > 200)
            {
                MessageBox.Show("Reasons length cannot exceed 200 characters");
                return(false);
            }

            return(true);
        }
예제 #7
0
        /// <summary>
        /// Creates a new appointment
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public Message AddAppointment([FromBody] JToken value)
        {
            int doctorid = 0, patientid = 0;

            int.TryParse((string)value.SelectToken("doctorid"), out doctorid);
            int.TryParse((string)value.SelectToken("patientid"), out patientid);
            if (!DoctorDAL.DoctorExists(doctorid))
            {
                return(MessageHandler.Error("Incorrect doctorid. Not authorized to update patients"));
            }
            if (!PatientDAL.PatientExist(patientid))
            {
                return(MessageHandler.Error("Incorrect patientid. Patient not found!"));
            }
            string date = (string)value.SelectToken("date");
            string time = (string)value.SelectToken("time");

            if (date == null)
            {
                return(MessageHandler.Error("Please specify a date for this appointment."));
            }
            if (time == null)
            {
                return(MessageHandler.Error("Please specify a time for this appointment."));
            }

            AppointmentDAL.InsertAppointment(doctorid, patientid, (int)StatusEnum.Success, date, time,
                                             (string)value.SelectToken("notes"));

            UserActivity.AddDoctorActivity((int)ActivityEnum.CreateAppointment, doctorid, (int)StatusEnum.Success, "Success", value.ToString());
            return(MessageHandler.Success("Appointment added!"));
        }
예제 #8
0
        public ActionResult BookAppointment_Post(FormCollection collection)
        {
            Appointment appointment = new Appointment();

            appointment.Pusername = TempData["username"].ToString();
            TempData.Keep();
            appointment.Dfirstname = TempData["drfirstname"].ToString();
            TempData.Keep();
            appointment.Dlastname = TempData["drlastname"].ToString();
            TempData.Keep();

            TryUpdateModel(appointment);
            if (ModelState.IsValid)
            {
                appointment.Dinfoid = 0;
                appointment.Pinfoid = 0;
                appointment.Status  = 0;
                AppointmentDAL.BookAppointment(appointment);
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
예제 #9
0
 /// <see cref="AppointmentDAL.GetPatientsAppointments(Patient)"/>
 public List <AppointmentDTO> GetPatientsAppointments(Patient patient)
 {
     if (patient == null || patient.ID == null)
     {
         throw new ArgumentNullException("patient and patientID cannot be null");
     }
     return(AppointmentDAL.GetPatientsAppointments(patient));
 }
예제 #10
0
        //Appointment
        public ActionResult Appointments()
        {
            AppointmentDAL            AppDAL  = new AppointmentDAL();
            int                       ID      = int.Parse(Session["DoctorID"].ToString());
            List <AppointmentDetails> details = Doc.getAppointmentDetails(ID);

            return(View(details));
        }
예제 #11
0
 /// <see cref="AppointmentDAL.GetAppointmentInDateRange(DateTime, DateTime)"/>
 public List <AppointmentDTO> GetAppointmentsInDateRange(DateTime startDate, DateTime endDate)
 {
     if (startDate == null || endDate == null)
     {
         throw new ArgumentNullException("startDate and endDate cannot be null");
     }
     return(AppointmentDAL.GetAppointmentInDateRange(startDate, endDate.AddDays(1)));
 }
예제 #12
0
 /// <see cref="AppointmentDAL.DeleteAppointment(Appointment)"/>
 public bool DeleteAppointment(Appointment appt)
 {
     if (appt == null)
     {
         throw new ArgumentNullException("Appointment cannot be null");
     }
     return(AppointmentDAL.DeleteAppointment(appt));
 }
        private void loadAvailableDoctorDateTimes()
        {
            this.timeComboBox.Items.Clear();
            this.availableTimes.Clear();

            var appointmentTimes = AppointmentDAL.GetDoctorAppointmentTimes(this.SelectedDoctor.ID, this.apptDatePicker.Value);

            this.getFormattedTimeComboList(appointmentTimes).ToList().ForEach(time => this.timeComboBox.Items.Add(time));
        }
예제 #14
0
        public ActionResult History()
        {
            string username = TempData["username"].ToString();

            TempData.Keep();
            List <Appointment> history = new List <Appointment>();

            history = AppointmentDAL.History(username);
            return(View(history));
        }
        private void loadAvailableDoctorDateTimes(DateTime timeToAdd)
        {
            this.timeComboBox.Items.Clear();
            this.availableTimes.Clear();

            var appointmentTimes = AppointmentDAL.GetDoctorAppointmentTimes(this.SelectedDoctor.ID, this.apptDatePicker.Value);

            appointmentTimes.Remove(appointmentTimes.FirstOrDefault(date => date.Hour == timeToAdd.Hour));
            this.getFormattedTimeComboList(appointmentTimes).ToList().ForEach(time => this.timeComboBox.Items.Add(time));
        }
예제 #16
0
        public List <Appointment> GetPatientAppointments([FromBody] JToken value)
        {
            int patientid = 0;

            int.TryParse((string)value.SelectToken("patientid"), out patientid);
            if (PatientDAL.PatientExist(patientid))
            {
                return(AppointmentDAL.GetPatientAppointments(patientid));
            }
            return(null);
        }
예제 #17
0
        public List <Appointment> GetDoctorAppointments([FromBody] JToken value)
        {
            int docId = 0;

            int.TryParse((string)value.SelectToken("doctorid"), out docId);
            if (DoctorDAL.DoctorExists(docId))
            {
                UserActivity.AddDoctorActivity((int)ActivityEnum.ViewAppointments, docId, (int)StatusEnum.Success, "Success", value.ToString());
                return(AppointmentDAL.GetDoctorAppointments(docId));
            }
            return(null);
        }
예제 #18
0
 /// <summary>
 /// Initalizes DAL objects
 /// </summary>
 public HealthcareController()
 {
     visitDAL       = new VisitDAL();
     appointmentDAL = new AppointmentDAL();
     doctorDAL      = new DoctorDAL();
     personDAL      = new PersonDAL();
     loginDAL       = new LoginDAL();
     patientDAL     = new PatientDAL();
     nurseDAL       = new NurseDAL();
     testDAL        = new TestDAL();
     specialtyDAL   = new SpecialityDAL();
 }
예제 #19
0
        public static string[] GetNames()
        {
            DataTable dTable = null;

            string[] objNamesList = null;
            dTable = AppointmentDAL.GetNames();

            if (dTable.Rows.Count > 0)
            {
                objNamesList = dTable.AsEnumerable().Select(row => row.Field <string>("NAME")).ToArray();
            }
            return(objNamesList);
        }
예제 #20
0
        public static string[] GetAppointments()
        {
            DataTable dTable = null;

            string[] objAppointmentList = null;
            dTable = AppointmentDAL.GetAppointments();

            if (dTable.Rows.Count > 0)
            {
                objAppointmentList = dTable.AsEnumerable().Select(row => row.Field <string>("APPOINTMENTNO")).ToArray();
            }
            return(objAppointmentList);
        }
        private void reloadAppointments()
        {
            this.listViewAppointments.Items.Clear();

            List <Appointment> appointments = AppointmentDAL.GetAllAppointmentsForPatient(this.patient.PatientID.Value);

            foreach (Appointment appointment in appointments)
            {
                string       formattedDateTime = appointment.DateTime.ToShortDateString() + " " + appointment.DateTime.ToShortTimeString();
                ListViewItem row = new ListViewItem(new[] { formattedDateTime, appointment.Reasons });
                row.Tag = appointment;
                this.listViewAppointments.Items.Add(row);
            }
        }
        public void SetUp()
        {
            var appointmentDbSetMock = GetMockDbSet(_appointment);

            var appointmentJobsDbSetMock = GetMockDbSet(_appointmentJob);

            appointmentJobsDbSetMock.Setup(m => m.Include("Appointments")).Returns(appointmentJobsDbSetMock.Object);

            _appointmentContextMock = new Mock <AppointmentContext>();
            _appointmentContextMock.Setup(mock => mock.Appointments).Returns(appointmentDbSetMock.Object);
            _appointmentContextMock.Setup(mock => mock.AppointmentJobs).Returns(appointmentJobsDbSetMock.Object);
            _appointmentContextMock.Setup(mock => mock.SaveChangesAsync()).Returns(Task.FromResult(0));
            _underTest = new AppointmentDAL(_appointmentContextMock.Object);
        }
        private async void finishEdit(object sender, RoutedEventArgs e)
        {
            try
            {
                this.ring.IsActive = true;
                var patientDal = new PatientDAL();
                var nurseDal   = new NurseDAL();
                var appointDal = new AppointmentDAL();
                var vm         = new RoutineCheckupViewModel();
                var appnt      = await appointDal.GetAppointmentById(this.AppointmentID);

                var patient = await patientDal.GetPatientById(this.PatientId);

                var nurse = await nurseDal.GetNurseByNurseId(this.NurseId);

                var date = this.CheckupDate.Date.AddHours(this.CheckupTime.Hours).AddMinutes(this.CheckupTime.Minutes);
                var sys  = !string.IsNullOrWhiteSpace(this.SystolicReading.ToString())
                    ? this.SystolicReading
                    : throw new ArgumentException("The Systolic Reading cannot be empty.");
                var dbp = !string.IsNullOrWhiteSpace(this.DiastolicBloodPressure.ToString())
                    ? this.DiastolicBloodPressure
                    : throw new ArgumentException("The blood pressure cannot be empty.");
                var weght = !string.IsNullOrWhiteSpace(this.Weight.ToString())
                    ? this.Weight
                    : throw new ArgumentException("The weight cannot be empty");
                var tep = !string.IsNullOrWhiteSpace(this.Temperature.ToString())
                    ? this.Temperature
                    : throw new ArgumentException("The tmeperature cannot be empty");
                var diag = !string.IsNullOrWhiteSpace(this.InitialDiagnosis)
                    ? this.InitialDiagnosis
                    : throw new ArgumentException("The initial diaggnosis cannot be empty");
                var checkup = new RoutineCheck(appnt, nurse, patient, date, sys, dbp, weght, tep, diag);
                await vm.EditCheckup(checkup);

                this.Editing(false);
                this.ChangesMade = true;
            }
            catch (Exception ex)
            {
                this.ring.IsActive = false;
                this.error.Text    = ex.Message;
                await Task.Delay(4000);

                this.error.Text = "";
            }

            this.ring.IsActive = false;
        }
        private void buttonSaveAppointment_Click(object sender, EventArgs e)
        {
            if (this.comboBoxAppointmentDoctor.SelectedValue == null)
            {
                MessageBox.Show("Please select a doctor");
                return;
            }

            int      patientId           = this.patient.PatientID.Value;
            DateTime appointmentDateTime = this.dateTimeAppointmentDate.Value;
            string   reasons             = this.textBoxAppointmentReasons.Text;
            int      doctorId            = Int32.Parse(this.comboBoxAppointmentDoctor.SelectedValue.ToString());
            bool     successful          = false;

            if (this.appointmentUpdateMode)
            {
                Appointment oldAppointment = (Appointment)this.listViewAppointments.SelectedItems[0].Tag;
                if (this.validateAppointmentInfo(appointmentDateTime, patientId, doctorId, reasons, oldAppointment))
                {
                    DateTime oldDateTime = oldAppointment.DateTime;
                    successful = AppointmentDAL.UpdateAppointment(this.patient.PatientID.Value, oldDateTime, appointmentDateTime, doctorId, reasons);
                }
                else
                {
                    return;
                }
            }
            else if (this.validateAppointmentInfo(appointmentDateTime, patientId, doctorId, reasons))
            {
                successful = AppointmentDAL.AddAppointment(patientId, appointmentDateTime, doctorId, reasons);
            }
            else
            {
                return;
            }

            if (successful)
            {
                this.reloadAppointments();
                this.clearAppointmentDetailsFields();
                this.groupBoxAppointmentInfo.Enabled = false;
                this.toggleCurrentlyEditingAppointment(false);
            }
            else
            {
                MessageBox.Show("An error occured while saving the appointment");
            }
        }
예제 #25
0
 /// <see cref="AppointmentDAL.UpdateAppointment(Appointment)"
 public bool UpdateAppointment(Appointment appointment)
 {
     if (appointment == null || appointment.PatientID == null || appointment.DoctorID == null)
     {
         throw new ArgumentNullException("appointment, patientID, and doctorID cannot be null");
     }
     if (appointment.AppointmentDateTime == null)
     {
         throw new ArgumentNullException("please specify a time for the visit");
     }
     if (String.IsNullOrWhiteSpace(appointment.ReasonForVisit))
     {
         throw new ArgumentNullException("please give a reason for the visit");
     }
     return(AppointmentDAL.UpdateAppointment(appointment));
 }
예제 #26
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting tests");

            AppointmentDAL.DEBUG = true;
            //AppointmentDAL.InsertAppointment(1, 22, 1, "sometime", "sometime", "somet  ime");
            //List<Appointment> a = AppointmentDAL.GetDoctorAppointments(1);

            AppointmentDAL.InsertAppointment(1, 32, (int)StatusEnum.Success, "2015-01-01", "8:00AM", "");



            //TestDB();
            //TestPatientSearch();

            Console.ReadLine();
        }
예제 #27
0
        public ActionResult PatientAppointment(string date)
        {
            string username = TempData["username"].ToString();

            TempData.Keep();
            if (ModelState.IsValid)
            {
                List <Appointment> patientsList = new List <Appointment>();
                patientsList = AppointmentDAL.GetAll(username, date);
                return(View(patientsList));
            }
            else
            {
                ModelState.AddModelError("", "Enter valid date..!!");
                return(View());
            }
        }
 private void handleSaveAppointment()
 {
     if (this.IsEditingAppointment)
     {
         var appt = this.buildAppointment();
         appt.ID = this.AppointmentControl.SelectedAppointment.ID;
         AppointmentDAL.UpdateAppointment(appt);
         MessageBox.Show("The appointment has been updated.", "Updated Appointment", MessageBoxButtons.OKCancel);
         this.Close();
     }
     else
     {
         var appt = this.buildAppointment();
         AppointmentDAL.InsertAppointment(appt);
         MessageBox.Show("The appointment has been created.", "New Appointment", MessageBoxButtons.OKCancel);
         this.Close();
     }
 }
예제 #29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="objPOType"></param>
        /// <returns></returns>
        public static bool Save(Appointment objAppoint, User objCurUser)
        {
            bool flgSave;

            try
            {
                using (TransactionScope objTScope = new TransactionScope(TransactionScopeOption.RequiresNew))
                {
                    if (objAppoint.IsEdited || objAppoint.IsNew)
                    {
                        AppointmentDAL.Save(objAppoint, objCurUser);
                    }
                    flgSave = true;
                    objTScope.Complete();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(flgSave);
        }
예제 #30
0
        private async void addCheckup(object sender, RoutedEventArgs e)
        {
            this.ring.IsActive = true;
            try
            {
                var aId            = int.Parse(this.aID.Text);
                var nId            = int.Parse(this.nID.Text);
                var time           = this.timeicker.Time;
                var date           = this.datePicker.Date.Date.AddHours(time.Hours).AddMinutes(time.Minutes);
                var sys            = int.Parse(this.sysReadind.Text);
                var bPr            = int.Parse(this.bPressure.Text);
                var _weight        = double.Parse(this.weight.Text);
                var temp           = double.Parse(this.temp.Text);
                var ini            = this.summaryTextBox.Text;
                var appointmentdal = new AppointmentDAL();
                var appointment    = await appointmentdal.GetAppointmentById(aId);

                var nursedal = new NurseDAL();
                var nurse    = await nursedal.GetNurseByNurseId(nId);

                var checkup = new RoutineCheck(appointment, nurse, appointment.Patient, date, sys, bPr, _weight, temp,
                                               ini);
                await this.viewModel.AddCheckup(checkup);

                await this.viewModel.LoadAllAppointments();

                var confirmBox = new MessageDialog($"CheckUp completed  {date.ToShortDateString()}");
                this.ring.IsActive = false;
                await confirmBox.ShowAsync();
            }
            catch (Exception ex)
            {
                this.ring.IsActive = false;
                var messageDialog = new MessageDialog(ex.Message);
                await messageDialog.ShowAsync();
            }
        }