Example #1
0
        public bool GetAvailabilityStatus(DateTime date)
        {
            BookingDL  bookingDL       = new BookingDL();
            List <int> roomId          = bookingDL.GetRoomIds(date);
            bool?      availableStatus = roomDL.IsRoomAvailable(roomId);

            if (availableStatus != false)
            {
                return(true);
            }
            return(false);
        }
Example #2
0
        public IHttpActionResult CompleteBooking(PatientBookingModel model)
        {
            try
            {
                var UserId  = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.NameIdentifier)).Value;
                var RefType = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Name)).Value;
                var RefID   = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Sid)).Value;

                BookingDL obj = new BookingDL();
                obj.CompleteBooking(model);
                model.success = true;
                model.message = "Booking " + model.Status + " successfully";
                model.code    = 200;
                return(Ok(model));
            }
            catch (Exception ex)
            {
                responseData.message = ex.Message != null?ex.Message.ToString() : "server error";

                return(Ok(responseData));
            }
        }
Example #3
0
        public IHttpActionResult GetAllPatientBooking(BookingModel model)
        {
            try
            {
                var UserId  = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.NameIdentifier)).Value;
                var RefType = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Name)).Value;
                var RefID   = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Sid)).Value;

                BookingDL obj = new BookingDL();

                List <PatientBookingModel> list = obj.GetAllBooking(Convert.ToInt32(UserId), Convert.ToInt32(RefType), Convert.ToInt32(RefID), model);
                //list.success = true;
                //list.message = "Get dashboard details Successfully";
                //list.code = 200;
                return(Ok(list));
            }
            catch (Exception ex)
            {
                responseData.message = ex.Message != null?ex.Message.ToString() : "server error";

                return(Ok(responseData));
            }
        }
Example #4
0
 public bool updateBookingStatus(out DataSet ds, out string errMsg, long bookingID, string bookingStatus)
 {
     BookingDL dl = new BookingDL();
     return dl.updateBookingStatus(out ds, out errMsg, bookingID, bookingStatus);
 }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session.Count != 0)
            {
                foreach (string name in Session.Keys)
                {
                    if (name == "Employee")
                    {
                        Employee myem = new Employee();
                        myem         = (Employee)Session[name];
                        Label30.Text = myem.EID.ToString();
                    }
                }
            }
            var empty = from a in myctx.ServiceProviders
                        where a.SupervisorID == Convert.ToInt16(Label30.Text)
                        select a;

            if (empty.Count() != 0)
            {
                var ty = empty.First();
                Label31.Text = ty.ServiceProviderType;
            }


            //ArrayList yearlist1 = new ArrayList();

            //for (int yea1 = 2019; yea1 <= 2050; yea1++)
            //{

            //    yearlist1.Add(yea1);

            //}
            //SYear.DataSource = yearlist1;
            //SYear.DataBind();

            //ArrayList monlist = new ArrayList();

            //for (int mon = 1; mon <= 12; mon++)
            //{

            //    monlist.Add(mon);

            //}
            //SMonth.DataSource = monlist;
            //SMonth.DataBind();


            //// Panel1.Visible = false;

            //ArrayList year2list = new ArrayList();

            //for (int yea = 2019; yea <= 2050; yea++)
            //{

            //    yearlist1.Add(yea);

            //}
            //Eyear.DataSource = yearlist1;
            //Eyear.DataBind();



            //ArrayList monlist1 = new ArrayList();

            //for (int mon = 1; mon <= 12; mon++)
            //{

            //    monlist.Add(mon);

            //}
            //EMonth.DataSource = monlist;
            //EMonth.DataBind();



            var elm1 = from BookCode1 in myctx.Bookings
                       orderby BookCode1.BookingCode descending
                       select BookCode1.BookingCode;

            if (elm1.Count() == 0)
            {
                Label11.Text = "BC00001";
            }

            if (elm1.Count() != 0)
            {
                var val = elm1.First();

                string s = val;
                int    i = Convert.ToInt32(s.Substring(3, 4));
                i = i + 1;
                s = i.ToString();

                if (s.Length == 1)
                {
                    Label11.Text = "BC0000" + i;
                }

                if (s.Length == 2)
                {
                    Label11.Text = "BC000" + i;
                }

                if (s.Length == 3)
                {
                    Label11.Text = "BC00" + i;
                }

                if (s.Length == 4)
                {
                    Label11.Text = "BC0" + i;
                }

                if (s.Length == 5)
                {
                    Label11.Text = "BC" + i;
                }
            }
            var executemp = from a in myctx.Employees
                            where a.EmployeeType == "Executive Secretary"
                            select new { name = a.FirstName + "  " + a.LastName, a.EID };

            if (executemp.Count() != 0)
            {
                BookingDL.DataSource     = executemp;
                BookingDL.DataTextField  = "name";
                BookingDL.DataValueField = "EID";
                BookingDL.DataBind();
            }
            //var sp2 = from a in myctx.ServiceProviders
            //          from b in myctx.Supervisors
            //          where a.SupervisorID == b.SupervisorID && a.SupervisorID==Convert.ToInt16(Label30.Text)
            //          select new { name = a.SPFirstName + "  " + a.SPLastName, a.ServiceProviderID };

            //if (sp2.Count() != 0)
            //{
            //    DropDownListSP.DataSource = sp2;
            //    DropDownListSP.DataTextField = "name";
            //    DropDownListSP.DataValueField = "ServiceProviderID";
            //    DropDownListSP.DataBind();
            //}
        }
