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


C# ListResult.AssignItems方法代码示例

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


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

示例1: SetPagedRecordsForAlert

        /// <summary>
        /// Sets the paged records for alert.
        /// </summary>
        /// <param name="presenter">The presenter.</param>
        /// <param name="alerts">The alerts.</param>
        private void SetPagedRecordsForAlert(PassengerPresenter presenter, ListResult<Alert> alerts)
        {
            var visitorAlerts = alerts.Items.Where(alert => !alert.IsMessage).ToList();
            var visitorAlertsResult = new ListResult<Alert>();
            visitorAlertsResult.AssignItems(visitorAlerts);
            SessionData.Instance.AssignAlertSearchResult(visitorAlertsResult);
            this.ExtractAlertPagedRecords(presenter);

            var visitorMessages = alerts.Items.Where(alert => alert.IsMessage).ToList();
            var visitorMessagesResult = new ListResult<Alert>();
            visitorMessagesResult.AssignItems(visitorMessages);
            SessionData.Instance.AssignMessageSearchResult(visitorMessagesResult);
            this.ExtractMessagePagedRecords(presenter);
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:19,代码来源:PassengerController.cs

示例2: MapAlertDataListFromService

        /// <summary>
        /// Maps the alert data from database.
        /// </summary>
        /// <param name="alertData">The alert data.</param>
        /// <returns>
        /// Alert type list
        /// </returns>
        private static ListResult<Entities.AlertType> MapAlertDataListFromService(ListResult<Entities.PersonNotification.Alert> alertData)
        {
            var result = new ListResult<Entities.AlertType>();
            var alerts = new AlertTypeCollection();

            foreach (var alert in alertData.Items)
            {
                Entities.AlertType alertTypeData = new Entities.AlertType();

                alertTypeData.AlertTypeId = alert.AlertId;
                alertTypeData.AddedBy = alert.AddedBy;
                alertTypeData.AddedDate = alert.AddedDate;
                alertTypeData.Description = alert.Description;
                alertTypeData.DueDate = alert.DueDate;
                alertTypeData.ExpiryDate = alert.ExpiryDate;
                alertTypeData.IsOverride = alert.IsOverride;
                alertTypeData.IsSoundEnable = alert.IsSoundEnable;
                alertTypeData.ModifiedBy = alert.LastModifiedBy;
                alertTypeData.IsMessage = false;
                alertTypeData.IsTemplate = false;
                alertTypeData.DepartmentId = alert.DepartmentId;

                foreach (var applicationIds in alert.AlertTargetApplications)
                {
                    alertTypeData.ApplicationId = applicationIds.ApplicationId;
                }

                alertTypeData.TypeId = alert.AlertTypeId;

                foreach (var personAlerts in alert.PersonAlerts)
                {
                    Entities.Alert personAlert = new Entities.Alert();

                    personAlert.PersonId = personAlerts.PersonId;
                    personAlert.PersonTypeId = personAlerts.PersonTypeId;
                    personAlert.ShipId = personAlerts.ShipId;
                    personAlert.VoyageId = personAlerts.VoyageId;
                    personAlert.StatusId = personAlerts.StatusId;
                    personAlert.AlertTypeId = personAlerts.AlertId;
                    personAlert.PersonAlertId = personAlerts.PersonAlertId;

                    alertTypeData.Alerts.Add(personAlert);
                }

                alerts.Add(alertTypeData);
            }

            result.AssignItems(alerts);

            return result;
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:58,代码来源:AlertClientRepository.cs

示例3: MapMessageTemplateDataListFromService

        /// <summary>
        /// Maps the alert template data from service.
        /// </summary>
        /// <param name="messageTemplateResults">The message template results.</param>
        /// <returns>
        /// Message template data
        /// </returns>
        private static ListResult<Entities.AlertType> MapMessageTemplateDataListFromService(ListResult<MessageTemplate> messageTemplateResults)
        {
            var result = new ListResult<Entities.AlertType>();
            var messageTemplate = new AlertTypeCollection();

            foreach (var message in messageTemplateResults.Items)
            {
                var messageTempalteData = new Entities.AlertType();

                messageTempalteData.Description = message.Description;
                messageTempalteData.ModifiedBy = message.LastModifiedBy;
                messageTempalteData.AlertTypeId = message.MessageTemplateId;
                messageTempalteData.IsTemplate = true;
                messageTempalteData.IsMessage = true;

                messageTemplate.Add(messageTempalteData);
            }

            result.AssignItems(messageTemplate);

            return result;
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:29,代码来源:AlertClientRepository.cs

示例4: MapPerson


//.........这里部分代码省略.........
            if (dataReader != null)
            {
                ////Map Crew
                person.AssignCrewmembers(await MapCrew(dataReader));

                ////Map Crew Personal Detail
                await dataReader.NextResultAsync();
                var crewPersonDetailList = await RetrieveCrewmemberPersonalDetail(dataReader);

                ////map access card
                await dataReader.NextResultAsync();
                var crewAccessCards = await AccessCardMapper.MapCrewAccessCards(dataReader);

                ////Map Crew Alerts
                await dataReader.NextResultAsync();
                var alerts = await AlertsAndMessageMapper.MapCrewAlerts(dataReader);

                await dataReader.NextResultAsync();
                var alertMessages = await AlertsAndMessageMapper.MapMessagesDescription(dataReader);

                await dataReader.NextResultAsync();
                var messages = await AlertsAndMessageMapper.MapCrewMessages(dataReader);

                await dataReader.NextResultAsync();
                var messageDescription = await AlertsAndMessageMapper.MapMessagesDescription(dataReader);

                MapCrewDetail(person, crewPersonDetailList, alerts, alertMessages, messages, messageDescription, crewAccessCards);

                ////Map Visitor
                await dataReader.NextResultAsync();
                person.AssignVisitors(await MapVisitors(dataReader));

                ////Map Visitor Personal Detail
                await dataReader.NextResultAsync();
                var visitorPersonalDetailList = await RetrieveVisitorPersonalDetail(dataReader);

                ////Map Visitor access card
                await dataReader.NextResultAsync();
                var visitorAccessCards = await AccessCardMapper.MapVisitorAccessCards(dataReader);

                ////Map Visitor Alerts
                await dataReader.NextResultAsync();
                var visitorAlerts = await AlertsAndMessageMapper.MapVisitorAlerts(dataReader);

                await dataReader.NextResultAsync();
                var visitorAlertMessages = await AlertsAndMessageMapper.MapMessagesDescription(dataReader);

                await dataReader.NextResultAsync();
                var visitorMessages = await AlertsAndMessageMapper.MapVisitorMessages(dataReader);

                await dataReader.NextResultAsync();
                var visitorMessagesDescription = await AlertsAndMessageMapper.MapMessagesDescription(dataReader);

                MapVisitorDetail(person, visitorPersonalDetailList, visitorAlerts, visitorAlertMessages, visitorMessages, visitorMessagesDescription, visitorAccessCards);

                ////Map Guest
                await dataReader.NextResultAsync();
                person.AssignGuests(await MapGuests(dataReader));

                ////Map Guest Personal Detail
                await dataReader.NextResultAsync();
                var guestPersonDetailList = await RetrieveGuestPersonalDetail(dataReader);

                ////Map Guest Cruise Detail
                await dataReader.NextResultAsync();
                var guestReservationDetailList = await RetrieveGuestReservationDetail(dataReader);

                ////Map Guest Alerts
                await dataReader.NextResultAsync();
                var guestAlerts = await AlertsAndMessageMapper.MapGuestAlerts(dataReader);

                await dataReader.NextResultAsync();
                var guestAlertMessages = await AlertsAndMessageMapper.MapMessagesDescription(dataReader);

                await dataReader.NextResultAsync();
                var guestMessages = await AlertsAndMessageMapper.MapGuestMessages(dataReader);

                await dataReader.NextResultAsync();
                var guestMessagesDescription = await AlertsAndMessageMapper.MapMessagesDescription(dataReader);

                // Map folio data.
                await dataReader.NextResultAsync();
                var folioList = await RetrieveFolios(dataReader);

                MapGuestDetail(person, guestPersonDetailList, guestReservationDetailList, guestAlerts, guestAlertMessages, guestMessages, guestMessagesDescription, folioList);

                ////map total results
                await dataReader.NextResultAsync();
                await MapTotalResults(dataReader, person);

                if (!dataReader.IsClosed)
                {
                    dataReader.Close();
                }
            }

            personCollection.Add(person);
            persons.AssignItems(personCollection);
            return await Task.FromResult(persons);
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:101,代码来源:PersonDataMapper.cs

示例5: AddPassenger

        /// <summary>
        /// Adds the passenger.
        /// </summary>
        /// <param name="presenter">The alert presenter.</param>
        /// <param name="personId">The person ids.</param>
        /// <returns>
        /// The JSON Result
        /// </returns>
        public ActionResult AddPassenger(AlertPresenter presenter, string personId)
        {
            var alertPresenter = new AlertPresenter();
            if (presenter != null)
            {
                alertPresenter = presenter;
            }

            if (!string.IsNullOrEmpty(personId))
            {
                var filteredPersonList = new List<Person>();
                var personSearchResult = new ListResult<Person>();
                if (!SessionData.Instance.SelectedPersonIds.Contains(personId))
                {
                    SessionData.Instance.SelectedPersonIds.Add(personId);
                }

                if (SessionData.Instance.PassengerAutoSearchItems != null && SessionData.Instance.PassengerAutoSearchItems.Items.Count > 0)
                {
                    filteredPersonList.Add(SessionData.Instance.PassengerAutoSearchItems.Items.FirstOrDefault(person => person.PersonId.Equals(personId)));
                }

                if (filteredPersonList.Count > 0)
                {
                    if (SessionData.Instance.FilterPersonList != null && SessionData.Instance.FilterPersonList.Count > 0)
                    {
                        foreach (var person in SessionData.Instance.FilterPersonList.Where(person => !person.PersonId.Equals(personId)))
                        {
                            filteredPersonList.Add(person);
                        }
                    }

                    personSearchResult.AssignItems(filteredPersonList);
                    alertPresenter.AssignPersonSearchResult(personSearchResult);
                    SessionData.Instance.AssignFilterPersonResult(filteredPersonList);
                }

                return this.PartialView(AlertPassengerListPartialView, alertPresenter);
            }

            return this.View();
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:50,代码来源:AlertController.cs

示例6: RetrieveCrewLists

        /// <summary>
        /// Retrieves the crew lists.
        /// </summary>
        /// <param name="personSearchParameter">The person search parameter.</param>
        /// <param name="isAlertCount">if set to <c>true</c> [is alert count].</param>
        /// <param name="crewIds">The crew ids.</param>
        /// <returns>The Crew list.</returns>
        private async Task<ListResult<Person>> RetrieveCrewLists(PersonSearchParameter personSearchParameter, bool isAlertCount, List<string> crewIds)
        {
            ListResult<Person> personList = new ListResult<Person>();
            if (crewIds.Count == 0 || !string.IsNullOrWhiteSpace(personSearchParameter.Birthdate) || !string.IsNullOrWhiteSpace(personSearchParameter.ReservationNo))
            {
                return personList;
            }

            ListResult<Stateroom> staterooms = new ListResult<Stateroom>();
            var crews = await this.crewClientRepository.RetrieveCrewmembersList(crewIds.RetrieveIds(id => id), personSearchParameter.LastNameContains, null, personSearchParameter.Citizenship, personSearchParameter.PassportNo, 1, int.MaxValue, CrewDepths.Crew);
            if (string.IsNullOrWhiteSpace(personSearchParameter.Stateroom))
            {
                var crewStateroomIds = crews.Items.RetrieveIds(a => a.StateroomId);
                if (!string.IsNullOrWhiteSpace(crewStateroomIds))
                {
                    staterooms = await this.RetrieveStaterooms(crewStateroomIds.TrimEnd(','), null);
                }
            }

            PersonMapper.MapPersonsByCrews(crews, staterooms, personList);
            var alerts = await this.RetrievePersonAlerts(personSearchParameter, personList.Items.RetrieveIds(p => p.PersonId));
            PersonMapper.MapPersonAlerts(alerts, personList);
            personList.AssignItems(personList.Items.Where(item => isAlertCount ? item.AlertCount > 0 : item.MessageCount > 0).ToList());
            personList.TotalResults = personList.Items.Count;
            personList.CrewTotalResults = personList.Items.Count;
            return personList;
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:34,代码来源:PersonAlertData.cs

示例7: RetrievePersonAlerts

        /// <summary>
        /// Retrieves the person alerts.
        /// </summary>
        /// <param name="personSearchParameter">The person search parameter.</param>
        /// <param name="personIds">The person ids.</param>
        /// <returns>
        /// The alerts.
        /// </returns>
        private async Task<ListResult<Entities.AlertType>> RetrievePersonAlerts(PersonSearchParameter personSearchParameter, string personIds)
        {
            var isMessage = false;
            var isAlert = false;

            if (personSearchParameter.IsMessageCount != null && Convert.ToBoolean(personSearchParameter.IsMessageCount, CultureInfo.CurrentCulture))
            {
                isMessage = true;
            }

            if (personSearchParameter.IsAlertCount != null && Convert.ToBoolean(personSearchParameter.IsAlertCount, CultureInfo.CurrentCulture))
            {
                isAlert = true;
            }

            var alertSearchParameter = new AlertListRequestSearchParameters
            {
                ApplicationId = Convert.ToString(this.applicationSettings.ApplicationId, CultureInfo.CurrentCulture),
                PersonIds = personIds,
                IsMessage = isMessage,
                IsAlert = isAlert,
                IsExpiredAlert = false
            };
            if (string.IsNullOrWhiteSpace(personSearchParameter.ShipTime))
            {
                var shipTimeTask = await this.shipTimeRepository.GetByIdAsync(this.applicationSettings.ShipId, null);
                alertSearchParameter.ShipTime = string.IsNullOrWhiteSpace(shipTimeTask) ? DateTime.Now : DateTime.UtcNow.AddMinutes(Convert.ToDouble(shipTimeTask));
            }
            else
            {
                alertSearchParameter.ShipTime = DateTime.Parse(personSearchParameter.ShipTime, CultureInfo.InvariantCulture);
            }

            var result = new ListResult<Entities.AlertType>();
            var alertTemplate = new Entities.AlertTypeCollection();
            var alertDetails = await this.RetrieveAlertDetails(alertSearchParameter);

            foreach (var alert in alertDetails.Items)
            {
                if ((alert.ExpiryDate.HasValue && alert.ExpiryDate.Value > alertSearchParameter.ShipTime) || !alert.ExpiryDate.HasValue)
                {
                    var active = alert.Alerts.Any(personAlert => personAlert.StatusId == "1");
                    if (active)
                    {
                        alertTemplate.Add(alert);
                    }
                }
            }

            result.AssignItems(alertTemplate);
            return result;
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:60,代码来源:PersonAlertData.cs

示例8: ResetMessagePassengersTest

        public void ResetMessagePassengersTest()
        {
            try
            {
                SessionData.Instance.User = CommonHelper.SetupUserData();
                var messagePresenter = new MessagePresenter();
                string templateValue = string.Empty;
                Alert alertDetailResult = SetUpAlertData();
                alertDetailResult.Persons = new PersonCollection { new Person { PersonId = "1228", PersonTypeId = "3", PersonalDetail = new PersonalDetail { FirstName = "R", LastName = "Della", DepartmentId = string.Empty, CitizenshipCountryId = "102", Gender = "M", Title = "Mr." } } };

                if (alertDetailResult.Persons.Count > 0 && string.IsNullOrEmpty(templateValue))
                {
                    var personList = new ListResult<Person>();
                    personList.AssignItems(alertDetailResult.Persons);

                    messagePresenter.AssignPersonSearchResult(personList);

                    foreach (var person in alertDetailResult.Persons)
                    {
                        SessionData.Instance.SelectedPersonIds.Add(person.PersonId);
                    }

                    SessionData.Instance.AssignFilterPersonResult(alertDetailResult.Persons);
                }

                this.messageController.ResetPassengers(new MessagePresenter());
                Assert.IsTrue(true);
            }
            finally
            {
                this.Dispose();
            }
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:33,代码来源:MessageControllerTests.cs

示例9: CreatedMessageListTest

        public async Task CreatedMessageListTest()
        {
            SessionData.Instance.User = CommonHelper.SetupUserData();
            var messagePresenter = SetUpMessagePresenter();
            var alertItem = new List<Alert>();
            alertItem.Add(new Alert { AddedDate = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture) });
            var alertItemList = new ListResult<Alert>();
            alertItemList.AssignItems(new List<Alert>());
            this.alertManager.Setup(mockItem => mockItem.AlertTypeAsync(It.IsNotNull<string>(), It.IsNotNull<bool>(), It.IsNotNull<bool>(), It.IsNotNull<bool>(), It.IsNotNull<string>(), It.IsNotNull<bool>(), It.IsAny<string>())).Returns(Task.FromResult(alertItemList));
            var result = await this.messageController.CreatedMessageList(messagePresenter);
            Assert.IsNotNull(result);

            alertItemList.AssignItems(alertItem);
            this.alertManager.Setup(mockItem => mockItem.AlertTypeAsync(It.IsNotNull<string>(), It.IsNotNull<bool>(), It.IsNotNull<bool>(), It.IsNotNull<bool>(), It.IsNotNull<string>(), It.IsNotNull<bool>(), It.IsAny<string>())).Returns(Task.FromResult(alertItemList));
            result = await this.messageController.CreatedMessageList(messagePresenter);
            Assert.IsNotNull(result);
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:17,代码来源:MessageControllerTests.cs

示例10: MessageControllerIndexTest

 public async Task MessageControllerIndexTest()
 {
     try
     {
         SessionData.Instance.User = CommonHelper.SetupUserData();
         MessagePresenter messagePresenter = SetUpMessagePresenter();
         var alertList = new ListResult<Alert>();
         alertList.AssignItems(new List<Alert> { SetUpAlertData() });
         this.alertManager.Setup(mockItem => mockItem.AlertTypeAsync(It.IsNotNull<string>(), It.IsNotNull<bool>(), It.IsNotNull<bool>(), It.IsNotNull<bool>(), It.IsNotNull<string>(), It.IsNotNull<bool>(), It.IsAny<string>())).Returns(Task.FromResult(alertList));
         var result = await this.messageController.Index(messagePresenter) as ViewResult;
         Assert.IsTrue(true);
     }
     finally
     {
         this.Dispose();
     }
 }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:17,代码来源:MessageControllerTests.cs

示例11: MessageDeletePassengerTest

        public void MessageDeletePassengerTest()
        {
            try
            {
                SessionData.Instance.User = CommonHelper.SetupUserData();
                MessagePresenter messagePresenter = SetUpMessagePresenter();
                string templateValue = null;
                string alertId = "2";
                Alert alertDetailResult = SetUpAlertData();
                alertDetailResult.Persons = new PersonCollection { new Person { PersonId = "1228", PersonTypeId = "3", PersonalDetail = new PersonalDetail { FirstName = "R", LastName = "Della", DepartmentId = string.Empty, CitizenshipCountryId = "102", Gender = "M", Title = "Mr." } } };
                messagePresenter.SelectedAlertTypes = Convert.ToString(alertDetailResult.TypeId, CultureInfo.InvariantCulture);
                messagePresenter.UserName = alertDetailResult.UserName;
                messagePresenter.StartDate = alertDetailResult.StartDate.ToString("MM-dd-yyyy HH':'mm':'ss", CultureInfo.InvariantCulture);
                messagePresenter.ExpiryDate = alertDetailResult.ExpiryDate.Value.ToString("MM-dd-yyyy HH':'mm':'ss", CultureInfo.InvariantCulture);
                messagePresenter.PersonCount = alertDetailResult.PersonCount;
                messagePresenter.IsOverrideAllowed = alertDetailResult.IsOverride;
                messagePresenter.IsSoundEnable = alertDetailResult.IsSoundEnable;
                SessionData.Instance.ActiveAlertId = alertId;
                SessionData.Instance.AssignAlertData(alertDetailResult);
                if (alertDetailResult.Persons.Count > 0 && string.IsNullOrEmpty(templateValue))
                {
                    var personList = new ListResult<Person>();
                    personList.AssignItems(alertDetailResult.Persons);

                    messagePresenter.AssignPersonSearchResult(personList);

                    foreach (var person in alertDetailResult.Persons)
                    {
                        SessionData.Instance.SelectedPersonIds.Add(person.PersonId);
                    }

                    SessionData.Instance.AssignFilterPersonResult(alertDetailResult.Persons);
                }

                var result = this.messageController.MessageDeletePassenger(new MessagePresenter(), "1228", "SetData") as JsonResult;
                Assert.IsTrue(result.Data.Equals(true));
                Assert.IsTrue(true);
            }
            finally
            {
                this.Dispose();
            }
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:43,代码来源:MessageControllerTests.cs

示例12: PagingTest

        public void PagingTest()
        {
            var persons = SetUpPersonData();
            var personList = persons.Items.ToList();
            SessionData.Instance.AssignFilterPersonResult(personList);
            this.personManager.Setup(mockItem => mockItem.GetPersonsAsync(It.IsNotNull<SearchFilters>(), It.IsAny<string>())).Returns(Task.FromResult(persons));
            var pagingResult = this.alertController.Paging(new AlertPresenter(), "1", AlertPassengerListPartialView) as PartialViewResult;
            Assert.AreEqual(pagingResult.ViewName, AlertPassengerListPartialView);

            this.personManager.Setup(mockItem => mockItem.GetPersonsAsync(It.IsNotNull<SearchFilters>(), It.IsAny<string>())).Returns(Task.FromResult(persons));
            pagingResult = this.alertController.Paging(new AlertPresenter(), "0", string.Empty) as PartialViewResult;
            Assert.AreEqual(pagingResult.ViewName, AlertListPartialView);

            var alertResult = new ListResult<Alert>();
            var alertList = new List<Alert>();
            alertList.Add(new Alert());
            alertList.Add(new Alert());
            alertList.Add(new Alert());
            alertResult.AssignItems(alertList);

            SessionData.Instance.AssignAlertSearchResult(alertResult);
            this.personManager.Setup(mockItem => mockItem.GetPersonsAsync(It.IsNotNull<SearchFilters>(), It.IsAny<string>())).Returns(Task.FromResult(persons));
            pagingResult = this.alertController.Paging(new AlertPresenter(), "0", string.Empty) as PartialViewResult;
            Assert.AreEqual(pagingResult.ViewName, AlertListPartialView);

            this.personManager.Setup(mockItem => mockItem.GetPersonsAsync(It.IsNotNull<SearchFilters>(), It.IsAny<string>())).Returns(Task.FromResult(persons));
            pagingResult = this.alertController.Paging(new AlertPresenter(), "0", AlertTemplateListPartialView) as PartialViewResult;
            Assert.AreEqual(pagingResult.ViewName, AlertTemplateListPartialView);
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:29,代码来源:AlertControllerTests.cs

示例13: AlertControllerIndexTest

 public async Task AlertControllerIndexTest()
 {
     try
     {
         SessionData.Instance.User = CommonHelper.SetupUserData();
         var alertPresenter = SetUpAlertPresenter();
         var alertItem = new List<Alert>();
         alertItem.Add(new Alert { AddedDate = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture) });
         var alertItemList = new ListResult<Alert>();
         alertItemList.AssignItems(alertItem);
         this.alertManager.Setup(mockItem => mockItem.AlertTypeAsync(It.IsNotNull<string>(), It.IsNotNull<bool>(), It.IsNotNull<bool>(), It.IsNotNull<bool>(), It.IsNotNull<string>(), It.IsNotNull<bool>(), It.IsNotNull<string>())).Returns(Task.FromResult(alertItemList));
         var result = await this.alertController.Index(alertPresenter) as ViewResult;
         Assert.IsTrue(true);
     }
     finally
     {
         this.Dispose();
     }
 }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:19,代码来源:AlertControllerTests.cs

示例14: MapGangwayHistory

        /// <summary>
        /// Maps the gangway history.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>List result of Gangway History</returns>
        internal static async Task<ListResult<GangwayHistory>> MapGangwayHistory(SqlDataReader dataReader)
        {
            var historyList = new ListResult<GangwayHistory>();
            var gangwayHistoryCollection = new Collection<GangwayHistory>();

            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    gangwayHistoryCollection.Add(MapHistory(dataReader));
                }

                if (!dataReader.IsClosed)
                {
                    dataReader.Close();
                }
            }

            historyList.AssignItems(gangwayHistoryCollection);
            return await Task.FromResult(historyList);
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:26,代码来源:GangwayHistoryMapper.cs

示例15: RetrieveListAsync

        /// <summary>
        /// Retrieves the person list asynchronous.
        /// </summary>
        /// <param name="personSearchParameter">The person search parameter.</param>
        /// <returns>
        /// Return person list
        /// </returns>
        public async Task<ListResult<Person>> RetrieveListAsync(PersonSearchParameter personSearchParameter)
        {
            bool isAlertCount = false;
            if ((string.IsNullOrEmpty(personSearchParameter.IsAlertCount) && string.IsNullOrEmpty(personSearchParameter.IsMessageCount)) || (!string.IsNullOrEmpty(personSearchParameter.IsAlertCount) && Convert.ToBoolean(personSearchParameter.IsAlertCount, CultureInfo.InvariantCulture)))
            {
                isAlertCount = true;
            }

            var personList = new ListResult<Person>();
            var stateroomId = string.Empty;
            var staterooms = new ListResult<Stateroom>();

            if (!string.IsNullOrWhiteSpace(personSearchParameter.Stateroom) && (string.IsNullOrEmpty(personSearchParameter.PersonTypeId) || !personSearchParameter.PersonTypeId.Equals("3")))
            {
                staterooms = await this.shipRepository.GetStateroomListAsync(this.applicationSettings.ShipId, null, personSearchParameter.Stateroom, null, null);
                stateroomId = PersonMapper.MapStateroomId(personSearchParameter.Stateroom, staterooms).StateroomId;
                if (string.IsNullOrEmpty(stateroomId))
                {
                    return personList;
                }

                if (string.IsNullOrEmpty(personSearchParameter.PersonTypeId) || (!string.IsNullOrEmpty(personSearchParameter.PersonTypeId) && string.Equals(personSearchParameter.PersonTypeId, "2")))
                {
                    var guests = await this.guestRepository.RetrieveGuests(null, stateroomId, personSearchParameter.VoyageId, null, null, personSearchParameter.Citizenship, null, 1, int.MaxValue);
                    PersonMapper.MapPersonsByGuests(guests, staterooms, personList);
                    var alerts = await this.RetrievePersonAlerts(personSearchParameter, personList.Items.RetrieveIds(p => p.PersonId));
                    PersonMapper.MapPersonAlerts(alerts, personList);
                    personList.AssignItems(personList.Items.Where(item => isAlertCount ? item.AlertCount > 0 : item.MessageCount > 0).ToList());
                    personList.TotalResults = personList.Items.Count;
                    personList.GuestTotalResults = personList.TotalResults;
                }
                else if (string.Equals(personSearchParameter.PersonTypeId, "1") || (string.IsNullOrEmpty(personSearchParameter.PersonTypeId) && personList.Items.Count == 0))
                {
                    var crews = await this.crewClientRepository.RetrieveCrewmembersList(null, null, stateroomId, null, null, 1, int.MaxValue, CrewDepths.Crew);
                    PersonMapper.MapPersonsByCrews(crews, staterooms, personList);
                    var alerts = await this.RetrievePersonAlerts(personSearchParameter, personList.Items.RetrieveIds(p => p.PersonId));
                    PersonMapper.MapPersonAlerts(alerts, personList);
                    personList.AssignItems(personList.Items.Where(item => isAlertCount ? item.AlertCount > 0 : item.MessageCount > 0).ToList());
                    personList.TotalResults = personList.Items.Count;
                    personList.CrewTotalResults = personList.TotalResults;
                }

                return personList;
            }

            List<string> guestIds = new List<string>(), crewIds = new List<string>(), visitorIds = new List<string>();
            string personVoyageId = null;
            if (!string.IsNullOrEmpty(personSearchParameter.PersonTypeId) && personSearchParameter.PersonTypeId.Equals("2") && (!personSearchParameter.IsAll.HasValue || !personSearchParameter.IsAll.Value))
            {
                personVoyageId = personSearchParameter.VoyageId;
            }

            if (isAlertCount)
            {
                var personAlerts = await this.alertClientRepository.ListPersonAlertsAsync(personSearchParameter.IsAll.GetValueOrDefault(false) ? null : personSearchParameter.PersonTypeId, null, "1", this.applicationSettings.ShipId, personVoyageId, Parts);
                guestIds = personAlerts.Items.Where(item => item.PersonTypeId == "2").Select(item => item.PersonId).Distinct().ToList();
                crewIds = personAlerts.Items.Where(item => item.PersonTypeId == "1").Select(item => item.PersonId).Distinct().ToList();
                visitorIds = personAlerts.Items.Where(item => item.PersonTypeId == "3").Select(item => item.PersonId).Distinct().ToList();
            }
            else
            {
                var personMessages = await this.alertClientRepository.ListPersonMessagesAsync(personSearchParameter.IsAll.GetValueOrDefault(false) ? null : personSearchParameter.PersonTypeId, null, "1", this.applicationSettings.ShipId, personVoyageId, Parts);
                guestIds = personMessages.Items.Where(item => item.PersonTypeId == "2").Select(item => item.PersonId).Distinct().ToList();
                crewIds = personMessages.Items.Where(item => item.PersonTypeId == "1").Select(item => item.PersonId).Distinct().ToList();
                visitorIds = personMessages.Items.Where(item => item.PersonTypeId == "3").Select(item => item.PersonId).Distinct().ToList();
            }

            if (string.IsNullOrEmpty(personSearchParameter.PersonTypeId) || string.Equals(personSearchParameter.PersonTypeId, "2"))
            {
                personList = await this.RetrieveGuestsList(personSearchParameter, isAlertCount, guestIds);
                if (personSearchParameter.IsAll.HasValue && personSearchParameter.IsAll.Value)
                {
                    var crewResults = await this.RetrieveCrewLists(personSearchParameter, isAlertCount, crewIds);
                    personList.CrewTotalResults = crewResults.Items.Count;
                    if (string.IsNullOrEmpty(personSearchParameter.PersonTypeId) && personList.Items.Count == 0)
                    {
                        personList = crewResults;
                    }

                    var visitorResults = await this.RetrieveVisitorLists(personSearchParameter, visitorIds, isAlertCount);
                    personList.VisitorTotalResults = visitorResults.Items.Count;
                    if (string.IsNullOrEmpty(personSearchParameter.PersonTypeId) && personList.Items.Count == 0)
                    {
                        personList = visitorResults;
                    }
                }
            }
            else if (string.Equals(personSearchParameter.PersonTypeId, "1"))
            {
                personList = await this.RetrieveCrewLists(personSearchParameter, isAlertCount, crewIds);
                if (personSearchParameter.IsAll.HasValue && personSearchParameter.IsAll.Value)
                {
                    personList.GuestTotalResults = (await this.RetrieveGuestsList(personSearchParameter, isAlertCount, guestIds)).Items.Count;
//.........这里部分代码省略.........
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:101,代码来源:PersonAlertData.cs


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