Example #1
0
        protected override string GetQuery(CodeActivityContext context)
        {
            string   tableId = TableID.Get(context);
            DateTime dueDate = DueDate.Get(context);
            string   title   = Title.Get(context);

            if (dueDate == null || dueDate == DateTime.MinValue)
            {
                dueDate = DateTime.Now.AddMonths(1);
            }

            var dict = DictionaryFields.Get(context);

            if (dict == null || dict.Count == 0)
            {
                var dataRow  = DataRowFields.Get(context);
                var tempDict = dataRow.ToDictionary();
                if (tempDict != null)
                {
                    dict = tempDict;
                }
            }

            if (string.IsNullOrWhiteSpace(title) && dict?.Count > 0)
            {
                title = dict.First().Value.ToString();
            }

            return(BuildQuery(tableId, title, dict, dueDate));
        }
        private string GetCardCustomFieldsQuery(CodeActivityContext context)
        {
            var dict = DictionaryFields.Get(context);

            if (dict == null || dict.Count == 0)
            {
                var dataRow  = DataRowFields.Get(context);
                var tempDict = dataRow.ToDictionary();
                if (tempDict != null && tempDict.Count > 0)
                {
                    dict = tempDict;
                }
                else
                {
                    return(string.Empty);
                }
            }

            var cardCustomFields = new List <string>();

            foreach (var item in dict)
            {
                string value = item.Value.ToString();
                value = value.ToQueryValue();
                cardCustomFields.Add(string.Format(CreateCardFieldQueryPart, item.Key, value));
            }

            string cardCustomFieldsStr = string.Join(", ", cardCustomFields);

            return(string.Format("fields_attributes: [ {0} ]", cardCustomFieldsStr));
        }