Example #6
0
        public IHttpActionResult SaveBooking(BookingModel model)
        {
            try
            {
                var UserId = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.NameIdentifier)).Value;

                var RefType = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Name)).Value;

                var RefID = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Sid)).Value;

                if (RefType == "1")
                {
                    model.TherapistID = Convert.ToInt32(RefID);
                }
                else if (RefType == "2")
                {
                    model.PatientID = Convert.ToInt32(RefID);
                }

                BookingDL obj = new BookingDL();
                obj.SaveBooking(model, UserId);

                //if (model.BookingID == 0)
                //{
                //    SendMail mail = new SendMail();
                //    RegisterDL obj1 = new RegisterDL();
                //    var list = obj1.GetUserDetails(Convert.ToInt32(UserId), Convert.ToInt32(RefType));

                //    var getAllService = obj1.GetAllServices();
                //    string getServiceName = "";
                //    foreach (var item in model.BookingSerList)
                //    {
                //        getServiceName += getAllService.Where(x => x.ServiceID == item.ServiceID).FirstOrDefault().ServiceName + ",";
                //    }
                //    getServiceName = getServiceName.TrimEnd(',');

                //    string body = mail.createEmailBody("PatientBooking.html");
                //    body = body.Replace("{UserName}", list[0].FirstName + " " + list[0].LastName);
                //    body = body.Replace("{servicename}", getServiceName);

                //    mail.SendGeneralMail("Patient Booking", list[0].Email, body);
                //}

                int bookId = Convert.ToInt32(RefID);

                int BookingID = entities.Bookings.Where(x => x.PatientID == bookId).Select(x => x.BookingID).FirstOrDefault();


                responseData.message = "Booking details saved successfully";
                responseData.success = true;
                responseData.data    = BookingID;
                return(Ok(responseData));
            }
            catch (Exception ex)
            {
                responseData.message = ex.Message != null?ex.Message.ToString() : "server error";

                responseData.success = false;
                return(Ok(responseData));
            }
        }
