示例#1
0
        private static void CreateAndInsertTrackingProfile()
        {
            TrackingProfile profile = new TrackingProfile();

            // Create an activity track point, used for tracking data from Code Activities.
            ActivityTrackPoint codeActivityTrackPoint = new ActivityTrackPoint();

            // Create an ActivityTrackingLocation to be added to the track point.
            ActivityTrackingLocation codeActivityTrackingLocation = new ActivityTrackingLocation("CodeActivity");

            codeActivityTrackingLocation.MatchDerivedTypes = true;
            // Add the location "Closed" event to track.
            codeActivityTrackingLocation.ExecutionStatusEvents.Add(ActivityExecutionStatus.Closed);
            codeActivityTrackPoint.MatchingLocations.Add(codeActivityTrackingLocation);

            // Create a WorkflowDataTrackingExtract for extracting data from the Balance property.
            WorkflowDataTrackingExtract balanceWorkflowTrackingExtract = new WorkflowDataTrackingExtract();

            balanceWorkflowTrackingExtract.Member = "Balance";

            // Create an activity track point, used for tracking data in the custom activity "ServiceCharge".
            ActivityTrackPoint       customActivityTrackPoint       = new ActivityTrackPoint();
            ActivityTrackingLocation customActivityTrackingLocation = new ActivityTrackingLocation("ServiceCharge");

            // Create an ActivityTrackingLocation to be added to the track point
            customActivityTrackingLocation.ExecutionStatusEvents.Add(ActivityExecutionStatus.Closed);
            customActivityTrackPoint.MatchingLocations.Add(customActivityTrackingLocation);

            // Create an ActivityDataTrackingExtract for extracting Fee property data from the ServiceCharge activity.
            ActivityDataTrackingExtract feeActivityTrackingExtract = new ActivityDataTrackingExtract();

            feeActivityTrackingExtract.Member = "Fee";

            // Add extracts to the activity tracking points.
            codeActivityTrackPoint.Extracts.Add(balanceWorkflowTrackingExtract);
            customActivityTrackPoint.Extracts.Add(feeActivityTrackingExtract);

            profile.ActivityTrackPoints.Add(codeActivityTrackPoint);
            profile.ActivityTrackPoints.Add(customActivityTrackPoint);
            profile.Version = new Version("3.0.0.0");

            // Serialize the profile.
            TrackingProfileSerializer serializer = new TrackingProfileSerializer();
            StringWriter writer = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture);

            serializer.Serialize(writer, profile);
            String trackingprofile = writer.ToString();

            InsertTrackingProfile(trackingprofile);
        }
示例#2
0
        /// <summary>
        /// Loads create a Default profile
        /// </summary>
        /// <returns></returns>
        private static TrackingProfile GetDefaultProfile(Type workflowType)
        {
            TrackingProfile profile = new TrackingProfile();

            profile.Version = new Version(1, 0, 0, 0);

            // all activity events
            ActivityTrackPoint             atp = new ActivityTrackPoint();
            List <ActivityExecutionStatus> executionStatusLists = new List <ActivityExecutionStatus>();

            foreach (ActivityExecutionStatus status in Enum.GetValues(typeof(ActivityExecutionStatus)))
            {
                executionStatusLists.Add(status);
            }
            ActivityTrackingLocation activityTrackingLocation = new ActivityTrackingLocation(typeof(Activity), true, executionStatusLists);

            atp.MatchingLocations.Add(activityTrackingLocation);


            WorkflowDataTrackingExtract we = new WorkflowDataTrackingExtract("SetupId");

            atp.Extracts.Add(we);

            profile.ActivityTrackPoints.Add(atp);

            // all user TrackData events
            UserTrackPoint utp = new UserTrackPoint();

            UserTrackingLocation userTrackingLocation = new UserTrackingLocation();

            userTrackingLocation.ActivityType = typeof(Activity);
            //userTrackingLocation.MatchDerivedActivityTypes = true;
            userTrackingLocation.ArgumentType = typeof(object);
            //userTrackingLocation.MatchDerivedArgumentTypes = true;
            utp.MatchingLocations.Add(userTrackingLocation);

            profile.UserTrackPoints.Add(utp);

            // all workflow events
            WorkflowTrackPoint wftp = new WorkflowTrackPoint();

            foreach (TrackingWorkflowEvent evt in Enum.GetValues(typeof(TrackingWorkflowEvent)))
            {
                wftp.MatchingLocation.Events.Add(evt);
            }
            profile.WorkflowTrackPoints.Add(wftp);

            return(profile);
        }
