Exemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            var appointment = AppointmentBO.GetById(id);

            if (appointment == null)
            {
                return(RedirectToAction("NotFound", "Home"));
            }
            appointment.Attendees = AppointmentBO.GetUsers(appointment.Id);

            var model = new AppointmentModel
            {
                Id              = appointment.Id,
                Title           = appointment.Title,
                Description     = appointment.Description,
                StartAndEndDate = appointment.StartDate.ToString(Helper.FormatDateTime) + " - " + appointment.EndDate.ToString(Helper.FormatDateTime),
                Attendees       = appointment.Attendees != null?appointment.Attendees.Select(u => u.Id).ToList() : new List <int>()
            };

            ViewBag.Count = AppointmentBO.CountCommentAccepted(model.Id);

            ViewBag.DisplayReject = CurrentUser.Id != appointment.CreateBy &&
                                    AppointmentBO.CommentCheckExisted(model.Id, CurrentUser.Id) == null;

            ViewBag.DisplaySave = CurrentUser.Id == appointment.CreateBy;

            PreparingData();
            return(View("Create", model));
        }
        public AppointmentBO BookAppointment(AppointmentBO appointmentBO)
        {
            try
            {
                if (checkAppointemnt(appointmentBO))
                {
                    using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                    {
                        if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                        {
                            objHmsDataContext.Connection.Open();
                        }

                        Appointment app            = new Appointment();
                        Appointment newAppointment = ConvertBOToAppt(app, appointmentBO);
                        objHmsDataContext.Appointments.InsertOnSubmit(newAppointment);
                        objHmsDataContext.SubmitChanges();
                    }
                }
                else
                {
                    AppointmentBO app_BO = null;
                    return(app_BO);
                }
                AppointmentBO appBO = GetAppointment(appointmentBO);
                return(appBO);
            }
            catch (Exception e)
            {
                AppointmentBO app_BO = new AppointmentBO();
                return(app_BO);
            }
        }
        public AppointmentBO GetAppointmentByID(AppointmentBO appointmentBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    AppointmentBO apmntBO = objHmsDataContext.Appointments.Where(apmnt => (apmnt.Appointment_ID == appointmentBO.appointment_ID))
                                            .Join(objHmsDataContext.Patients,
                                                  a => a.Patient_ID,
                                                  p => p.Patient_ID,
                                                  (a, p) => new AppointmentBO
                    {
                        appointment_ID   = a.Appointment_ID,
                        patientName      = p.First_Name,
                        paitent_ID       = a.Patient_ID,
                        appointment_Date = a.Appointment_Date,
                        timings          = a.Timings,
                        doctor_ID        = a.Doctor_ID,
                    }).First();

                    return(apmntBO);
                }
            }
            catch (Exception e)
            {
                AppointmentBO app_BO = new AppointmentBO();
                return(app_BO);
            }
        }
        //Method to update Appointment, with return type string
        public AppointmentBO UpdateApmnt(AppointmentBO appointmentBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Appointment apmnt = objHmsDataContext.Appointments.SingleOrDefault(appmt => (appmt.Appointment_ID == appointmentBO.appointment_ID ||
                                                                                                 (appmt.Patient_ID == appointmentBO.paitent_ID && appmt.Appointment_Date == appointmentBO.appointment_Date)));

                    Appointment updateApmnt = ConvertBOToAppt(apmnt, appointmentBO);

                    objHmsDataContext.SubmitChanges();
                }
                return(GetAppointment(appointmentBO));
            }
            catch (Exception e)
            {
                throw new Exception("unable to update appointment now");
                //return "Unable to update appointment please try again later";
            }
        }
        public List <string> GetAvailableTimingsForPatient(AppointmentBO appointmentBo)
        {
            try
            {
                using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        ObjHmsDataContext.Connection.Open();
                    }

                    IEnumerable <AppointmentBO> doctorsAppointmentsList = ObjHmsDataContext.Appointments.Where(a => a.Appointment_Date == appointmentBo.appointment_Date &&
                                                                                                               a.Patient_ID == appointmentBo.paitent_ID && a.Cancelled == false)
                                                                          .Select(t => new AppointmentBO
                    {
                        timings = t.Timings
                    }).ToList();

                    List <string> timingsList = new List <string>();
                    foreach (var d in doctorsAppointmentsList)
                    {
                        timingsList.Add(d.timings.ToString(@"hh\:mm"));
                    }

                    return(timingsList);
                }
            }
            catch (Exception ex)
            {
                List <string> timingsList = null;
                return(timingsList);
            }
        }
        public IEnumerable <int> GetPaitentsListByDate(AppointmentBO app)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    IEnumerable <int> patientsList = objHmsDataContext.Patients.Distinct().Select(p => p.Patient_ID).ToArray();

                    // IEnumerable<int> patients = objHmsDataContext.Appointments.Where(a =>a.Appointment_Date == app.appointment_Date && a.);

                    //foreach ()
                    //{

                    //}

                    return(patientsList);
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }
        public bool checkAppointemnt(AppointmentBO apmnt)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Appointment appointment = new Appointment();

                    Appointment appointmentUpdate = ConvertBOToAppt(appointment, apmnt);

                    var checkExistingAppointments = objHmsDataContext.Appointments.Select(checkApmnt => (checkApmnt.Doctor_ID == apmnt.doctor_ID &&
                                                                                                         checkApmnt.Patient_ID == apmnt.paitent_ID && checkApmnt.Appointment_Date == apmnt.appointment_Date &&
                                                                                                         checkApmnt.Timings == apmnt.timings));
                    if (checkExistingAppointments != null)
                    {
                        return(true);
                    }
                    return(false);
                }
            }
            catch { return(false); }
        }
        //Method to delete Appointment, with return type string
        public string DeleteAppointment(AppointmentBO apmntBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Appointment apmnt = objHmsDataContext.Appointments.SingleOrDefault(appmnt => (appmnt.Appointment_ID == apmntBO.appointment_ID &&
                                                                                                  appmnt.Patient_ID == apmntBO.paitent_ID));
                    Appointment converted_Apmnt = ConvertBOToAppt(apmnt, apmntBO);

                    objHmsDataContext.Appointments.DeleteOnSubmit(converted_Apmnt);

                    objHmsDataContext.SubmitChanges();

                    return("Appointment Deleted successfully");
                }
            }
            catch (Exception e)
            {
                return("Unable to Delete Appointment Please try again later");
            }
        }
        public IEnumerable <AppointmentBO> GetAppointmentsWithNoBilling()
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }
                    List <int> appts = objHmsDataContext.Appointments.Where(a => a.Cancelled == false).Select(a => a.Appointment_ID).ToList();
                    List <int> accBO = objHmsDataContext.Accounts.Select(a => a.Appointment_ID).ToList();
                    appts = appts.Except(accBO).ToList();

                    List <AppointmentBO> result = new List <AppointmentBO>();
                    AppointmentBO        app    = new AppointmentBO();
                    foreach (var a in appts)
                    {
                        app.appointment_ID = a;
                        var r = GetAppointmentByID(app);
                        result.Add(r);
                    }

                    return(result);
                }
            }
            catch (Exception e)
            {
                IEnumerable <AppointmentBO> app_BO = null;
                return(app_BO);
            }
        }
        public IEnumerable <ReportBO> ReqNewReport(AppointmentBO appBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Appointment appt = objHmsDataContext.Appointments.SingleOrDefault(rprt => (rprt.Appointment_ID == appBO.appointment_ID));
                    appt.RequestedReport      = true;
                    appt.RequestedReportNotes = appBO.reqReportNotes;
                    objHmsDataContext.SubmitChanges();



                    return(GetAllPatientsReports_DAL());
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }
        public IEnumerable <int> GetPaitentsListByDate(AppointmentBO app)
        {
            PatientBLLFactory patientBBLFactory = new PatientBLLFactory();
            var patientsList = patientBBLFactory.CreatePatientBLL().GetPatientBLL().CreatePatientDAL().GetPatientsList();

            return(patientsList);
        }