Example #7
0
        public IHttpActionResult ApproveCancelBooking(PatientBookingModel model)
        {
            try
            {
                var UserId  = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.NameIdentifier)).Value;
                var RefType = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Name)).Value;
                var RefID   = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Sid)).Value;

                BookingDL obj = new BookingDL();
                obj.ApproveCancelBooking(model);
                model.success = true;
                model.message = "Booking " + model.Status + " successfully";
                model.code    = 200;

                //For Therapist
                if (model.Status == "APPROVED")
                {
                    SendMail   mail = new SendMail();
                    RegisterDL obj1 = new RegisterDL();

                    var getBooking = entities.PatientBookings.Where(x => x.PatientBookingID == model.PatientBookingID).FirstOrDefault();

                    var getUserTherapist = entities.Therapists.Where(x => x.TherapistID == getBooking.TherapistID).FirstOrDefault();

                    var getUserPatient = entities.Patients.Where(x => x.PatientID == getBooking.PatientID).FirstOrDefault();

                    var getUserTherapistEmail = entities.Users.Where(x => x.RefID == getUserTherapist.TherapistID && x.RefType == 1).FirstOrDefault();

                    var getUserPatientEmail = entities.Users.Where(x => x.RefID == getUserPatient.PatientID && x.RefType == 2).FirstOrDefault();

                    var services = (from ep in entities.Services
                                    join e in entities.PatientBookings on ep.ServiceID equals e.ServiceID
                                    where e.PatientBookingID == model.PatientBookingID
                                    select new
                    {
                        ServiceName = ep.ServiceName
                    }).ToList();

                    string getServiceName = "";
                    foreach (var item in services)
                    {
                        getServiceName += item.ServiceName + ",";
                    }
                    getServiceName = getServiceName.TrimEnd(',');


                    string bookingDate = getBooking.BookingDate?.DayOfWeek.ToString() + " " + getBooking.BookingDate?.ToString("MMMM") + " " + getBooking.BookingDate?.Day + " " + getBooking.BookingDate?.Year;



                    //For Therapist
                    string body = mail.createEmailBody("TherapistBookingConfirmation.html");
                    body = body.Replace("{PatientName}", getUserPatient.FirstName + " " + getUserPatient.LastName);
                    body = body.Replace("{UserName}", getUserTherapist.FirstName + " " + getUserTherapist.LastName);
                    body = body.Replace("{PatientAddress}", getBooking.Address);

                    body = body.Replace("{PatientServices}", getServiceName);
                    body = body.Replace("{Datetime}", bookingDate + " " + getBooking.FromTime + " to " + getBooking.ToTime);

                    mail.SendGeneralMail("Therapist Booking Confirmation", getUserTherapistEmail.Email, body);

                    //For Patient
                    string body1 = mail.createEmailBody("PatientBookingConfirmation.html");
                    body1 = body1.Replace("{PatientName}", getUserPatient.FirstName + " " + getUserPatient.LastName);
                    body1 = body1.Replace("{UserName}", getUserPatient.FirstName + " " + getUserPatient.LastName);
                    body1 = body1.Replace("{PatientServices}", getServiceName);
                    body1 = body1.Replace("{PatientAddress}", getBooking.Address);
                    body1 = body1.Replace("{TherapistName}", getUserTherapist.FirstName + " " + getUserTherapist.LastName);
                    body1 = body1.Replace("{Datetime}", bookingDate + " " + getBooking.FromTime + " to " + getBooking.ToTime);

                    mail.SendGeneralMail("Patient Booking Confirmation", getUserPatientEmail.Email, body1);
                }


                return(Ok(model));
            }
            catch (Exception ex)
            {
                responseData.message = ex.Message != null?ex.Message.ToString() : "server error";

                return(Ok(responseData));
            }
        }
Example #8
0
        public IHttpActionResult GetPatientBooking(PatientBookingModel model)
        {
            try
            {
                var UserId = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.NameIdentifier)).Value;

                var RefType = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.Name)).Value;

                BookingDL obj = new BookingDL();

                PatientBookingModel booking = entities.PatientBookings.Where(x => x.PatientBookingID == model.PatientBookingID).Select(y => new PatientBookingModel
                {
                    PatientBookingID = y.PatientBookingID,
                    BookingDate      = y.BookingDate,
                    Status           = y.Status,
                    Address          = y.Address,
                    FromTime         = y.FromTime,
                    ToTime           = y.ToTime,
                    PatientID        = y.PatientID,
                    TherapistID      = y.TherapistID,
                    ServiceID        = y.ServiceID
                }).FirstOrDefault();

                if (booking == null)
                {
                    booking             = new PatientBookingModel();
                    booking.ServiceList = new List <ServicesModel>();
                }

                booking.ServiceList = entities.Services.Where(x => x.ParServiceID == 0).Select(y => new ServicesModel
                {
                    ServiceID   = y.ServiceID,
                    ServiceName = y.ServiceName
                }).ToList();


                booking.TherapistList = (from ep in entities.Therapists
                                         join e in entities.Users on ep.TherapistID equals e.RefID
                                         where e.RefType == 1 && e.Approve == 1
                                         select new TherapistModel
                {
                    UserName = ep.FirstName + " " + ep.LastName,
                    TherapistID = ep.TherapistID
                }).ToList();

                //             SELECT(T.FirstName + ' ' + T.LastName) as UserName,T.TherapistID,U.UserID FROM[therapistdb].[Therapist]
                //     T
                //INNER JOIN[therapistdb].[Users]
                //     U on T.TherapistID = U.RefID AND U.RefType = 1
                //WHERE U.Approve = 1
                //BookingModel list = obj.GetBooking(Convert.ToInt32(UserId), Convert.ToInt32(RefType), model.BookingID);

                //list.success = true;
                //list.message = "Get booking details Successfully";
                //list.code = 200;

                return(Ok(booking));
            }
            catch (Exception ex)
            {
                responseData.message = ex.Message != null?ex.Message.ToString() : "server error";

                return(Ok(responseData));
            }
        }
Example #9
0
    public bool updateBookingStatus(out DataSet ds, out string errMsg, long bookingID, string bookingStatus)
    {
        BookingDL dl = new BookingDL();

        return(dl.updateBookingStatus(out ds, out errMsg, bookingID, bookingStatus));
    }