Exemplo n.º 1
0
        protected override bool Execute(CodeActivityContext context)
        {
            string p = Command.Get(context);
            string s = Arguments.Get(context);

            Process          RunProc = new Process();
            ProcessStartInfo psi     = new ProcessStartInfo(p, s);

            psi.RedirectStandardOutput = true;
            psi.RedirectStandardError  = true;
            psi.UseShellExecute        = false;
            RunProc.StartInfo          = psi;
            RunProc.Start();
            string output = RunProc.StandardOutput.ReadToEnd();
            string error  = RunProc.StandardError.ReadToEnd();

            RunProc.WaitForExit();

            var record = new CustomTrackingRecord("Info");

            record.Data.Add(new KeyValuePair <string, object>("Message", output + "\n" + error));
            context.Track(record);

            int exitCode = RunProc.ExitCode;

            if (exitCode > 0)
            {
                record = new CustomTrackingRecord("Error");
                record.Data.Add(new KeyValuePair <string, object>("Message", "Command exited with Error Code = " + exitCode));
                context.Track(record);
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
        protected override void Execute(CodeActivityContext context)
        {
            try
            {
                bool useSSL = context.GetValue(UseSSL);

                string[] RecieverList = To.Get(context).Split(';');
                var      mailMessage  = new System.Net.Mail.MailMessage();
                foreach (string address in RecieverList)
                {
                    if (address.Trim() != "")
                    {
                        mailMessage.To.Add(address.Trim());
                    }
                }

                mailMessage.Subject = Subject.Get(context);
                mailMessage.Body    = Body.Get(context);

                //Get email setting from extension
                IEmailSetting settings = context.GetExtension <IEmailSetting>();

                if (settings != null)
                {
                    var FromAddress = settings.GetAddress();
                    var Host        = settings.GetHost();
                    var UserName    = settings.GetUsername();
                    var Password    = settings.GetPassword();

                    if (FromAddress == null | Host == null | UserName == null | Password == null)
                    {
                        var record = new CustomTrackingRecord("Warning");
                        record.Data.Add(new KeyValuePair <string, object>("Message", "E-mail extension not configured. Please make sure to run the workflow with the environment variables configured."));
                        context.Track(record);
                        return;
                    }

                    mailMessage.From = new System.Net.Mail.MailAddress(FromAddress);
                    var smtp = new System.Net.Mail.SmtpClient();
                    smtp.Host        = Host;
                    smtp.Credentials = new System.Net.NetworkCredential(UserName, Password);
                    smtp.EnableSsl   = useSSL;
                    smtp.Send(mailMessage);
                }
                else
                {
                    var record = new CustomTrackingRecord("Warning");
                    record.Data.Add(new KeyValuePair <string, object>("Message", "E-mail extension not found. Please make sure to run the workflow with a configured EmailSetting extension."));
                    context.Track(record);
                }
            }
            catch (Exception ex)
            {
                var record = new CustomTrackingRecord("Warning");
                record.Data.Add(new KeyValuePair <string, object>("Message", "Error while sending e-mail.\n" + ex.ToString()));
                context.Track(record);
            }
        }
        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);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Writes an event into the log database.
        /// </summary>
        /// <param name="e"></param>
        public void LogEvent(Event e)
        {
            e.UserGuid        = this.userGuid;
            e.JobGuid         = this.jobGuid;
            e.ContextGuid     = this.contextGuid;
            e.EventSource     = EventSource.Registry;
            e.ExecutionStatus = ExecutionStatus.Closed;


            // Logging is different inside activities
            if (activityContext == null)
            {
                // Direct logging invoked from code running outside a workflow.
                // Event will be written directly into the database.

                e.EventOrder = ++eventOrder;

                Logger.Instance.LogEvent(e);
            }
            else
            {
                // Logging event sent by code running inside a workflow.
                // In this case event will be routed to the workflow
                // tracking service.

                System.Activities.Tracking.CustomTrackingRecord r =
                    new System.Activities.Tracking.CustomTrackingRecord("Jhu.Graywulf.Logging");

                r.Data.Add("Jhu.Graywulf.Logging.Event", e);

                activityContext.Track(r);
            }
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
 // If your activity returns a value, derive from CodeActivity<TResult>
 // and return the value from the Execute method.
 protected override void Execute(CodeActivityContext context)
 {
     context.Track(
         new CustomTrackingRecord(WorkItemStatus.Get(context))
     {
         Data =
         {
             { CustomProgressTrackingDataKey.Target,  Item.Get(context)            },
             { CustomProgressTrackingDataKey.Message, ProgressMessage.Get(context) }
         }
     });
 }
Exemplo n.º 7
0
        private void LogMessage(BuildMessageImportance logLevel, CodeActivityContext context, string message)
        {
            BuildInformationRecord <BuildMessage> record =
                new BuildInformationRecord <BuildMessage>()
            {
                Value = new BuildMessage()
                {
                    Importance = logLevel,
                    Message    = message,
                },
            };

            context.Track(record);
        }
Exemplo n.º 8
0
            protected override void Execute(CodeActivityContext context)
            {
                Console.WriteLine("In CustomActivity.Execute");
                CustomTrackingRecord customRecord = new CustomTrackingRecord("OrderIn")
                {
                    Data =
                    {
                        { "OrderId",             200 },
                        { "OrderDate", "20 Aug 2001" }
                    }
                };

                // Emit CustomTrackingRecord
                context.Track(customRecord);
            }
Exemplo n.º 9
0
        protected override void Execute(CodeActivityContext context)
        {
            DateTime startLookup = DateTime.Now;

            string symbol = StockSymbol.Get(context);
            double price = knownSymbols[symbol];
            Value.Set(context, price);

            DateTime endLookup = DateTime.Now;

            TimeSpan lookupTime = endLookup - startLookup;
            CustomTrackingRecord userRecord = new CustomTrackingRecord("QuoteLookupEvent");
            userRecord.Data.Add("LookupTime", lookupTime.TotalMilliseconds);
            userRecord.Data.Add("Units", "Milliseconds");
            context.Track(userRecord);
        }
Exemplo n.º 10
0
        protected override void Execute(CodeActivityContext context)
        {
            // Get the connection string
            DBConnection ext = context.GetExtension <DBConnection>();

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

            // Lookup the QueueInstance
            UserTasksDataContext dc = new UserTasksDataContext(ext.ConnectionString);

            dc.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, dc.QueueInstances);
            QueueInstance qi = dc.QueueInstances.SingleOrDefault(x => x.QueueInstanceKey == QueueInstanceKey.Get(context));

            if (qi == null)
            {
                throw new InvalidProgramException("The specified request (" + QueueInstanceKey.Get(context) + ") was not found");
            }

            if (qi.AssignedOperatorID != null)
            {
                qi.AssignedOperatorID = null;
                qi.AssignedDate       = null;

                // Update the QueueInstance record
                PersistQueueInstance persist = context.GetExtension <PersistQueueInstance>();
                persist.AddQueueInstance(qi);
            }

            // Add a custom track record
            CustomTrackingRecord userRecord = new CustomTrackingRecord("UnAssign")
            {
                Data =
                {
                    { "QueueInstanceKey", qi.QueueInstanceKey  },
                    { "SubQueueID",       qi.CurrentSubQueueID },
                    { "QC",               qi.QC                }
                }
            };

            // Emit the custom tracking record
            context.Track(userRecord);
        }
Exemplo n.º 11
0
        protected override void Execute(CodeActivityContext context)
        {
            // create and set the record data
            CustomTrackingRecord customRecord = new CustomTrackingRecord("ActionExecuted");
            customRecord.Data.Add("HiringRequestId", this.HiringRequestId.Get(context));
            customRecord.Data.Add("State", this.State.Get(context));
            customRecord.Data.Add("Date", DateTime.Now);
            customRecord.Data.Add("Action", this.Action.Get(context));
            customRecord.Data.Add("Comment", this.Comment.Get(context));
            if (this.Employee.Get(context) != null)
            {
                customRecord.Data.Add("EmployeeId", this.Employee.Get(context).Id);
                customRecord.Data.Add("EmployeeName", this.Employee.Get(context).Name);
            }

            // emit the record
            context.Track(customRecord);
        }
Exemplo n.º 12
0
        protected override void Execute(CodeActivityContext context)
        {
            DateTime startLookup = DateTime.Now;

            string symbol = StockSymbol.Get(context);
            double price  = knownSymbols[symbol];

            Value.Set(context, price);

            DateTime endLookup = DateTime.Now;

            TimeSpan             lookupTime = endLookup - startLookup;
            CustomTrackingRecord userRecord = new CustomTrackingRecord("QuoteLookupEvent");

            userRecord.Data.Add("LookupTime", lookupTime.TotalMilliseconds);
            userRecord.Data.Add("Units", "Milliseconds");
            context.Track(userRecord);
        }
        /// <summary>
        /// Messages are logged to build log if the user instructed us to log (through the VerboseLogging argument) or if an error occured
        /// </summary>
        private void LogMessage(String message, CodeActivityContext context, bool isError = false)
        {
            bool shouldLog = context.GetValue(this.VerboseLogging);
            if (shouldLog || isError)
            {
                BuildInformationRecord<BuildMessage> record =
                  new BuildInformationRecord<BuildMessage>()
                  {
                      Value = new BuildMessage()
                      {
                          Importance = BuildMessageImportance.High,
                          Message = message,
                      },
                  };

                context.Track(record);
            }
        }
Exemplo n.º 14
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);

            // 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);
        }
        protected override void Execute(CodeActivityContext context)
        {
            // create and set the record data
            CustomTrackingRecord customRecord = new CustomTrackingRecord("ActionExecuted");

            customRecord.Data.Add("HiringRequestId", this.HiringRequestId.Get(context));
            customRecord.Data.Add("State", this.State.Get(context));
            customRecord.Data.Add("Date", DateTime.Now);
            customRecord.Data.Add("Action", this.Action.Get(context));
            customRecord.Data.Add("Comment", this.Comment.Get(context));
            if (this.Employee.Get(context) != null)
            {
                customRecord.Data.Add("EmployeeId", this.Employee.Get(context).Id);
                customRecord.Data.Add("EmployeeName", this.Employee.Get(context).Name);
            }

            // emit the record
            context.Track(customRecord);
        }
