当前位置: 首页>>代码示例>>C#>>正文


C# List.Iterate方法代码示例

本文整理汇总了C#中Common.List.Iterate方法的典型用法代码示例。如果您正苦于以下问题:C# List.Iterate方法的具体用法?C# List.Iterate怎么用?C# List.Iterate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Common.List的用法示例。


在下文中一共展示了List.Iterate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RetrieveHistoryByPersonStatusAsync

        /// <summary>
        /// Retrieves the history by person status asynchronous.
        /// </summary>
        /// <param name="shipId">The ship identifier.</param>
        /// <param name="voyageIds">The voyage ids.</param>
        /// <param name="statusType">Type of the status.</param>
        /// <param name="personTypeId">The person type identifier.</param>
        /// <param name="startDate">The start date.</param>
        /// <param name="pageNumber">The page number.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <returns>
        /// List Result of person status.
        /// </returns>
        public async Task<ListResult<PersonStatusHistory>> RetrieveHistoryByPersonStatusAsync(string shipId, string voyageIds, string statusType, string personTypeId, string startDate, int? pageNumber, int? pageSize)
        {
            var statusTypeId = RetrieveStatusTypeId(statusType);
            var personIds = string.Empty;
            var personStatus = new List<PersonStatus>();
            var personTypeList = new List<PersonType>();
            personTypeList.Add(personTypeId.RetrievePersonType());
            var personData = new Person();
            long totalResults = 0;

            if (statusType.Equals(ExpectedToday, StringComparison.OrdinalIgnoreCase) && personTypeId == CommonConstants.VisitorTypeId)
            {
                personData = await this.personDataAdaptor.RetrievePersonsBySearchText(shipId, personIds, personTypeList, SearchType.VisitorExpectedToday, pageNumber: pageNumber, maxResults: pageSize, folioNumber: null);
                return PersonStatusHistoryMapper.MapPersonInformation(personData, personTypeId, personStatus);
            }
            else if (statusType.Equals(LeavingToday, StringComparison.OrdinalIgnoreCase) && personTypeId == CommonConstants.GuestTypeId)
            {
                var dbCommand = this.Database.GetStoredProcCommand(RetrieveGuestDashboardStatisticsDetail)
                .AddParameter(StatsDate, DbType.DateTime, startDate)
                .AddParameter(ShipId, DbType.String, shipId)
               .AddParameter(PageNumber, DbType.Int32, pageNumber != null && pageNumber.Value != default(int) ? pageNumber : OfflineConstants.DefaultPageNumber)
               .AddParameter(PageSize, DbType.Int32, pageSize != null && pageSize.Value != default(int) ? pageSize : OfflineConstants.DefaultPageSize)
               .AddParameter(RecordCount, ParameterDirection.Output, DbType.Int64, 0);

                if (!string.IsNullOrWhiteSpace(voyageIds))
                {
                    dbCommand.AddParameter(VoyageIDs, DbType.String, voyageIds);
                }

                personIds = await this.ExecuteReaderAsync(dbCommand, PersonStatusHistoryMapper.MapPersonIds);
                totalResults = RetrieveRecordCountValue(dbCommand);
            }
            else
            {
                var command = this.Database.GetStoredProcCommand(RetrieveDashboardStatisticsDetail)
                   .AddParameter(StatisticsType, DbType.Int16, Convert.ToInt16(statusTypeId))
                .AddParameter(PersonTypeID, DbType.Byte, personTypeId)
                .AddParameter(StatsDate, DbType.DateTime, startDate)
                .AddParameter(ShipId, DbType.String, shipId)
               .AddParameter(PageNumber, DbType.Int32, pageNumber != null && pageNumber.Value != default(int) ? pageNumber : OfflineConstants.DefaultPageNumber)
               .AddParameter(PageSize, DbType.Int32, pageSize != null && pageSize.Value != default(int) ? pageSize : OfflineConstants.DefaultPageSize)
               .AddParameter(RecordCount, ParameterDirection.Output, DbType.Int64, 0);

                if (!string.IsNullOrWhiteSpace(voyageIds))
                {
                    command.AddParameter(VoyageIDs, DbType.String, voyageIds);
                }

                personStatus = await this.ExecuteReaderAsync(command, PersonStatusHistoryMapper.MapPersonStatus);
                personStatus.Iterate(a => { personIds = string.Concat(personIds, a.PersonId, CommaSeparator); });
                totalResults = RetrieveRecordCountValue(command);
            }

            personData = await this.personDataAdaptor.RetrievePersonsBySearchText(shipId, personIds, personTypeList, SearchType.PersonId, pageNumber: OfflineConstants.DefaultPageNumber, maxResults: pageSize, personId: personIds, folioNumber: null);

            var personHistoryList = PersonStatusHistoryMapper.MapPersonInformation(personData, personTypeId, personStatus);
            personHistoryList.TotalResults = totalResults;
            return personHistoryList;
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:72,代码来源:EmbarkationStatisticsDataAdaptor.cs


注:本文中的Common.List.Iterate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。