Exemplo n.º 12
0
        public ActionResult Reject(int id)
        {
            var app = AppointmentBO.GetById(id);

            ViewBag.Appointment = app;
            return(View());
        }
        public void cancelAllAppointmentByDate(AppointmentBO appBO)
        {
            DoctorBLLFactory docBLLFactory = new DoctorBLLFactory();
            var             patIDs         = docBLLFactory.CreateDoctorBLL().GetDocAppointments().CreateDoctorDAL().cancelAllAppointmentByDate(appBO);
            EmailController emails         = new EmailController();

            emails.SendAppCancelledEmail(patIDs.ToList());
        }
        public List <string> GetAvailableTimingsForPatient(AppointmentBO appointmentBO)
        {
            DoctorBLLFactory getDoctors = new DoctorBLLFactory();

            var val = getDoctors.CreateDoctorBLL().GetDoctorsListBLL().CreateDoctorDAL().GetAvailableTimingsForPatient(appointmentBO);

            return(val);
        }
Exemplo n.º 15
0
        public AppointmentBO GetApmntByID(AppointmentBO appBO)
        {
            AppointmentBLLFactory appBLLFactory = new AppointmentBLLFactory();

            AppointmentBO app_BO = appBLLFactory.CreateAppointmentBLL().GetAppointment().CreateAppointmentDAL().GetAppointment(appBO);

            return(app_BO);
        }
        public AppointmentBO PatientBookAppointment(AppointmentBO bookAppointment)
        {
            AppointmentBLLFactory appBLLFactory = new AppointmentBLLFactory();

            AppointmentBO newAppointment = appBLLFactory.CreateAppointmentBLL().GetAppointment().CreateAppointmentDAL().BookAppointment(bookAppointment);

            return(newAppointment);
        }
        //Method to get appointment details, with return type appointmet Business object
        public AppointmentBO GetAppointment(AppointmentBO appointmentBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }
                    AppointmentBO apmntBO = null;
                    if (appointmentBO.appointment_Date != DateTime.MinValue)
                    {
                        apmntBO = objHmsDataContext.Appointments.Where(apmnt => ((apmnt.Patient_ID == appointmentBO.paitent_ID && apmnt.Date_Time == appointmentBO.date) ||
                                                                                 (apmnt.Patient_ID == appointmentBO.paitent_ID && apmnt.Appointment_Date == appointmentBO.appointment_Date)) ||
                                                                       (apmnt.Appointment_ID == appointmentBO.appointment_ID))
                                  .Join(objHmsDataContext.Patients,
                                        a => a.Patient_ID,
                                        p => p.Patient_ID,
                                        (a, p) => new AppointmentBO
                        {
                            appointment_ID   = a.Appointment_ID,
                            patientName      = p.First_Name,
                            paitent_ID       = a.Patient_ID,
                            appointment_Date = a.Appointment_Date,
                            timings          = a.Timings,
                            doctor_ID        = a.Doctor_ID,
                            reqReportNotes   = a.RequestedReportNotes != null ? a.RequestedReportNotes : "N/A"
                        }).First();
                    }
                    else
                    {
                        apmntBO = objHmsDataContext.Appointments.Where(apmnt => (apmnt.Appointment_ID == appointmentBO.appointment_ID))
                                  .Join(objHmsDataContext.Patients,
                                        a => a.Patient_ID,
                                        p => p.Patient_ID,
                                        (a, p) => new AppointmentBO
                        {
                            appointment_ID   = a.Appointment_ID,
                            patientName      = p.First_Name,
                            paitent_ID       = a.Patient_ID,
                            appointment_Date = a.Appointment_Date,
                            timings          = a.Timings,
                            doctor_ID        = a.Doctor_ID,
                            reqReportNotes   = a.RequestedReportNotes != null ? a.RequestedReportNotes : "N/A"
                        }).First();
                    }

                    apmntBO.doctorName = objHmsDataContext.Doctors.Where(d => d.Doctor_ID == apmntBO.doctor_ID).Select(dn => dn.First_Name).FirstOrDefault();
                    return(apmntBO);
                }
            }
            catch (Exception e)
            {
                AppointmentBO app_BO = new AppointmentBO();
                return(app_BO);
            }
        }