Exemplo n.º 16
0
        protected override void Execute(CodeActivityContext context)
        {
            if (!Active.Get(context))
            {
                return;
            }

            try
            {
                string DirPath = DirectoryPath.Get(context);
                string ZipPath = ZipFileName.Get(context);

                ZipFile.CreateFromDirectory(DirPath, ZipPath);
            }
            catch (Exception ex)
            {
                var record = new CustomTrackingRecord("Warning");
                record.Data.Add(new KeyValuePair <string, object>("Message", "Error while zipping.\n" + ex.ToString()));
                context.Track(record);
            }
        }
Exemplo n.º 17
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            Guid   CurrentWorkflowInstanceId;
            string Mess = Message.Get(executionContext);
            PropertyDescriptorCollection pr = executionContext.DataContext.GetProperties();
            PropertyDescriptor           ph = pr.Find(ActivitiesSettings.InParamNameWorkflowInstanceId, true);

            if (ph != null)
            {
                string v = ph.GetValue(executionContext.DataContext).ToString();
                try
                {
                    if (!string.IsNullOrEmpty(Mess) && Mess.Length > 1023)
                    {
                        Mess = Mess.Substring(0, 1023);
                    }

                    CurrentWorkflowInstanceId = Guid.Parse(v);
                    ARM_Service.WWF_Write_Log_Message(CurrentWorkflowInstanceId, Mess);
                }
                catch
                {
                    return;
                }
            }

            Mess = "Сообщение в лог>> " + Mess;
            if (ActivitiesSettings.runMode == ActivitiesSettings.enumWorkFlowRunMode.UserNotifyServer)
            {
                Console.WriteLine(Mess);
            }
            else
            {
                WriteLineTrackingRecord WLRecord = new WriteLineTrackingRecord();
                WLRecord.WriteLineMessage = Mess;
                executionContext.Track(WLRecord);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// The execute.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        protected override void Execute(CodeActivityContext context)
        {
            var text = context.GetValue(this.Text);

            // Debug.WriteLine(text);
            switch (this.Level)
            {
                case TraceLevel.Error:
                    Trace.TraceError(text);
                    break;
                case TraceLevel.Info:
                    Trace.TraceInformation(text);
                    break;
                case TraceLevel.Verbose:
                    WorkflowTrace.Information(text, this.Category);
                    break;
                case TraceLevel.Warning:
                    Trace.TraceWarning(text);
                    break;
            }

            if (this.Level != TraceLevel.Off)
            {
                var trackRecord = new CustomTrackingRecord(this.Category, this.Level);
                trackRecord.Data.Add("Text", text);
                trackRecord.Data.Add("Category", this.Category);

                context.Track(trackRecord);
            }
        }
        /// <summary>
        /// Logs a message to the build summary.
        /// </summary>
        /// <param name="message">The message to the build summary.</param>
        public void LogMsg(string message)
        {
            var importance = new CustomTrackingRecord(string.Format("TrackBuildMessage {0} {1}", BuildMessageImportance.High, message));

            _context.Track(importance);
        }
Exemplo n.º 20
0
 protected override void Execute(CodeActivityContext context)
 {
     context.Track(new TestCustomTrackingRecord("MyRecord") { Value = CustomTrackingTraceTests.TestValue });
 }
Exemplo n.º 21
0
 private void TrackMessage(CodeActivityContext context, string message)
 {
     context.Track(new BuildInformationRecord<BuildMessage>
     {
         Value = new BuildMessage()
         {
             Importance = BuildMessageImportance.Normal,
             Message = message,
         },
     });
 }
Exemplo n.º 22
0
        protected override void Execute(CodeActivityContext context)
        {
            string text = context.GetValue(this.Text);

            switch (Level)
            {
                case System.Diagnostics.TraceLevel.Error:
                    Trace.TraceError(text);
                    break;
                case System.Diagnostics.TraceLevel.Info:
                    Trace.TraceInformation(text);
                    break;
                case System.Diagnostics.TraceLevel.Verbose:
                    Trace.WriteLine(text, Category);
                    break;
                case System.Diagnostics.TraceLevel.Warning:
                    Trace.TraceWarning(text);
                    break;
            }

            if (Level != System.Diagnostics.TraceLevel.Off)
            {
                var trackRecord = new CustomTrackingRecord(Category, Level);
                trackRecord.Data.Add("Text", text);
                trackRecord.Data.Add("Category", Category);

                context.Track(trackRecord);
            }
        }
        // Si la actividad devuelve un valor, se debe derivar de CodeActivity<TResult>
        // y devolver el valor desde el método Execute.
        protected override void Execute(CodeActivityContext context)
        {
            Log.Debug("Inicio Actividad.");
            //// LLaves
            string GmapKey          = ConfigurationManager.AppSettings["GmapKey"];
            string BmapKey          = ConfigurationManager.AppSettings["BmapKey"];
            string GplacespKey      = ConfigurationManager.AppSettings["GplacespKey"];
            string FoursquareId     = ConfigurationManager.AppSettings["FoursquareId"];
            string FoursquareSecret = ConfigurationManager.AppSettings["FoursquareSecret"];
            string Openweathermap   = ConfigurationManager.AppSettings["Openweathermap"];
            string Apixu            = ConfigurationManager.AppSettings["Apixu"];

            WorkflowEntity dataEntry = context.GetValue(this.Data);

            List <ParkingEntity> listEntity = new List <ParkingEntity>();
            List <Service>       items      = new List <Service>();

            int totalCoordinatesOrigins     = dataEntry.LatitudeOrigins.Length;
            int totalCoordinatesDestinatios = dataEntry.LatitudeDestinations.Length;

            ////Cargar la configuracion
            using (StreamReader r = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + @"\" + "config.txt"))
            {
                string jsons = r.ReadToEnd();
                items = JsonConvert.DeserializeObject <List <Service> >(jsons);
            }

            //-----
            //Tomar un solo servicio
            items = items.GroupBy(c => c.methodValue, (key, c) => c.FirstOrDefault()).ToList();
            //y consultar los datos
            foreach (Service itemService in items)
            {
                switch (itemService.methodValue)
                {
                case "BestPlace":
                    break;

                case "BestRoad":
                    for (int i = 0; i < totalCoordinatesOrigins; i++)
                    {
                        for (int j = 0; j < totalCoordinatesDestinatios; j++)
                        {
                            string key      = itemService.url.Contains("google") ? GmapKey : BmapKey;
                            string urlFinal = string.Format(itemService.url,
                                                            dataEntry.LatitudeOrigins[i], dataEntry.LongitudeOrigins[i],
                                                            dataEntry.LatitudeDestinations[j], dataEntry.LongitudeDestinations[j],
                                                            "driving", key);

                            Task <string> resultt = ConsumeGetAsync(urlFinal);

                            listEntity.Add(new ParkingEntity
                            {
                                Destination = new Coordinates
                                {
                                    Latitude  = dataEntry.LatitudeDestinations[j],
                                    Longitude = dataEntry.LongitudeDestinations[j]
                                }
                            });
                        }
                    }
                    break;

                case "BestWeather":
                    break;

                default:
                    break;
                }
            }

            // devolver la lista final
            //-----


            CustomTrackingRecord record = new CustomTrackingRecord("MyRecord-Get-Init");

            record.Data.Add(new KeyValuePair <String, Object>("ExecutionTime", DateTime.Now));
            context.Track(record);
        }
Exemplo n.º 24
0
        protected override void Execute(CodeActivityContext context)
        {
            // Get the connection string
            DBConnection ext = context.GetExtension <DBConnection>();

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

            UserTasksDataContext dc = new UserTasksDataContext(ext.ConnectionString);

            Queue    q          = null;
            SubQueue sq         = null;
            int      queueID    = 0;
            int      subQueueID = 0;

            if (QueueName.Get(context) != "" && SubQueueName.Get(context) != "None")
            {
                // Lookup the queue and subqueue
                q = dc.Queues.SingleOrDefault(x => x.QueueName == QueueName.Get(context));
                if (q == null)
                {
                    throw new InvalidProgramException("The specified queue (" + QueueName.Get(context) + ") was not found");
                }

                sq = dc.SubQueues.SingleOrDefault(x => x.QueueID == q.QueueID &&
                                                  x.SubQueueName == SubQueueName.Get(context));
                if (sq == null)
                {
                    throw new InvalidProgramException("The specified subqueue (" +
                                                      QueueName.Get(context) + " - " +
                                                      SubQueueName.Get(context) + ") was not found");
                }

                queueID    = q.QueueID;
                subQueueID = sq.SubQueueID;
            }

            // Lookup the QueueInstance
            dc.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, dc.QueueInstances);
            QueueInstance qi = dc.QueueInstances.SingleOrDefault(x => x.QueueInstanceKey == QueueInstanceKey.Get(context));

            if (qi == null)
            {
                throw new InvalidProgramException("The specified request (" + QueueInstanceKey.Get(context) + ") was not found");
            }

            // Assign the QueueInstance to this subqueue
            if (sq != null)
            {
                qi.CurrentSubQueueID = sq.SubQueueID;
            }
            else
            {
                qi.CurrentSubQueueID = null;
            }

            qi.AssignedDate       = null;
            qi.AssignedOperatorID = null;
            qi.QC       = false;
            qi.Priority = null;

            // Update the QueueInstance record
            PersistQueueInstance persist = context.GetExtension <PersistQueueInstance>();

            persist.AddQueueInstance(qi);

            // Add a custom track record
            CustomTrackingRecord userRecord = new CustomTrackingRecord("Route")
            {
                Data =
                {
                    { "QueueInstanceKey", qi.QueueInstanceKey  },
                    { "SubQueueID",       qi.CurrentSubQueueID }
                }
            };

            // Emit the custom tracking record
            context.Track(userRecord);
        }
Exemplo n.º 25
0
        protected override void Execute(CodeActivityContext context)
        {
            // Get the connection string
            DBConnection ext = context.GetExtension <DBConnection>();

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

            // Lookup the Queue
            UserTasksDataContext dc = new UserTasksDataContext(ext.ConnectionString);
            Queue q = dc.Queues.SingleOrDefault(x => x.QueueName == QueueName.Get(context));

            if (q == null)
            {
                throw new InvalidProgramException("The specified queue (" + QueueName.Get(context) + ") was not found");
            }

            SubQueue s = dc.SubQueues
                         .SingleOrDefault(x => x.QueueID == q.QueueID &&
                                          x.SubQueueName == SubQueueName.Get(context));

            if (s == null)
            {
                throw new InvalidProgramException("The specified sub-queue (" + SubQueueName.Get(context) + ") was not found");
            }

            // Create and initialize a QueueInstance object
            QueueInstance qi = new QueueInstance();

            qi.QueueInstanceKey  = Guid.NewGuid();
            qi.CurrentSubQueueID = s.SubQueueID;
            qi.CreateDate        = DateTime.UtcNow;
            qi.InstanceID        = context.WorkflowInstanceId;

            // Setup the initial values
            qi.AssignedDate       = null;
            qi.AssignedOperatorID = null;
            qi.QC       = false;
            qi.Priority = null;

            // Insert the Request record
            PersistQueueInstance persist = context.GetExtension <PersistQueueInstance>();

            persist.AddQueueInstance(qi);

            // Return the QueueInstance object
            QueueInstanceKey.Set(context, qi.QueueInstanceKey);

            CustomTrackingRecord userRecord = new CustomTrackingRecord("Start")
            {
                Data =
                {
                    { "QueueInstanceKey", qi.QueueInstanceKey  },
                    { "SubQueueID",       qi.CurrentSubQueueID }
                }
            };

            // Emit the custom tracking record
            context.Track(userRecord);
        }
Exemplo n.º 26
0
            protected override void Execute(CodeActivityContext context)
            {
                Console.WriteLine("In CustomActivity.Execute");
                CustomTrackingRecord customRecord = new CustomTrackingRecord("OrderIn")
                {
                    Data =
                            {
                                {"OrderId", 200},
                                {"OrderDate", "20 Aug 2001"}
                            }
                };

                // Emit CustomTrackingRecord
                context.Track(customRecord);
            }