private static List <SizeViewModel> LoadXML(SizeKeyType feedObjectType) { SizeViewModel sizes = new SizeViewModel(feedObjectType == SizeKeyType.Dimension ? "Dimensions" : "Metrics"); XDocument xDocument = Analytics.Data.Query.GetSizeCollectionAsXML(feedObjectType); foreach (XElement element in xDocument.Root.Elements("Category")) { SizeViewModel category = new SizeViewModel(element.Attribute("name").Value); foreach (XElement subElement in element.Elements(feedObjectType == SizeKeyType.Dimension ? "Dimension" : "Metric")) { string paramValue = subElement.Attribute("value").Value; SizeViewModel size = new SizeViewModel(subElement.Attribute("name").Value, paramValue); category.Children.Add(size); } category.IsInitiallyExpanded = false; sizes.Children.Add(category); } sizes.IsInitiallyExpanded = true; sizes.Initialize(); return(new List <SizeViewModel> { sizes }); }
public FilterItem(string key, string value, SizeOperator op, string expression, SizeKeyType filterSizeKeyType, LogicalOperator logicalOperator) { _operator = op; _key = key; _value = value; _expression = expression; _logicalOperator = logicalOperator; _filterSizeKeyType = filterSizeKeyType; }
public FilterItem(string key, string value, SizeOperator op, string expression, SizeKeyType filterSizeKeyType, LogicalOperator logicalOperator) { _operator = op; _key = key; _value = value; _expression = expression; _logicalOperator = logicalOperator; _filterSizeKeyType = filterSizeKeyType; }
public static Dictionary <string, string> GetOperatorCollection(SizeKeyType feedObjectType) { Dictionary <string, string> operators = new Dictionary <string, string>(); XDocument xDocument = XDocument.Load(System.Xml.XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream("Analytics.Data.General." + FeedSizeKeyType(feedObjectType)))); foreach (XElement element in xDocument.Root.Elements("Operator")) { operators.Add(element.Attribute("description").Value, element.Attribute("urlEncoded").Value); } return(operators); }
private static string FeedSizeKeyType(SizeKeyType feedObjectType) { if (SizeKeyType.Dimension == feedObjectType) { return("DimensionFilterOperators.xml"); } else if (SizeKeyType.Metric == feedObjectType) { return("MetricFilterOperators.xml"); } else { return("SegmentOperators.xml"); } }
public static Dictionary <string, string> GetSizeCollection(SizeKeyType feedObjectType) { Dictionary <string, string> sizes = new Dictionary <string, string>(); XDocument xDocument = GetSizeCollectionAsXML(feedObjectType); foreach (XElement element in xDocument.Root.Elements("Category")) { foreach (XElement subElement in element.Elements(feedObjectType == SizeKeyType.Dimension ? "Dimension" : "Metric")) { if (!sizes.ContainsKey(subElement.Attribute("name").Value)) { sizes.Add(subElement.Attribute("name").Value, subElement.Attribute("value").Value); } } } return(sizes); }
private string GetFriendlySizeName(string urlEncoded, out SizeKeyType outType) { outType = SizeKeyType.Unknown; string friendlyName = urlEncoded; if (DimensionDefinitions.Values.Contains(urlEncoded)) { friendlyName = DimensionDefinitions.First(p => p.Value == urlEncoded).Key; outType = SizeKeyType.Dimension; } else if (MetricDefinitions.Values.Contains(urlEncoded)) { friendlyName = MetricDefinitions.First(p => p.Value == urlEncoded).Key; outType = SizeKeyType.Metric; } return(friendlyName); }
private void InitializeForm() { BindSizeList(ListType.Dim); BindSizeList(ListType.Met); BindSizeList(ListType.Fil); BindSizeList(ListType.Sort); BindSizeList(ListType.Profile); if (_query.SortParams != null && _query.SortParams.Count > 0) { //Select the orderItem från query list. sortBycomboBox.SelectedValue = _query.SortParams.First().Value; } if (_query.GetMetricsAndDimensions.Count() > 0) { queryNotCompleted = true; DataBindSortByDropDown(); } if (CurrentUser != null) { DataBindAccountsDropDown(); DataBindSegmentsDropDown(); } this._query.AccountId.OrderBy(x => x); // Setting the first account in the list if (this._query.AccountId.Count > 0) { string aID = this._query.AccountId.First().Value; if (_currentUserAccount.Entrys.Find(p => p.AccountId == aID) != null) comboBoxAccount.SelectedValue = _currentUserAccount.Entrys.Find(p => p.AccountId == aID); else Notify("You have no access to any accounts"); } else if (_currentUserAccount != null) comboBoxAccount.SelectedIndex = _currentUserAccount.Entrys.Count > 0 ? 0 : -1; // The profiles are shown based on wich account is selected. if (this._query.ProfileId.Count > 0) { string pId = this._query.Ids.ToSimplifiedString(); if (_currentUserAccount.Entrys.Find(p => p.ProfileId == pId) != null) { foreach (Entry entry in _currentUserAccount.Entrys) { if (entry.ProfileId == pId) { comboBoxAccount.SelectedValue = _currentUserAccount.Entrys.Find(p => p.AccountId == entry.AccountId); ; } } comboBoxProfile.SelectedValue = _currentUserAccount.Entrys.Find(p => p.ProfileId == pId); } else Notify("Your account lacks permission on the target profile"); } else if (_currentUserAccount != null) comboBoxProfile.SelectedIndex = _currentUserAccount.Entrys.Count > 0 ? 0 : -1; if (CurrentUser != null) { DataBindSitesDropDown(); } if (this._query.Segments.Count > 0) { string sId = this._query.Segments.First().Value; if (_currentUserAccount.Segments.Find(p => p.SegmentId == sId) != null) comboBoxSegments.SelectedValue = _currentUserAccount.Segments.Find(p => p.SegmentId == sId); } else if (_currentUserAccount != null) comboBoxSegments.SelectedIndex = _currentUserAccount.Segments.Count > 0 ? 0 : -1; SetCalendars(); activeSize = SizeKeyType.Dimension; startIndexTextBox.Text = _query.StartIndex.ToString(); maxResultsTextBox.Text = _query.MaxResults.ToString(); }
private void comboBoxMetrics_SelectionChanged(object sender, SelectionChangedEventArgs e) { activeSize = SizeKeyType.Metric; BindOperatorList(SizeKeyType.Metric); }
private void comboBoxMetrics_DropDownOpened(object sender, EventArgs e) { comboBoxDimensions.SelectedIndex = -1; activeSize = SizeKeyType.Metric; BindOperatorList(SizeKeyType.Metric); }
private void comboBoxDimensions_SelectionChanged(object sender, SelectionChangedEventArgs e) { activeSize = SizeKeyType.Dimension; BindOperatorList(SizeKeyType.Dimension); }
private void BindOperatorList(SizeKeyType activeSize) { Binding opBind = new Binding(); opBind.Source = Query.GetOperatorCollection(activeSize); comboBoxOperator.SetBinding(ComboBox.ItemsSourceProperty, opBind); }
private void AddSortByParam(SizeKeyType size) { if (sortBycomboBox.SelectedItem != null) { KeyValuePair<string, string> item = (sortBycomboBox.SelectedItem as Nullable<KeyValuePair<string, string>>).Value; string key = item.Key; if (listOrder.Content.Equals(descending) && !item.Key.Contains("-")) { key = "-" + item.Key; } if (!(_query.SortParams.Keys.Contains(item.Key))) { Item sItem = new Item(item.Value, key); _query.Sort.Add(sItem); } BindSortListBox(); } }
private static List<SizeViewModel> LoadXML(SizeKeyType feedObjectType) { SizeViewModel sizes = new SizeViewModel(feedObjectType == SizeKeyType.Dimension ? "Dimensions" : "Metrics"); try { XDocument xDocument = Analytics.Data.Query.GetSizeCollectionAsXML(feedObjectType); foreach (XElement element in xDocument.Root.Elements("Category")) { SizeViewModel category = new SizeViewModel(element.Attribute("name").Value); foreach (XElement subElement in element.Elements(feedObjectType == SizeKeyType.Dimension ? "Dimension" : "Metric")) { string paramValue = subElement.Attribute("value").Value; SizeViewModel size = new SizeViewModel(subElement.Attribute("name").Value, paramValue); /* if (size.Name.Contains("hour")) { size.IsChecked = true; }*/ category.Children.Add(size); } category.IsInitiallyExpanded = false; sizes.Children.Add(category); } sizes.IsInitiallyExpanded = true; sizes.Initialize(); } catch { } return new List<SizeViewModel> { sizes }; }
private static string FeedSizeKeyType(SizeKeyType feedObjectType) { if (SizeKeyType.Dimension == feedObjectType) return "DimensionFilterOperators.xml"; else if (SizeKeyType.Metric == feedObjectType) return "MetricFilterOperators.xml"; else return "SegmentOperators.xml"; }
public static XDocument GetSizeCollectionAsXML(SizeKeyType feedObjectType) { return XDocument.Parse((feedObjectType == SizeKeyType.Dimension ? Settings.Instance.DimensionsXml : Settings.Instance.MetricsXml).OuterXml); }
public static Dictionary<string, string> GetSizeCollection(SizeKeyType feedObjectType) { Dictionary<string, string> sizes = new Dictionary<string, string>(); XDocument xDocument = GetSizeCollectionAsXML(feedObjectType); foreach (XElement element in xDocument.Root.Elements("Category")) foreach (XElement subElement in element.Elements(feedObjectType == SizeKeyType.Dimension ? "Dimension" : "Metric")) if (!sizes.ContainsKey(subElement.Attribute("name").Value)) sizes.Add(subElement.Attribute("name").Value, subElement.Attribute("value").Value); return sizes; }
public static Dictionary<string, string> GetOperatorCollection(SizeKeyType feedObjectType) { Dictionary<string, string> operators = new Dictionary<string, string>(); XDocument xDocument = XDocument.Load(System.Xml.XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream("Analytics.Data.General." + FeedSizeKeyType(feedObjectType)))); foreach (XElement element in xDocument.Root.Elements("Operator")) operators.Add(element.Attribute("description").Value, element.Attribute("urlEncoded").Value); return operators; }
public static XDocument GetSizeCollectionAsXML(SizeKeyType feedObjectType) { return(XDocument.Parse((feedObjectType == SizeKeyType.Dimension ? Settings.Instance.DimensionsXml : Settings.Instance.MetricsXml).OuterXml)); }
private string GetFriendlySizeName(string urlEncoded, out SizeKeyType outType) { outType = SizeKeyType.Unknown; string friendlyName = urlEncoded; if (DimensionDefinitions.Values.Contains(urlEncoded)) { friendlyName = DimensionDefinitions.First(p => p.Value == urlEncoded).Key; outType = SizeKeyType.Dimension; } else if (MetricDefinitions.Values.Contains(urlEncoded)) { friendlyName = MetricDefinitions.First(p => p.Value == urlEncoded).Key; outType = SizeKeyType.Metric; } return friendlyName; }
private void AddFilter(SizeKeyType size) { ComboBox sizeRefBox = size == SizeKeyType.Dimension ? comboBoxDimensions : comboBoxMetrics; if (sizeRefBox.SelectedItem != null) { KeyValuePair<string, string> item = (sizeRefBox.SelectedItem as Nullable<KeyValuePair<string, string>>).Value; KeyValuePair<string, string> selectedOperator = (comboBoxOperator.SelectedItem as Nullable<KeyValuePair<string, string>>).Value; FilterItem fItem = new FilterItem(item.Key, item.Value, new SizeOperator(selectedOperator.Key, selectedOperator.Value), textBoxExpression.Text, (SizeKeyType)size, _query.Filter.Count == 0 ? LogicalOperator.None : LogicalOperator.And); _query.Filter.Add(fItem); BindFilterListBox(); } }