コード例 #1
0
        public ActionResult Show(int id)
        {
            var campaign          = this.campaignService.Get(id);
            var applicableMembers = this.memberService.SearchByCampaignId(id).ToList();
            var searchFilters     = this.memberSearchFilterService.ForCampaign(id)
                                    .Select(m =>
            {
                var criteriaDisplayText = SearchCriteria.Create(m.InternalName,
                                                                m.DisplayName,
                                                                (SearchFieldType)m.FilterType,
                                                                (SearchOperator)m.SearchOperator,
                                                                m.Value
                                                                ).ToFriendlyDisplayString();
                return(new MemberSearchFilterViewModel
                {
                    MemberSearchFilterId = m.Id,
                    CampaignId = campaign.Id,
                    CriteriaDisplayText = criteriaDisplayText
                });
            }).ToList();

            var model = new CampaignShowViewModel(Resources.Literal_ShowCampaign)
            {
                Campaign              = campaign,
                SearchFilters         = searchFilters,
                NoSearchFiltersText   = Resources.Literal_NoSearchFiltersText,
                NoMatchingMembersText = Resources.Literal_NoMatchingMembersText,
                ApplicableMembers     = applicableMembers,
                IsReadonly            = campaign.IsReadonly
            };

            return(View(model));
        }
コード例 #2
0
 public void Can_Read_Authenticated()
 {
     using (var cfg = new InfrastructureConfig(true)) {
         var addresses = IOFacadeService.Current.ReadEntityList <Address>(SearchCriteria.Create <AddressDTO>());
         Assert.NotEmpty(addresses);
         Assert.True(addresses.Count == 1);
         Assert.True(addresses[0].ID == new Guid(MockAddresses.MOCK_ADDRESS_ID));
     }
 }
コード例 #3
0
 public void Cannot_Browse()
 {
     using (var cfg = new InfrastructureConfig(false))
     {
         List <Address> addresses = null;
         Assert.Throws <SOLID.Store.Authorization.AuthorizationException>(
             () =>
             addresses = IOFacadeService.Current.ReadEntityList <Address>(
                 SearchCriteria.Create <AddressDTO>())
             );
     }
 }
コード例 #4
0
 public SearchCriteria ToSearchCriteria()
 {
     return(SearchCriteria.Create(InternalName, DisplayName, (SearchFieldType)FilterType, (SearchOperator)SearchOperator, Value));
 }