示例#1
0
    protected Booking[] GetBookingsSortedByProviderTimeOrganisation(DateTime date)
    {
        // get bookings
        date = date.Date;
        Booking[] bookings = BookingDB.GetBetween(date, date.AddHours(23).AddMinutes(59), null, null, null, null);

        // remove unavailabilities
        ArrayList list = new ArrayList();

        for (int i = 0; i < bookings.Length; i++)
        {
            if (bookings[i].BookingTypeID == 34)
            {
                list.Add(bookings[i]);
            }
        }
        bookings = (Booking[])list.ToArray(typeof(Booking));

        // sort by prov, bk time, org
        Array.Sort(bookings, BkCompare);

        return(bookings);
    }
    public static string Run(bool incDisplay, bool incSending, DateTime date)
    {
        date = date.Date;


        bool   EnableDailyBookingReminderSMS             = Convert.ToInt32(SystemVariableDB.GetByDescr("EnableDailyBookingReminderSMS").Value) == 1;
        bool   EnableDailyBookingReminderEmails          = Convert.ToInt32(SystemVariableDB.GetByDescr("EnableDailyBookingReminderEmails").Value) == 1;
        int    NbrDaysAheadToSendDailyBookingReminderSMS = Convert.ToInt32(SystemVariableDB.GetByDescr("NbrDaysAheadToSendDailyBookingReminderSMS").Value);
        string SendDailyBookingReminderText_SMS          = SystemVariableDB.GetByDescr("SendDailyBookingReminderText_SMS").Value;
        string SendDailyBookingReminderText_Email        = SystemVariableDB.GetByDescr("SendDailyBookingReminderText_Email").Value;
        string SendDailyBookingReminderText_EmailSubject = SystemVariableDB.GetByDescr("SendDailyBookingReminderText_EmailSubject").Value;
        string PT_Reminders_HasBothSMSandEmail           = SystemVariableDB.GetByDescr("PT_Reminders_HasBothSMSandEmail").Value;

        date = date.AddDays(NbrDaysAheadToSendDailyBookingReminderSMS - 1);


        Booking[] bookings = BookingDB.GetBetween(date, date.AddDays(1).AddMinutes(-1), null, null, null, null, false, "0", false, null);
        Hashtable patientContactPhoneNbrHash = GetPatientPhoneNbrCache(bookings);
        Hashtable patientContactEmailHash    = GetPatientEmailCache(bookings);
        Hashtable orgContactHash             = GetOrgPhoneNbrCache(bookings);
        Hashtable orgAddrContactHash         = GetOrgAddrCache(bookings);



        decimal balance = SMSCreditDataDB.GetTotal() - SMSHistoryDataDB.GetTotal();
        decimal cost    = Convert.ToDecimal(SystemVariableDB.GetByDescr("SMSPrice").Value);


        string    callerId                 = System.Configuration.ConfigurationManager.AppSettings["SMSTech_callerId"];  // not used here as the callerId will be the org name
        string    countryCode              = System.Configuration.ConfigurationManager.AppSettings["SMSTech_CountryCode"];
        ArrayList messagesToSMS            = new ArrayList();
        ArrayList messagesToEmail          = new ArrayList();
        ArrayList bookingIDsConfirmedSMS   = new ArrayList();
        ArrayList bookingIDsConfirmedEmail = new ArrayList();


        string output           = "<table class=\"table table-bordered table-striped table-grid table-grid-top-bottum-padding-thick auto_width block_center\" border=\"1\" style=\"border-collapse:collapse;\">";
        int    countWithPatient = 0;

        foreach (Booking booking in bookings)
        {
            if (booking.BookingTypeID != 34)  // only bookings, not days marked off
            {
                continue;
            }

            if (booking.Patient == null || booking.Offering == null)      // prob aged care booking
            {
                continue;
            }

            // Marcus: send sms even if booking is confirmed
            //if (booking.ConfirmedBy != null)  // don't send reminders to those already confirmed
            //    continue;

            // get all info to send via sms or email

            string phoneNumPatient = GetPhoneNbr(patientContactPhoneNbrHash, booking.Patient.Person.EntityID, true);
            if (phoneNumPatient != null)
            {
                phoneNumPatient = phoneNumPatient.StartsWith("0") ? countryCode + phoneNumPatient.Substring(1) : phoneNumPatient;
            }

            string emailPatient = GetEmail(patientContactEmailHash, booking.Patient.Person.EntityID);
            string phoneNumOrg  = GetPhoneNbrs(orgContactHash, booking.Organisation.EntityID);
            string addrOrg      = GetAddr(orgAddrContactHash, booking.Organisation.EntityID);

            string smsText          = GetSMSText(booking, phoneNumOrg, addrOrg, SendDailyBookingReminderText_SMS);
            string emailText        = GetEmailText(booking, phoneNumOrg, addrOrg, SendDailyBookingReminderText_Email);
            string emailSubjectText = GetEmailSubjectText(booking, phoneNumOrg, addrOrg, SendDailyBookingReminderText_EmailSubject);


            // kept just to show their email/phone number exists even though we may not be sending to there due to settings or low balance.
            string phoneNumPatient_Original = phoneNumPatient;
            string emailPatient_Original    = emailPatient;


            // ignore if setting is to not sending sms's or emails
            if (phoneNumPatient != null && !EnableDailyBookingReminderSMS)
            {
                phoneNumPatient = null;
            }
            if (emailPatient != null && !EnableDailyBookingReminderEmails)
            {
                emailPatient = null;
            }

            // if balance too low, can not send by SMS
            if (phoneNumPatient != null && balance < cost)
            {
                phoneNumPatient = null;
            }

            // if has both, then send based on setting
            if (phoneNumPatient != null && emailPatient != null)
            {
                if (PT_Reminders_HasBothSMSandEmail == "Email") // setting is - when both, send only via email
                {
                    phoneNumPatient = null;
                }
                if (PT_Reminders_HasBothSMSandEmail == "SMS")   // setting is - when both, send only via sms
                {
                    emailPatient = null;
                }
            }


            string textToDisplay = string.Empty;
            if (phoneNumPatient != null)
            {
                textToDisplay += "<b>" + smsText.Replace(Environment.NewLine, "<br />") + "</b>";
            }
            if (emailPatient != null)
            {
                textToDisplay += (textToDisplay.Length == 0 ? "" : "<br><hr>") + "<u>" + emailSubjectText + "</u><br /><br />" + emailText;
            }



            // display the info

            string tdTagStart          = phoneNumPatient == null && emailPatient == null ? "<td class=\"nowrap\" style=\"color:grey;\">" : (phoneNumPatient == null ? "<td>"  : "<td>");
            string tdTagStartLeftAlign = phoneNumPatient == null && emailPatient == null ? "<td class=\"nowrap text_left\" style=\"color:grey;\">" : (phoneNumPatient == null ? "<td class=\"text_left\">" : "<td class=\"text_left\">");
            string tdTagEnd            = phoneNumPatient == null && emailPatient == null ? "</td>" : (phoneNumPatient == null ? "</td>" : "</td>");

            output += "<tr>";
            output += tdTagStart + booking.BookingID + tdTagEnd;
            output += tdTagStart + booking.DateStart.ToString("dd-MM-yy") + "<br />" + booking.DateStart.ToString("HH:mm") + " - " + booking.DateEnd.ToString("HH:mm") + tdTagEnd;
            output += tdTagStart + booking.Organisation.Name + "<br />" + (phoneNumOrg == null ? "-- No Phone --" : phoneNumOrg.Replace(",", "<br />").Replace("or", "<br />")) + tdTagEnd;
            output += tdTagStart + booking.Patient.Person.FullnameWithoutMiddlename + "<br />" +
                      (phoneNumPatient_Original == null ? "-- No Mobile --" : "<u>" + phoneNumPatient_Original + "</u>") + "<br />" +
                      (emailPatient_Original == null ? "-- No Email --"  : "<u>" + emailPatient_Original + "</u>") + tdTagEnd;
            output += tdTagStartLeftAlign + textToDisplay + tdTagEnd;
            output += "</tr>";

            countWithPatient++;



            /*
             *  add to lists to sms or email (or both)
             */

            if (phoneNumPatient != null)
            {
                messagesToSMS.Add(new Tuple <int, decimal, string, string, string>(booking.BookingID, cost, phoneNumPatient, smsText, booking.Organisation.Name));
                bookingIDsConfirmedSMS.Add(booking.BookingID);
                if (incSending)
                {
                    balance -= cost;
                }
            }
            if (emailPatient != null)
            {
                messagesToEmail.Add(new Tuple <int, string, string, string, string>(booking.BookingID, booking.Organisation.Name, emailPatient, emailText, emailSubjectText));
                bookingIDsConfirmedEmail.Add(booking.BookingID);
            }


            /*
             * bool sendingAlready = false;
             * if (EnableDailyBookingReminderSMS && phoneNumPatient != null && balance >= cost)
             * {
             *  messagesToSMS.Add(new Tuple<int, decimal, string, string, string>(booking.BookingID, cost, phoneNumPatient, smsText, booking.Organisation.Name));
             *  bookingIDsConfirmedSMS.Add(booking.BookingID);
             *  sendingAlready = true;
             *  if (incSending)
             *      balance -= cost;
             * }
             * if (EnableDailyBookingReminderEmails && emailPatient != null)
             * {
             *  messagesToEmail.Add(new Tuple<int, string, string, string, string>(booking.BookingID, booking.Organisation.Name, emailPatient, emailText, emailSubjectText));
             *  if (!sendingAlready)  // if not already added for sms sending
             *      bookingIDsConfirmedEmail.Add(booking.BookingID);
             * }
             */
        }
        output += "</table>";


        // run the sending and send off reminders -- but only if there was any bookings

        if (incSending && bookings.Length > 0)
        {
            /*
             * run the sendings
             */

            SendSMSes((Tuple <int, decimal, string, string, string>[])messagesToSMS.ToArray(typeof(Tuple <int, decimal, string, string, string>)));
            SendEmails((Tuple <int, string, string, string, string>[])messagesToEmail.ToArray(typeof(Tuple <int, string, string, string, string>)));

            /*
             * if sms or email sent, set booking as confirmed
             */
            BookingDB.UpdateSetConfirmed((int[])bookingIDsConfirmedSMS.ToArray(typeof(int)), 2, -1);
            BookingDB.UpdateSetConfirmed((int[])bookingIDsConfirmedEmail.ToArray(typeof(int)), 3, -1);

            /*
             * send balance warning
             */

            SystemVariables systemVariables            = SystemVariableDB.GetAll();
            string          warningEmail               = systemVariables["SMSCreditNotificationEmailAddress"].Value;
            decimal         warningThreshold           = Convert.ToDecimal(systemVariables["SMSCreditLowBalance_Threshold"].Value);
            bool            checkSMSCreditOutOfBalance = Convert.ToInt32(systemVariables["SMSCreditOutOfBalance_SendEmail"].Value) == 1;
            bool            checkMSCreditLowBalance    = Convert.ToInt32(systemVariables["SMSCreditLowBalance_SendEmail"].Value) == 1;


            if (warningEmail.Length > 0 && checkSMSCreditOutOfBalance && balance < cost)
            {
                SendEmail(
                    warningEmail,
                    "SMS Credit Used Up",
                    "Please note that your SMS credit at mediclinic has been used up. To continue sending, please top up.<br /><br />Best regards,<br />Mediclinic");
            }
            else if (warningEmail.Length > 0 && checkMSCreditLowBalance && balance <= warningThreshold)  // dont send warning low balance if already sending out of credit email
            {
                SendEmail(
                    warningEmail,
                    "SMS Credit Warning - Don't Forget To Top-Up Before It Runs Out",
                    "Hi! Just a friendly reminder that the SMS reminder threshold you set has been reached.<br /> To avoid missing SMS'es being sent, don't forget to top-up before the remainder runs out!<br /><br />Best regards,<br />Mediclinic");
            }
        }

        if (incDisplay)
        {
            return("Count: <b>" + countWithPatient + "</b> &nbsp;&nbsp; [Sending Via SMS: <b>" + messagesToSMS.Count + "</b>] &nbsp;&nbsp; [Sending Via Email: <b>" + messagesToEmail.Count + "</b>] " + "<br /><br />" + output);
        }
        else
        {
            return(string.Empty);
        }
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Utilities.SetNoCache(Response);
        }

        bool isLoggedIn  = Session != null && Session["DB"] != null;
        bool useConfigDB = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UseConfigDB"]);

        try
        {
            string staff_id = Request.QueryString["staff"];
            if (staff_id == null || !Regex.IsMatch(staff_id, @"^\-?\d+$"))
            {
                throw new CustomMessageException();
            }
            string org_id = Request.QueryString["org"];
            if (org_id == null || !Regex.IsMatch(staff_id, @"^\-?\d+$"))
            {
                throw new CustomMessageException();
            }


            if (!isLoggedIn && useConfigDB)
            {
                Session["DB"] = System.Configuration.ConfigurationManager.AppSettings["Database"];
                Session["SystemVariables"] = SystemVariableDB.GetAll();
            }
            if (!isLoggedIn && !useConfigDB)
            {
                string _output = @"<table>
                        <tr>
                            <td align=""left"" colspan=""5""><b>Patients Waiting" + @"</b><font color=""#8a8a8a""> &nbsp;&nbsp;  @ " + DateTime.Now.ToString("h:mm:ss") + @"</font></td>
                        </tr>
                        <tr style=""height:10px"">
                            <td colspan=""5""></td>
                        </tr>
                        <tr><td colspan=""5""><font color=""#8a8a8a"">Unable to retrieve patients while logged out.</font></td></tr>
                        </table>";
                Response.Write(_output);
                return;
            }


            Staff staff = StaffDB.GetByID(Convert.ToInt32(staff_id));
            if (staff_id == "-1" || staff == null)
            {
                throw new CustomMessageException();
            }
            Organisation org = OrganisationDB.GetByID(Convert.ToInt32(org_id));
            if (staff_id == "0" || staff == null)
            {
                throw new CustomMessageException();
            }


            string output = string.Empty;

            int       count    = 0;
            Booking[] bookings = BookingDB.GetBetween(DateTime.Now.AddMinutes(-45), DateTime.Now.AddMinutes(120), new Staff[] { staff }, new Organisation[] { org }, null, null, false, "0");
            foreach (Booking b in bookings)
            {
                if (b.ArrivalTime == DateTime.MinValue)
                {
                    continue;
                }

                output += @"<tr><td>" + b.Patient.Person.FullnameWithoutMiddlename + @"</td><td style=""width:10px""></td><td>" + b.DateStart.ToString("h:mm") + @"</td><td style=""width:10px""></td><td><a href=""javascript:void(0)"" onclick=""ajax_unset_arrival_time(" + b.BookingID + @");return false;"" title=""Remove from list"" style=""text-decoration:none;""><font color=""red"">X</font></a></td></tr>";
                count++;
            }

            if (count == 0)
            {
                output += @"<tr><td colspan=""5""><font color=""#8a8a8a"">No patients waiting</font></td></tr>";
            }


//                               <td align=""left"" colspan=""5""><b>Patients Waiting (" + count + ")" + @"</b><font color=""#8a8a8a""> &nbsp;&nbsp;  @ " + DateTime.Now.ToString("h:mm:ss") + @"</font></td>
//                               <td align=""left"" colspan=""5""><b>Patients Waiting (" + count + ")" + @"</td>
            output = @"<table>
                           <tr>
                                <td align=""left"" colspan=""5""><b>Patients Waiting (" + count + ")" + @"</b><font color=""#8a8a8a""> &nbsp;&nbsp;  @ " + DateTime.Now.ToString("h:mm:ss") + @"</font></td>
                           </tr>
                           <tr style=""height:10px"">
                               <td colspan=""5""></td>
                           </tr>" + output + "</table>";

            Response.Write(output);
        }
        catch (Exception ex)
        {
            Response.Write("Exception: " + (Utilities.IsDev() ? ex.ToString() : "please contact system administrator."));
        }
        finally
        {
            if (!isLoggedIn && useConfigDB)
            {
                Session.Remove("DB");
                Session.Remove("SystemVariables");
            }
        }
    }
    protected void CheckClashFullDayBookings()
    {
        string old_edit_date        = Request.QueryString["editfullday_old_date"];
        string old_edit_org_id      = Request.QueryString["editfullday_old_org"];
        string old_edit_provider_id = Request.QueryString["editfullday_old_provider"];
        string new_edit_date        = Request.QueryString["editfullday_new_date"];
        string new_edit_org_id      = Request.QueryString["editfullday_new_org"];
        string new_edit_provider_id = Request.QueryString["editfullday_new_provider"];

        if (old_edit_date == null || !Regex.IsMatch(old_edit_date, @"^\d{4}_\d{2}_\d{2}$") ||
            new_edit_date == null || !Regex.IsMatch(new_edit_date, @"^\d{4}_\d{2}_\d{2}$") ||
            old_edit_org_id == null || !Regex.IsMatch(old_edit_org_id, @"^\d+$") ||
            new_edit_org_id == null || !Regex.IsMatch(new_edit_org_id, @"^\d+$") ||
            old_edit_provider_id == null || !Regex.IsMatch(old_edit_provider_id, @"^\d+$") ||
            new_edit_provider_id == null || !Regex.IsMatch(new_edit_provider_id, @"^\d+$"))
        {
            throw new CustomMessageException();
        }


        DateTime oldEditDateTime = ConvertStringToDateTime(old_edit_date + "_0000");
        DateTime newEditDateTime = ConvertStringToDateTime(new_edit_date + "_0000");

        Organisation oldOrg   = OrganisationDB.GetByID(Convert.ToInt32(old_edit_org_id));
        Organisation newOrg   = OrganisationDB.GetByID(Convert.ToInt32(new_edit_org_id));
        Staff        oldStaff = StaffDB.GetByID(Convert.ToInt32(old_edit_provider_id));
        Staff        newStaff = StaffDB.GetByID(Convert.ToInt32(new_edit_provider_id));

        if (oldOrg == null ||
            newOrg == null ||
            oldStaff == null ||
            newStaff == null)
        {
            throw new CustomMessageException();
        }



        // get all bookings from that day/staff/org
        // check each for clash

        bool hasClash = false;

        Booking[] daysBookingList = BookingDB.GetBetween(oldEditDateTime, oldEditDateTime.AddDays(1), new Staff[] { oldStaff }, new Organisation[] { oldOrg }, null, null, false, "0", false);

        // remove any 34 types not for this org
        System.Collections.ArrayList tmp = new System.Collections.ArrayList();
        foreach (Booking booking in daysBookingList)
        {
            if (booking.BookingTypeID != 34 || (booking.Organisation.OrganisationID == oldOrg.OrganisationID && booking.Provider.StaffID == oldStaff.StaffID))
            {
                tmp.Add(booking);
            }
        }
        daysBookingList = (Booking[])tmp.ToArray(typeof(Booking));

        foreach (Booking booking in daysBookingList)
        {
            DateTime newDateStart = newEditDateTime.AddHours(booking.DateStart.Hour).AddMinutes(booking.DateStart.Minute).AddSeconds(booking.DateStart.Second);
            DateTime newDateEnd   = newEditDateTime.AddHours(booking.DateEnd.Hour).AddMinutes(booking.DateEnd.Minute).AddSeconds(booking.DateEnd.Second);

            Booking[] bookings = BookingDB.GetToCheckOverlap_OneTime(newDateStart, newDateEnd, newStaff, null, true, true, true, new Booking[] { booking });

            // remove any non 34 types (unavailabilities) for other orgs
            tmp = new System.Collections.ArrayList();
            foreach (Booking bk in bookings)
            {
                if (bk.Organisation.OrganisationID == oldOrg.OrganisationID || bk.BookingTypeID == 34)
                {
                    tmp.Add(bk);
                }
            }
            bookings = (Booking[])tmp.ToArray(typeof(Booking));

            if (Booking.HasOverlap(bookings, newDateStart, newDateEnd, booking))
            {
                hasClash = true;
                break;
            }
        }

        Response.Write(hasClash ? "1" : "0");
    }
    protected void EditFullDayBookings()
    {
        DateTime?    old_date = UrlEditFullDay_OldDate;
        DateTime?    new_date = UrlEditFullDay_NewDate;
        Organisation old_org  = UrlEditFullDay_OldOrg;
        Organisation new_org  = UrlEditFullDay_NewOrg;
        Staff        old_prov = UrlEditFullDay_OldProvider;
        Staff        new_prov = UrlEditFullDay_NewProvider;

        if (old_date == null)
        {
            throw new Exception("Invalid url field editfullday_old_date");
        }
        if (new_date == null)
        {
            throw new Exception("Invalid url field editfullday_new_date");
        }
        if (old_org == null)
        {
            throw new Exception("Invalid url field editfullday_old_org");
        }
        if (new_org == null)
        {
            throw new Exception("Invalid url field editfullday_new_org");
        }
        if (old_prov == null)
        {
            throw new Exception("Invalid url field editfullday_old_provider");
        }
        if (new_prov == null)
        {
            throw new Exception("Invalid url field editfullday_new_provider");
        }


        // get all bookings from that day/staff/org
        // check each for clash

        bool hasClash = false;

        System.Collections.ArrayList clashes = new System.Collections.ArrayList();
        Booking[] daysBookingList            = BookingDB.GetBetween(old_date.Value, old_date.Value.AddDays(1), new Staff[] { old_prov }, new Organisation[] { old_org }, null, null, false, "0", false);

        // remove any 34 types not for this org
        System.Collections.ArrayList tmp = new System.Collections.ArrayList();
        foreach (Booking booking in daysBookingList)
        {
            if (booking.BookingTypeID != 34 || (booking.Organisation.OrganisationID == old_org.OrganisationID && booking.Provider.StaffID == old_prov.StaffID))
            {
                tmp.Add(booking);
            }
        }
        daysBookingList = (Booking[])tmp.ToArray(typeof(Booking));

        foreach (Booking booking in daysBookingList)
        {
            DateTime newDateStart = new_date.Value.AddHours(booking.DateStart.Hour).AddMinutes(booking.DateStart.Minute).AddSeconds(booking.DateStart.Second);
            DateTime newDateEnd   = new_date.Value.AddHours(booking.DateEnd.Hour).AddMinutes(booking.DateEnd.Minute).AddSeconds(booking.DateEnd.Second);

            Booking[] bookings = BookingDB.GetToCheckOverlap_OneTime(newDateStart, newDateEnd, new_prov, null, true, true, true, new Booking[] { booking });

            // remove any non 34 types (unavailabilities) for other orgs
            tmp = new System.Collections.ArrayList();
            foreach (Booking bk in bookings)
            {
                if (bk.Organisation.OrganisationID == old_org.OrganisationID || bk.BookingTypeID == 34)
                {
                    tmp.Add(bk);
                }
            }
            bookings = (Booking[])tmp.ToArray(typeof(Booking));

            if (Booking.HasOverlap(bookings, newDateStart, newDateEnd, booking))
            {
                hasClash = true;
                clashes.Add(booking.DateStart.ToString("yyyy-MM-dd HH:mm") + (booking.Patient == null ? "" : " " + booking.Patient.Person.FullnameWithoutMiddlename));
                //break;
            }
        }

        if (hasClash)
        {
            string clashesString = string.Empty;
            foreach (string s in clashes)
            {
                clashesString += (clashesString.Length == 0 ? "" : "\r\n") + s;
            }
            throw new CustomMessageException("There are clashes that need to be moved first:\r\n\r\nThese are unable to be moved:\r\n" + clashesString);
        }

        foreach (Booking booking in daysBookingList)
        {
            if (booking.BookingTypeID != 34)
            {
                continue;
            }

            DateTime newDateStart = new_date.Value.AddHours(booking.DateStart.Hour).AddMinutes(booking.DateStart.Minute).AddSeconds(booking.DateStart.Second);
            DateTime newDateEnd   = new_date.Value.AddHours(booking.DateEnd.Hour).AddMinutes(booking.DateEnd.Minute).AddSeconds(booking.DateEnd.Second);

            int bookingChangeHistoryReason = 276; // 276 = Admininstration reschedule needs
            BookingChangeHistoryDB.Insert(booking.BookingID, GetStaffID(), bookingChangeHistoryReason, booking.DateStart);
            BookingDB.Update(booking.BookingID, newDateStart, newDateEnd, new_org.OrganisationID, new_prov.StaffID, booking.Patient == null ? -1 : booking.Patient.PatientID, booking.Offering == null ? -1 : booking.Offering.OfferingID,
                             booking.BookingTypeID, booking.BookingStatus.ID, -1, booking.AddedBy.StaffID, booking.BookingConfirmedByType == null ? -1 : booking.BookingConfirmedByType.ID, booking.ConfirmedBy == null ? -1 : booking.ConfirmedBy.StaffID, booking.DateConfirmed,
                             booking.DeletedBy == null ? -1 : booking.DeletedBy.StaffID, booking.DateDeleted,
                             booking.CancelledBy == null ? -1 : booking.CancelledBy.StaffID, booking.DateCancelled,
                             booking.IsPatientMissedAppt, booking.IsProviderMissedAppt, booking.IsEmergency, booking.IsRecurring, booking.RecurringDayOfWeek, booking.RecurringStartTime, booking.RecurringEndTime);
        }
    }