public void SetEditMode(bool isEditMode)
    {
        if (isEditMode)
        {
            tbl_edit_mode.Visible     = true;
            tbl_non_edit_mode.Visible = false;

            td_edit_Available.BgColor   = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.Updatable));
            td_edit_Unavailable.BgColor = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.UnavailableButAddable));
            td_edit_Booking.BgColor     = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.UpdatableConfirmable));
        }
        else
        {
            tbl_edit_mode.Visible     = false;
            tbl_non_edit_mode.Visible = true;

            td_Available.BgColor   = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.Available));
            td_Unavailable.BgColor = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.UnavailableButAddable));

            td_AC_Unconfirmed.BgColor     = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.Booking_AC_NonEPC_Future_Unconfirmed));
            td_AC_Confirmed.BgColor       = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.Booking_AC_NonEPC_Future_Confirmed));
            td_AC_Unconfirmed_epc.BgColor = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.Booking_AC_EPC_Future_Unconfirmed));
            td_AC_Confirmed_epc.BgColor   = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.Booking_AC_EPC_Future_Confirmed));

            td_CL_Unconfirmed.BgColor     = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.Booking_CL_NonEPC_Future_Unconfirmed));
            td_CL_Confirmed.BgColor       = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.Booking_CL_NonEPC_Future_Confirmed));
            td_CL_Unconfirmed_epc.BgColor = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.Booking_CL_EPC_Future_Unconfirmed));
            td_CL_Confirmed_epc.BgColor   = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.Booking_CL_EPC_Future_Confirmed));

            td_Completed.BgColor = System.Drawing.ColorTranslator.ToHtml(BookingSlot.GetColor(BookingSlot.Type.Booking_AC_NonEPC_Past_Completed_Has_Invoice));
        }
    }
 public ApiResponse AddBookingSlot(BookingSlot bookingSlot)
 {
     try
     {
         var _bookingSlot = _context.BookingSlots.FirstOrDefault(b => b.Day == bookingSlot.Day &&
                                                                 b.FromTo == bookingSlot.FromTo);
         if (_bookingSlot != null)
         {
             return(new ApiResponse
             {
                 Added = false,
                 Message = "Booking Slot already added for " + bookingSlot.Day
             });
         }
         _context.BookingSlots.Add(bookingSlot);
         _context.SaveChanges();
         return(new ApiResponse
         {
             Added = true,
             Message = "Booking Slot added successfully."
         });
     }
     catch (Exception)
     {
         return(new ApiResponse
         {
             Added = false,
             Message = "Error occured. Please try again..."
         });
     }
 }
Beispiel #3
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BookingSlot bookingSlot = db.BookingSlots.Find(id);

            if (bookingSlot == null)
            {
                return(HttpNotFound());
            }
            return(View(bookingSlot));
        }
Beispiel #4
0
        public ActionResult BookSlot([Bind(Include = "VehicleNumber,AllocatedDate,AllocatedTime,VehicleType")] BookingSlot bs)
        {
            if (bs.VehicleType != null && bs.VehicleNumber != null)
            {
                if (bs.VehicleType == "Large")
                {
                    var count = db.BookingSlots.Where(x => x.VehicleType == "Large" && x.VehicleNumber == null).ToList().Count();
                    if (count != 0)
                    {
                        var EditedObj = db
                                        .BookingSlots
                                        .Where(x => x.VehicleType == "Large" && x.VehicleNumber == null)
                                        .First();

                        EditedObj.VehicleNumber = bs.VehicleNumber;
                        EditedObj.AllocatedDate = DateTime.Now;
                        EditedObj.AllocatedTime = DateTime.Now.TimeOfDay;
                        db.SaveChanges();
                    }
                }
                else if (bs.VehicleType == "Medium")
                {
                    var EditedObj = db
                                    .BookingSlots
                                    .Where(x => x.VehicleType == "Medium" || x.VehicleType == "Medium" && x.VehicleNumber == null)
                                    .First();
                    EditedObj.VehicleNumber = bs.VehicleNumber;
                    EditedObj.AllocatedDate = DateTime.Now;
                    EditedObj.AllocatedTime = DateTime.Now.TimeOfDay;
                    db.SaveChanges();
                }
                else if (bs.VehicleType == "Small")
                {
                    var EditedObj = db
                                    .BookingSlots
                                    .Where(x => x.VehicleNumber == null)
                                    .First();
                    EditedObj.VehicleNumber = bs.VehicleNumber;
                    EditedObj.AllocatedDate = DateTime.Now;
                    EditedObj.AllocatedTime = DateTime.Now.TimeOfDay;
                    db.SaveChanges();
                }
            }
            else
            {
                ViewBag.DropDown = db.BookingSlots.Select(u => u.VehicleType).Distinct().ToList();
                return(View());
            }
            return(RedirectToAction("HomePage"));
        }
