private void SearchBar_OnTextChanged(object sender, TextChangedEventArgs e) { QuotaList.ItemsSource = string.IsNullOrWhiteSpace(e.NewTextValue) ? QuotaList.ItemsSource = QuotaGroup : QuotaList.ItemsSource = QuotaGroup.Where(x => x.Any(n => n.Name.ToLowerInvariant().Contains(e.NewTextValue.ToLowerInvariant())) || x.LevelName.ToLowerInvariant().Contains(e.NewTextValue.ToLowerInvariant())); }
private void SetUpQuotas() { try { QuotaGroup = new ObservableCollection <QuotaGroup>(); var group = new QuotaGroup(""); QuotaGroup = QuotaGroups(SurveyCounts.QuotaCounts.Attributes, group, QuotaGroup, ""); } catch (Exception) { throw; } }
private ObservableCollection <QuotaGroup> QuotaGroups(List <QuotaAttribute> quotaAttributes, QuotaGroup group, ObservableCollection <QuotaGroup> quotaCollection, string name, string levelName = "") { foreach (var attribute in quotaAttributes) { name = string.IsNullOrEmpty(levelName) ? attribute.Name : levelName; group = new QuotaGroup(name); foreach (var level in attribute.Levels) { group.Add(level); QuotaGroups(level.Attributes, group, quotaCollection, name, level.Name); } quotaCollection.Add(group); } return(quotaCollection); }
public static LineItemCriteria GetTestLineItem() { var filters = new QuotaFilters[] { //new QuotaFilters //{ // AttributeID = "11", // Options = new string[] {"90007", "95134"} //} }; var quotaGroups = new QuotaGroup[] { new QuotaGroup { Name = "Age distribution", QuotaCells = new QuotaCell[] { new QuotaCell { QuotaNodes = new QuotaNode[] { new QuotaNode { AttributeID = "13", OptionIDs = new string[] { "46-70" } } }, Perc = 30 }, new QuotaCell { QuotaNodes = new QuotaNode[] { new QuotaNode { AttributeID = "13", OptionIDs = new string[] { "18-45" } } }, Perc = 30 }, new QuotaCell { QuotaNodes = new QuotaNode[] { new QuotaNode { AttributeID = "13", OptionIDs = new string[] { "70-99" } } }, Perc = 40 } } } }; return(new LineItemCriteria { ExtLineItemID = "lineItem001", Title = "US College", CountryISOCode = "US", LanguageISOCode = "en", SurveyURL = "www.mysurvey.com/live/survey?pid=2424131312&k2=59931&psid=VgrJ2-9iUQZK3noVDtXobw", SurveyTestURL = "www.mysurvey.com/test/survey?pid=2424131312&k2=59931&psid=VgrJ2-9iUQZK3noVDtXobw", IndicativeIncidence = 70, DaysInField = 2, LengthOfInterview = 5, RequiredCompletes = 10, DeliveryType = "BALANCED", QuotaPlan = new QuotaPlan { Filters = filters, QuotaGroups = quotaGroups } }); }