public async Task AddSelected(AddSelectionRequest request)
        {
            Selection selection = new Selection()
            {
                ComponentType = request.ComponentType,
                Date          = request.Date,
                ElementID     = request.ElementID
            };

            await _dbContext.Selections.AddAsync(selection);

            for (int i = 0; i < request.Properties.Count; i++)
            {
                var property = await _dbContext.Properties.Where(e => e.Component == request.ComponentType && e.Name == request.Properties.Keys.ElementAt(i)).FirstOrDefaultAsync();

                var value = property.Values.Where(e => e.Value == request.Properties[property.Name]).FirstOrDefault();
                SelectionProperties selectionProperties = new SelectionProperties()
                {
                    PropertyValue = value,
                    Selection     = selection
                };

                await _dbContext.SelectionProperties.AddAsync(selectionProperties);
            }

            await _dbContext.SaveChangesAsync();
        }
        public void RemoveSelectionProperty(QueryFromTable table, QueryFromProperty property)
        {
            var item = SelectionProperties.FirstOrDefault(s => s.StoreProperty.Name == property.StoreProperty.Name && s.FromTable.Alias == table.Alias);

            if (item != null)
            {
                SelectionProperties.Remove(item);
            }
        }
        /// <summary>
        /// Gets a string representation of <see cref="T:BrowseSelection"/>.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            StringBuilder buf = new StringBuilder();

            buf.Append("name: ").Append(FieldName).Append(" ");
            buf.Append("values: " + string.Join(",", m_values.ToArray())).Append(" ");
            buf.Append("nots: " + string.Join(",", m_notValues.ToArray())).Append(" ");
            buf.Append("op: " + SelectionOperation.ToString()).Append(" ");
            buf.Append("sel props: " + SelectionProperties.ToDisplayString());
            return(buf.ToString());
        }
 public void AddSelectionProperty(QueryFromTable table, QueryFromProperty property)
 {
     if (!SelectionProperties.Any(s => s.FromTable.Alias == table.Alias && s.StoreProperty.Name == property.StoreProperty.Name))
     {
         var newSelectProperty = new QuerySelectProperty(table, property.StoreProperty)
         {
             IsOutput = true, Alias = property.Alias
         };
         SelectionProperties.Add(newSelectProperty);
     }
 }
        public void Clear()
        {
            // clear all values in controller
            StoreParameters.DataService     = "MyDataService";
            StoreParameters.QueryName       = "";
            StoreParameters.Namespace       = "Default";
            StoreParameters.QueryReturnType = "";

            FromTables.Clear();
            SelectionProperties.Clear();
            FromTableLinks.Clear();
            FromTableJoins.Clear();
            WhereClause = "";
        }
        public void SetGroupByFunction(QuerySelectProperty property, string func)
        {
            property.GroupByFunction = func;

            if (func == "Group By All")
            {
                SelectionProperties.Where(p => p.IsOutput).ToList().ForEach(p => p.GroupByFunction = "Group By");
                SelectionProperties.Where(p => !String.IsNullOrWhiteSpace(p.Filter)).ToList().ForEach(p => p.GroupByFunction = "Where");
            }

            if (func == "Group By None")
            {
                SelectionProperties.ToList().ForEach(p => p.GroupByFunction = "");
            }
        }
Beispiel #7
0
 public SelectionTool(Project project) :
     base(project)
 {
     Type  = SelectionType.Rectangle;
     Panel = new SelectionProperties(this);
 }
 protected virtual void OnCommandBufferRefresh(IRTECamera camera)
 {
     HandleProperties.SetColor("_Color", HandlesColor);
     LineProperties.SetColor("_Color", LineColor);
     SelectionProperties.SetColor("_Color", SelectionColor);
 }