示例#3
0
        private void CreateAndInsertTrackingProfile()
        {
            TrackingProfile          profile    = new TrackingProfile();
            ActivityTrackPoint       trackPoint = new ActivityTrackPoint();
            ActivityTrackingLocation location   = new ActivityTrackingLocation(typeof(Activity));

            // Specify tracking locations
            location.MatchDerivedTypes = true;

            foreach (ActivityExecutionStatus status in Enum.GetValues(typeof(ActivityExecutionStatus)))
            {
                location.ExecutionStatusEvents.Add(status);
            }

            trackPoint.MatchingLocations.Add(location);

            // Specify workflow properties to track
            WorkflowDataTrackingExtract dataExtract = new WorkflowDataTrackingExtract();

            dataExtract.Member = "UserId";
            trackPoint.Extracts.Add(dataExtract);

            dataExtract        = new WorkflowDataTrackingExtract();
            dataExtract.Member = "SessionId";
            trackPoint.Extracts.Add(dataExtract);

            dataExtract        = new WorkflowDataTrackingExtract();
            dataExtract.Member = "RegistrationStatus";
            trackPoint.Extracts.Add(dataExtract);

            // Update profile
            profile.ActivityTrackPoints.Add(trackPoint);
            profile.Version = new Version("3.0.0.1");

            // Serialize the profile
            TrackingProfileSerializer serializer = new TrackingProfileSerializer();
            StringWriter writer = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture);

            serializer.Serialize(writer, profile);
            string trackingprofile = writer.ToString();

            InsertTrackingProfile(trackingprofile);
        }
示例#4
0
        static TrackingProfile GetProfileWithWorkflowDataExtract()
        {
            //Create Tracking Profile
            TrackingProfile trackingProfile = new TrackingProfile();

            trackingProfile.Version = new Version("1.0.0");

            //Create Activity Track Point
            ActivityTrackPoint activityTrackPoint = new ActivityTrackPoint();

            //Create matchingActivityTrackingLocation
            ActivityTrackingLocation matchingActivityTrackingLocation = new ActivityTrackingLocation();

            //Set ActivityName = "activityName"
            matchingActivityTrackingLocation.ActivityTypeName = "activityName";
            //Add all possible ActivityExecutionStatus to the matchingActivityTrackingLocation Events
            IEnumerable <ActivityExecutionStatus> statuses = Enum.GetValues(typeof(ActivityExecutionStatus)) as IEnumerable <ActivityExecutionStatus>;

            foreach (ActivityExecutionStatus status in statuses)
            {
                matchingActivityTrackingLocation.ExecutionStatusEvents.Add(status);
            }

            //Create matchingActivityTrackingCondition where memberName = memberValue
            ActivityTrackingCondition matchingActivityTrackingCondition = new ActivityTrackingCondition("memberName", "memberValue");

            matchingActivityTrackingCondition.Operator = ComparisonOperator.Equals;

            //Add matchingActivityTrackingCondition to activityTrackingLocation
            matchingActivityTrackingLocation.Conditions.Add(matchingActivityTrackingCondition);

            //Add matchingActivityTrackingCondition to the matching locations for activityTrackPoint
            activityTrackPoint.MatchingLocations.Add(matchingActivityTrackingLocation);

            //Create excludedActivityTrackingLocation
            ActivityTrackingLocation excludedActivityTrackingLocation = new ActivityTrackingLocation();

            //Set ActivityName = "activityName"
            excludedActivityTrackingLocation.ActivityTypeName = "activityName";
            //Add Compensating ActivityExecutionStatus to the excludedActivityTrackingLocation Events
            excludedActivityTrackingLocation.ExecutionStatusEvents.Add(ActivityExecutionStatus.Compensating);

            //Add excludedActivityTrackingCondition to the excluded locations for activityTrackPoint
            activityTrackPoint.ExcludedLocations.Add(excludedActivityTrackingLocation);

            //Create workflowDataTrackingExtract to extract Workflow data "Name"
            WorkflowDataTrackingExtract workflowDataTrackingExtract = new WorkflowDataTrackingExtract();

            workflowDataTrackingExtract.Member = "Name";

            //Add workflowDataTrackingExtract to activityTrackPoint
            activityTrackPoint.Extracts.Add(workflowDataTrackingExtract);

            //Annotate activityTrackPoint with
            activityTrackPoint.Annotations.Add("Track Point Annotations");

            //Add ActivityTrackPoints to trackingProfile
            trackingProfile.ActivityTrackPoints.Add(activityTrackPoint);

            return(trackingProfile);
        }