private void SetUpData() { this.targetService = new PhotoService(); this.person = new Person(); CrewmemberCollection crewMembers = new CrewmemberCollection(); var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, DocumentNumber = string.Empty, Suffix = string.Empty }; crewMembers.Add(new Crewmember { CrewmemberId = string.Empty, CrewmemberTypeId = "1", SecurityPhotoAddress = string.Empty, ChargeId = string.Empty, EmployeeNo = string.Empty, LastEvent = string.Empty, PersonalDetail = personDetail }); this.person.AssignCrewmembers(crewMembers); GuestCollection guests = new GuestCollection(); var checkInDetail = new CheckInDetail { ApplicationId = string.Empty, LocationId = "1", LocationTypeId = "1", MachineName = "Machine", Station = "station", UserId = "user" }; var cruiseDetail = new GuestCruiseDetail { BeaconId = string.Empty, CheckInDetail = checkInDetail, LoyaltyLevelTypeId = "1", ReservationId = "1", Stateroom = stateroom, ReservationStatusId = "0000089", StateroomCategoryTypeId = "3" }; var guest = new Guest { GuestId = PersonId, PersonalDetail = personDetail, Age = 0, CruiseDetail = cruiseDetail, SecurityPhotoAddress = string.Empty, }; guests.Add(guest); this.person.AssignGuests(guests); PortDebarkAuthorization pda = new PortDebarkAuthorization { PortId = "1", PersonId = "00001", CanDebarkAlone = true, IsActivePort = true, PortOrder = 1 }; DebarkAuthorizedPersonCollection dapCollection = new DebarkAuthorizedPersonCollection(); dapCollection.Add(new DebarkAuthorizedPerson { PersonTypeId = "2", Person = this.FilledPerson(), PersonId = PersonId, PersonType = PersonType.Guest }); pda.AssignDebarkAuthorizedPersons(dapCollection); PortDebarkAuthorizationCollection portDebarkAuthorizations = new PortDebarkAuthorizationCollection(); portDebarkAuthorizations.Add(pda); guest.AssignPortAuthorizations(portDebarkAuthorizations); guests.Add(guest); this.listOfPDA.Add(pda); person.AssignGuests(guests); }
/// <summary> /// Crews the member mapper. /// </summary> /// <param name="crewmemberCollection">The crew member collection.</param> /// <param name="crew">The object of personBase.</param> public static void CrewmemberMapper(CrewmemberCollection crewmemberCollection, PersonBase crew) { var crewmember = new Crewmember(); if (crew != null && crewmemberCollection != null) { crewmember.CrewmemberId = crew.PersonId; crewmember.PersonalDetail = crew.PersonalDetail; crewmember.Photo = crew.Photo; crewmember.SecurityPhotoAddress = crew.SecurityPhotoAddress; crewmember.EmployeeNo = crew.EmployeeNo; crewmember.IsOnboard = crew.IsOnboard; crewmember.AreAllMessagesGotAcknowledged = crew.AreAllMessagesGotAcknowledged; crewmember.LastDateTime = crew.LastDateTime; crewmember.LastEvent = crew.LastEvent; crewmember.Stateroom = crew.Stateroom; crewmember.HasAlert = crew.HasAlert; crewmember.HasMessage = crew.HasMessage; crewmember.Department = crew.Department; crewmember.StateroomOccupancy = crew.StateroomOccupancy; crewmember.Position = crew.Position; crewmember.AssignAlerts(crew.Alerts); crewmember.AssignMessages(crew.Messages); crewmember.BoardingInfo.OnboardDate = crew.BoardingInfo.OnboardDate; crewmember.BoardingInfo.AshoreDate = crew.BoardingInfo.AshoreDate; crewmember.AllowOnboardAlert = crew.AllowOnboardAlert; crewmember.PortAssignedDate = crew.PortAssignedDate; crewmemberCollection.Add(crewmember); } }
/// <summary> /// Function to sort crew members. /// </summary> /// <param name="crewmember">List of crew members</param> /// <returns>IEnumerable for crew member</returns> public static CrewmemberCollection Sort(this CrewmemberCollection crewmember) { var crewmemberCollection = new CrewmemberCollection(); var c = from crew in crewmember orderby crew.OrderKey, crew.PersonalDetail.FirstName, crew.PersonalDetail.LastName select crew; foreach (var crew in c) { crewmemberCollection.Add(crew); } return crewmemberCollection; }
/// <summary> /// Function to retrieve matching crew members. /// </summary> /// <param name="crew">List of crew members</param> /// <param name="personIdentityList">List of person identities</param> /// <returns>IEnumerable for crew members</returns> public static CrewmemberCollection RetrieveMatchingCrewmembers(this CrewmemberCollection crew, IList<PersonIdentity> personIdentityList) { var crewmemberCollection = new CrewmemberCollection(); var c = from crewmember in crew join personIdentity in personIdentityList on crewmember.CrewmemberId equals personIdentity.PersonId where personIdentity.PersonType == PersonType.Crewmember select crewmember; foreach (var crewmember in c) { crewmemberCollection.Add(crewmember); } return crewmemberCollection; }
private void SetUpPartyManagerData() { //// var party = new PersonsParty { SelectedPerson = this.FilledPerson() }; this.person = new Person(); CrewmemberCollection crewMembers = new CrewmemberCollection(); var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, DocumentNumber = string.Empty, Suffix = string.Empty }; crewMembers.Add(new Crewmember { CrewmemberId = string.Empty, CrewmemberTypeId = "1", SecurityPhotoAddress = string.Empty, ChargeId = string.Empty, EmployeeNo = string.Empty, LastEvent = string.Empty, PersonalDetail = personDetail }); this.person.AssignCrewmembers(crewMembers); GuestCollection guests = new GuestCollection(); var checkInDetail = new CheckInDetail { ApplicationId = string.Empty, LocationId = "1", LocationTypeId = "1", MachineName = "Machine", Station = "station", UserId = "user" }; var cruiseDetail = new GuestCruiseDetail { BeaconId = string.Empty, CheckInDetail = checkInDetail, LoyaltyLevelTypeId = "1", ReservationId = "1", Stateroom = stateroom, ReservationStatusId = "0000089", StateroomCategoryTypeId = "aaasad" }; guests.Add(new Guest { GuestId = "1", PersonalDetail = personDetail, Age = 0, CruiseDetail = cruiseDetail, SecurityPhotoAddress = string.Empty }); this.person.AssignGuests(guests); }
/// <summary> /// Function to retrieve photo of Crewmember. /// </summary> /// <param name="crewmember">Instance of Crewmember</param> private static void RetrieveCrewmemberPhoto(Crewmember crewmember) { Observable.ToAsync(() => { var person = new Person(); var crewmemberCollection = new CrewmemberCollection(); crewmemberCollection.Add(crewmember); person.AssignCrewmembers(crewmemberCollection); DIContainer.Instance.Resolve<PhotoService>().RetrievePhotos(person); })().Subscribe(r => { }, ex => { }); }
/// <summary> /// Maps the crew personal detail. /// </summary> /// <param name="dataReader">The data reader.</param> /// <returns>The crew member</returns> private static async Task<CrewmemberCollection> RetrieveCrewmemberPersonalDetail(SqlDataReader dataReader) { var crewmembers = new CrewmemberCollection(); if (dataReader != null) { while (await dataReader.ReadAsync()) { var crewmember = new Crewmember(); crewmember.CrewmemberId = dataReader.Int32Field(CrewMemberId).ToString(); crewmember.PersonalDetail = new PersonalDetail(); crewmember.PersonalDetail.Age = dataReader.Int16NullableField(Age); crewmember.PersonalDetail.AnniversaryDate = dataReader.DateTimeNullableField(AnniversaryDate); crewmember.PersonalDetail.BirthCountryId = dataReader.Int32NullableField(BirthCountryId).ToString(); crewmember.PersonalDetail.Birthdate = dataReader.DateTimeNullableField(BirthDate); crewmember.PersonalDetail.CitizenshipCountryId = dataReader.Int32NullableField(CitizenshipCountryId).ToString(); crewmember.PersonalDetail.FirstName = dataReader.StringField(FirstName); crewmember.PersonalDetail.Gender = dataReader.StringField(Gender); crewmember.PersonalDetail.LastName = dataReader.StringField(LastName); crewmember.PersonalDetail.MaritalStatus = dataReader.StringField(MaritalStatus); crewmember.PersonalDetail.MiddleName = dataReader.StringField(MiddleName); crewmember.PersonalDetail.Nickname = dataReader.StringField(NickName); crewmember.PersonalDetail.Occupation = dataReader.StringField(Occupation); crewmember.PersonalDetail.DocumentNumber = dataReader.StringField(DocumentNumber); crewmember.PersonalDetail.Suffix = dataReader.StringField(Suffix); crewmember.PersonalDetail.Title = dataReader.StringField(Title); crewmember.PersonalDetail.PreferredName = dataReader.StringField(PreferredName); crewmember.BoardingInfo.OnboardDate = dataReader.DateTimeNullableField(OnboardDate); crewmember.BoardingInfo.AshoreDate = dataReader.DateTimeNullableField(AshoreDate); crewmembers.Add(crewmember); } } return crewmembers; }
/// <summary> /// Maps the crew. /// </summary> /// <param name="dataReader">The data reader.</param> /// <returns>Crew member collection</returns> private static async Task<CrewmemberCollection> MapCrew(SqlDataReader dataReader) { var crewmemberCollection = new CrewmemberCollection(); if (dataReader != null) { while (await dataReader.ReadAsync()) { var crew = new Crewmember(); crew.CrewmemberId = dataReader.Int32Field(CrewMemberId).ToString(); crew.CrewmemberTypeId = dataReader.ByteField(CrewMemberTypeId).ToString(); crew.EmployeeNo = dataReader.StringField(EmployeeNo); var hasAlert = dataReader.BooleanNullableField(HasAlert); var hasMessage = dataReader.BooleanNullableField(HasMessage); crew.HasAlert = hasAlert.HasValue ? hasAlert.Value : false; crew.HasMessage = hasMessage.HasValue ? hasMessage.Value : false; crew.Position = dataReader.StringField(Position); crew.LastDateTime = dataReader.DateTimeNullableField(LastDateTime); crew.LastEvent = dataReader.StringField(LastEvent); crew.SafetyNumber = dataReader.StringField(SafetyNumber); crew.SecurityPhotoAddress = dataReader.StringField(SecurityPhotoAddress); crew.Stateroom = dataReader.StringField(Stateroom); crew.StateroomOccupancy = dataReader.ByteField(StateroomOccupancy).ToString(); crew.Department = dataReader.StringField(Department); crew.PortAssignedDate = dataReader.DateTimeNullableField(PortAssignedDate); byte[] bytes = await crew.SecurityPhotoAddress.ImageAddressToByteArray(); crew.Photo = bytes.ToBitmapSource(); crew.AssignPhotoByteArray(new Collection<byte>(bytes)); crewmemberCollection.Add(crew); } } return crewmemberCollection; }
private Person FilledPerson() { var person = new Person(); CrewmemberCollection crewMembers = new CrewmemberCollection(); var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, DocumentNumber = string.Empty, Suffix = string.Empty }; crewMembers.Add(new Crewmember { CrewmemberId = string.Empty, CrewmemberTypeId = "1", SecurityPhotoAddress = string.Empty, ChargeId = string.Empty, EmployeeNo = string.Empty, LastEvent = string.Empty, PersonalDetail = personDetail }); person.AssignCrewmembers(crewMembers); GuestCollection guests = new GuestCollection(); var checkInDetail = new CheckInDetail { ApplicationId = string.Empty, LocationId = "1", LocationTypeId = "1", MachineName = "Machine", Station = "station", UserId = "user" }; var cruiseDetail = new GuestCruiseDetail { BeaconId = string.Empty, CheckInDetail = checkInDetail, LoyaltyLevelTypeId = "1", ReservationId = "1", Stateroom = stateroom, ReservationStatusId = "0000089", StateroomCategoryTypeId = "aaasad" }; var guest = new Guest { GuestId = PersonId, PersonalDetail = personDetail, Age = 0, CruiseDetail = cruiseDetail, SecurityPhotoAddress = string.Empty }; var cruiseDetails = new GuestCruiseDetail { BeaconId = string.Empty, BerthNumber = string.Empty, IdentificationId = string.Empty, LoyaltyLevelTypeId = string.Empty, ReservationId = string.Empty, Stateroom = stateroom }; //// var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, PassportNo = string.Empty, Suffix = string.Empty }; var personBase = new PersonBase { IsOnHold = true, ChargeId = ChargeId, CruiseDetail = cruiseDetails, PersonalDetail = personDetail, LastEvent = string.Empty, PersonId = PersonId, SecurityPhotoAddress = string.Empty, Stateroom = stateroom }; PortDebarkAuthorization pda = new PortDebarkAuthorization { PortId = "1", PersonId = "00001", CanDebarkAlone = true, IsActivePort = true, PortOrder = 1 }; DebarkAuthorizedPersonCollection dapCollection = new DebarkAuthorizedPersonCollection(); dapCollection.Add(new DebarkAuthorizedPerson { PersonTypeId = "2", Person = personBase, PersonId = PersonId, PersonType = PersonType.Guest }); pda.AssignDebarkAuthorizedPersons(dapCollection); PortDebarkAuthorizationCollection portDebarkAuthorizations = new PortDebarkAuthorizationCollection(); portDebarkAuthorizations.Add(pda); guest.AssignPortAuthorizations(portDebarkAuthorizations); guests.Add(guest); person.AssignGuests(guests); return person; }
/// <summary> /// Setups the data. /// </summary> private void SetupData() { Domain.Dependencies.Register(); DataAccess.Dependencies.Register(); this.workstationMock = new Mock<Workstation>(); DIContainer.Instance.RegisterInstance<Workstation>(this.workstationMock.Object); Workstation ws = DIContainer.Instance.Resolve<Workstation>(); ws.Port = new Port { PortId = "1" }; ws.Ship = new Ship { ShipId = "5" }; ws.GangwayLocation = new GangwayLocation { LocationId = "1" }; ws.GangwayServiceBaseAddress = "http://Localhost/"; ws.ConfigurationServiceBaseAddress = "http://Localhost/"; ws.AuthenticationServiceBaseAddress = "http://Localhost/"; ws.AuthorizationServiceBaseAddress = "http://Localhost/"; ws.ConnectionMode = ConnectionMode.Online; var intCollection = new Collection<int>(); intCollection.Add(0); var brand = new Brand { BrandId = "3", Name = "Carnival Breeze", MediaItemAddress = "http://172.26.248.122/ImagingMediaService/MediaItems/23" }; var voyageList = new List<Voyage>(); var voyage = new Voyage { DebarkPortId = "1", EmbarkPortId = "1", DestinationId = "1", MediaItemAddress = "http://172.26.248.122/", VoyageId = "31", Name = "Carnival Voyage", IsActive = true, ShipId = "5", Number = "ccl", DebarkDate = new DateTime(2015, 3, 3), EmbarkDate = new DateTime(2015, 3, 2) }; voyageList.Add(voyage); ws.AssignVoyageList(voyageList); ////this.repository = new Mock<IRepository>(); ////this.embarkationStatisticsRepositoryMock = new Mock<EmbarkationStatisticsRepository>(); this.personServiceRepositoryMock = new Mock<PersonServiceRepository>(); this.referenceDataRepositoryMock = new Mock<ReferenceDataRepository>(); ////this.photoCaptureRepositoryMock = new Mock<PhotoCaptureRepository>(); ////this.shipTimeRepositoryMock = new Mock<ShipTimeRepository>(); ////this.referenceDataRepositoryMock = new Mock<ReferenceDataRepository>(); ////this.gangwayEventRepositoryMock = new Mock<GangwayEventRepository>(); ////this.guestClient = new Mock<IGuestClient>(); ////this.personClient = new Mock<IPersonsClient>(); ////DIContainer.Instance.RegisterInstance<IGuestClient>(this.guestClient.Object); ////DIContainer.Instance.RegisterInstance<IPersonsClient>(this.personClient.Object); ////DIContainer.Instance.RegisterInstance<IRepository>(this.repository.Object); DIContainer.Instance.RegisterInstance<ReferenceDataRepository>(this.referenceDataRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<EmbarkationStatisticsRepository>(this.embarkationStatisticsRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<GangwayEventRepository>(this.gangwayEventRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<PhotoCaptureRepository>(this.photoCaptureRepositoryMock.Object); DIContainer.Instance.RegisterInstance<PersonServiceRepository>(this.personServiceRepositoryMock.Object); ////DIContainer.Instance.RegisterInstance<ShipTimeRepository>(this.shipTimeRepositoryMock.Object); var cruiseDetails = new GuestCruiseDetail { BeaconId = string.Empty, BerthNumber = string.Empty, IdentificationId = string.Empty, LoyaltyLevelTypeId = string.Empty, ReservationId = string.Empty, Stateroom = "0000" }; var personDetail = new PersonalDetail { CitizenshipCountryId = string.Empty, FirstName = string.Empty, LastName = string.Empty, MiddleName = string.Empty, Title = string.Empty, PreferredName = string.Empty, MaritalStatus = string.Empty, Nickname = string.Empty, Occupation = string.Empty, DocumentNumber = string.Empty, Suffix = string.Empty, DocumentTypeId = "1" }; this.person = new Person { TotalResults = 1 }; CrewmemberCollection crewMembers = new CrewmemberCollection(); crewMembers.Add(new Crewmember { CrewmemberId = string.Empty, CrewmemberTypeId = "1", SecurityPhotoAddress = string.Empty, ChargeId = string.Empty, EmployeeNo = string.Empty, LastEvent = string.Empty, PersonalDetail = personDetail }); person.AssignCrewmembers(crewMembers); GuestCollection guests = new GuestCollection(); var checkInDetail = new CheckInDetail { ApplicationId = string.Empty, LocationId = "1", LocationTypeId = "1", MachineName = "Machine", Station = "station", UserId = "user" }; var cruiseDetail = new GuestCruiseDetail { BeaconId = string.Empty, CheckInDetail = checkInDetail, LoyaltyLevelTypeId = "1", ReservationId = "1", Stateroom = "00000", ReservationStatusId = "0000089", StateroomCategoryTypeId = "aaasad" }; guests.Add(new Guest { GuestId = "0001", PersonalDetail = personDetail, Age = 0, CruiseDetail = cruiseDetail, SecurityPhotoAddress = string.Empty, }); VisitorCollection visitors = new VisitorCollection(); visitors.Add(new Visitor { VisitorId = "0003", PersonalDetail = personDetail, SecurityPhotoAddress = string.Empty, }); this.person.AssignGuests(guests); this.person.AssignVisitors(visitors); this.personTypes = new List<PersonType>(); personTypes.Add(PersonType.Guest); this.personServiceRepositoryMock.Setup(data => data.RetrievePersonsBySearchText(It.IsNotNull<string>(), It.IsAny<string>(), It.IsAny<IList<PersonType>>(), It.IsAny<SearchType>(), It.IsAny<string>(), It.IsAny<string>(), 0, 0, It.IsAny<string>(), It.IsAny<string>())).Returns(Task.FromResult(this.person)); var documentTypes = new DocumentTypeCollection(); documentTypes.Add(new DocumentType { CountryId = "232", Code = "USA", DocumentTypeId = "1", Name = "Passport" }); var referencedata = new ReferenceData(); referencedata.AssignDocumentTypes(documentTypes); this.referenceDataRepositoryMock.Setup(data => data.RetrieveReferenceDataAsync()).Returns(Task.FromResult(referencedata)); ////this.personClient.Setup(data => data.RetrievePersonsAsync("5", "ab", null, null, "0001", null, null, "Guest", null, null, null, null, null, 0, 0)).Returns(RetrieveData()); }