コード例 #1
0
ファイル: Attribute.cs プロジェクト: Vialythen/AcumaticaTest
 protected virtual Type GetSearchTypeRestrictedByDate(Type selectorSearchType, Type dateType)
 {
     selectorSearchType = selectorSearchType ?? GetDefaultSelectorSearchType();
     if (dateType != null)
     {
         BqlCommand select    = BqlCommand.CreateInstance(selectorSearchType) ?? throw new ArgumentNullException("BqlCommand.CreateInstance(selectorSearchType)");
         Type       whereDate = BqlCommand.Compose(
             typeof(Where <, ,>),
             typeof(FABookPeriod.startDate),
             typeof(LessEqual <>),
             typeof(Current <>),
             dateType,
             typeof(And <,>),
             typeof(FABookPeriod.endDate),
             typeof(Greater <>),
             typeof(Current <>),
             dateType);
         select = select.WhereAnd(whereDate);
         Type[] decomposed = BqlCommand.Decompose(select.GetSelectType());
         decomposed[0]      = BqlHelper.SelectToSearch[decomposed[0]];
         decomposed[1]      = typeof(FABookPeriod.finPeriodID);
         selectorSearchType = BqlCommand.Compose(decomposed);
     }
     return(selectorSearchType);
 }
コード例 #2
0
        /// <summary>
        /// Returns all searchable fields including dependent fields and key fields.
        /// Ex: Since Contact.DisplayName depends on FirstName, LastName, etc. all these fields will also be returned.
        /// </summary>
        /// <returns></returns>
        public ICollection <Type> GetSearchableFields(PXCache cache)
        {
            HashSet <Type> result = new HashSet <Type>();

            foreach (Type item in titleFields.Union(fields))
            {
                result.Add(item);

                foreach (Type dependable in PXDependsOnFieldsAttribute.GetDependsRecursive(cache, item.Name).Select(cache.GetBqlField))
                {
                    result.Add(dependable);
                }

                //Note: Keys can be removed once 43383 is resolved.
                Type dacType = BqlCommand.GetItemType(item);
                foreach (Type key in cache.Graph.Caches[dacType].BqlKeys)
                {
                    result.Add(key);
                }
            }

            if (WhereConstraint != null)
            {
                foreach (Type type in BqlCommand.Decompose(WhereConstraint))
                {
                    if ((typeof(IBqlField)).IsAssignableFrom(type))
                    {
                        result.Add(type);
                    }
                }
            }

            return(result);
        }
コード例 #3
0
        protected virtual void EnsureSearchView(PXCache sender)
        {
            if (searchView == null)
            {
                List <Type> list = new List <Type>();
                list.Add(typeof(Select <,>));
                list.Add(sender.GetItemType());
                list.AddRange(BqlCommand.Decompose(WhereConstraint));

                BqlCommand cmd = BqlCommand.CreateInstance(list.ToArray());
                searchView = new PXView(sender.Graph, true, cmd);
            }
        }