protected override string GetQuery(CodeActivityContext context)
        {
            long     recordId = TableRecordID.Get(context);
            string   title    = Title.Get(context);
            DateTime dueDate  = DueDate.Get(context);
            string   statusId = StatusID.Get(context);

            string titleStr = string.Empty;

            if (!string.IsNullOrWhiteSpace(title))
            {
                titleStr = string.Format("title: {0}", title.ToQueryValue());
            }

            string dueDateStr = string.Empty;

            if (dueDate != null && dueDate != DateTime.MinValue)
            {
                dueDateStr = string.Format("due_date: {0}", dueDate.ToQueryValue());
            }

            string statusStr = string.Empty;

            if (!string.IsNullOrWhiteSpace(statusId))
            {
                statusStr = string.Format("statusId: \"{0}\"", statusId);
            }

            return(string.Format(UpdateTableRecordQuery, recordId, titleStr, dueDateStr, statusStr));
        }
Beispiel #2
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));
        }
Beispiel #3
0
        protected override string GetQuery(CodeActivityContext context)
        {
            var card      = CardID.Get(context);
            var assignees = AssigneeIDs.Get(context);
            var dueDate   = DueDate.Get(context);
            var labels    = LabelIDs.Get(context);
            var title     = Title.Get(context);

            var cardFields = new List <string>();

            if (assignees?.Length > 0)
            {
                cardFields.Add(string.Format("assignee_ids: {0}", assignees.ToQueryValue()));
            }

            if (dueDate != null && dueDate != DateTime.MinValue)
            {
                cardFields.Add(string.Format("due_date: {0}", dueDate.ToQueryValue()));
            }

            if (labels?.Length > 0)
            {
                cardFields.Add(string.Format("label_ids: {0}", labels.ToQueryValue()));
            }

            if (!string.IsNullOrWhiteSpace(title))
            {
                cardFields.Add(string.Format("title: {0}", title.ToQueryValue()));
            }

            var paramsStr = string.Join(" ", cardFields);

            return(string.Format(UpdateCardQuery, card, paramsStr));
        }
Beispiel #4
0
        /// <summary>
        /// Create the QCL record.
        /// </summary>
        /// <param name="context"></param>
        protected override void DoWork(CodeActivityContext context)
        {
            var mgr = new QclManager {
                PM = PM
            };
            int chkId = mgr.CreateQcl(PatId1.Get(context),
                                      TskId.Get(context),
                                      StaffIdResponsible.Get(context),
                                      StaffIdRequesting.Get(context),
                                      DueDate.Get(context),
                                      CGroup.Get(context),
                                      PrsId.Get(context),
                                      Instructions.Get(context),
                                      Comment.Get(context));

            ChkId.Set(context, chkId);
        }
Beispiel #5
0
        /// <summary>
        /// Checks for QCL's with attributes matching the parameters passed in.
        /// </summary>
        /// <param name="context"></param>
        protected override void DoWork(CodeActivityContext context)
        {
            var mgr = new QclManager {
                PM = PM
            };
            bool qclExists = mgr.CheckQclExists(PatId1.Get(context),
                                                TskId.Get(context),
                                                StaffIdResponsible.Get(context),
                                                StaffIdRequesting.Get(context),
                                                DueDate.Get(context),
                                                CGroup.Get(context),
                                                PrsId.Get(context),
                                                Instructions.Get(context),
                                                Comment.Get(context),
                                                Completed.Get(context));

            QclExists.Set(context, qclExists);
        }
        private string GetCardFieldsQuery(CodeActivityContext context)
        {
            var assignees = AssigneeIDs.Get(context);
            var dueDate   = DueDate.Get(context);
            var labels    = LabelIDs.Get(context);
            var parents   = ParentsIDs.Get(context);
            var phase     = PhaseID.Get(context);
            var title     = Title.Get(context);

            var cardFields = new List <string>();

            if (assignees?.Length > 0)
            {
                cardFields.Add(string.Format("assignee_ids: {0}", assignees.ToQueryValue()));
            }

            if (dueDate != null && dueDate != DateTime.MinValue)
            {
                cardFields.Add(string.Format("due_date: {0}", dueDate.ToQueryValue()));
            }

            if (labels?.Length > 0)
            {
                cardFields.Add(string.Format("label_ids: {0}", labels.ToQueryValue()));
            }

            if (parents?.Length > 0)
            {
                cardFields.Add(string.Format("parent_ids: {0}", parents.ToQueryValue()));
            }

            if (phase > 0)
            {
                cardFields.Add(string.Format("phase_id: \"{0}\"", phase));
            }

            if (!string.IsNullOrWhiteSpace(title))
            {
                cardFields.Add(string.Format("title: {0}", title.ToQueryValue()));
            }

            return(string.Join(" ", cardFields));
        }