internal override Grouping GetSubgrouping(object val) { CustomFieldDefinition defn = CustomFieldsManager.GetCustomFieldDefinition(val.ToString()); return(defn == null ? null : new CustomFieldGrouping(defn, null)); }
private PropertyAccessor CalcProperty() { if (column.StartsWith(CustomFieldsManager.CUSTOM_FIELD)) { string fieldName = column.Substring(CustomFieldsManager.CUSTOM_FIELD.Length); CustomFieldDefinition customFieldDefinition = CustomFieldsManager.GetCustomFieldDefinition(fieldName); if (customFieldDefinition == null) // a custom field that existed at the time the search was created but no longer exists { return(o => null); } if (customFieldDefinition.Type == CustomFieldDefinition.Types.Date) { return(delegate(IXenObject o) { object val = CustomFieldsManager.GetCustomFieldValue(o, customFieldDefinition); return (DateTime?)(val is DateTime ? val : null); }); } else { return(delegate(IXenObject o) { object val = CustomFieldsManager.GetCustomFieldValue(o, customFieldDefinition); return val == null ? null : val.ToString(); }); } } ColumnNames c; try { c = (ColumnNames)Enum.Parse(typeof(ColumnNames), column); } catch (ArgumentException) { return(null); } PropertyNames propertyName = PropertyAccessors.GetSortPropertyName(c); return(PropertyAccessors.Get(propertyName)); }
internal override QueryFilter GetSubquery(object parent, object val) { System.Diagnostics.Trace.Assert(val != null); CustomFieldDefinition defn = CustomFieldsManager.GetCustomFieldDefinition(definition.Name); System.Diagnostics.Trace.Assert(defn != null); if (defn.Type == CustomFieldDefinition.Types.String) { return(new CustomFieldQuery(defn, (string)val, StringPropertyQuery.PropertyQueryType.exactmatch)); } else if (defn.Type == CustomFieldDefinition.Types.Date) { return(new CustomFieldDateQuery(defn, (DateTime)val, DatePropertyQuery.PropertyQueryType.exact)); } else { return(base.GetSubquery(parent, val)); } }
internal override QueryFilter GetSubquery(object parent, object val) { System.Diagnostics.Trace.Assert(val != null); // Clicked on a key in the tree (which is now in val). if (parent == null) { CustomFieldDefinition defn = CustomFieldsManager.GetCustomFieldDefinition(val.ToString()); System.Diagnostics.Trace.Assert(defn != null); if (defn.Type == CustomFieldDefinition.Types.String) { return(new CustomFieldQuery(defn, String.Empty, StringPropertyQuery.PropertyQueryType.exactmatch)); } else { return(new CustomFieldDateQuery(defn, DateTime.Now, DatePropertyQuery.PropertyQueryType.exact)); } } // Clicked on a value in the tree (key is in parent, value is in val). else { CustomFieldDefinition defn = CustomFieldsManager.GetCustomFieldDefinition(parent.ToString()); System.Diagnostics.Trace.Assert(defn != null); if (defn.Type == CustomFieldDefinition.Types.String) { return(new CustomFieldQuery(defn, val.ToString(), StringPropertyQuery.PropertyQueryType.exactmatch)); } else { return(new CustomFieldDateQuery(defn, (DateTime)val, DatePropertyQuery.PropertyQueryType.exact)); } } }