Show / Hide Table of Contents

Class BookingManager

The booking manager is mainly used by the AppointmentMatrix to maintain booking related information.

Inheritance
Object
BookingManager
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: SuperOffice.CRM.Entities
Assembly: SoDataBase.dll
Syntax
public class BookingManager
Remarks

The AppointmentMatrix is responsible for database updates of appointment records, but the knowledge about how these records are modified lies in the BookinManager. The booking manager also handles information about Participants. Participants are represented both by individual appointment records and the ParticipantInfo object.

Constructors

BookingManager(AppointmentRow)

Declaration
public BookingManager(AppointmentRow mainBooking)
Parameters
Type Name Description
AppointmentRow mainBooking

Methods

AcceptAppointment(AppointmentRow)

Set the appointment record to a state where it is accepted.

Declaration
public static void AcceptAppointment(AppointmentRow appointment)
Parameters
Type Name Description
AppointmentRow appointment

The appointment in question

Remarks

RejectReason is erased automatically when you accept. If this is a main booking we also zero the AssignedBy field in case the appointment was an assigned main booking record

AcceptRejectedAppointment(AppointmentRow)

The booking owner can set the appointment record to a state where it is accepted that the invited participant has rejected to participate.

Declaration
public static void AcceptRejectedAppointment(AppointmentRow appointmentRow)
Parameters
Type Name Description
AppointmentRow appointmentRow

The appointment in question

AssignTo(AppointmentRow, ParticipantInfo)

Assign an appointment to a participant.

Declaration
public static void AssignTo(AppointmentRow row, ParticipantInfo participant)
Parameters
Type Name Description
AppointmentRow row

The appointment to assign to the new participant.

ParticipantInfo participant

Participant to assign the appointment to. This participant needs to be an associate.

AssignTo(ParticipantInfo)

Changes the owner of an Appointment and sets the associate id of the associate that assigned the Appointment as Assigned By

Declaration
public void AssignTo(ParticipantInfo participant)
Parameters
Type Name Description
ParticipantInfo participant
Remarks

Also updates the GroupId, InvitedPersonId, ContactId and EmailId fields. The method updates the main booking AppointmentRow. The AppointmentRow given as parameter is marked for deletion if the new associate is already a participant in this Booking.

AssignToExternalOrganizer(AppointmentRow, ParticipantInfo)

Assign an appointment to a participant.

Declaration
public static void AssignToExternalOrganizer(AppointmentRow row, ParticipantInfo participant)
Parameters
Type Name Description
AppointmentRow row

The appointment to assign to the new participant.

ParticipantInfo participant

Participant to assign the appointment to. This participant needs to be an associate.

ConvertAppoinmentToInvitationStatus(AppointmentStatus)

Declaration
public static InvitationStatus ConvertAppoinmentToInvitationStatus(AppointmentStatus appointmentStatus)
Parameters
Type Name Description
AppointmentStatus appointmentStatus
Returns
Type Description
InvitationStatus

ConvertInvitationToAppointmentStatus(ParticipantInfo)

Declaration
public static AppointmentStatus ConvertInvitationToAppointmentStatus(ParticipantInfo participant)
Parameters
Type Name Description
ParticipantInfo participant
Returns
Type Description
AppointmentStatus

CreateAppointmentForParticipant(ParticipantInfo)

Creates a new instance of an appointment row for the participant specified

Declaration
public AppointmentRow CreateAppointmentForParticipant(ParticipantInfo participant)
Parameters
Type Name Description
ParticipantInfo participant

Participant to create an appointment record for

Returns
Type Description
AppointmentRow

A new instance of an appointment row for the participant specified.

GetAppointmentDeleteAction(Appointment, InvitationStatus)

The method analyzes the appointment given and returns what kind of delete action that should be performed on this instance.

Declaration
public static AppointmentDeleteAction GetAppointmentDeleteAction(Appointment appointment, InvitationStatus invitationStatus)
Parameters
Type Name Description
Appointment appointment

Appointment appointment

InvitationStatus invitationStatus
Returns
Type Description
AppointmentDeleteAction

MainBookingDeleteAction, ChildBookingDeleteAction, AssignmentDeleteAction or AppointmentDeleteAction

Remarks

Is it a Main booking or a child booking that is going to be deleted, or is the appointment not a booking at all? Is the do by date past date of today? All this parameters requires different Actions to be performed and this method will give you the delete action you need to act upon.

GetAppointmentDeleteAction(AppointmentRow, InvitationStatus)

The method analyzes the appointment given and returns what kind of delete action that should be performed on this instance.

Declaration
public static AppointmentDeleteAction GetAppointmentDeleteAction(AppointmentRow appointmentRow, InvitationStatus invitationStatus)
Parameters
Type Name Description
AppointmentRow appointmentRow

