Show / Hide Table of Contents

Class BookingManager

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

Inheritance
object
BookingManager
Implements
IBookingManager
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.BusinessLogic.dll
Syntax
public class BookingManager : IBookingManager
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()

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

Declaration
public 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.

Methods

AcceptAppointmentAsync(AppointmentRow, CancellationToken)

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

Declaration
public Task AcceptAppointmentAsync(AppointmentRow appointment, CancellationToken cancellationToken = default)
Parameters
Type Name Description
AppointmentRow appointment

The appointment in question

CancellationToken cancellationToken
Returns
Type Description
Task
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

AcceptRejectedAppointmentAsync(AppointmentRow, CancellationToken)

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 Task AcceptRejectedAppointmentAsync(AppointmentRow appointmentRow, CancellationToken cancellationToken = default)
Parameters
Type Name Description
AppointmentRow appointmentRow

The appointment in question

CancellationToken cancellationToken
Returns
Type Description
Task
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.

AssignToAsync(AppointmentRow, ParticipantInfo, CancellationToken)

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

Declaration
public Task AssignToAsync(AppointmentRow row, ParticipantInfo participant, CancellationToken cancellationToken = default)
Parameters
Type Name Description
AppointmentRow row
ParticipantInfo participant
CancellationToken cancellationToken
Returns
Type Description
Task
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 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.

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.

ConvertAppoinmentToInvitationStatus(AppointmentStatus)

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

Declaration
public static InvitationStatus ConvertAppoinmentToInvitationStatus(AppointmentStatus appointmentStatus)
Parameters
Type Name Description
AppointmentStatus appointmentStatus
Returns
Type Description
InvitationStatus
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.

ConvertInvitationToAppointmentStatus(ParticipantInfo)

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

Declaration
public static AppointmentStatus ConvertInvitationToAppointmentStatus(ParticipantInfo participant)
Parameters
Type Name Description
ParticipantInfo participant
Returns
Type Description
AppointmentStatus
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.

CreateAppointmentForParticipantAsync(AppointmentRow, ParticipantInfo, CancellationToken)

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

Declaration
public Task<AppointmentRow> CreateAppointmentForParticipantAsync(AppointmentRow mainBooking, ParticipantInfo participant, CancellationToken cancellationToken = default)
Parameters
Type Name Description
AppointmentRow mainBooking
ParticipantInfo participant

Participant to create an appointment record for

CancellationToken cancellationToken
Returns
Type Description
Task<AppointmentRow>

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

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.

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 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 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 BookingType GetBookingType(Appointment appointment)
Parameters
Type Name Description
Appointment appointment
Returns
Type Description
BookingType

None, Main or Child

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.

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 BookingType GetBookingType(AppointmentRow appointmentRow)
Parameters
Type Name Description
AppointmentRow appointmentRow
Returns
Type Description
BookingType

None, Main or Child

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.

GetBookingType(int, int)

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

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

The AppointmentId of the appointment

int motherId

The MotherId of the appointment

Returns
Type Description
BookingType

BookingType Owner, Participant or None

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.

HasAccepted(AppointmentRow)

Has the appointment been accepted?

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

True if the status of the appointment is NotStarted or Started

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.

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 bool IsAppointmentAssignment(Appointment appointment)
Parameters
Type Name Description
Appointment appointment
Returns
Type Description
bool

True if this is an assignment

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.

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 bool IsAppointmentAssignment(AppointmentRow appointmentRow)
Parameters
Type Name Description
AppointmentRow appointmentRow
Returns
Type Description
bool

True if this is an assignment

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.

IsAppointmentBooking(Appointment)

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

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

True if this is a booking row

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.

IsAppointmentBooking(AppointmentRow)

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

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

True if this is a booking row

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.

IsAppointmentChildBooking(Appointment)

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

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

True if this is a child booking row

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.

IsAppointmentChildBooking(AppointmentRow)

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

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

True if this is a child booking row

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.

IsAppointmentIncludedInParticipantList(AppointmentRow)

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

Declaration
public bool IsAppointmentIncludedInParticipantList(AppointmentRow appointment)
Parameters
Type Name Description
AppointmentRow appointment
Returns
Type Description
bool
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.

IsAppointmentMainBooking(Appointment)

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

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

True if this is a Main booking row

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.

IsAppointmentMainBooking(AppointmentRow)

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

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

True if this is a Main booking row

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.

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 AcceptAppointmentAsync(AppointmentRow, CancellationToken) or RejectAppointment should be carried out on a later instance in a series. Such operations should be carried out if the status is similar.

Declaration
public 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
bool

True if the appointment status are similar.

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.

IsEmailParticipant(AppointmentRow)

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

Declaration
public bool IsEmailParticipant(AppointmentRow appointment)
Parameters
Type Name Description
AppointmentRow appointment
Returns
Type Description
bool
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.

IsExternalPersonAsync(ParticipantInfo, CancellationToken)

Check if the participant is an external person

Declaration
public Task<bool> IsExternalPersonAsync(ParticipantInfo participantInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ParticipantInfo participantInfo

ParticipantInfo

CancellationToken cancellationToken
Returns
Type Description
Task<bool>

true if the participant is an external person.

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.

ModifyAppointmentForParticipant(AppointmentRow, AppointmentRow)

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

Declaration
public BookingManagerModified ModifyAppointmentForParticipant(AppointmentRow mainBooking, AppointmentRow childBooking)
Parameters
Type Name Description
AppointmentRow mainBooking
AppointmentRow childBooking
Returns
Type Description
BookingManagerModified
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.

RejectAppointmentAsync(AppointmentRow, string, CancellationToken)

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

Declaration
public Task RejectAppointmentAsync(AppointmentRow appointmentRow, string rejectReason, CancellationToken cancellationToken = default)
Parameters
Type Name Description
AppointmentRow appointmentRow

Appointment to be Rejected

string rejectReason

Reject reason to show with the rejection

CancellationToken cancellationToken
Returns
Type Description
Task
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 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.

SetAppointmentToRemovedFromParticipantListAsync(AppointmentRow, int, CancellationToken)

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

Declaration
public Task SetAppointmentToRemovedFromParticipantListAsync(AppointmentRow appointmentRow, int diaryOwner, CancellationToken cancellationToken = default)
Parameters
Type Name Description
AppointmentRow appointmentRow

Appointment row in question

int diaryOwner

AssociateId of the owner of the diary.

CancellationToken cancellationToken
Returns
Type Description
Task
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.

SetAppointmentToRemovedFromParticipantListAsync(AppointmentRow, CancellationToken)

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 Task SetAppointmentToRemovedFromParticipantListAsync(AppointmentRow appointmentRow, CancellationToken cancellationToken = default)
Parameters
Type Name Description
AppointmentRow appointmentRow

Appointment row in question

CancellationToken cancellationToken
Returns
Type Description
Task
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 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

ValidateAppointmentAsync(bool, bool, AppointmentRow, CancellationToken)

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 Task ValidateAppointmentAsync(bool isBookingMaster, bool isBooking, AppointmentRow appointmentRow, CancellationToken cancellationToken = default)
Parameters
Type Name Description
bool isBookingMaster
bool isBooking
AppointmentRow appointmentRow
CancellationToken cancellationToken
Returns
Type Description
Task
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.

Implements

IBookingManager

Extension Methods

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