/// <summary>
        /// Function to map the Crew member entity to PersonBase.
        /// </summary>
        /// <param name="crewmember">Instance of Crew member</param>        
        /// <returns>Instance of PersonBase</returns>
        public static PersonBase MapToPersonBase(this Crewmember crewmember)
        {
            if (crewmember == null)
            {
                throw new ArgumentNullException("crewmember");
            }

            var personBase = new PersonBase();
            personBase.PersonId = crewmember.CrewmemberId;
            personBase.PersonType = PersonType.Crewmember;
            personBase.PersonalDetail = crewmember.PersonalDetail;
            personBase.EmployeeNo = crewmember.EmployeeNo;
            personBase.IsOnboard = crewmember.IsOnboard;
            personBase.PersonTypeId = CommonConstants.CrewmemberTypeId;
            personBase.LastDateTime = crewmember.LastDateTime;
            personBase.LastEvent = crewmember.LastEvent;
            personBase.IsPhotoAddedInCartForSwap = SwapPhotoManager.Instance.PhotoExistsInCart(personBase.PersonId);
            personBase.SecurityPhotoAddress = crewmember.SecurityPhotoAddress;
            personBase.AreAllMessagesGotAcknowledged = crewmember.AreAllMessagesGotAcknowledged;
            personBase.Photo = crewmember.Photo;
            personBase.AssignPhotoByteArray(crewmember.PhotoByteArray);
            personBase.Stateroom = crewmember.Stateroom;
            personBase.Department = crewmember.Department;
            personBase.Position = crewmember.Position;
            personBase.SafetyNumber = crewmember.SafetyNumber;
            personBase.StateroomOccupancy = crewmember.StateroomOccupancy;
            personBase.HasAlert = crewmember.HasAlert;
            personBase.HasMessage = crewmember.HasMessage;
            personBase.AssignAlerts(crewmember.Alerts);
            personBase.AssignPersonMessages(crewmember.Messages);
            personBase.BoardingInfo.OnboardDate = crewmember.BoardingInfo.OnboardDate;
            personBase.BoardingInfo.AshoreDate = crewmember.BoardingInfo.AshoreDate;
            personBase.AllowOnboardAlert = crewmember.AllowOnboardAlert;
            personBase.PortAssignedDate = crewmember.PortAssignedDate;
            return personBase;
        }
Example #2
0
 /// <summary>
 /// Retrieves the guest messages.
 /// </summary>
 /// <param name="person">The person.</param>
 /// <param name="retrievedPerson">The retrieved person.</param>
 private static void MapMessages(PersonBase person, PersonBase retrievedPerson)
 {
     person.HasMessage = retrievedPerson.HasMessage;
     person.AreAllMessagesGotAcknowledged = retrievedPerson.Messages.All(m => m.StatusId.Equals(CommonConstants.MessageAcknowledgeStatusId));
     person.AssignPersonMessages(retrievedPerson.Messages);
 }
        /// <summary>
        /// Function to map the Guest entity to PersonBase.
        /// </summary>
        /// <param name="guest">Instance of Guest</param>        
        /// <returns>Instance of PersonBase</returns>
        public static PersonBase MapToPersonBase(this Guest guest)
        {
            if (guest == null)
            {
                throw new ArgumentNullException("guest");
            }

            var personBase = new PersonBase();
            personBase.PersonId = guest.GuestId;
            personBase.PersonType = PersonType.Guest;
            personBase.SecurityPhotoAddress = guest.SecurityPhotoAddress;
            personBase.Stateroom = guest.CruiseDetail != null ? guest.CruiseDetail.Stateroom : string.Empty;
            personBase.PersonalDetail = guest.PersonalDetail;
            personBase.CruiseDetail = guest.CruiseDetail;
            personBase.Photo = guest.Photo;
            personBase.IsPhotoAddedInCartForSwap = SwapPhotoManager.Instance.PhotoExistsInCart(personBase.PersonId);
            personBase.AssignPhotoByteArray(guest.PhotoByteArray);
            personBase.AssignPortAuthorizations(guest.PortAuthorizations);
            personBase.AssignAlerts(guest.Alerts);
            personBase.AssignFolios(guest.Folios);
            personBase.HasAlert = guest.HasAlert;
            personBase.HasMessage = guest.HasMessage;
            personBase.AreAllMessagesGotAcknowledged = guest.AreAllMessagesGotAcknowledged;
            personBase.IsOnboard = guest.IsOnboard;
            personBase.PersonTypeId = CommonConstants.GuestTypeId;
            personBase.LastDateTime = guest.LastDateTime;
            personBase.LastEvent = guest.LastEvent;
            personBase.IsParentalAuthorizationAlertOverridden = guest.IsParentalAuthorizationAlertOverridden;
            personBase.IsBirthdayToday = guest.IsBirthdayToday;
            personBase.IsAnniversaryDayToday = guest.IsAnniversaryDayToday;
            personBase.IsOnboardWithoutCheckIn = guest.IsOnboardWithoutCheckIn;
            personBase.IsDisabledCard = guest.IsDisabledCard;
            personBase.AllowOnboardAlert = guest.AllowOnboardAlert;
            personBase.AssignPersonMessages(guest.Messages);

            return personBase;
        }
        /// <summary>
        /// Function to map the Visitor entity to PersonBase.
        /// </summary>
        /// <param name="visitor">Instance of Visitor</param>        
        /// <returns>Instance of PersonBase</returns>
        public static PersonBase MapToPersonBase(this Visitor visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            var personBase = new PersonBase();
            personBase.PersonId = visitor.VisitorId;
            personBase.PersonType = PersonType.Visitor;
            personBase.PersonalDetail = visitor.PersonalDetail;
            personBase.Photo = visitor.Photo;
            personBase.IsPhotoAddedInCartForSwap = SwapPhotoManager.Instance.PhotoExistsInCart(personBase.PersonId);
            personBase.AssignPhotoByteArray(visitor.PhotoByteArray);
            personBase.IsOnboard = visitor.IsOnboard;
            personBase.VisitorInfo = visitor.VisitorInfo;
            personBase.PersonTypeId = CommonConstants.VisitorTypeId;
            personBase.AreAllMessagesGotAcknowledged = visitor.AreAllMessagesGotAcknowledged;
            personBase.LastDateTime = visitor.LastDateTime;
            personBase.VisitorType = visitor.VisitorType;
            personBase.LastEvent = visitor.LastEvent;
            personBase.SecurityPhotoAddress = visitor.SecurityPhotoAddress;
            personBase.HasAlert = visitor.HasAlert;
            personBase.HasMessage = visitor.HasMessage;
            personBase.CardNumber = visitor.CardNumber;
            personBase.AssignAlerts(visitor.Alerts);
            personBase.AssignPersonMessages(visitor.Messages);
            personBase.AllowOnboardAlert = visitor.AllowOnboardAlert;
            return personBase;
        }