Exemplo n.º 18
0
        //
        // GET: /Appointment/

        public ActionResult Index()
        {
            var user         = CurrentUser;
            var appointments = AppointmentBO.GetByUserId(user.Id);

            if (appointments != null && appointments.Count > 0)
            {
            }
            return(View(appointments));
        }
        public ReportBO GetReportsByAppt(AppointmentBO app)
        {
            //ReportBO reportBO = new ReportBO();
            //reportBO.report_ID = app.appointment_ID;

            ReportBLLFactory rprtBLLFactory = new ReportBLLFactory();

            ReportBO rprtBO = rprtBLLFactory.CreateReportBLL().GetReportBLL().CreateReportDAL().GetReportsByAppt(app.appointment_ID);

            return(rprtBO);
        }
Exemplo n.º 20
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            AppointmentBO appointmentbo = new AppointmentBO();
            long          l             = Convert.ToInt64((TextBox1.Text.Trim()));

            GridView1.VirtualItemCount = appointmentbo.Count(x => x.AppointmentId.Equals(l));
            GridView1.DataSource       = appointmentbo.Find(x => x.AppointmentId.Equals(l), 0, GridView1.PageSize)
                                         .ToList();
            GridView1.DataBind();
            Button1.Enabled = true;
        }
Exemplo n.º 21
0
        // GET: api/Appointment/5
        //Get Action which accepts integer as parameter and appointment Business object as return type
        public AppointmentBO Get(int id)
        {
            AppointmentBO appBO = new AppointmentBO();

            appBO.appointment_ID = id;

            AppointmentBLLFactory appBLLFactory = new AppointmentBLLFactory();

            AppointmentBO app_BO = appBLLFactory.CreateAppointmentBLL().GetAppointment().CreateAppointmentDAL().GetAppointment(appBO);

            return(app_BO);
        }