AppointmentRow appointmentRow

InvitationStatus invitationStatus
Returns
Type Description
AppointmentDeleteAction

MainBookingDeleteAction, ChildBookingDeleteAction, AssignmentDeleteAction or AppointmentDeleteAction

Remarks

Is it a Main booking or a child booking that is going to be deleted, or is the appointment not a booking at all? Is the do by date past date of today? All this parameters requires different Actions to be performed and this method will give you the delete action you need to act upon.

GetBookingType(Appointment)

Get the type of booking row this is, the Main record, a child record or not a booking at all (none)

Declaration
public static BookingType GetBookingType(Appointment appointment)
Parameters
Type Name Description
Appointment appointment
Returns
Type Description
BookingType

None, Main or Child

GetBookingType(AppointmentRow)

Get the type of booking row this is, the Main record, a child record or not a booking at all (none)

Declaration
public static BookingType GetBookingType(AppointmentRow appointmentRow)
Parameters
Type Name Description
AppointmentRow appointmentRow
Returns
Type Description
BookingType

None, Main or Child

GetBookingType(Int32, Int32)

Get the type of booking row this is, the Main record, a child record or not a booking at all (none)

Declaration
public static BookingType GetBookingType(int appointmentId, int motherId)
Parameters
Type Name Description
Int32 appointmentId

The AppointmentId of the appointment

Int32 motherId

The MotherId of the appointment

Returns
Type Description
BookingType

BookingType Owner, Participant or None

HasAccepted(AppointmentRow)

Has the appointment been accepted?

Declaration
public static bool HasAccepted(AppointmentRow appointment)
Parameters
Type Name Description
AppointmentRow appointment
Returns
Type Description
Boolean

True if the status of the appointment is NotStarted or Started

IsAppointmentAssignment(Appointment)

Test if this appointment row is an assignment. Wii also return True if it is a booking row that is also an assignment

Declaration
public static bool IsAppointmentAssignment(Appointment appointment)
Parameters
Type Name Description
Appointment appointment
Returns
Type Description
Boolean

True if this is an assignment

IsAppointmentAssignment(AppointmentRow)

Test if this appointment row is an assignment. Wii also return True if it is a booking row that is also an assignment

Declaration
public static bool IsAppointmentAssignment(AppointmentRow appointmentRow)
Parameters
Type Name Description
AppointmentRow appointmentRow
Returns
Type Description
Boolean

True if this is an assignment

IsAppointmentBooking(Appointment)

Test if this appointment row is a booking appointment (MotherId != 0)

Declaration
public static bool IsAppointmentBooking(Appointment appointment)
Parameters
Type Name Description
Appointment appointment
Returns
Type Description
Boolean

True if this is a booking row

IsAppointmentBooking(AppointmentRow)

Test if this appointment row is a booking appointment (MotherId != 0)

Declaration
public static bool IsAppointmentBooking(AppointmentRow appointmentRow)
Parameters
Type Name Description
AppointmentRow appointmentRow
Returns
Type Description
Boolean

True if this is a booking row

IsAppointmentChildBooking(Appointment)

Test if this appointment row is a Child booking appointment (MotherId > 0 and MotherId != AppointmentId)

Declaration
public static bool IsAppointmentChildBooking(Appointment appointment)
Parameters
Type Name Description
Appointment appointment
Returns
Type Description
Boolean

True if this is a child booking row

IsAppointmentChildBooking(AppointmentRow)

Test if this appointment row is a Child booking appointment (MotherId > 0 and MotherId != AppointmentId)

Declaration
public static bool IsAppointmentChildBooking(AppointmentRow appointmentRow)
Parameters
Type Name Description
AppointmentRow appointmentRow
Returns
Type Description
Boolean

True if this is a child booking row

IsAppointmentIncludedInParticipantList(AppointmentRow)

Does the appointment record represent a user that should be listed in the participant list?

Declaration
public static bool IsAppointmentIncludedInParticipantList(AppointmentRow appointment)
Parameters
Type Name Description
AppointmentRow appointment
Returns
Type Description
Boolean

IsAppointmentMainBooking(Appointment)

Test if this appointment row is a Main booking appointment (MotherId > 0 and MotherId == AppointmentId)

Declaration
public static bool IsAppointmentMainBooking(Appointment appointment)
Parameters
Type Name Description
Appointment appointment
Returns
Type Description
Boolean

True if this is a Main booking row

IsAppointmentMainBooking(AppointmentRow)

Test if this appointment row is a Main booking appointment (MotherId > 0 and MotherId == AppointmentId)

Declaration
public static bool IsAppointmentMainBooking(AppointmentRow appointmentRow)
Parameters
Type Name Description
AppointmentRow appointmentRow
Returns
Type Description
Boolean

