private void SetupReferenceData()
        {
            var countries = new Country { CountryId = "1", Name = "USA", Code = "USA" };

            var states = new State { StateId = "2", CountryId = "1", Name = "Florida" };

            var ports = new Port { PortId = "1", City = "Florida", Name = "Miami", State = "Florida", StateId = "2", CountryId = "1" };

            var brands = new Brand { BrandId = "1", Name = "Carnival" };

            var personTypes = new PersonTypeEntity { PersonTypeId = "1001", Name = "Daniel" };

            var loyaltyLevelTypes = new LoyaltyLevelType { LoyaltyLevelTypeId = "1001", Name = "abc", BrandId = "1", NoOfCruiseNights = 3, LogoImageAddress = "abc" };

            var documentType = new DocumentType { CountryId = "232", Code = "USA", DocumentTypeId = "1", Name = "Passport" };

            var brand = new BrandCollection();

            var country = new CountryCollection();
            country.Add(countries);

            var state = new StateCollection();
            state.Add(states);

            var documentTypes = new DocumentTypeCollection();
            documentTypes.Add(documentType);

            var port = new PortCollection();
            port.Add(ports);

            var personTypeEntity = new PersonTypeEntityCollection();
            personTypeEntity.Add(personTypes);

            var loyaltyLevelType = new LoyaltyLevelTypeCollection();
            loyaltyLevelType.Add(loyaltyLevelTypes);

            this.referenceData.AssignBrands(brand);
            this.referenceData.AssignCountries(country);
            this.referenceData.AssignStates(state);
            this.referenceData.AssignDocumentTypes(documentTypes);
            this.referenceData.AssignLoyaltyLevelTypes(loyaltyLevelType);
            this.referenceData.AssignPersonTypes(personTypeEntity);
            this.referenceData.AssignPorts(port);
        }
Ejemplo n.º 2
0
        private void RefreshMenu()
        {
            try
            {
                int organizationID = Int32.Parse(ArenaContext.Current.AppSettings["Organization"]);
                organization = new Arena.Organization.Organization(organizationID);

                // Load the scanner devices and set the default
                this.acquisition = new Acquisition();

                if (this.acquisition.Devices.Count <= 0)
                {
                    MessageBox.Show("There were not any scanners found.  This application requires a scanner.", "No Scanner", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    Application.Exit();
                }

                this.acquisition.AsynchronousException += new AsynchronousExceptionEventHandler(this.acquisition_AsynchronousException);
                this.acquisition.AcquireFinished       += new EventHandler(acquisition_AcquireFinished);
                this.acquisition.ImageAcquired         += new ImageAcquiredEventHandler(acquisition_ImageAcquired);
                this.acquisition.AcquireCanceled       += new EventHandler(acquisition_AcquireCanceled);
                this.acquisition.DeviceEvent           += new DeviceEventHandler(acquisition_DeviceEvent);

                miScanner.DropDownItems.Clear();
                foreach (Device twainDevice in this.acquisition.Devices)
                {
                    ToolStripMenuItem miDevice = new ToolStripMenuItem();
                    miDevice.Text = twainDevice.Identity.ProductName;
                    miDevice.Tag  = twainDevice;
                    miScanner.DropDownItems.Add(miDevice);
                    if (twainDevice.Identity.ProductName == Properties.Settings.Default.DefaultScanner)
                    {
                        this.device      = twainDevice;
                        miDevice.Checked = true;
                    }
                }

                if (this.device == null)
                {
                    this.device = this.acquisition.Devices.Default;
                    foreach (ToolStripItem item in miScanner.DropDownItems)
                    {
                        if (item.Text == this.device.Identity.ProductName)
                        {
                            ((ToolStripMenuItem)item).Checked = true;
                            break;
                        }
                    }
                }

                // Load document types and set default
                miDocumentType.DropDownItems.Clear();

                DocumentTypeCollection docTypes = new DocumentTypeCollection();
                docTypes.LoadByOrganizationID(organizationID);

                int defaultDocType = Properties.Settings.Default.DefaultDocType;
                foreach (AttributeGroup attrGroup in new AttributeGroupCollection(organizationID))
                {
                    foreach (Arena.Core.Attribute attr in attrGroup.Attributes)
                    {
                        if (attr.AttributeType == Arena.Enums.DataType.Document &&
                            attr.TypeQualifier.Trim() != string.Empty)
                        {
                            try
                            {
                                DocumentType docType = new DocumentType(Int32.Parse(attr.TypeQualifier));
                                if (defaultDocType == 0)
                                {
                                    defaultDocType = docType.DocumentTypeId;
                                }

                                ToolStripMenuItem miDocument = new ToolStripMenuItem();
                                miDocument.Text    = docType.TypeName;
                                miDocument.Tag     = new myDocType(docType, attr.AttributeId);
                                miDocument.Checked = (docType.DocumentTypeId == defaultDocType);
                                miDocumentType.DropDownItems.Add(miDocument);
                            }
                            catch { }
                        }
                    }
                }

                for (int i = 0; i < miPageSize.DropDownItems.Count; i++)
                {
                    ((ToolStripMenuItem)miPageSize.DropDownItems[i]).Checked = (i == Properties.Settings.Default.DefaultPageSize);
                }

                for (int i = 0; i < miRotation.DropDownItems.Count; i++)
                {
                    ((ToolStripMenuItem)miRotation.DropDownItems[i]).Checked = (i == Properties.Settings.Default.DefaultRotate);
                }

                UpdateStatus();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void SetUpData()
        {
            Domain.Dependencies.Register();
            DataAccess.Dependencies.Register();

            Workstation ws = DIContainer.Instance.Resolve<Workstation>();

            ws.Port = new Port { PortId = "1" };
            ws.Ship = new Ship { ShipId = "1" };
            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" };
            brand.AssignPortIds(intCollection);
            ws.Brand = brand;

            this.personServiceRepositoryMock = new Mock<PersonServiceRepository>();
            this.referenceDataRepositoryMock = new Mock<ReferenceDataRepository>();
            DIContainer.Instance.RegisterInstance<ReferenceDataRepository>(this.referenceDataRepositoryMock.Object);
            DIContainer.Instance.RegisterInstance<PersonServiceRepository>(this.personServiceRepositoryMock.Object);

            this.personServiceRepositoryMock.Setup(data => data.RetrievePersonsBySearchText(It.IsNotNull<string>(), It.IsAny<string>(), It.IsAny<IList<PersonType>>(), It.IsAny<SearchType>(), null, null, 0, 0, null, null)).Returns(Task.FromResult(this.person));

            this.personTypes = new List<PersonType>();
            personTypes.Add(PersonType.Guest);

            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));
        }
Ejemplo n.º 4
0
        /// <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());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Maps the document types.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>Document types</returns>
        private static async Task<DocumentTypeCollection> MapDocumentTypes(SqlDataReader dataReader)
        {
            var documentTypeCollection = new DocumentTypeCollection();
            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    var documentType = new DocumentType
                    {
                        DocumentTypeId = dataReader.Int16Field(DocumentTypeId).ToString(),
                        Code = dataReader.StringField(Code),
                        Name = dataReader.StringField(Name),
                        CountryId = dataReader.Int32NullableField(CountryId).HasValue ? dataReader.Int32NullableField(CountryId).Value.ToString() : null
                    };

                    documentTypeCollection.Add(documentType);
                }
            }

            return documentTypeCollection;
        }