コード例 #1
0
        /// <summary>
        /// Maps the visitor embark.
        /// </summary>
        /// <param name="visitorEmbarkStatsCollection">The visitor embark stats collection.</param>
        /// <returns>
        /// returns VisitorEmbarkStats
        /// </returns>
        public static VisitorEmbarkStats MapVisitorEmbarkData(IEnumerable<Entities.VisitorEmbarkStats> visitorEmbarkStatsCollection)
        {
            var visitorEmbark = new VisitorEmbarkStats();
            if (visitorEmbarkStatsCollection != null)
            {
                foreach (var visitorEmbarkations in visitorEmbarkStatsCollection)
                {
                    visitorEmbark.ExpectedToday += visitorEmbarkations.ExpectedToday;
                    visitorEmbark.Onboard += visitorEmbarkations.Onboard;
                    visitorEmbark.Ashore += visitorEmbarkations.Ashore;
                }
            }

            return visitorEmbark;
        }
コード例 #2
0
        /// <summary>
        /// Function to map VisitorEmbarkStats.
        /// </summary>
        /// <param name="dataReader">Instance of SqlDataReader</param>
        /// <returns>Instance of VisitorEmbarkStats</returns>
        private static async Task<VisitorEmbarkStats> MapVisitorEmbarkStatistics(SqlDataReader dataReader)
        {
            var visitorEmbarkStats = new VisitorEmbarkStats();

            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    visitorEmbarkStats = new VisitorEmbarkStats
                    {
                        ExpectedToday = dataReader.Int32Field(ExpectedToday),
                        Onboard = dataReader.Int32Field(Onboard),
                        Ashore = dataReader.Int32Field(Ashore)
                    };
                }
            }

            return visitorEmbarkStats;
        }