True if this is a Main booking row

IsAppointmentStatusSimilar(AppointmentStatus, AppointmentStatus)

This method compares to AppointmentStatus enumerators and determines if they are similar, hence; threated equally. The typical scenario is that a repeating booking needs to determine if an action like AcceptAppointment(AppointmentRow) or RejectAppointment(AppointmentRow, String) should be carried out on a later instance in a series. Such operations should be carried out if the status is similar.

Declaration
public static bool IsAppointmentStatusSimilar(AppointmentStatus originalStaus, AppointmentStatus compareStatus)
Parameters
Type Name Description
AppointmentStatus originalStaus

First status to compare, typically the status of the first appointment in a repeating series.

AppointmentStatus compareStatus

Second status to compare, typically the status of an appointment later on in the series.

Returns
Type Description
Boolean

True if the appointment status are similar.

IsExternalPerson(ParticipantInfo)

Check if the participant is an external person

Declaration
public static bool IsExternalPerson(ParticipantInfo participantInfo)
Parameters
Type Name Description
ParticipantInfo participantInfo

ParticipantInfo

Returns
Type Description
Boolean

true if the participant is an external person.

ModifyAppointmentForParticipant(AppointmentRow)

Declaration
public BookingManagerModified ModifyAppointmentForParticipant(AppointmentRow childBooking)
Parameters
Type Name Description
AppointmentRow childBooking
Returns
Type Description
BookingManagerModified

RejectAppointment(AppointmentRow, String)

Set the appointment record to a state where it is not accepted.

Declaration
public static void RejectAppointment(AppointmentRow appointmentRow, string rejectReason)
Parameters
Type Name Description
AppointmentRow appointmentRow

Appointment to be Rejected

String rejectReason

Reject reason to show with the rejection

Remarks

This will set the booking invitation or assignment to rejected. If the appointment is an assignment, then the appointment will be sent back to the sender by switching the AssociateId and AssignedBy values.

SetAppointmentToIncludedInParticipantList(AppointmentRow)

Set the appointment record to a state where it is shown in the participant list

Declaration
public static void SetAppointmentToIncludedInParticipantList(AppointmentRow appointmentRow)
Parameters
Type Name Description
AppointmentRow appointmentRow

Appointment row in question

Remarks

Nothing is modified if the participant is in the participant list (e.g. IsAppointmentIncludedInParticipantList(AppointmentRow) is true.

SetAppointmentToRemovedFromParticipantList(AppointmentRow)

Set the appointment record to a state where it is not shown in the participant list, assuming that it is the logged on users diary that is being worked on.

Declaration
public static void SetAppointmentToRemovedFromParticipantList(AppointmentRow appointmentRow)
Parameters
Type Name Description
AppointmentRow appointmentRow

Appointment row in question

Remarks

The child appointment will be removed from the list if the participant in question has not seen the invitation yet. If he has seen the invitation, then his status is updated so he will be notified.

SetAppointmentToRemovedFromParticipantList(AppointmentRow, Int32)

Set the appointment record to a state where it is not shown in the participant list.

Declaration
public static void SetAppointmentToRemovedFromParticipantList(AppointmentRow appointmentRow, int diaryOwner)
Parameters
Type Name Description
AppointmentRow appointmentRow

Appointment row in question

Int32 diaryOwner

AssociateId of the owner of the diary.

Remarks

The child appointment will be removed from the list if the participant in question has not seen the invitation yet. If he has seen the invitation, then his status is updated so he will be notified.

SetSeen(AppointmentRow)

Sets an appointment Invitation or Assignment to seen.

Declaration
public static void SetSeen(AppointmentRow appointmentRow)
Parameters
Type Name Description
AppointmentRow appointmentRow

AppointmentRow appointmentRow - The appointment row whos status should be set to Seen

Remarks

Set Seen (Booking or Assignment) or MovedSeen (Booking) depending on the previous status of the Appointment

SholdParticipate(ParticipantInfo)

Check if a participant is supposed to or can be a member of the appointment.

Declaration
public static bool SholdParticipate(ParticipantInfo participant)
Parameters
Type Name Description
ParticipantInfo participant

Participant to sheck for participation.

Returns
Type Description
Boolean

True if the participant should participate.

ValidateAppointment(Boolean, Boolean, AppointmentRow)

This method validates the appointment row and makes sure that business rules that are special for different states of an appointment are followed.

Declaration
public static void ValidateAppointment(bool isBookingMaster, bool isBooking, AppointmentRow appointmentRow)
Parameters
Type Name Description
Boolean isBookingMaster
Boolean isBooking
AppointmentRow appointmentRow

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top