Exemplo n.º 22
0
        public IEnumerable <AppointmentBO> GetAppointmentsForBookedRooms(int id)
        {
            AppointmentBO appBO = new AppointmentBO();

            appBO.paitent_ID = id;

            AppointmentBLLFactory appBLLFactory = new AppointmentBLLFactory();

            IEnumerable <AppointmentBO> app_BO = appBLLFactory.CreateAppointmentBLL().GetAppointment().CreateAppointmentDAL().GetAppointmentsForBookedRooms(appBO);

            return(app_BO);
        }
        // PUT: api/Appointment/5
        //Put action which accepts integer and appointment business object as parameter with void return type
        public void DeleteAppointment(AppointmentBO appointmentBO)
        {
            //sample input values are provided
            appointmentBO.appointment_ID   = 12004;
            appointmentBO.paitent_ID       = 7002;
            appointmentBO.doctor_ID        = 5006;
            appointmentBO.date             = DateTime.Parse("2010/03/02");
            appointmentBO.timings          = TimeSpan.Parse("20:20:20");
            appointmentBO.appointment_Date = DateTime.Parse("2222/02/02");
            AppointmentBLLFactory appntBLLFactory = new AppointmentBLLFactory();

            string deleteApp = appntBLLFactory.CreateAppointmentBLL().DeleteAppointmentBLL().CreateAppointmentDAL().DeleteAppointment(appointmentBO);
        }
