- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
FIRST WORKFLOW in Visual C#
CHAPTER 2 FIRST WORKFLOW Data Matrix 2d Barcode Creator In Visual C# Using Barcode creation for .NET Control to generate, create DataMatrix image in .NET framework applications. www.OnBarcode.comDecoding Data Matrix ECC200 In C#.NET Using Barcode reader for .NET framework Control to read, scan read, scan image in Visual Studio .NET applications. www.OnBarcode.comMake sure the name parameter to the Add method is the same as the public property name. For example, the first parameter to be added is PartNumber, and PartNumber is a public property of the workflow. If the parameters don t match, the value can t be passed. Also make sure to include CDate when passing a date value, and CInt when passing an integer value; otherwise, you ll get an Invalid Value error. Finally, change the CreateWorkflow line to the following: workflowInstance = workflowRuntime.CreateWorkflow(GetType(PurchaseOrderProcess), Parameters) This passes the Parameters dictionary object to the workflow. Following is the completed Sub Main code necessary to prompt for, read, and pass the necessary parameters for a purchase order: Shared Sub Main() Dim Parameters As New Dictionary(Of String, Object) Console.Write("("Enter the Part Number")") Parameters.Add("("PartNumber",",Console.ReadLine) Console.Write("Enter the Purchase Date:") Parameters.Add("PurchaseDate", Cdate(Console.ReadLine)) Console.Write("Enter the Expected Date:") Parameters.Add("ExpectedDate", Cdate(Console.ReadLine)) Console.Write("Enter the Buyer Login:") Parameters.Add("BuyerLogin", Console.ReadLine) Console.Write("Enter the Buyer Name:") Parameters.Add("BuyerName", Console.ReadLine) Console.Write("Enter the Quantity Ordered:") Parameters.Add("QuantityOrdered", Cint(Console.ReadLine)) Using workflowRuntime As New WorkflowRuntime() AddHandler workflowRuntime.WorkflowCompleted, AddressOf OnWorkflowCompleted AddHandler workflowRuntime.WorkflowTerminated, AddressOf OnWorkflowTerminated Dim workflowInstance As WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow( GetType(PurchaseOrderProcess), Parameters) workflowInstance.Start() WaitHandle.WaitOne() End Using End Sub The last change to be made to Module1.vb is to change the sub OnWorkflowCompleted. When the workflow is completed, the purchase order number is to be given back to the user. Change the OnWorkflowCompleted sub, as follows: Shared Sub OnWorkflowCompleted(ByVal sender As Object, ByVal e As WorkflowCompletedEventArgs) MsgBox("Purchase Order Number is: " & e.OutputParameters("PurchaseOrderNumber").ToString) WaitHandle.Set() End Sub Encode UPC Code In Visual C#.NET Using Barcode generator for VS .NET Control to generate, create Universal Product Code version A image in .NET applications. www.OnBarcode.comCreating EAN / UCC - 14 In C# Using Barcode printer for .NET Control to generate, create UCC.EAN - 128 image in Visual Studio .NET applications. www.OnBarcode.comCHAPTER 2 FIRST WORKFLOW
Painting EAN / UCC - 13 In Visual C# Using Barcode maker for Visual Studio .NET Control to generate, create GS1 - 13 image in .NET framework applications. www.OnBarcode.comBarcode Generation In C#.NET Using Barcode drawer for .NET Control to generate, create Barcode image in .NET framework applications. www.OnBarcode.comMake sure the WaitHandle.Set() line is after the message box line; otherwise, your workflow will complete before the message box can appear. The last steps in this process are to add a Code activity to the workflow, and to add all necessary code to insert the purchase order, determine the purchase order number, and then provide that purchase order number to the user. To start, add a Code activity to the workflow and name the Code activity AddPurchaseOrder. Generate handlers for the Code activity. Now, within the AddPurchaseOrder_ExecuteCode sub, you must build the SQL statement and execute it against the database to insert the purchase order record. Before you can interact with a database, you must determine the connection string that s necessary. Because this is a Windows-based application instead of a Web-based application, an app.config file can hold settings that you want to use later. Click the My Project link within Solution Explorer, which opens a form with several tabs down the left side. Click the Settings tab and a new page appears. However, this page only has a link that says This project does not contain a default settings file. Click here to create one. Click this link to create the app.config file for this project. When the settings form appears, change the name value in the first row to ConnString and use the drop-down list under Type to change the type to ConnectionString (the last one in the list). Your settings form looks like Figure 2-13. Making PDF-417 2d Barcode In Visual C# Using Barcode generator for VS .NET Control to generate, create PDF-417 2d barcode image in .NET applications. www.OnBarcode.comDraw Bookland EAN In C# Using Barcode maker for VS .NET Control to generate, create ISBN image in Visual Studio .NET applications. www.OnBarcode.comFigure 2-13. Application settings within My Project Click the ellipse at the right side of the Value column for the first row. This allows you to choose a data source. Choose Microsoft SQL Server and click Continue, as shown in Figure 2-14. Draw Data Matrix 2d Barcode In VS .NET Using Barcode drawer for ASP.NET Control to generate, create ECC200 image in ASP.NET applications. www.OnBarcode.comDrawing Data Matrix 2d Barcode In None Using Barcode drawer for Software Control to generate, create DataMatrix image in Software applications. www.OnBarcode.comFigure 2-14. Choose Microsoft SQL Server as the data source.
Generate Code 128B In None Using Barcode generation for Online Control to generate, create Code 128C image in Online applications. www.OnBarcode.comPDF417 Creation In Visual Studio .NET Using Barcode printer for ASP.NET Control to generate, create PDF417 image in ASP.NET applications. www.OnBarcode.comCHAPTER 2 FIRST WORKFLOW
Reading QR Code In None Using Barcode decoder for Software Control to read, scan read, scan image in Software applications. www.OnBarcode.comCreating Code 128C In .NET Framework Using Barcode encoder for ASP.NET Control to generate, create Code 128A image in ASP.NET applications. www.OnBarcode.comWhen the Connection Properties form appears, you can enter (local) as the server name. Leave Windows Authentication checked. This assumes that the account you re logged into on your computer is a SQL Server user and can use the Purchasing database. Click the drop-down for Database Name and choose Purchasing. If you don t see the Purchasing database, either you didn t enter (local) correctly (this must match exactly), or your login doesn t have access to the Purchasing database. If you see other databases, but not Purchasing, then the latter is correct; if you don t see any database names, then you didn t enter the Server Name correctly. If you re encountering a problem with using (local), you can use the drop-down list under Server Name to find your server s name. The completed connection properties look like Figure 2-15. GS1 - 12 Creation In None Using Barcode creator for Online Control to generate, create UPC-A Supplement 5 image in Online applications. www.OnBarcode.comPrint 1D Barcode In Java Using Barcode creation for Java Control to generate, create Linear Barcode image in Java applications. www.OnBarcode.comFigure 2-15. Completed connection properties Now the connection string has been established. Click the Save button to save the project properties and close the project properties. Next, view the code for the workflow and add a new sub called SQLInsertUpdate. This sub will do the work to insert the record and update the purchase order number. You ll call this Encode GS1 DataBar Stacked In Java Using Barcode maker for Java Control to generate, create DataBar image in Java applications. www.OnBarcode.comDrawing Barcode In Objective-C Using Barcode generation for iPhone Control to generate, create Barcode image in iPhone applications. www.OnBarcode.comEAN-13 Supplement 5 Decoder In Visual Studio .NET Using Barcode scanner for .NET Control to read, scan read, scan image in .NET framework applications. www.OnBarcode.comMatrix Barcode Creator In Visual Basic .NET Using Barcode encoder for .NET Control to generate, create 2D Barcode image in VS .NET applications. www.OnBarcode.com |
|