protected void QueryFilterAdd(string field, ParaEnums.QueryCriteria criteria, string value) { var internalCrit = ""; switch (criteria) { case ParaEnums.QueryCriteria.Equal: internalCrit = "="; break; case ParaEnums.QueryCriteria.LessThan: internalCrit = "_max_="; break; case ParaEnums.QueryCriteria.Like: internalCrit = "_like_="; break; case ParaEnums.QueryCriteria.MoreThan: internalCrit = "_min_="; break; } var qe = new QueryElement { QueryName = field, QueryFilter = internalCrit, QueryValue = value }; QueryElementsRemoveDuplicate(qe); QElements.Add(qe); }
/// <summary> /// Add a custom field filter to the query for multiple values. Does not work for boolean field types. Query acts like a union of all provided values. /// </summary> /// <param name="customFieldId">The id of the custom field to query on</param> /// <param name="criteria">The query criteria</param> /// <param name="values">The list of possible values</param> public void AddCustomFieldInListFilter(Int64 customFieldId, ParaEnums.QueryCriteria criteria, IEnumerable <string> values) { var processedValues = values.Select(value => ProcessEncoding(value)).ToList(); QueryFilterAdd("FID" + customFieldId, criteria, string.Join(",", processedValues)); }
/// <summary> /// Adds a custom field based filter to the query. Use this method for Custom Fields that are NOT multi values. /// </summary> /// <param name="customFieldId"> /// The id of the custom field you would like to filter your query on. /// </param> /// <param name="criteria"> /// The criteria you would like to apply to this custom field /// </param> /// <param name="value"> /// The value you would like the custom field to have, for this filter. /// </param> public void AddCustomFieldFilter(Int64 customFieldId, ParaEnums.QueryCriteria criteria, bool value) { var filter = value ? "1" : "0"; QueryFilterAdd("FID" + customFieldId, criteria, filter); }
/// <summary> /// Adds a static field based filter to the query. Use this method only if you are dealing with a bool custom field (like a checkbox) /// Static field filters are actually general properties that will be independant from static fields. /// You can use them this filter by passing the Read Only Static Property of the object you are using. /// You will find all these properties in ModuleQuery>ObjectQuery>ObjectStaticFields, where object is /// the name of the module you are accessing. /// </summary> /// <param name="staticFieldProperty"> /// these properties in ModuleQuery>ObjectQuery>ObjectStaticFields, where object is /// the name of the module you are accessing. /// </param> /// <param name="criteria"> /// The criteria you would like to apply to this static field. /// </param> /// <param name="value"> /// The bool value you would like the static field to have, for this filter. /// </param> public void AddStaticFieldFilter(string staticFieldProperty, ParaEnums.QueryCriteria criteria, bool value) { var filter = "0"; filter = value ? "1" : "0"; QueryFilterAdd(staticFieldProperty, criteria, filter); }
/// <summary> /// Adds a custom field based filter to the query. Use this method for Custom Fields that are multi values (dropdown, radio buttons, etc). /// </summary> /// <param name="customFieldId"> /// The id of the multi value custom field you would like to filter your query on. /// </param> /// <param name="criteria"> /// The criteria you would like to apply to this custom field /// </param> /// <param name="customFieldOptionId"> /// The list of all custom field options (for the customFieldID you specified) that need to be selected for an item to qualify to be returned when you run your query. /// </param> public void AddCustomFieldFilter(Int64 customFieldId, ParaEnums.QueryCriteria criteria, Int64[] customFieldOptionId) { if (customFieldOptionId.Length <= 0) { return; } var filtering = ""; for (var i = 0; i < customFieldOptionId.Length; i++) { var separator = ","; if (i == 0) { if (customFieldOptionId.Length > 1) { separator = ""; } } filtering = filtering + separator + customFieldOptionId[i]; } QueryFilterAdd("FID" + customFieldId, criteria, filtering); }
/// <summary> /// Adds a static field based filter to the query. Use this method only if you are dealing with a bool custom field (like a checkbox) /// Static field filters are actually general properties that will be independant from static fields. /// You can use them this filter by passing the Read Only Static Property of the object you are using. /// You will find all these properties in ModuleQuery>ObjectQuery>ObjectStaticFields, where object is /// the name of the module you are accessing. /// </summary> /// <param name="staticFieldProperty"> /// these properties in ModuleQuery>ObjectQuery>ObjectStaticFields, where object is /// the name of the module you are accessing. /// </param> /// <param name="criteria"> /// The criteria you would like to apply to this static field. /// </param> /// <param name="value"> /// The Date you would like to base your filter off. ParaConnect will manage the date formatting part. /// </param> public void AddCustomFieldFilter(string staticFieldProperty, ParaEnums.QueryCriteria criteria, DateTime value) { QueryFilterAdd(staticFieldProperty, criteria, value.ToString("yyyy-MM-ddTHH:mm:ssZ")); }
/// <summary> /// Adds a static field based filter to the query. /// Static field filters are actually general properties that will be independant from static fields. /// You can use them this filter by passing the Read Only Static Property of the object you are using. /// You will find all these properties in ModuleQuery>ObjectQuery>ObjectStaticFields, where object is /// the name of the module you are accessing. /// </summary> /// <param name="staticFieldProperty"> /// these properties in ModuleQuery>ObjectQuery>ObjectStaticFields, where object is /// the name of the module you are accessing. /// </param> /// <param name="criteria"> /// The criteria you would like to apply to this static field. /// </param> /// <param name="value"> /// The DateTime value you would like the static field to have, for this filter. Down to the millisecond. /// DateTime will be converted to UTC and formatted as a string in the query. /// </param> public void AddStaticFieldFilter(string staticFieldProperty, ParaEnums.QueryCriteria criteria, DateTime value) { QueryFilterAdd(staticFieldProperty, criteria, value.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ")); }
/// <summary> /// Filter by static field with multiple values. Query acts like a union of all provided values. /// </summary> /// <param name="staticFieldProperty">The static field to filter against</param> /// <param name="criteria">The query criteria</param> /// <param name="values">The list of possible values</param> public void AddStaticFieldInListFilter(string staticFieldProperty, ParaEnums.QueryCriteria criteria, IEnumerable <string> values) { var processedValues = values.Select(value => ProcessEncoding(value)).ToList(); QueryFilterAdd(staticFieldProperty, criteria, string.Join(",", processedValues)); }
/// <summary> /// Adds a static field based filter to the query. /// Static field filters are actually general properties that will be independant from static fields. /// You can use them this filter by passing the Read Only Static Property of the object you are using. /// You will find all these properties in ModuleQuery>ObjectQuery>ObjectStaticFields, where object is /// the name of the module you are accessing. /// </summary> /// <param name="staticFieldProperty"> /// these properties in ModuleQuery>ObjectQuery>ObjectStaticFields, where object is /// the name of the module you are accessing. /// </param> /// <param name="criteria"> /// The criteria you would like to apply to this static field. /// </param> /// <param name="value"> /// The value you would like the static field to have, for this filter. /// </param> public void AddStaticFieldFilter(string staticFieldProperty, ParaEnums.QueryCriteria criteria, string value) { QueryFilterAdd(staticFieldProperty, criteria, ProcessEncoding(value)); }
/// <summary> /// Adds a custom field based filter to the query. Use this method for Custom Fields that are NOT multi values. /// </summary> /// <param name="customFieldId"> /// The id of the custom field you would like to filter your query on. /// </param> /// <param name="criteria"> /// The criteria you would like to apply to this custom field /// </param> /// <param name="value"> /// The value you would like the custom field to have, for this filter. /// </param> public void AddCustomFieldFilter(Int64 customFieldId, ParaEnums.QueryCriteria criteria, string value) { QueryFilterAdd("FID" + customFieldId, criteria, ProcessEncoding(value)); }
/// <summary> /// Adds a custom field based filter to the query. Use this method for Custom Fields that are date based. /// </summary> /// <param name="customFieldId"> /// The id of the custom field you would like to filter your query on. /// </param> /// <param name="criteria"> /// The criteria you would like to apply to this custom field /// </param> /// <param name="value"> /// The Date you would like to base your filter off, converted to UTC. /// NOTE: Custom fields are days, and do not include a time component. Data will look like: yyyy-MM-ddT00:00:00 /// The APIs do respect filtering relative to the full date/time provided, so if you want to use equals, zero the time component. /// </param> public void AddCustomFieldFilter(Int64 customFieldId, ParaEnums.QueryCriteria criteria, DateTime value) { QueryFilterAdd("FID" + customFieldId, criteria, value.ToString("yyyy-MM-ddTHH:mm:ss.fffZ")); }
/// <summary> /// Adds a custom field based filter to the query. Use this method for Custom Fields that are multi values (dropdown, radio buttons, etc). /// </summary> /// <param name="customFieldId"> /// The id of the multi value custom field you would like to filter your query on. /// </param> /// <param name="criteria"> /// The criteria you would like to apply to this custom field /// </param> /// <param name="customFieldOptionId"> /// The custom field option (for the customFieldID you specified) that need to be selected for an item to qualify to be returned when you run your query. /// </param> public void AddCustomFieldFilter(Int64 customFieldId, ParaEnums.QueryCriteria criteria, Int64 customFieldOptionId) { QueryFilterAdd("FID" + customFieldId, criteria, customFieldOptionId.ToString()); }