Пример #1
0
        protected override void Execute(CodeActivityContext context)
        {
            // Create a Lead class and populate it with the input arguments
            Lead l = new Lead();

            l.ContactName  = ContactName.Get(context);
            l.ContactPhone = ContactPhone.Get(context);
            l.Interests    = Interests.Get(context);
            l.Comments     = Notes.Get(context);
            l.WorkflowID   = context.WorkflowInstanceId;
            l.Status       = "Open";

            // Get the connection string
            DBExtension ext = context.GetExtension <DBExtension>();

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

            // Insert a record into the Lead table
            LeadDataDataContext dc =
                new LeadDataDataContext(ext.ConnectionString);

            dc.Leads.InsertOnSubmit(l);
            dc.SubmitChanges();

            // Store the request in the OutArgument
            Lead.Set(context, l);
        }
Пример #2
0
        protected override void Execute(CodeActivityContext context)
        {
            // Create a Lead class and populate it with the input arguments
            Lead l = new Lead();

            l.ContactName  = ContactName.Get(context);
            l.ContactPhone = ContactPhone.Get(context);
            l.Interests    = Interests.Get(context);
            l.Comments     = Notes.Get(context);
            l.WorkflowID   = context.WorkflowInstanceId;
            l.Status       = "Open";

            // Add this to the work queue to be persisted later
            PersistLead persist = context.GetExtension <PersistLead>();

            persist.AddLead(l, "Insert");

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

            // Add a custom track record
            CustomTrackingRecord userRecord = new CustomTrackingRecord("New Lead")
            {
                Data =
                {
                    { "Name",  l.ContactName  },
                    { "Phone", l.ContactPhone }
                }
            };

            // Emit the custom tracking record
            context.Track(userRecord);
        }
Пример #3
0
        public async void FillFilters()
        {
            for (int i = 0; i < DateTime.Now.Year - 2017; i++)
            {
                cboYear.Items.Add((2018 + i).ToString());
            }
            string[] months = { "January",   "February", "March",    "April", "May", "June", "July", "August",
                                "September", "October",  "November", "December" };
            cboMonth.Items.AddRange(months);

            Interests interest = new Interests();

            cboPaymentTerm.DataSource    = interest.Get();
            cboPaymentTerm.ValueMember   = "Id";
            cboPaymentTerm.DisplayMember = "Description";

            Users user = new Users();

            cboCollector.DataSource = await user.GetAll();

            cboCollector.ValueMember   = "Id";
            cboCollector.DisplayMember = "Name";

            cboYear.SelectedIndex        = -1;
            cboMonth.SelectedIndex       = -1;
            cboPaymentTerm.SelectedIndex = -1;
            cboCollector.SelectedIndex   = -1;
        }
        private void LoadInterest()
        {
            cboPaymentTerm.DataSource    = interests.Get();
            cboPaymentTerm.ValueMember   = "Id";
            cboPaymentTerm.DisplayMember = "Description";

            cboPaymentTerm.SelectedIndex = -1;
        }
Пример #5
0
        public ActionResult interests()
        {
            Interests f = new Interests();

            f.Get();

            return(View("interests", f));
        }
Пример #6
0
        public EnterLead()
        {
            // Define the variables used by this workflow
            Variable <Lead> lead = new Variable <Lead> {
                Name = "lead"
            };

            // Define the SendRequest workflow
            this.Implementation = () => new Sequence
            {
                DisplayName = "EnterLead",
                Variables   = { lead },
                Activities  =
                {
                    new CreateLead
                    {
                        ContactName = new InArgument <string>
                                          (env => ContactName.Get(env)),
                        ContactPhone = new InArgument <string>
                                           (env => ContactPhone.Get(env)),
                        Interests = new InArgument <string>
                                        (env => Interests.Get(env)),
                        Notes            = new InArgument <string>(env => Notes.Get(env)),
                        ConnectionString = new InArgument <string>
                                               (env => ConnectionString.Get(env)),
                        Lead = new OutArgument <Lead>(env => lead.Get(env)),
                    },
                    new WriteLine
                    {
                        Text = new InArgument <string>
                                   (env => "Lead received [" + Rating.Get(env).ToString()
                                   + "]; waiting for assignment"),
                        TextWriter = new InArgument <TextWriter> (env => Writer.Get(env))
                    },
                    new InvokeMethod
                    {
                        TargetType = typeof(ApplicationInterface),
                        MethodName = "NewLead",
                        Parameters =
                        {
                            new InArgument <Lead>(env => lead.Get(env))
                        }
                    },
                    new WaitForInput <Lead>
                    {
                        BookmarkName = "GetAssignment",
                        Input        = new OutArgument <Lead>(env => lead.Get(env))
                    },
                    new WriteLine
                    {
                        Text = new InArgument <string>
                                   (env => "Lead assigned [" + Rating.Get(env).ToString()
                                   + "] to " + lead.Get(env).AssignedTo),
                        TextWriter = new InArgument <TextWriter> (env => Writer.Get(env))
                    }
                }
            };
        }
        public void Get()
        {
            Basic               basicGet      = new Basic(this.userId);
            Appearance          appearanceGet = new Appearance(this.userId);
            Interests           interestsGet  = new Interests(this.userId);
            Lifestyle           lifestyleGet  = new Lifestyle(this.userId);
            Values              valuesGet     = new Values(this.userId);
            Username            usernameGet   = new Username(this.userId);
            WelcomeMessage      welcomeGet    = new WelcomeMessage(this.userId);
            PersonalDescription personalGet   = new PersonalDescription(this.userId);

            basicGet.Get();
            this.BasicProperties = basicGet;


            appearanceGet.Get();
            this.AppearanceProperties = appearanceGet;


            interestsGet.Get();
            this.InterestsProperties = interestsGet;


            lifestyleGet.Get();
            this.LifestyleProperties = lifestyleGet;


            valuesGet.Get();
            this.ValuesProperties = valuesGet;


            usernameGet.Get();
            this.UsernameValue = usernameGet;


            welcomeGet.Get();
            this.WelcomeMessageProperties = welcomeGet;

            personalGet.Get();
            if (personalGet.About.Length < 246)
            {
                this.DescriptionLowResolution = personalGet.About + "&nbsp;...";
            }
            else
            {
                this.DescriptionLowResolution = personalGet.About.Substring(0, 245) + "&nbsp;...";
            }
        }
