private string GetInputQuery(CodeActivityContext context)
        {
            var cardsInput = new List <string>();
            var first      = Amount.Get(context);
            var after      = AfterCursor.Get(context);

            if (first <= 0)
            {
                first = 20;
            }

            cardsInput.Add("first: " + first);

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

            var searchFields = new List <string>();
            var assignees    = AssignedTo.Get(context);
            var ignoreIds    = IgnoreIDs.Get(context);
            var labels       = Labels.Get(context);
            var title        = Title.Get(context);

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

            if (ignoreIds?.Length > 0)
            {
                searchFields.Add(string.Format("ignore_ids: {0}", ignoreIds.ToQueryValue()));
            }

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

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

            string searchFieldsStr = string.Empty;

            if (searchFields.Count > 0)
            {
                searchFieldsStr = "search { " + string.Join(" ", searchFields) + " }";
                cardsInput.Add(searchFieldsStr);
            }

            return(string.Join(" ", cardsInput));
        }
Ejemplo n.º 2
0
        protected override void Execute(CodeActivityContext context)
        {
            Lead l = Lead.Get(context);

            l.AssignedTo = AssignedTo.Get(context);
            l.Status     = "Assigned";

            PersistLead persist = context.GetExtension <PersistLead>();

            persist.AddLead(l, "Update");

            // Store the request in the OutArgument
            Lead.Set(context, l);
        }
Ejemplo n.º 3
0
        protected override void Execute(CodeActivityContext context)
        {
            MeetingApplyForm meetingApplyForm = new MeetingApplyForm();

            YunShanOA.DataAccess.Mapping.YunShanOADataContext dc = new YunShanOADataContext();
            meetingApplyForm.ApplyUserName       = AssignedTo.Get(context).ApplyUserName;
            meetingApplyForm.BeginTime           = AssignedTo.Get(context).BeginTime;
            meetingApplyForm.Comments            = AssignedTo.Get(context).Comments;
            meetingApplyForm.EndTime             = AssignedTo.Get(context).EndTime;
            meetingApplyForm.MeetingIntroduction = AssignedTo.Get(context).MeetingIntroduction;
            meetingApplyForm.MeetingStatus       = 2;
            meetingApplyForm.MeetingTopic        = AssignedTo.Get(context).MeetingTopic;
            meetingApplyForm.MeetingTypeID       = AssignedTo.Get(context).MeetingTypeID;
            meetingApplyForm.WFID = context.WorkflowInstanceId;

            var query = from p in dc.Workflows where p.WFID == meetingApplyForm.WFID select p;

            if (0 == query.Count())
            {
                YunShanOA.DataAccess.Mapping.Workflows wf = new Workflows();
                wf.WFID  = meetingApplyForm.WFID;
                wf.WFTID = Guid.NewGuid();
                dc.Workflows.InsertOnSubmit(wf);
            }

            var query1 = from p in dc.MeetingApplyForm where p.WFID == meetingApplyForm.WFID select p;

            if (0 == query1.Count())
            {
                dc.MeetingApplyForm.InsertOnSubmit(meetingApplyForm); //将数据插入到MeetingApplyForm表
                dc.SubmitChanges();                                   //提交MeeingApplyForm的更改,以便下面根据WFID来查询MeetingApplyFormID
                var quer = from p in dc.MeetingApplyForm where p.WFID == meetingApplyForm.WFID select p;
                if (0 != quer.Count())
                {
                    Model.MeetingRoom mar = new Model.MeetingRoom();
                    mar = MeetingRoomNameAndID.Get(context);
                    int meetingApplyFormID = quer.First().MeetingApplyFormID;
                    DataAccess.Mapping.MeetingAndRoom m = new MeetingAndRoom();
                    m.Status             = 2;
                    m.MeetingApplyFormID = meetingApplyFormID;
                    m.MeetingRoomID      = mar.MeetingRoomID;
                    dc.MeetingAndRoom.InsertOnSubmit(m);
                    dc.SubmitChanges();
                }
            }
            Apply.Set(context, meetingApplyForm);
        }
        protected override void Execute(CodeActivityContext context)
        {
            // Create an Assignment class and populate its properties
            Assignment a = new Assignment();

            a.WorkflowID   = context.WorkflowInstanceId;
            a.LeadID       = LeadID.Get(context);
            a.DateAssigned = DateTime.Now;
            a.AssignedTo   = AssignedTo.Get(context);
            a.Status       = "Assigned";
            a.DateDue      = DateTime.Now + TimeSpan.FromDays(5);

            PersistAssignment persist = context.GetExtension <PersistAssignment>();

            persist.AddAssignment(context.WorkflowInstanceId, a, "Insert");

            // Store the request in the OutArgument
            Assignment.Set(context, a);
        }
Ejemplo n.º 5
0
        protected override void Execute(NativeActivityContext context)
        {
            // Get the connection string
            DBExtension ext = context.GetExtension <DBExtension>();

            if (ext == null)
            {
                throw new InvalidProgramException("No connection string available");
            }

            // Query the Lead table
            LeadDataDataContext dc = new LeadDataDataContext(ext.ConnectionString);

            dc.Refresh(RefreshMode.OverwriteCurrentValues, dc.Leads);
            Lead l = dc.Leads.SingleOrDefault <Lead>
                         (x => x.WorkflowID == context.WorkflowInstanceId);

            if (l == null)
            {
                throw new InvalidProgramException
                          ("The Lead was not found in the database");
            }

            l.AssignedTo = AssignedTo.Get(context);
            l.Status     = "Assigned";

            // Enlist on the current transaction
            RuntimeTransactionHandle rth = new RuntimeTransactionHandle();

            rth = context.Properties.Find(rth.ExecutionPropertyName)
                  as RuntimeTransactionHandle;
            if (rth != null)
            {
                Transaction t = rth.GetCurrentTransaction(context);
                dc.Connection.EnlistTransaction(t);
            }

            dc.SubmitChanges();

            // Store the request in the OutArgument
            Lead.Set(context, l);
        }