Exemplo n.º 1
0
 /// <summary>
 /// Assigns the stateroom categories.
 /// </summary>
 /// <param name="stateroomCategoryCollection">The stateroom category collection.</param>
 public void AssignStateroomCategories(StateroomCategoryCollection stateroomCategoryCollection)
 {
     this.stateroomCategories = stateroomCategoryCollection;
 }
        /// <summary>
        /// Retrieves the stateroom categories.
        /// </summary>
        private void RetrieveStateroomCategories()
        {
            var task = Task.Run(async () => await CacheManager.RetrieveStateroomCategories(this.workstation.Ship.ShipId));
            task.Wait();

            if (!task.IsCanceled && !task.IsFaulted)
            {
                this.tempStateroomCategories = task.Result;
            }
        }
        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";
        }
        /// <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;
        }