Beispiel #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            BookingSlot bookingSlot = db.BookingSlots.Find(id);

            his.AllocatedDate         = bookingSlot.AllocatedDate.Value;
            his.AllocatedTime         = bookingSlot.AllocatedTime.Value;
            his.VehicleNo             = bookingSlot.VehicleNumber;
            his.SlotNo                = bookingSlot.SlotNo.Value;
            his.UnAllocatedDate       = DateTime.Now;
            his.UnAllocatedTime       = DateTime.Now.TimeOfDay;
            bookingSlot.VehicleNumber = null;
            bookingSlot.AllocatedDate = null;
            bookingSlot.AllocatedTime = null;
            db.History.Add(his);
            db.SaveChanges();
            return(RedirectToAction("UnallocateParkingSlot"));
        }
 public ApiResponse AddBookingSlot(BookingSlot bookingSlot)
 {
     return(_dal.AddBookingSlot(bookingSlot));
 }
    public static System.Drawing.Color GetColor(BookingSlot.Type slotType)
    {
        if (slotType == BookingSlot.Type.Unavailable)
            return GetColourFromConfig("BookingColour_Unavailable");
        if (slotType == BookingSlot.Type.Available)
            return GetColourFromConfig("BookingColour_Available");
        if (slotType == BookingSlot.Type.Available_PatientLoggedIn)
            return GetColourFromConfig("BookingColour_Available");
        if (slotType == BookingSlot.Type.UnavailableButAddable)
            return GetColourFromConfig("BookingColour_UnavailableButAddable");
        if (slotType == BookingSlot.Type.UnavailableButUpdatable)
            return GetColourFromConfig("BookingColour_UnavailableButUpdatable");

        if (slotType == BookingSlot.Type.Booking_CL_EPC_Past_Completed_Has_Invoice)
            return GetColourFromConfig("BookingColour_CL_EPC_Past_Completed_Has_Invoice");
        if (slotType == BookingSlot.Type.Booking_CL_EPC_Past_Completed_No_Invoice)
            return GetColourFromConfig("BookingColour_CL_EPC_Past_Completed_No_Invoice");
        if (slotType == BookingSlot.Type.Booking_CL_EPC_Past_Uncompleted_Unconfirmed)
            return GetColourFromConfig("BookingColour_CL_EPC_Future_Unconfirmed");
        if (slotType == BookingSlot.Type.Booking_CL_EPC_Past_Uncompleted_Confirmed)
            return GetColourFromConfig("BookingColour_CL_EPC_Future_Confirmed");
        if (slotType == BookingSlot.Type.Booking_CL_EPC_Future_Unconfirmed)
            return GetColourFromConfig("BookingColour_CL_EPC_Future_Unconfirmed");
        if (slotType == BookingSlot.Type.Booking_CL_EPC_Future_Confirmed)
            return GetColourFromConfig("BookingColour_CL_EPC_Future_Confirmed");

        if (slotType == BookingSlot.Type.Booking_AC_EPC_Past_Completed_Has_Invoice)
            return GetColourFromConfig("BookingColour_AC_EPC_Past_Completed_Has_Invoice");
        if (slotType == BookingSlot.Type.Booking_AC_EPC_Past_Completed_No_Invoice)
            return GetColourFromConfig("BookingColour_AC_EPC_Past_Completed_No_Invoice");
        if (slotType == BookingSlot.Type.Booking_AC_EPC_Past_Uncompleted_Unconfirmed)
            return GetColourFromConfig("BookingColour_AC_EPC_Future_Unconfirmed");
        if (slotType == BookingSlot.Type.Booking_AC_EPC_Past_Uncompleted_Confirmed)
            return GetColourFromConfig("BookingColour_AC_EPC_Future_Confirmed");
        if (slotType == BookingSlot.Type.Booking_AC_EPC_Future_Unconfirmed)
            return GetColourFromConfig("BookingColour_AC_EPC_Future_Unconfirmed");
        if (slotType == BookingSlot.Type.Booking_AC_EPC_Future_Confirmed)
            return GetColourFromConfig("BookingColour_AC_EPC_Future_Confirmed");

        if (slotType == BookingSlot.Type.Booking_CL_NonEPC_Past_Completed_Has_Invoice)
            return GetColourFromConfig("BookingColour_CL_NonEPC_Past_Completed_Has_Invoice");
        if (slotType == BookingSlot.Type.Booking_CL_NonEPC_Past_Completed_No_Invoice)
            return GetColourFromConfig("BookingColour_CL_NonEPC_Past_Completed_No_Invoice");
        if (slotType == BookingSlot.Type.Booking_CL_NonEPC_Past_Uncompleted_Unconfirmed)
            return GetColourFromConfig("BookingColour_CL_NonEPC_Future_Unconfirmed");
        if (slotType == BookingSlot.Type.Booking_CL_NonEPC_Past_Uncompleted_Confirmed)
            return GetColourFromConfig("BookingColour_CL_NonEPC_Future_Confirmed");
        if (slotType == BookingSlot.Type.Booking_CL_NonEPC_Future_Unconfirmed)
            return GetColourFromConfig("BookingColour_CL_NonEPC_Future_Unconfirmed");
        if (slotType == BookingSlot.Type.Booking_CL_NonEPC_Future_Confirmed)
            return GetColourFromConfig("BookingColour_CL_NonEPC_Future_Confirmed");

        if (slotType == BookingSlot.Type.Booking_AC_NonEPC_Past_Completed_Has_Invoice)
            return GetColourFromConfig("BookingColour_AC_NonEPC_Past_Completed_Has_Invoice");
        if (slotType == BookingSlot.Type.Booking_AC_NonEPC_Past_Completed_No_Invoice)
            return GetColourFromConfig("BookingColour_AC_NonEPC_Past_Completed_No_Invoice");
        if (slotType == BookingSlot.Type.Booking_AC_NonEPC_Past_Uncompleted_Unconfirmed)
            return GetColourFromConfig("BookingColour_AC_NonEPC_Future_Unconfirmed");
        if (slotType == BookingSlot.Type.Booking_AC_NonEPC_Past_Uncompleted_Confirmed)
            return GetColourFromConfig("BookingColour_AC_NonEPC_Future_Confirmed");
        if (slotType == BookingSlot.Type.Booking_AC_NonEPC_Future_Unconfirmed)
            return GetColourFromConfig("BookingColour_AC_NonEPC_Future_Unconfirmed");
        if (slotType == BookingSlot.Type.Booking_AC_NonEPC_Future_Confirmed)
            return GetColourFromConfig("BookingColour_AC_NonEPC_Future_Confirmed");

        if (slotType == BookingSlot.Type.Booking_Future_PatientLoggedIn)
            return GetColourFromConfig("BookingColour_Future_PatientLoggedIn");
        if (slotType == BookingSlot.Type.Booking_Past_PatientLoggedIn)
            return GetColourFromConfig("BookingColour_Past_PatientLoggedIn");

        if (slotType == BookingSlot.Type.Updatable)
            return GetColourFromConfig("BookingColour_Updatable");
        if (slotType == BookingSlot.Type.UpdatableConfirmable)
            return GetColourFromConfig("BookingColour_CL_EPC_Future_Unconfirmed");    /// what about AC or NonEPC ?
        if (slotType == BookingSlot.Type.FullDayAvailable)
            return GetColourFromConfig("BookingColour_Available");
        if (slotType == BookingSlot.Type.FullDayUpdatable)
            return GetColourFromConfig("BookingColour_Available");
        if (slotType == BookingSlot.Type.FullDayTaken)
            return GetColourFromConfig("BookingColour_FullDayTaken");
        throw new Exception("Unknown slotType");
    }
    public static string GetContextMenuClass(BookingSlot.Type slotType)
    {
        if (slotType == BookingSlot.Type.Unavailable)
            return "showTakenContext";
        if (slotType == BookingSlot.Type.Available)
            return "showAddableContext";
        if (slotType == BookingSlot.Type.Available_PatientLoggedIn)
            return "showAddableContext_PatientLoggedIn";
        if (slotType == BookingSlot.Type.UnavailableButAddable)
            return "showTakenButAddableContext";
        if (slotType == BookingSlot.Type.UnavailableButUpdatable)
            return "showTakenButUpdatableContext";

        if (slotType == BookingSlot.Type.Booking_CL_EPC_Past_Completed_Has_Invoice    ||
            slotType == BookingSlot.Type.Booking_CL_NonEPC_Past_Completed_Has_Invoice)
            return "Menu_Past_Completed_Has_Invoice_Clinic";

        if (slotType == BookingSlot.Type.Booking_AC_EPC_Past_Completed_Has_Invoice    ||
            slotType == BookingSlot.Type.Booking_AC_NonEPC_Past_Completed_Has_Invoice)
            return "Menu_Past_Completed_Has_Invoice_AC";

        if (slotType == BookingSlot.Type.Booking_CL_EPC_Past_Completed_No_Invoice     ||
            slotType == BookingSlot.Type.Booking_AC_EPC_Past_Completed_No_Invoice     ||
            slotType == BookingSlot.Type.Booking_CL_NonEPC_Past_Completed_No_Invoice  ||
            slotType == BookingSlot.Type.Booking_AC_NonEPC_Past_Completed_No_Invoice)
            return "Menu_Past_Completed_No_Invoice";

        if (slotType == BookingSlot.Type.Booking_CL_EPC_Past_Uncompleted_Unconfirmed    ||
            slotType == BookingSlot.Type.Booking_CL_EPC_Past_Uncompleted_Confirmed      ||
            slotType == BookingSlot.Type.Booking_CL_NonEPC_Past_Uncompleted_Unconfirmed ||
            slotType == BookingSlot.Type.Booking_CL_NonEPC_Past_Uncompleted_Confirmed)
            return "Menu_Past_Uncompleted_Clinic";

        if (slotType == BookingSlot.Type.Booking_AC_EPC_Past_Uncompleted_Unconfirmed    ||
            slotType == BookingSlot.Type.Booking_AC_EPC_Past_Uncompleted_Confirmed      ||
            slotType == BookingSlot.Type.Booking_AC_NonEPC_Past_Uncompleted_Unconfirmed ||
            slotType == BookingSlot.Type.Booking_AC_NonEPC_Past_Uncompleted_Confirmed)
            return "Menu_Past_Uncompleted_AC";

        if (slotType == BookingSlot.Type.Booking_CL_EPC_Future_Unconfirmed    ||
            slotType == BookingSlot.Type.Booking_CL_EPC_Future_Confirmed      ||
            slotType == BookingSlot.Type.Booking_CL_NonEPC_Future_Unconfirmed ||
            slotType == BookingSlot.Type.Booking_CL_NonEPC_Future_Confirmed)
            return "Menu_Future_Clinic";

        if (slotType == BookingSlot.Type.Booking_AC_EPC_Future_Unconfirmed ||
            slotType == BookingSlot.Type.Booking_AC_EPC_Future_Confirmed ||
            slotType == BookingSlot.Type.Booking_AC_NonEPC_Future_Unconfirmed ||
            slotType == BookingSlot.Type.Booking_AC_NonEPC_Future_Confirmed)
            return "Menu_Future_AC";

        if (slotType == BookingSlot.Type.Booking_Future_PatientLoggedIn)
            return "Menu_Future_PatientLoggedIn";
        if (slotType == BookingSlot.Type.Booking_Past_PatientLoggedIn)
            return "emptyContext";

        if (slotType == BookingSlot.Type.Updatable)
            return "showUpdatableContext";
        if (slotType == BookingSlot.Type.UpdatableConfirmable)
            return "showUpdatableContext";
        if (slotType == BookingSlot.Type.FullDayAvailable)
            return "showFullDayAddableContext";
        if (slotType == BookingSlot.Type.FullDayUpdatable)
            return "showFullDayUpdatableContext";
        if (slotType == BookingSlot.Type.FullDayTaken)
            return "showFullDayTakenContext";
        if (slotType == BookingSlot.Type.PatientAndServiceNotSet)
            return "showPatientAndServiceNotSetContext";
        if (slotType == BookingSlot.Type.PatientNotSet)
            return "showPatientNotSetContext";
        if (slotType == BookingSlot.Type.ServiceNotSet)
            return "showServiceNotSetContext";
        if (slotType == BookingSlot.Type.None)
            return "emptyContext";

        throw new Exception("Unknown slotType");
    }
    protected string GetBookingText(Hashtable patientsPhoneNumbersCache, string callCenterPrefix, Booking curBooking, Hashtable patientsHasNotesCache, Hashtable patientsHasMedNotesCache, Hashtable patientsHasMedCondNotesCache, Hashtable patientsFlashingNotesCache, Hashtable patientsOwingCache, bool isShowable, bool isPatientLoggedIn, string bookingTypeText, bool bkHasChangeHistory, bool isfirstSlotOfBooking, bool incOrg, BookingSlot.Type bookingSlotType)
    {
        if (isPatientLoggedIn && !isShowable)
            return Utilities.IsDev() ? "  " : string.Empty;

        bool     IsMobileDevice = Utilities.IsMobileDevice(Request);
        UserView userView       = UserView.GetInstance();
        bool     isProviderViewAndOtherProviderBk = userView.IsProviderView && curBooking.Provider != null && Convert.ToInt32(Session["StaffID"]) != curBooking.Provider.StaffID;
        if (isProviderViewAndOtherProviderBk)
            isShowable = false;

        bool isCollapsed = false; //GetFormIsCollapsed();

        string blankText          = Utilities.IsDev() ? "<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>" : "<br/><br/>";
        string blankTextCollapsed = Utilities.IsDev() ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "";

        string unavailableProvText = string.Empty;
        if (curBooking.BookingTypeID == 341 || curBooking.BookingTypeID == 342 || curBooking.BookingTypeID == 36)
        {
            unavailableProvText = (curBooking.IsRecurring) ?
                unavailableProvText = curBooking.RecurringDayOfWeek.ToString() + "'s this time <br /><b>" + curBooking.DateStart.Date.ToString("dd'/'MM'/'yy") + (curBooking.DateEnd == DateTime.MinValue ? " onwards" : " - " + curBooking.DateEnd.AddDays(-1).Date.ToString("dd'/'MM'/'yy")) + "</b>" + (curBooking.Organisation == null ? " <br />*<b>all orgs</b>*" : "") :
                unavailableProvText = "this time" + (curBooking.Organisation == null ? " *<b>all orgs</b>*" : "");
        }

        string unavailabilityReason = curBooking.BookingUnavailabilityReason == null ? "" : "<br /><i>[" + curBooking.BookingUnavailabilityReason.Descr + "]</i>";
        string addedByText = curBooking.AddedBy == null ? "" : "<a href=\"#\" onclick=\"$(this).tooltip().mouseover();return false;\" title=\"Added By " + curBooking.AddedBy.Person.FullnameWithoutMiddlename + " on " + curBooking.DateCreated.ToString("ddd d MMM, yyyy") + "\" style=\"text-decoration:none;\">*</a>";

        if (curBooking.BookingTypeID == 342)
        {
            if (curBooking.Provider != null)
                return isfirstSlotOfBooking && !isCollapsed ? curBooking.Provider.Person.FullnameWithoutMiddlename + " is unavailable " + unavailableProvText + unavailabilityReason + " " + addedByText : (isCollapsed ? blankTextCollapsed : blankText);
            else if (curBooking.Organisation != null)
                return isfirstSlotOfBooking && !isCollapsed ? curBooking.Organisation.Name + " is unavailable " + unavailableProvText + unavailabilityReason + " " + addedByText : (isCollapsed ? blankTextCollapsed : blankText);
            else
                return isfirstSlotOfBooking && !isCollapsed ? "All orgs/providers unavailable " + unavailableProvText + unavailabilityReason + " " + addedByText : (isCollapsed ? blankTextCollapsed : blankText);
        }
        else if (curBooking.BookingTypeID == 341)
            return isfirstSlotOfBooking && !isCollapsed ? curBooking.Provider.Person.FullnameWithoutMiddlename + " is unavailable " + unavailableProvText + unavailabilityReason + " " + addedByText : (isCollapsed ? blankTextCollapsed : blankText);
        else if (curBooking.BookingTypeID == 340)
            return isfirstSlotOfBooking && !isCollapsed ? curBooking.Organisation.Name + " is unavailable this day" : (isCollapsed ? blankTextCollapsed + unavailabilityReason + " " + addedByText : blankText);
        else if (curBooking.BookingTypeID == 36)
            return isfirstSlotOfBooking && !isCollapsed ? curBooking.Provider.Person.FullnameWithoutMiddlename + " is unavailable this time <a href=\"#\" onclick=\"$(this).tooltip().mouseover();return false;\" title=\"Paid Break - Counted In The Hours Worked Report\" style=\"color:inherit;\">(<u>P</u>)</a>" + unavailabilityReason + " " + addedByText : (isCollapsed ? blankTextCollapsed : blankText);
        else if (!isfirstSlotOfBooking)
            return (isCollapsed ? blankTextCollapsed : blankText);
        else
        {
            if (isCollapsed)
                return blankTextCollapsed;

            bool SiteIsClinic   = Convert.ToBoolean(Session["SiteIsClinic"]);
            bool SiteIsAgedCare = Convert.ToBoolean(Session["SiteIsAgedCare"]);
            bool SiteIsGP       = Convert.ToBoolean(Session["SiteIsGP"]);

            if (curBooking.Organisation.OrganisationType.OrganisationTypeGroup.ID == 6 && curBooking.Patient == null) // aged care
            {
                ArrayList orgTreeBranch = new ArrayList();

                Organisation org = curBooking.Organisation;
                orgTreeBranch.Add(org);
                while (org.ParentOrganisation != null)
                {
                    org = org.ParentOrganisation;
                    orgTreeBranch.Add(org);
                }

                string text = string.Empty;
                for (int i = orgTreeBranch.Count - 1; i >= 0; i--)
                    text += (text.Length == 0 ? "" : "<br />") + "&nbsp;・ " + ((Organisation)orgTreeBranch[i]).Name;

                return text;
            }
            else if (curBooking.Organisation.OrganisationType.OrganisationTypeGroup.ID == 6 && curBooking.Patient != null)
            {

                bool includeOrg = incOrg;
                bool incProvider = false;

                string notesText = string.Empty;
                if (curBooking.Patient != null)
                    notesText             = Note.GetBookingPopupLinkTextV2(curBooking.EntityID, curBooking.NoteCount > 0, true, 1425, 700, "images/notes-bw-24-Thin.png", "images/notes-24-Thin.png", null, !IsMobileDevice);
                //string notesText        = Note.GetPopupLinkTextV2(15, curBooking.EntityID, curBooking.NoteCount > 0, true, 980, 530, "images/notes-bw-24-Thin.png", "images/notes-24-Thin.png", null, !IsMobileDevice);
                bool   ptHasNotes         = patientsHasNotesCache[curBooking.Patient.Person.EntityID] != null;
                string ptNotesText        = Note.GetPopupLinkTextV2(16, curBooking.Patient.Person.EntityID, ptHasNotes, true, 1425, 640, "images/BC-24-Thin-bw.png", "images/BC-24-Thin.png", null, !IsMobileDevice);
                bool   ptHasMedsNotes     = patientsHasMedNotesCache[curBooking.Patient.Person.EntityID] != null;
                string ptMedsNotesText    = Note.GetPopupLinkTextV2(17, curBooking.Patient.Person.EntityID, ptHasMedsNotes, true, 1050, 530, "images/M-24-Thin-bw.png", "images/M-24-Thin.png", null, !IsMobileDevice);
                bool   ptHasMedCondNotes  = patientsHasMedCondNotesCache[curBooking.Patient.Person.EntityID] != null;
                string ptMedCondNotesText = Note.GetPopupLinkTextV2(18, curBooking.Patient.Person.EntityID, ptHasMedCondNotes, true, 1050, 530, "images/MC-24-Thin-bw.png", "images/MC-24-Thin.png", null, !IsMobileDevice);

                bool hasArrived = curBooking.ArrivalTime != DateTime.MinValue;
                string jsArrivedText = hasArrived ?
                                            "javascript:ajax_booking_confirm_delete_cancel('unarrived', '" + curBooking.BookingID.ToString() + "');" :
                                            "javascript:ajax_booking_confirm_delete_cancel('arrived', '" + curBooking.BookingID.ToString() + "');";
                string imgArrivedText = "images/person2colour-24.png";
                string setArrivedText = "<input type=\"image\" title=\"" + (hasArrived ? "Unset Arrived" : "Set Arrived") + "\" src=\"" + imgArrivedText + "\" alt=\"" + (hasArrived ? "Unset Arrived" : "Set Arrived") + "\" onclick=\"" + jsArrivedText + "\" />";
                if (curBooking.ArrivalTime != DateTime.MinValue)
                    setArrivedText += "&nbsp;<b>" + curBooking.ArrivalTime.ToString("HH:mm") + "</b>";

                bool isConfirmed = curBooking.DateConfirmed != DateTime.MinValue;
                string jsConfirmedText = isConfirmed ?
                                            "javascript:ajax_booking_confirm_delete_cancel('unconfirm', '" + curBooking.BookingID.ToString() + "');" :
                                            "javascript:ajax_booking_confirm_delete_cancel('confirm', '" + curBooking.BookingID.ToString() + "');";
                string imgConfirmedText = isConfirmed ? "images/tick2color-24.png" : "images/tick2bw-24.png";
                string setConfirmedText = "<input type=\"image\" title=\"" + (isConfirmed ? "Set Unconfirmed" : "Set Confirmed") + "\" src=\"" + imgConfirmedText + "\" alt=\"" + (isConfirmed ? "Set Unconfirmed" : "Set Confirmed") + "\" onclick=\"" + jsConfirmedText + "\" />";

                bool   hasFlashingNote = patientsFlashingNotesCache[curBooking.Patient.PatientID] != null;
                string flashingNote    = hasFlashingNote ? (string)patientsFlashingNotesCache[curBooking.Patient.PatientID] : string.Empty;
                string flasingTextIcon = Patient.GetFlashingTextLink(curBooking.Patient.PatientID, hasFlashingNote, flashingNote, true, 525, 275, "images/asterisk_bw_16.png", "images/asterisk_red_16.gif", null, !IsMobileDevice);

                bool   hasOwing  = patientsOwingCache[curBooking.Patient.PatientID] != null;
                string owingText = hasOwing ? "<b><font color=\"red\">Owes $" + Convert.ToDecimal(patientsOwingCache[curBooking.Patient.PatientID]).ToString("0.00") + "</font></b>" : string.Empty;

                //string printLetterJS = "javascript:window.location.href='Letters_PrintV2.aspx?booking="+curBooking.BookingID+"';return false;";
                //string printLetterImg = "images/printer_green-24.png";
                //string printLetterText = "<input type=\"image\" title=\"Print Letter\" src=\"" + printLetterImg + "\" alt=\"Print Letter\" onclick=\"" + printLetterJS + "\" />";

                string preferredNbr = string.Empty;
                if (curBooking.Patient != null)
                {
                    if (Utilities.GetAddressType().ToString() == "Contact")
                    {
                        Contact[] phoneNbrs = GetPatientsPhoneNumbersFromCache(patientsPhoneNumbersCache, curBooking.Patient.Person.EntityID);
                        if (phoneNbrs != null && phoneNbrs.Length > 0)
                        {
                            preferredNbr = phoneNbrs[0].PhoneNumberWithDashes;

                            bool curIsMobile = phoneNbrs[0].ContactType.ContactTypeID == 30;

                            for (int i = 1; i < phoneNbrs.Length; i++)
                            {
                                if (phoneNbrs[i].ContactType.ContactTypeID == 30 && !curIsMobile)
                                {
                                    curIsMobile = phoneNbrs[i].ContactType.ContactTypeID == 30;
                                    preferredNbr = phoneNbrs[i].PhoneNumberWithDashes;
                                }
                            }
                        }
                    }
                    else if (Utilities.GetAddressType().ToString() == "ContactAus")
                    {
                        ContactAus[] phoneNbrs = GetPatientsPhoneNumbersFromAusCache(patientsPhoneNumbersCache, curBooking.Patient.Person.EntityID);
                        if (phoneNbrs != null && phoneNbrs.Length > 0)
                        {
                            preferredNbr = phoneNbrs[0].PhoneNumberWithDashes;

                            bool curIsMobile = phoneNbrs[0].ContactType.ContactTypeID == 30;

                            for (int i = 1; i < phoneNbrs.Length; i++)
                            {
                                if (phoneNbrs[i].ContactType.ContactTypeID == 30 && !curIsMobile)
                                {
                                    curIsMobile = phoneNbrs[i].ContactType.ContactTypeID == 30;
                                    preferredNbr = phoneNbrs[i].PhoneNumberWithDashes;
                                }
                            }
                        }
                    }
                    else
                        throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString());
                }

                if (preferredNbr.Length > 0 && callCenterPrefix.Length > 0)
                    preferredNbr = callCenterPrefix + " " + preferredNbr;

                int      loggedInStaffID   = Session["StaffID"]       == null ? -1 : Convert.ToInt32(Session["StaffID"]);
                bool     canSeePatientLink = userView.IsAdminView || userView.IsPrincipal || (curBooking.Patient != null && curBooking.Provider != null && curBooking.Provider.StaffID == loggedInStaffID);

                string ptURL = "PatientDetailV2.aspx?type=view&id=" + curBooking.Patient.PatientID;
                //string patientLink = curBooking.Patient == null ? "" : (canSeePatientLink ? flasingTextIcon + " " + "<a href=\"#\" onclick=\"open_new_window('PatientDetailV2.aspx?type=view&id=" + curBooking.Patient.PatientID + "', 1750, 1000);return false;\">" + curBooking.Patient.Person.FullnameWithoutMiddlename + (curBooking.Patient.Person.Nickname.Trim().Length == 0 ? "" : " (" + curBooking.Patient.Person.Nickname.Trim() + ")") + "</a><br />" : "<b>" + curBooking.Patient.Person.FullnameWithoutMiddlename + "</b><br />");
                string patientLink = curBooking.Patient == null ? "" : (canSeePatientLink ? flasingTextIcon + " " + "<a href=\"" + ptURL + "\" onclick=\"var win=window.open('" + ptURL + "', '_blank'); win.focus();return false;\">" + curBooking.Patient.Person.FullnameWithoutMiddlename + (curBooking.Patient.Person.Nickname.Trim().Length == 0 ? "" : " (" + curBooking.Patient.Person.Nickname.Trim() + ")") + "</a><span style=\"color:transparent;\">-</span>" + (curBooking.Patient.Person.Dob == DateTime.MinValue ? "" : "(" + Utilities.GetAge(curBooking.Patient.Person.Dob) + ")") + "<br />" : "<b>" + curBooking.Patient.Person.FullnameWithoutMiddlename + "</b><br />");

                bool isCancelled = curBooking.BookingStatus.ID == 188;
                bool notYetCompleted = curBooking.BookingStatus.ID == 0;

                return
                    //(!isShowable || isPatientLoggedIn || userView.IsExternalView ? "" : (isShowable && !isPatientLoggedIn ? notesText + "&nbsp;" + ptNotesText + "&nbsp;" +  (SiteIsGP ? ptMedsNotesText + "&nbsp;" : "") : "") : "") + (notYetCompleted ? setConfirmedText + "&nbsp;" + setArrivedText : "") + "<br/>") +
                    //(bookingTypeText.Length > 0 ? bookingTypeText + "<br/>" : "") +

                    (isCancelled                                     ? "<b>[Cancelled" + (curBooking.InvoiceCount > 0 ? "" : " - No Inv") + "]</b><br/>" : "") +
                    (!includeOrg  || curBooking.Organisation == null ? "" : "<i>[" + curBooking.Organisation.Name + "]</i><br/>") +
                    (!incProvider || curBooking.Provider == null     ? "" : curBooking.Provider.Person.FullnameWithoutMiddlename + "<br/>") +
                    (curBooking.Patient == null || !curBooking.Patient.IsDiabetic || isPatientLoggedIn ? "" : "<font color=\"blue\"><b><i>PT is Diabetic</i></b></font><br/>") +
                    patientLink +
                    (preferredNbr        == string.Empty             ? "" : preferredNbr + "<br/>") +
                    (curBooking.Offering == null                     ? "" : curBooking.Offering.Name) +
                    (!isShowable || (!userView.IsProvider && !userView.IsAdminView) || !hasOwing  || curBooking.Offering == null ? "" : "<br />" + owingText);
            }
            else // clinics
            {
                bool includeOrg = incOrg;
                bool incProvider = false;

                string notesText          = String.Empty;
                string ptNotesText        = String.Empty;
                string ptMedsNotesText    = String.Empty;
                string ptMedCondNotesText = String.Empty;
                string ptFilesText        = String.Empty;

                notesText = Note.GetBookingPopupLinkTextV2(curBooking.EntityID, curBooking.NoteCount > 0, true, 1425, 700, "images/notes-bw-24-Thin.png", "images/notes-24-Thin.png", null, !IsMobileDevice);

                if (curBooking.Patient != null)
                {
                    //string notesText       = Note.GetPopupLinkTextV2(15, curBooking.EntityID, curBooking.NoteCount > 0, true, 980, 530, "images/notes-bw-24-Thin.png", "images/notes-24-Thin.png", null, !IsMobileDevice);
                    bool   ptHasNotes        = patientsHasNotesCache[curBooking.Patient.Person.EntityID] != null;
                    ptNotesText              = Note.GetPopupLinkTextV2(16, curBooking.Patient.Person.EntityID, ptHasNotes,        true, 1270, 640, "images/BC-24-Thin-bw.png", "images/BC-24-Thin.png", null, !IsMobileDevice);
                    bool   ptHasMedsNotes    = patientsHasMedNotesCache[curBooking.Patient.Person.EntityID] != null;
                    ptMedsNotesText          = Note.GetPopupLinkTextV2(17, curBooking.Patient.Person.EntityID, ptHasMedsNotes,    true, 1050,  530, "images/M-24-Thin-bw.png",  "images/M-24-Thin.png",  null, !IsMobileDevice);
                    bool   ptHasMedCondNotes = patientsHasMedCondNotesCache[curBooking.Patient.Person.EntityID] != null;
                    ptMedCondNotesText       = Note.GetPopupLinkTextV2(18, curBooking.Patient.Person.EntityID, ptHasMedCondNotes, true, 1050,  530, "images/MC-24-Thin-bw.png", "images/MC-24-Thin.png", null, !IsMobileDevice);
                    ptFilesText              = curBooking.GetScannedDocsImageLink();
                }

                bool hasArrived = curBooking.ArrivalTime != DateTime.MinValue;
                string jsArrivedText = hasArrived ?
                                            "javascript:ajax_booking_confirm_delete_cancel('unarrived', '" + curBooking.BookingID.ToString() + "');" :
                                            "javascript:ajax_booking_confirm_delete_cancel('arrived', '" + curBooking.BookingID.ToString() + "');";
                string imgArrivedText = "images/person2colour-24.png";
                string setArrivedText = "<input type=\"image\" title=\"" + (hasArrived ? "Unset Arrived" : "Set Arrived") + "\" src=\"" + imgArrivedText + "\" alt=\"" + (hasArrived ? "Unset Arrived" : "Set Arrived") + "\" onclick=\"" + jsArrivedText + "\" />";
                if (curBooking.ArrivalTime != DateTime.MinValue)
                    setArrivedText += "&nbsp;<b>" + curBooking.ArrivalTime.ToString("HH:mm") + "</b>";

                bool isConfirmed = curBooking.DateConfirmed != DateTime.MinValue;
                string jsConfirmedText = isConfirmed ?
                                            "javascript:ajax_booking_confirm_delete_cancel('unconfirm', '" + curBooking.BookingID.ToString() + "');" :
                                            "javascript:ajax_booking_confirm_delete_cancel('confirm', '" + curBooking.BookingID.ToString() + "');";
                string imgConfirmedText = isConfirmed ? "images/tick2color-24.png" : "images/tick2bw-24.png";
                string setConfirmedText = "<input type=\"image\" title=\"" + (isConfirmed ? "Set Unconfirmed" : "Set Confirmed") + "\" src=\"" + imgConfirmedText + "\" alt=\"" + (isConfirmed ? "Set Unconfirmed" : "Set Confirmed") + "\" onclick=\"" + jsConfirmedText + "\" />";

                string flashingNote = String.Empty;
                string flasingTextIcon = String.Empty;
                if (curBooking.Patient != null)
                {
                    bool hasFlashingNote = patientsFlashingNotesCache[curBooking.Patient.PatientID] != null;
                    flashingNote         = hasFlashingNote ? (string)patientsFlashingNotesCache[curBooking.Patient.PatientID] : "";
                    flasingTextIcon      = Patient.GetFlashingTextLink(curBooking.Patient.PatientID, hasFlashingNote, flashingNote, true, 525, 275, "images/asterisk_bw_16.png", "images/asterisk_red_16.gif", null, !IsMobileDevice);
                }

                bool   hasOwing  = false;
                string owingText = string.Empty;
                if (curBooking.Patient != null)
                {
                    hasOwing  = patientsOwingCache[curBooking.Patient.PatientID] != null;
                    owingText = hasOwing ? "<b><font color=\"red\">Owes $" + Convert.ToDecimal(patientsOwingCache[curBooking.Patient.PatientID]).ToString ("0.00") + "</font></b>" : string.Empty;
                }

                //string printLetterJS = "javascript:window.location.href='Letters_PrintV2.aspx?booking="+curBooking.BookingID+"';return false;";
                //string printLetterImg = "images/printer_green-24.png";
                //string printLetterText = "<input type=\"image\" title=\"Print Letter\" src=\"" + printLetterImg + "\" alt=\"Print Letter\" onclick=\"" + printLetterJS + "\" />";

                string preferredNbr = string.Empty;
                if (curBooking.Patient != null)
                {
                    if (Utilities.GetAddressType().ToString() == "Contact")
                    {
                        Contact[] phoneNbrs = GetPatientsPhoneNumbersFromCache(patientsPhoneNumbersCache, curBooking.Patient.Person.EntityID);
                        if (phoneNbrs != null && phoneNbrs.Length > 0)
                        {
                            preferredNbr = phoneNbrs[0].PhoneNumberWithDashes;

                            bool curIsMobile = phoneNbrs[0].ContactType.ContactTypeID == 30;

                            for (int i = 1; i < phoneNbrs.Length; i++)
                            {
                                if (phoneNbrs[i].ContactType.ContactTypeID == 30 && !curIsMobile)
                                {
                                    curIsMobile = phoneNbrs[i].ContactType.ContactTypeID == 30;
                                    preferredNbr = phoneNbrs[i].PhoneNumberWithDashes;
                                }
                            }
                        }
                    }
                    else if (Utilities.GetAddressType().ToString() == "ContactAus")
                    {
                        ContactAus[] phoneNbrs = GetPatientsPhoneNumbersFromAusCache(patientsPhoneNumbersCache, curBooking.Patient.Person.EntityID);
                        if (phoneNbrs != null && phoneNbrs.Length > 0)
                        {
                            preferredNbr = phoneNbrs[0].PhoneNumberWithDashes;

                            bool curIsMobile = phoneNbrs[0].ContactType.ContactTypeID == 30;

                            for (int i = 1; i < phoneNbrs.Length; i++)
                            {
                                if (phoneNbrs[i].ContactType.ContactTypeID == 30 && !curIsMobile)
                                {
                                    curIsMobile = phoneNbrs[i].ContactType.ContactTypeID == 30;
                                    preferredNbr = phoneNbrs[i].PhoneNumberWithDashes;
                                }
                            }
                        }
                    }
                    else
                        throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString());
                }

                if (preferredNbr.Length > 0 && callCenterPrefix.Length > 0)
                    preferredNbr = callCenterPrefix + " " + preferredNbr;

                int  loggedInStaffID   = Session["StaffID"]       == null ? -1 : Convert.ToInt32(Session["StaffID"]);
                bool canSeePatientLink = userView.IsAdminView || userView.IsPrincipal || userView.IsExternal|| (curBooking.Patient != null && curBooking.Provider != null && curBooking.Provider.StaffID == loggedInStaffID);

                string patientLink = string.Empty;
                if (curBooking.Patient != null)
                {
                    string ptURL  = "PatientDetailV2.aspx?type=view&id=" + curBooking.Patient.PatientID;
                    //patientLink = curBooking.Patient == null ? "" : (canSeePatientLink ? flasingTextIcon + " " + "<a href=\"#\" onclick=\"open_new_window('PatientDetailV2.aspx?type=view&id=" + curBooking.Patient.PatientID + "', 1750, 1000);return false;\">" + curBooking.Patient.Person.FullnameWithoutMiddlename + (curBooking.Patient.Person.Nickname.Trim().Length == 0 ? "" : " (" + curBooking.Patient.Person.Nickname.Trim() + ")") + "</a><br />" : "<b>" + curBooking.Patient.Person.FullnameWithoutMiddlename + "</b><br />");
                    patientLink   = curBooking.Patient == null ? "" : (canSeePatientLink ? flasingTextIcon + " " + "<a href=\"" + ptURL + "\" onclick=\"var win=window.open('" + ptURL + "', '_blank'); win.focus();return false;\">" + curBooking.Patient.Person.FullnameWithoutMiddlename + (curBooking.Patient.Person.Nickname.Trim().Length == 0 ? "" : " (" + curBooking.Patient.Person.Nickname.Trim() + ")") + "</a><span style=\"color:transparent;\">-</span>" + (curBooking.Patient.Person.Dob == DateTime.MinValue ? "" : "(" + Utilities.GetAge(curBooking.Patient.Person.Dob) + ")") + "<br />" : "<b>" + curBooking.Patient.Person.FullnameWithoutMiddlename + "</b><br />");
                }

                bool isCancelled = curBooking.BookingStatus.ID == 188;
                bool notYetCompleted = curBooking.BookingStatus.ID == 0;

                // "td_1751_76_2015_02_16_0930"//
                string id = "td_" + curBooking.Organisation.OrganisationID + "_" + curBooking.Provider.StaffID + "_" + curBooking.DateStart.ToString("yyyy_MM_dd_HHmm");

                string firstRow = string.Empty;
                if (isShowable && !isPatientLoggedIn && !userView.IsExternalView && curBooking.Patient != null)
                {
                    firstRow = (bkHasChangeHistory ? curBooking.GetBookingChangeHistoryPopupLinkImage(null, false, !IsMobileDevice) + "&nbsp;" : "") + notesText + "&nbsp;" + (SiteIsGP ? ptMedsNotesText + "&nbsp;" + ptMedCondNotesText + "&nbsp;" : "") + (ptFilesText + "&nbsp;") + (notYetCompleted ? setConfirmedText + "&nbsp;" + setArrivedText : "");
                }
                else // first row still blank
                {
                    if (notYetCompleted && (userView.IsExternalView || isProviderViewAndOtherProviderBk))
                        firstRow += setArrivedText;
                }
                if (firstRow.Length > 0) firstRow += "<br />";

                if (SiteIsAgedCare || SiteIsClinic)
                {
                    return

                        // don't put notes in because the note is not linked to which PT in the group booking, so at end of PT page, it can't show the note only for that PT
                        //(curBooking.Patient == null ? ((userView.IsAdminView || (userView.IsProviderView && !isProviderViewAndOtherProviderBk)) ? notesText + "&nbsp;" : "") + "<font color=\"blue\"><b><i>Group Booking</i></b></font><br/>" : "") +
                        (curBooking.Patient == null ?  "<font color=\"blue\"><b><i>Group Booking</i></b></font><br/>" : "") +
                        firstRow +
                        (bookingTypeText.Length <= 0                                 ? "" : bookingTypeText + "<br/>") +
                        (!isCancelled                                                ? "" : "<b>[Cancelled" + (curBooking.InvoiceCount > 0 ? "" : " - No Inv") + "]</b><br/>") +
                        (!includeOrg  || curBooking.Organisation == null             ? "" : "<i>[" + curBooking.Organisation.Name + "]</i><br/>") +
                        (!incProvider || curBooking.Provider == null                 ? "" : curBooking.Provider.Person.FullnameWithoutMiddlename + "<br/>") +
                        (curBooking.Patient == null || !curBooking.Patient.IsDiabetic || isPatientLoggedIn ? "" : "<font color=\"blue\"><b><i>PT is Diabetic</i></b></font><br/>") +
                        patientLink +
                        (preferredNbr == string.Empty                                ? "" : preferredNbr + "<br/>") +
                        (curBooking.Offering == null                                 ? "" : curBooking.Offering.Name) +
                        (!isShowable || (!userView.IsProvider && !userView.IsAdminView) || !hasOwing || curBooking.Offering == null ? "" : "<br />" + owingText) +
                        (isShowable && bookingSlotType != BookingSlot.Type.None ? "<a href='javascript:void(0)' title=\"Long Click To Show Menu\r\nFor Mouse Without A Right Click Button\" onclick=\"ShowMenu_" + GetContextMenuClass(bookingSlotType, curBooking) + "('" + id + "');return false;\" style=\"text-decoration:none;\">&nbsp;★&nbsp;</a>&nbsp;" : "");
                }
                else
                {
                    return

                        // don't put notes in because the note is not linked to which PT in the group booking, so at end of PT page, it can't show the note only for that PT
                        //(curBooking.Patient == null ? ((userView.IsAdminView || (userView.IsProviderView && !isProviderViewAndOtherProviderBk)) ? notesText + "&nbsp;" : "") + "<font color=\"blue\"><b><i>Group Booking</i></b></font><br/>" : "") +
                        (curBooking.Patient == null ? "<font color=\"blue\"><b><i>Group Booking</i></b></font><br/>" : "") +
                        firstRow +
                        (!isCancelled                                                ? "" : "<b>[Cancelled" + (curBooking.InvoiceCount > 0 ? "" : " - No Inv") + "]</b><br/>") +
                        (!includeOrg  || curBooking.Organisation == null             ? "" : "<i>[" + curBooking.Organisation.Name + "]</i><br/>") +
                        (!incProvider || curBooking.Provider     == null             ? "" : curBooking.Provider.Person.FullnameWithoutMiddlename + "<br/>") +
                        (curBooking.Patient == null || !curBooking.Patient.IsDiabetic || isPatientLoggedIn ? "" : "<font color=\"blue\"><b><i>PT is Diabetic</i></b></font><br/>") +
                        patientLink +
                        (preferredNbr == string.Empty                                ? "" : preferredNbr + "<br/>") +
                        (curBooking.Offering == null                                 ? "" : curBooking.Offering.Name) +
                        (!isShowable || (!userView.IsProvider && !userView.IsAdminView) || !hasOwing  || curBooking.Offering == null ? "" : "<br />" + owingText) +
                        (isShowable && bookingSlotType != BookingSlot.Type.None ? "<a href='javascript:void(0)' onclick=\"ShowMenu_Menu_" + GetContextMenuClass(bookingSlotType, curBooking) + "('" + id + "');return false;\" style=\"text-decoration:none;\">&nbsp;★&nbsp;</a>&nbsp;" : "");
                }

            }
        }
    }
    protected void UpdateCells(int nSlots, Booking curBooking, string lblTextFirstCell, string lblTextFirstCellWithOrg, string lblTextRestCells, bool useFirstTimeOfDayAsFirstText, Organisation curOrgToUpdate, Booking booking, BookingSlot.Type slotType, bool canBook = true)
    {
        string firstRow = GetFirstTimeOfDay();

        TimeSpan timeToAddPerSlot = new TimeSpan(0, 0, 0);
        for (int i = 0; i < nSlots; i++)
        {
            bool isFirstSlot = curBooking.DateStart.Add(timeToAddPerSlot).ToString("HHmm") == firstRow || i == 0;
            string text = isFirstSlot ? (slotType == BookingSlot.Type.Unavailable ? lblTextFirstCellWithOrg : lblTextFirstCell) : lblTextRestCells;
            string nameText = isFirstSlot && booking.Patient != null && slotType != BookingSlot.Type.Unavailable ? booking.Patient.Person.FullnameWithoutMiddlename : "";

            if (curBooking.Provider != null)
                UpdateCell(curOrgToUpdate, curBooking, timeToAddPerSlot, text, nameText, slotType, canBook);
            else // all providers
            {
                Staff original = curBooking.Provider;
                foreach (Staff s in this.staffList)
                {
                    curBooking.Provider = s;
                    UpdateCell(curOrgToUpdate, curBooking, timeToAddPerSlot, text, nameText, slotType, canBook);
                }
                curBooking.Provider = original;
            }

            timeToAddPerSlot = timeToAddPerSlot.Add(new TimeSpan(0, bookingSlotMinsCache.GetSlotMins(), 0));
        }
    }
    protected void UpdateCell(Organisation curOrgToUpdate, Booking booking, TimeSpan timeToAdd, string text, string nameText, BookingSlot.Type slotType, bool canBook = true)
    {
        Hashtable OfferingColors = (Hashtable)Session["OfferingColors"];

        ArrayList bookingStartDateTimes = new ArrayList();
        if (booking.IsRecurring)
        {
            for (int i = 0; i < this.daysData.Length; i++)
                if (booking.RecurringDayOfWeek == this.daysData[i].Date.DayOfWeek)
                    bookingStartDateTimes.Add(this.daysData[i].Date.Add(booking.RecurringStartTime));
        }
        else
        {
            bookingStartDateTimes.Add(booking.DateStart);
        }

        foreach (DateTime bookingStartDateTime in bookingStartDateTimes)
        {
            // change to beginning of hour for aged care since its hourly bookings
            DateTime date = bookingSlotMinsCache.GetSlotMins() == 60 ? bookingStartDateTime.Subtract(new TimeSpan(0, bookingStartDateTime.Minute, 0)).Add(timeToAdd) : bookingStartDateTime.Add(timeToAdd);
            //string cellID = booking.Organisation.OrganisationID + "_" + booking.Provider.StaffID + "_" + date.Date.ToString("yyyy_MM_dd") + "_" + date.Hour.ToString().PadLeft(2, '0') + date.Minute.ToString().PadLeft(2, '0');
            string cellID = curOrgToUpdate.OrganisationID + "_" + booking.Provider.StaffID + "_" + date.Date.ToString("yyyy_MM_dd") + "_" + date.Hour.ToString().PadLeft(2, '0') + date.Minute.ToString().PadLeft(2, '0');

            string lblID = "lbl_" + cellID;
            Control lbl = GetControlByID2(lblID, main_table);
            if (lbl != null)
            {
                System.Drawing.Color color = booking.Offering != null && OfferingColors[booking.Offering.OfferingID] != null && !IsEditBookingMode() && !IsEditDayMode() ?
                    (System.Drawing.Color)System.Drawing.ColorTranslator.FromHtml("#" + OfferingColors[booking.Offering.OfferingID]) :
                    BookingSlot.GetColor(slotType);

                //((Label)lbl).BackColor = IsEditBookingMode() || IsEditDayMode() ? HSLColor.ChangeBrightness(BookingSlot.GetColor(slotType), -10) : BookingSlot.GetColor(slotType);
                ((Label)lbl).BackColor = IsEditBookingMode() || IsEditDayMode() ? HSLColor.ChangeBrightness(color, -10) : color;
                ((Label)lbl).Text = text;
            }

            string tdID = "td_" + cellID;
            Control cell = GetControlByID2(tdID, main_table);
            if (cell != null)
            {
                ((HtmlTableCell)cell).Attributes.Remove("ondblclick");
                ((HtmlTableCell)cell).Attributes.Remove("onmousedown");
                ((HtmlTableCell)cell).Attributes.Remove("onmouseup");

                if (!Utilities.IsDev())
                    ((HtmlTableCell)cell).BgColor = System.Drawing.ColorTranslator.ToHtml(((Label)lbl).BackColor);
                else
                    ((HtmlTableCell)cell).BgColor = System.Drawing.ColorTranslator.ToHtml(HSLColor.ChangeBrightness(((Label)lbl).BackColor, 35));

                if (canBook)
                {
                    ((HtmlTableCell)cell).Attributes["class"] = GetContextMenuClass(slotType, booking);
                }
                else
                {
                    ((HtmlTableCell)cell).Attributes.Remove("class");
                    ((HtmlTableCell)cell).Attributes["class"] = BookingSlot.GetContextMenuClass(BookingSlot.Type.None);
                }

                // Add hiddencol labels
                NewOrUpdateLabel(cell, "lblBookingID_" + cellID, booking.BookingID.ToString());
                if (booking.Patient != null)
                    NewOrUpdateLabel(cell, "lblPatientName_" + cellID, nameText, false, true);
                if (booking.Offering != null)
                    NewOrUpdateLabel(cell, "lblOfferingID_" + cellID, booking.Offering.OfferingID.ToString());
                if (booking.Provider != null)
                    NewOrUpdateLabel(cell, "lblProviderID_" + cellID, booking.Provider.StaffID.ToString());
                if (booking.Organisation != null)
                    NewOrUpdateLabel(cell, "lblOrgID_" + cellID, booking.Organisation.OrganisationID.ToString());
            }

        }
    }
    protected Label NewLbl(int width, int height, BookingSlot.Type slotType, string lblID = null, bool isNonAddable = false)
    {
        Label lbl = new Label();

        if (width > 0)
            lbl.Width = new Unit(width);
        lbl.Height = new Unit(100, UnitType.Percentage); ;// new Unit(height);

        if (!isNonAddable)
            lbl.BackColor = (IsEditBookingMode() || IsEditDayMode()) ? HSLColor.ChangeBrightness(BookingSlot.GetColor(slotType), -10) : BookingSlot.GetColor(slotType);
        else
            lbl.BackColor = HSLColor.ChangeBrightness(System.Drawing.Color.Tan, 20);

        if (lbl != null)
        {
            lbl.ID = lblID;

            if (Utilities.IsDev())
                lbl.Text = "<small>" + lblID.Replace("lbl_", "").Replace("_", " ") + "</small>";
        }

        lbl.Attributes.Add("style", "padding:1px;");
        return lbl;
    }
 protected string GetContextMenuClass(BookingSlot.Type bookingSlotType, Booking curBooking)
 {
     if (bookingSlotType == BookingSlot.Type.Booking_CL_EPC_Past_Completed_Has_Invoice ||
         bookingSlotType == BookingSlot.Type.Booking_CL_NonEPC_Past_Completed_Has_Invoice ||
         bookingSlotType == BookingSlot.Type.Booking_AC_EPC_Past_Completed_Has_Invoice ||
         bookingSlotType == BookingSlot.Type.Booking_AC_NonEPC_Past_Completed_Has_Invoice)
     {
         if (curBooking.Patient == null)  // set as ac slot (ie with treatment list menu item) - use any AC from the 'if' statement
             return BookingSlot.GetContextMenuClass(BookingSlot.Type.Booking_AC_NonEPC_Past_Completed_Has_Invoice);
         else                          // set as clinic slot (ie without treatment list menu item) - use either Clinic from the 'if' statement
             return BookingSlot.GetContextMenuClass(BookingSlot.Type.Booking_CL_NonEPC_Past_Completed_Has_Invoice);
     }
     else if (bookingSlotType == BookingSlot.Type.Booking_CL_EPC_Future_Unconfirmed ||
              bookingSlotType == BookingSlot.Type.Booking_CL_EPC_Future_Confirmed ||
              bookingSlotType == BookingSlot.Type.Booking_AC_EPC_Future_Unconfirmed ||
              bookingSlotType == BookingSlot.Type.Booking_AC_EPC_Future_Confirmed ||
              bookingSlotType == BookingSlot.Type.Booking_CL_NonEPC_Future_Unconfirmed ||
              bookingSlotType == BookingSlot.Type.Booking_CL_NonEPC_Future_Confirmed ||
              bookingSlotType == BookingSlot.Type.Booking_AC_NonEPC_Future_Unconfirmed ||
              bookingSlotType == BookingSlot.Type.Booking_AC_NonEPC_Future_Confirmed)
     {
         if (curBooking.Patient == null)  // set as ac slot (ie with complete  menu item) - use any AC from the 'if' statement
             return BookingSlot.GetContextMenuClass(BookingSlot.Type.Booking_AC_NonEPC_Future_Unconfirmed);
         else                          // set as clinic slot (ie without complete menu item) - use any Clinic from the 'if' statement
             return BookingSlot.GetContextMenuClass(BookingSlot.Type.Booking_CL_NonEPC_Future_Unconfirmed);
     }
     else if (bookingSlotType == BookingSlot.Type.Booking_CL_EPC_Past_Uncompleted_Unconfirmed ||
              bookingSlotType == BookingSlot.Type.Booking_CL_EPC_Past_Uncompleted_Confirmed ||
              bookingSlotType == BookingSlot.Type.Booking_CL_NonEPC_Past_Uncompleted_Unconfirmed ||
              bookingSlotType == BookingSlot.Type.Booking_CL_NonEPC_Past_Uncompleted_Confirmed ||
              bookingSlotType == BookingSlot.Type.Booking_AC_EPC_Past_Uncompleted_Unconfirmed ||
              bookingSlotType == BookingSlot.Type.Booking_AC_EPC_Past_Uncompleted_Confirmed ||
              bookingSlotType == BookingSlot.Type.Booking_AC_NonEPC_Past_Uncompleted_Unconfirmed ||
              bookingSlotType == BookingSlot.Type.Booking_AC_NonEPC_Past_Uncompleted_Confirmed)
     {
         if (curBooking.Patient == null)  // set as ac slot (ie with complete  menu item) - use any AC from the 'if' statement
             return BookingSlot.GetContextMenuClass(BookingSlot.Type.Booking_AC_NonEPC_Past_Uncompleted_Unconfirmed);
         else                          // set as clinic slot (ie without complete menu item) - use any Clinic from the 'if' statement
             return BookingSlot.GetContextMenuClass(BookingSlot.Type.Booking_CL_NonEPC_Past_Uncompleted_Unconfirmed);
     }
     else
     {
         return BookingSlot.GetContextMenuClass(bookingSlotType);
     }
 }
 public IHttpActionResult Post([FromBody] BookingSlot bookingSlot)
 {
     return(Ok(_bal.AddBookingSlot(bookingSlot)));
 }