public void list_topics()
        {
            //setup
            var handler = CreateHandler();
            var request = new ListEventTopicsRequest();

            //act
            var response = HandleRequest<ListEventTopicsResponse>(handler, request);

            //assert
            List<EventTopicDto> topics = new List<EventTopicDto>(response.EventTopics);

            Assert.AreEqual(5, topics.Count);
            Assert.AreEqual(2, topics[3].Id);
            Assert.AreEqual("Surgery", topics[3].Name);
            Assert.AreEqual(true, topics[3].IsEnabled);
        }
Example #2
0
 private static void GetAllEventTopics(EventAdminDetailView parent, out IEnumerable<EventTopicDto> eventTopics, out List<SubEntityRecord> records)
 {
     var request = new ListEventTopicsRequest() { IsEnabled = true };
     eventTopics = parent.ProcessRequest<ListEventTopicsResponse>(request).EventTopics;
     records = new List<SubEntityRecord>();
 }
 private void GetTopics(List<KeyValuePair<object, object>> records)
 {
     var eventTopicsRequest = new ListEventTopicsRequest();
     var eventTopics = _view.ProcessRequest<ListEventTopicsResponse>(eventTopicsRequest).EventTopics.Where(e => e.IsEnabled == true);
     foreach (var eventTopic in eventTopics)
         records.Add(new KeyValuePair<object, object>(eventTopic.Name, eventTopic.Id));
 }
        private ListEventTopicsResponse QueryData()
        {
            var listRequest = new ListEventTopicsRequest();

            //Paging
            listRequest.PageSize = _viewModel.PageSize;
            listRequest.RequestedPage = _viewModel.PageNumber;

            //Sorting
            if (!string.IsNullOrEmpty(_viewModel.SortColumn))
            {
                listRequest.SortField = _viewModel.SortColumn;
                listRequest.SortDirection = _viewModel.SortDirection.ToLowerInvariant() == "asc" ? "Ascending" : "Descending";
            }

            //Filter
            var enabledFilterValue = string.IsNullOrEmpty(_viewModel.FilterFields.Single(f => f.FieldName == "Enabled").FieldValue) ? string.Empty : _viewModel.FilterFields.Single(f => f.FieldName == "Enabled").FieldValue;
            if (!string.IsNullOrEmpty(enabledFilterValue) && enabledFilterValue != "All")
                listRequest.IsEnabled = enabledFilterValue == "Enabled";

            return ProcessRequest<ListEventTopicsResponse>(listRequest);
        }