TRACKING in Visual Basic .NET

Generation Data Matrix 2d barcode in Visual Basic .NET TRACKING

CHAPTER 13 TRACKING
Data Matrix Drawer In Visual Basic .NET
Using Barcode creation for .NET framework Control to generate, create Data Matrix ECC200 image in .NET framework applications.
www.OnBarcode.com
Recognize Data Matrix 2d Barcode In Visual Basic .NET
Using Barcode decoder for .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
Figure 13-5. The Friendly view from the Details tab Notice in the Data section that it includes the Name and Phone elements just like the ListBoxTrackingParticipant did.
PDF-417 2d Barcode Maker In Visual Basic .NET
Using Barcode generation for Visual Studio .NET Control to generate, create PDF-417 2d barcode image in .NET applications.
www.OnBarcode.com
UCC - 12 Generation In VB.NET
Using Barcode drawer for VS .NET Control to generate, create EAN128 image in .NET framework applications.
www.OnBarcode.com
SqlTrackingParticipant
Matrix Barcode Generator In Visual Basic .NET
Using Barcode generation for .NET framework Control to generate, create Matrix 2D Barcode image in .NET applications.
www.OnBarcode.com
GTIN - 13 Creation In Visual Basic .NET
Using Barcode encoder for .NET framework Control to generate, create UPC - 13 image in .NET applications.
www.OnBarcode.com
The last participant that you ll implement will write the events to a database. The tracking participant will receive the track events based on the queries defined in the TrackingProfile. The tracking participant is responsible for performing the database updates, which gives you complete control of how this is stored.
QR Code JIS X 0510 Encoder In VB.NET
Using Barcode drawer for Visual Studio .NET Control to generate, create QR image in .NET applications.
www.OnBarcode.com
Making Identcode In Visual Basic .NET
Using Barcode creator for VS .NET Control to generate, create Identcode image in VS .NET applications.
www.OnBarcode.com
Setting up the Database
ECC200 Drawer In Visual C#.NET
Using Barcode maker for Visual Studio .NET Control to generate, create ECC200 image in .NET framework applications.
www.OnBarcode.com
Data Matrix ECC200 Maker In .NET Framework
Using Barcode maker for Reporting Service Control to generate, create DataMatrix image in Reporting Service applications.
www.OnBarcode.com
The first step is to create the tables in the database. To store the four types of tracking events, you will use the following tables: TrackInstance TrackBookmark TrackActivity TrackCustom
Barcode Generator In Visual Studio .NET
Using Barcode printer for .NET Control to generate, create Barcode image in .NET applications.
www.OnBarcode.com
UCC - 12 Generator In None
Using Barcode creator for Office Excel Control to generate, create GTIN - 12 image in Office Excel applications.
www.OnBarcode.com
Run the Tracking.sql script in the Create Scripts folder and these four tables will be created.
Drawing Barcode In Java
Using Barcode generator for Android Control to generate, create Barcode image in Android applications.
www.OnBarcode.com
Make GS1 128 In .NET Framework
Using Barcode generation for .NET Control to generate, create EAN 128 image in .NET framework applications.
www.OnBarcode.com
CHAPTER 13 TRACKING
Code 128C Decoder In Visual Basic .NET
Using Barcode reader for .NET framework Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Recognize Barcode In C#
Using Barcode reader for .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Open the LeadData.dbml file, which should display the O/R Designer. In the Server Explorer, expand the 13 data connection to get the list of tables in the database. (If the tracking tables are not listed, right-click the data connection and choose Refresh.) Drag these four tables to the O/R Designer. The diagram should look like the one shown in Figure 13-6.
1D Barcode Drawer In C#
Using Barcode maker for VS .NET Control to generate, create Linear 1D Barcode image in .NET framework applications.
www.OnBarcode.com
Barcode Encoder In Visual C#.NET
Using Barcode generator for Visual Studio .NET Control to generate, create Barcode image in .NET framework applications.
www.OnBarcode.com
Figure 13-6. The O/R DesignerO/R Designer
Draw Code 3 Of 9 In None
Using Barcode drawer for Online Control to generate, create Code 39 image in Online applications.
www.OnBarcode.com
QR Code ISO/IEC18004 Reader In .NET Framework
Using Barcode decoder for .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
Note You might get a warning telling you that the data connection you re using is different from the one initially used by the O/R Designer because you initially created the LeadData.dbml file in 11 and used the 11 data connection. The warning asks if you want to update the connection used by the designer. You should choose Yes.
CHAPTER 13 TRACKING
Implementing the SqlTrackingParticipant
In the Solution Explorer, right-click the Extensions folder and choose Add Class. For the class name, enter SqlTrackingParticipant.cs. The implementation for this class is shown in Listing 13-4. Listing 13-4. Implementation of the SqlTrackingParticipant Class using using using using using System; System.Activities.Tracking; System.Collections.Generic; System.Text; System.Data.Linq;
namespace LeadGenerator { public class SqlTrackingParticipant : TrackingParticipant { private string _connectionString { get; set; } private const String participantName = "SqlTrackingParticipant"; public SqlTrackingParticipant(string connectionString) { _connectionString = connectionString; } protected override void Track(TrackingRecord record, TimeSpan timeout) { WorkflowInstanceRecord instanceTrackingRecord = record as WorkflowInstanceRecord; if (instanceTrackingRecord != null) { TrackInstance t = new TrackInstance(); t.WorkflowID = instanceTrackingRecord.InstanceId; t.Status = instanceTrackingRecord.State; t.EventDate = DateTime.UtcNow; // Insert a record into the TrackInstance table LeadDataDataContext dc = new LeadDataDataContext(_connectionString); dc.TrackInstances.InsertOnSubmit(t); dc.SubmitChanges(); } BookmarkResumptionRecord bookTrackingRecord = record as BookmarkResumptionRecord; if (bookTrackingRecord != null) { TrackBookmark t = new TrackBookmark();
CHAPTER 13 TRACKING
t.WorkflowID = bookTrackingRecord.InstanceId; t.BookmarkName = bookTrackingRecord.BookmarkName; t.EventDate = DateTime.UtcNow; // Insert a record into the TrackBookmark table LeadDataDataContext dc = new LeadDataDataContext(_connectionString); dc.TrackBookmarks.InsertOnSubmit(t); dc.SubmitChanges(); } ActivityStateRecord activityStateRecord = record as ActivityStateRecord; if (activityStateRecord != null) { TrackActivity t = new TrackActivity(); t.ActivityName = activityStateRecord.Activity.Name; t.WorkflowID = activityStateRecord.InstanceId; t.Status = activityStateRecord.State; t.EventDate = DateTime.UtcNow; // Concatenate all the variables into a string IDictionary<String, object> variables = activityStateRecord.Variables; StringBuilder s = new StringBuilder(); if (variables.Count > 0) { foreach (KeyValuePair<string, object> v in variables) { s.AppendLine(String.Format("{0}: Value = [{1}]", v.Key, v.Value)); } } // Store the variables string t.Variables = s.ToString(); // Insert a record into the TrackActivity table LeadDataDataContext dc = new LeadDataDataContext(_connectionString); dc.TrackActivities.InsertOnSubmit(t); dc.SubmitChanges(); } CustomTrackingRecord customTrackingRecord = record as CustomTrackingRecord; if (customTrackingRecord != null) {
CHAPTER 13 TRACKING
TrackCustom t = new TrackCustom(); t.WorkflowID = customTrackingRecord.InstanceId; t.CustomEventName = customTrackingRecord.Name; t.EventDate = DateTime.UtcNow; // Concatenate all the user data into a string string s = ""; if ((customTrackingRecord != null) && (customTrackingRecord.Data.Count > 0)) { foreach (string data in customTrackingRecord.Data.Keys) { if (s.Length > 1) s += "\r\n"; s += String.Format("{0}: Value = [{1}]", data, customTrackingRecord.Data[data]); } } t.UserData = s; // Insert a record into the TrackUser table LeadDataDataContext dc = new LeadDataDataContext(_connectionString); dc.TrackCustoms.InsertOnSubmit(t); dc.SubmitChanges(); } } } } As with the ListBoxTrackingParticipant, this class overrides the Track() method. A generic TrackingRecord is passed in to this method. It is then cast to the each of the four record types: WorkflowInstanceRecord, BookmarkResumptionRecord, ActivityStateRecord, and CustomTrackingRecord. If the cast succeeds, the subsequent code creates the corresponding LINQ class (TrackInstance, TrackBookmark, TrackActivity, or TrackCustom, respectively) that is then inserted into the database.
Copyright © OnBarcode.com . All rights reserved.