Exemplo n.º 24
0
        public JsonResult Reject(AppointmentComment comment)
        {
            if (comment != null)
            {
                comment.CommentType = CommentType.Rejected;
                comment.CreateBy    = CurrentUser.Id;
                comment.CreateDate  = DateTime.Now;
                comment.ModifyBy    = CurrentUser.Id;
                comment.ModifyDate  = DateTime.Now;
                AppointmentBO.AppointmentCommentInsert(comment);
            }

            return(Json(1, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 25
0
 public JsonResult Accept(int id)
 {
     AppointmentBO.AppointmentCommentInsert(new AppointmentComment
     {
         CommentType   = (int)CommentType.Accepted,
         Comments      = "Accepted",
         CreateBy      = CurrentUser.Id,
         CreateDate    = DateTime.Now,
         ModifyBy      = CurrentUser.Id,
         ModifyDate    = DateTime.Now,
         AppointmentId = id
     });
     return(Json(1, JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 26
0
        // POST: api/Appointment
        // Post action which accepts Appointment Business object as parameter and same as return type
        public AppointmentBO BookAppointment(AppointmentBO appointmentBO)
        {
            AppointmentBLLFactory appntBLLFactory = new AppointmentBLLFactory();

            //appointmentBO.paitent_ID = 7002;
            //appointmentBO.doctor_ID = 5006;
            //appointmentBO.date = DateTime.Parse("2000/10/15");
            //appointmentBO.appointment_Date = DateTime.Parse("2010/2/3");
            //appointmentBO.timings = TimeSpan.Parse("08:00:00");

            AppointmentBO appBO = appntBLLFactory.CreateAppointmentBLL().CreateAppointmentBLL().CreateAppointmentDAL().NewAppointment(appointmentBO);

            return(appBO);
        }
 //Method to convert Appointment to AppointmentBO, with return type appointmet Business object
 public AppointmentBO ConvertApmntToBO(Appointment apmnt)
 {
     try
     {
         AppointmentBO apmntBO = new AppointmentBO(apmnt.Appointment_ID, apmnt.Patient_ID, apmnt.Appointment_Date,
                                                   apmnt.Timings, apmnt.Doctor_ID, apmnt.Date_Time, apmnt.RequestedReport, apmnt.RequestedReportNotes);
         return(apmntBO);
     }
     catch (Exception e)
     {
         AppointmentBO appBO = new AppointmentBO();
         return(appBO);
     }
 }
Exemplo n.º 28
0
        protected void btUpdateA_Click(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                AppointmentBO         AppointmentBO   = new AppointmentBO();
                DataLayer.Appointment editAppointment = new DataLayer.Appointment();

                int AppointmentId = Convert.ToInt32(Session["PrimaryKeyAppointment"]);

                editAppointment = AppointmentBO.Get(AppointmentId);
                if (editAppointment == null)
                {
                    string str = string.Format("Appointment with Id {0} not found for Update.", AppointmentId);
                    lblMsg.Text = str;
                    return;
                }

                string AStartFrom = txtAStartFrom.Text.Trim();
                if (!string.IsNullOrEmpty(AStartFrom))
                {
                    editAppointment.StartFrom = DateTime.Parse(AStartFrom);
                    editAppointment.EndTo     = DateTime.Parse(txtAEndTo.Text.Trim());

                    editAppointment.AppointmentId = long.Parse(ddAppointmentId.SelectedValue);
                    editAppointment.PatientId     = long.Parse(ddPatientId.SelectedValue);
                    editAppointment.NoShow        = cbANoShow.Checked;
                    editAppointment.Cancelled     = cbACancelled.Checked;
                    editAppointment.Active        = cbAActive.Checked;
                    editAppointment.DateEntered   = DateTime.Now;
                    editAppointment.UserIdEntered = 0;

                    AppointmentBO.Edit(editAppointment);
                    AppointmentBO.Save();



                    string msg = string.Format("Appointment {0} Updated.", AStartFrom);

                    Response.Redirect("~/AppointmentPages/AppointmentList.aspx?msg=" + msg);
                }
                else
                {
                    string str = string.Format("First Name field Can't be empty.");
                    lblMsg.Text = str;
                    return;
                }
            }
        }
Exemplo n.º 29
0
        public ActionResult ListOfComment(int id)
        {
            var listcomments = AppointmentBO.GetCommentByAppointmentId(id);

            if (listcomments != null && listcomments.Count > 0)
            {
                for (int i = 0; i < listcomments.Count; i++)
                {
                    listcomments[i].User = UserBO.GetById(listcomments[i].CreateBy);
                }
            }
            else
            {
                listcomments = new List <AppointmentComment>();
            }
            return(View(listcomments));
        }
Exemplo n.º 30
0
        public int UpdateAppointment(AppointmentBO AppointmentBO)
        {
            DataAccessSqlHelper sqlHelper = new DataAccessSqlHelper(AppointmentBO.ConString);
            SqlCommand          command   = sqlHelper.CreateCommand(CommandType.StoredProcedure);

            command.CommandText = "usp_SaveAppointment";
            sqlHelper.AddParameter(command, "@userId", AppointmentBO.UserId, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@AppointmentDate", AppointmentBO.AppointmentDate, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@Description", AppointmentBO.AppointmentDescription, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@latitude", AppointmentBO.Latitude, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@longitude", AppointmentBO.Longitude, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@processName", AppointmentBO.ProcessName, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@Source", AppointmentBO.Source, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@mobileSyncDate", AppointmentBO.mobileSyncDate, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@MobileReferenceNo", AppointmentBO.MobReferenceNo, ParameterDirection.Input);
            return(Convert.ToInt32(sqlHelper.ExecuteNonQuery(command)));
        }