예제 #1
0
 /// <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);
 }
예제 #2
0
 /// <summary>
 /// Object used to connect to a Parature Instance
 /// </summary>
 /// <param name="token">API Token</param>
 /// <param name="serverfarmaddress">Address of your severfarm. Include https://. Ex: https://demo.parature.com</param>
 /// <param name="apiversion">Version of the API</param>
 /// <param name="instanceid">Instance ID</param>
 /// <param name="departmentid">Department ID</param>
 /// <param name="enforceRequiredFields">Whether to enforce required custom fields or not</param>
 public ParaCredentials(string token, string serverfarmaddress, ParaEnums.ApiVersion apiversion, int instanceid, int departmentid, bool enforceRequiredFields)
 {
     Token = token;
     ServerfarmAddress = serverfarmaddress;
     Apiversion = apiversion;
     Instanceid = instanceid;
     Departmentid = departmentid;
     EnforceRequiredFields = enforceRequiredFields;
 }
예제 #3
0
        /// <summary>
        /// Filter by static field for NULL or NOT NULL
        /// </summary>
        /// <param name="staticFieldProperty">Static field name</param>
        /// <param name="fieldFilter">Filter type</param>
        public void AddStaticFieldFilter(string staticFieldProperty, ParaEnums.FieldValueFilter fieldFilter)
        {
            string filterValue = "";

            switch (fieldFilter)
            {
                case ParaEnums.FieldValueFilter.IsNotNull:
                    filterValue = "_IS_NOT_NULL_";
                    break;
                case ParaEnums.FieldValueFilter.IsNull:
                    filterValue = "_IS_NULL_";
                    break;
            }

            QueryFilterAdd(staticFieldProperty, ParaEnums.QueryCriteria.Equal, filterValue);
        }
예제 #4
0
        /// <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);
        }
예제 #5
0
 /// <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"));
 }
예제 #6
0
 /// <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));
 }
예제 #7
0
 /// <summary>
 /// Add a sort order to the Query, based on a static field.
 /// </summary>
 /// <param name="fieldName">
 /// the field name to passe would be the exact name of the field in the object properties.
 /// For example, if you have a property "Ticket.Date_Created", you will need to pass "Date_Created".
 /// </param>
 /// <param name="sortDirection"></param>              
 public bool AddSortOrder(string fieldName, ParaEnums.QuerySortBy sortDirection)
 {
     if (_SortByFields.Count < 5)
     {
         _SortByFields.Add(fieldName + "_" + sortDirection.ToString().ToLower() + "_");
         return true;
     }
     else
     {
         return false;
     }
 }
예제 #8
0
 /// <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"));
 }
예제 #9
0
 /// <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());
 }
예제 #10
0
 /// <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));
 }
예제 #11
0
 /// <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"));
 }
예제 #12
0
 /// <summary>
 /// Add a sort order to the Query, based on a custom field.
 /// </summary>
 /// <param name="customFieldId">The id of the custom field you would like to filter upon.</param>
 /// <param name="sortDirection"></param>       
 public bool AddSortOrder(Int64 customFieldId, ParaEnums.QuerySortBy sortDirection)
 {
     if (_SortByFields.Count < 5)
     {
         _SortByFields.Add("FID" + customFieldId + "_" + sortDirection.ToString().ToLower() + "_");
         return true;
     }
     else
     {
         return false;
     }
 }
예제 #13
0
        /// <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));
        }
예제 #14
0
        /// <summary>
        /// Add a custom field filter for NULL or NOT NULL. Use with any custom fields
        /// </summary>
        /// <param name="customFieldId">
        /// The id of the multi value custom field you would like to filter your query on.
        /// </param>
        /// <param name="fieldFilter">Null or Not Null filter</param>
        public void AddCustomFieldFilter(Int64 customFieldId, ParaEnums.FieldValueFilter fieldFilter)
        {
            string filterValue = "";

            switch (fieldFilter)
            {
                case ParaEnums.FieldValueFilter.IsNotNull:
                    filterValue = "_IS_NOT_NULL_";
                    break;
                case ParaEnums.FieldValueFilter.IsNull:
                    filterValue = "_IS_NULL_";
                    break;
            }

            QueryFilterAdd("FID" + customFieldId, ParaEnums.QueryCriteria.Equal, filterValue);
        }
예제 #15
0
        /// <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));
        }
예제 #16
0
 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);
 }
예제 #17
0
        /// <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);
        }