/// <summary> /// Creates the debark authorization instance. /// </summary> /// <param name="canAshoreAlone">if set to <c>true</c> [can ashore alone].</param> /// <param name="authorizedPersons">The authorized persons.</param> /// <returns>Debark authorization</returns> private static DebarkAuthorization CreateDebarkAuthorizationInstance(bool canAshoreAlone, IList<DebarkPersonDetail> authorizedPersons) { var debarkAuthorization = new DebarkAuthorization(); var portDebarkAuthorization = new PortDebarkAuthorization { CanDebarkAlone = canAshoreAlone }; var debarkAuthorizedPersons = authorizedPersons != null && authorizedPersons.Count > 0 ? authorizedPersons.Select(aItem => new DebarkAuthorizedPerson { PersonId = aItem.PersonId, PersonTypeId = aItem.PersonTypeId }).ToList() : null; if (debarkAuthorizedPersons != null) { var debarkAuthorizedPersonList = new DebarkAuthorizedPersonCollection(debarkAuthorizedPersons); portDebarkAuthorization.AssignDebarkAuthorizedPersons(debarkAuthorizedPersonList); debarkAuthorization.PortDebarkAuthorizations.Add(portDebarkAuthorization); } return debarkAuthorization; }
/// <summary> /// Clones the debark authorization. /// </summary> /// <param name="actualInstance">The actual instance.</param> /// <param name="personId">The person identifier.</param> /// <returns>Cloned Debark authorization</returns> private static DebarkAuthorization CloneDebarkAuthorization(DebarkAuthorization actualInstance, string personId) { var clonedInstnace = (DebarkAuthorization)actualInstance.CloneObject(); clonedInstnace.PersonId = personId; return clonedInstnace; }