Пример #8
0
        protected override void Execute(CodeActivityContext context)
        {
            // Create a Lead class and populate it with the input arguments
            Lead l = new Lead();

            l.ContactName  = ContactName.Get(context);
            l.ContactPhone = ContactPhone.Get(context);
            l.Interests    = Interests.Get(context);
            l.Comments     = Notes.Get(context);
            l.WorkflowID   = context.WorkflowInstanceId;
            l.Status       = "Open";

            // Insert a record into the Lead table
            LeadDataDataContext dc =
                new LeadDataDataContext(ConnectionString.Get(context));

            dc.Leads.InsertOnSubmit(l);
            dc.SubmitChanges();

            // Store the request in the OutArgument
            Lead.Set(context, l);
        }
Пример #9
0
        public EnterLead()
        {
            // Define the variables used by this workflow
            Variable <Lead> lead = new Variable <Lead> {
                Name = "lead"
            };
            Variable <string> assignedTo = new Variable <string> {
                Name = "assignedTo"
            };

            // Define the SendRequest workflow
            this.Implementation = () => new Sequence
            {
                DisplayName = "EnterLead",
                Variables   = { lead, assignedTo },
                Activities  =
                {
                    new CreateLead
                    {
                        ContactName = new InArgument <string>
                                          (env => ContactName.Get(env)),
                        ContactPhone = new InArgument <string>
                                           (env => ContactPhone.Get(env)),
                        Interests = new InArgument <string>
                                        (env => Interests.Get(env)),
                        Notes = new InArgument <string>(env => Notes.Get(env)),
                        Lead  = new OutArgument <Lead>(env => lead.Get(env)),
                    },
                    new WriteLine
                    {
                        Text = new InArgument <string>
                                   (env => "Lead received [" + Rating.Get(env).ToString()
                                   + "]; waiting for assignment"),
                        TextWriter = new InArgument <TextWriter> (env => Writer.Get(env))
                    },
                    new InvokeMethod
                    {
                        TargetType = typeof(ApplicationInterface),
                        MethodName = "NewLead",
                        Parameters =
                        {
                            new InArgument <Lead>(env => lead.Get(env))
                        }
                    },
                    new AddComment
                    {
                        Comment = new InArgument <string>(env => "Lead has been created")
                    },
                    new WaitForInput <string>
                    {
                        BookmarkName = "GetAssignment",
                        Input        = new OutArgument <string>(env => assignedTo.Get(env))
                    },
                    new TransactionScope
                    {
                        Body = new Sequence
                        {
                            Activities =
                            {
                                new AssignLead
                                {
                                    AssignedTo = new InArgument <string>(env => assignedTo.Get(env)),
                                    Lead       = new OutArgument <Lead>(env => lead.Get(env)),
                                },
                                new Delay
                                {
                                    Duration = TimeSpan.FromSeconds(20)
                                },
                                new CreateAssignment
                                {
                                    AssignedTo = new InArgument <string>(env => assignedTo.Get(env)),
                                    LeadID     = new InArgument <int>(env => lead.Get(env).LeadID),
                                }
                            }
                        },
                    },
                    new InvokeMethod
                    {
                        TargetType = typeof(ApplicationInterface),
                        MethodName = "UpdateLead",
                        Parameters =
                        {
                            new InArgument <Lead>(env => lead.Get(env))
                        }
                    },
                    new AddComment
                    {
                        Comment = new InArgument <string>(env => "Lead is being assigned")
                    },
                    new WriteLine
                    {
                        Text = new InArgument <string>
                                   (env => "Lead assigned [" + Rating.Get(env).ToString()
                                   + "] to " + lead.Get(env).AssignedTo),
                        TextWriter = new InArgument <TextWriter> (env => Writer.Get(env))
                    }
                }
            };
        }
        public EnterLead()
        {
            // Define the variables used by this workflow
            Variable <Lead> lead = new Variable <Lead> {
                Name = "lead"
            };
            Variable <string> assignedTo = new Variable <string> {
                Name = "assignedTo"
            };
            Send send = new Send
            {
                OperationName       = "Assign",
                ServiceContractName = "CreateAssignment",
                Content             = new SendParametersContent
                {
                    Parameters =
                    {
                        {
                            "leadID",
                            new InArgument <int> (env => lead.Get(env).LeadID)
                        },
                        {
                            "assignedTo",
                            new InArgument <string>(env => assignedTo.Get(env))
                        }
                    }
                },
                EndpointAddress = new InArgument <Uri>
                                      (env => new Uri("http://localhost/CreateAssignment")),
                Endpoint = new Endpoint
                {
                    Binding = new BasicHttpBinding()
                }
            };

            // Define the SendRequest workflow
            this.Implementation = () => new Sequence
            {
                DisplayName = "EnterLead",
                Variables   = { lead, assignedTo },
                Activities  =
                {
                    new CreateLead
                    {
                        ContactName = new InArgument <string>
                                          (env => ContactName.Get(env)),
                        ContactPhone = new InArgument <string>
                                           (env => ContactPhone.Get(env)),
                        Interests = new InArgument <string>
                                        (env => Interests.Get(env)),
                        Notes = new InArgument <string>(env => Notes.Get(env)),
                        //ConnectionString = new InArgument<string>(env => ConnectionString.Get(env)),
                        Lead = new OutArgument <Lead>(env => lead.Get(env)),
                    },
                    new WriteLine
                    {
                        Text = new InArgument <string>
                                   (env => "Lead received [" + Rating.Get(env).ToString()
                                   + "]; waiting for assignment"),
                        TextWriter = new InArgument <TextWriter>
                                         (env => Writer.Get(env))
                    },
                    new InvokeMethod
                    {
                        TargetType = typeof(ApplicationInterface),
                        MethodName = "NewLead",
                        Parameters =
                        {
                            new InArgument <Lead>(env => lead.Get(env))
                        }
                    },
                    new AddComment
                    {
                        Comment = new InArgument <string>(env => "Lead has been created")
                    },



                    new WaitForInput <string>
                    {
                        BookmarkName = "GetAssignment",
                        Input        = new OutArgument <string>(env => assignedTo.Get(env))
                    },
                    //funziona capitolo 15
                    //new TransactionScope
                    //{
                    //    Body = new Sequence
                    //    {
                    //        Activities =
                    //        {

                    //            new AssignLead
                    //            {
                    //            AssignedTo = new InArgument<string>(env => assignedTo.Get(env)),
                    //            Lead = new InOutArgument<Lead>(env => lead.Get(env)),
                    //            },
                    //            new Delay
                    //            {
                    //            Duration = TimeSpan.FromSeconds(20)
                    //            },
                    //            new CreateAssignment
                    //            {
                    //            AssignedTo = new InArgument<string>(env => assignedTo.Get(env)),
                    //            LeadID = new InArgument<int>(env => lead.Get(env).LeadID),
                    //            }
                    //        }
                    //    },
                    // },
                    new AssignLead
                    {
                        AssignedTo = new InArgument <string>
                                         (env => assignedTo.Get(env)),
                        Lead = new InOutArgument <Lead>(env => lead.Get(env)),
                    },
                    new CorrelationScope
                    {
                        Body = new Sequence
                        {
                            Activities =
                            {
                                send,
                                new ReceiveReply
                                {
                                    Request = send
                                }
                            }
                        }
                    },

                    new InvokeMethod
                    {
                        TargetType = typeof(ApplicationInterface),
                        MethodName = "UpdateLead",
                        Parameters =
                        {
                            new InArgument <Lead>(env => lead.Get(env))
                        }
                    },

                    new AddComment
                    {
                        Comment = new InArgument <string>(env => "Lead is being assigned")
                    },
                    new WriteLine
                    {
                        Text = new InArgument <string>
                                   (env => "Lead assigned [" + Rating.Get(env).ToString()
                                   + "] to " + lead.Get(env).AssignedTo),
                        TextWriter = new InArgument <TextWriter>
                                         (env => Writer.Get(env))
                    }
                }
            };
        }