コード例 #1
0
        private void SetupShipInfoData()
        {
            var location = new GangwayLocation { LocationId = "1", LocationTypeId = "123" };

            var voyage = new Voyage { DebarkPortId = "2", DestinationId = "1", IsActive = true, EmbarkPortId = "2", Name = "Demo", ShipId = "5", Nights = 2 };

            var stateroomCategory = new StateroomCategory { StateroomCategoryId = "1", Category = "123", MediaItemAddress = "http://172.26.248.122/ImagingMediaService/MediaItems/23", StateroomCategoryType = "EDE", StateroomCategoryTypeId = "2" };

            var locations = new Collection<GangwayLocation>();
            locations.Add(location);

            var voyages = new Collection<Voyage>();
            voyages.Add(voyage);

            var stateroomCategories = new StateroomCategoryCollection();
            stateroomCategories.Add(stateroomCategory);

            this.shipInfo.AssignGangwayLocations(locations);
            this.shipInfo.AssignStateroomCategories(stateroomCategories);
            this.shipInfo.AssignVoyageCollection(voyages);
            this.shipInfo.ShipId = "5";
        }
コード例 #2
0
        /// <summary>
        /// Maps the stateroom categories.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>The collection of stateroom category</returns>
        private static async Task<StateroomCategoryCollection> MapStateroomCategories(SqlDataReader dataReader)
        {
            var stateroomCategories = new StateroomCategoryCollection();
            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    var stateroomCategory = new StateroomCategory
                    {
                        StateroomCategoryTypeId = dataReader.Int16Field(StateroomCategoryTypeId).ToString(),
                        StateroomCategoryType = dataReader.StringField(StateroomCategoryType),
                        MediaItemAddress = dataReader.StringField(MediaItemAddress),
                        Category = dataReader.StringField(Category)
                    };

                    byte[] bytes = await stateroomCategory.MediaItemAddress.ImageAddressToByteArray();
                    stateroomCategory.StateroomIcon = bytes.ToBitmapSource();
                    stateroomCategories.Add(stateroomCategory);
                }
            }

            return stateroomCategories;
        }