cs 8628 – n-tier client-serverarchitectures, dr. guimaraes taskmaster ken crosson cs 8628, summer...
TRANSCRIPT
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
TaskMaster
Ken Crosson
CS 8628, Summer 2003
Priority Manager
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Sequence of Tasks
• Add task on handheld or desktop• Set task attributes (priority, description, due
date, etc.)• Synchronize remote and consolidated databases
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Project Description
This program tracks prioritized tasks. The user is able to create, categorize, prioritize, and update tasks, and synchronize his task list between his handheld and desktop computers.
The program uses a SQL Server database as the consolidated database, with an Ultralite database on the handheld.
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Logical Schema
This schema was produced in Microsoft Visio
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Physical Schema (DDL)
CREATE TABLE [dbo].[tbActivity] ([ActivityID] [uniqueidentifier] NOT NULL ,[Name] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[Description] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]GO
CREATE TABLE [dbo].[tbCategory] ([CategoryID] [uniqueidentifier] NOT NULL ,[Name] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[Description] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]GO
CREATE TABLE [dbo].[tbNote] ([NoteID] [uniqueidentifier] NOT NULL ,[TaskID] [uniqueidentifier] NOT NULL ,[DateCreated] [datetime] NULL ,[Note] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]GO
CREATE TABLE [dbo].[tbStatus] ([StatusID] [int] IDENTITY (1, 1) NOT NULL ,[Name] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[Description] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]GO
CREATE TABLE [dbo].[tbTask] ([TaskID] [uniqueidentifier] NOT NULL ,[Name] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[Description] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[DateCreated] [datetime] NULL ,[DateDue] [datetime] NULL ,[DateDueOriginal] [datetime] NULL ,[DateCompleted] [datetime] NULL ,[CategoryID] [uniqueidentifier] NOT NULL ,[Priority] [int] NULL ,[StatusID] [int] NOT NULL
) ON [PRIMARY]GO
CREATE TABLE [dbo].[tbTaskActivity] ([TaskActivityID] [uniqueidentifier] NOT NULL ,[TaskID] [uniqueidentifier] NOT NULL ,[Note] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[DateCreated] [datetime] NULL ,[ActivityID] [uniqueidentifier] NOT NULL
) ON [PRIMARY]GO
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Matrix: Forms vs. Tables
Tables
Forms
Activity Task Category TaskActivity
Note Status
Activity CRUD
Task CR CRUD CR CRUD CRUD R
Category CRUD
TaskActivity
R R CRUD CRUD
Note CRUD
Status R
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Publication Script # 1
CREATE PUBLICATION pub_tasks ( TABLE tbTask (TaskID, Name, Description, DateCreated, DateDue, Status, Priority, Category ) );
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Synchronization Script
CREATE SYNCHRONIZATION SUBSCRIPTION TO pub_taskFOR sub_userTYPE 'tcpip'ADDRESS 'host=localhost'
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Difficulties Encountered
• Unfamiliar technology has made this very difficult.
• AppForge product is somewhat less user-friendly than it could be.
• New technology provides faster, easier ways to achieve the same result.
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Screen Snapshot # 1
This screenshot shows a Task being displayed in the Task form. Updates are achieved by clicking the "Save" button. Deletes can be done by clicking the "Delete" button. Creates are done using the "New" button. Navigation is accomplished using the "<<" and ">>" buttons.
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Code Sample # 1
Public Sub LoadTasks()On Error GoTo ErrHandler Dim conn_parms As String Dim open_parms As String Dim schema_parms As String conn_parms = "uid=DBA;pwd=SQL" open_parms = conn_parms & ";" & "FILE_NAME=" & App.Path & "\TaskMaster.udb" schema_parms = open_parms & ";" & "SCHEMA_FILE=" & App.Path & "\TaskMaster.usm" On Error Resume Next Set Connection = DatabaseMgr.OpenConnection(open_parms) If Err.Number <> ulSQLE_NOERROR Then If Err.Number = ULSQLCode.ulSQLE_DATABASE_NOT_FOUND Then Err.Clear Set Connection = DatabaseMgr.CreateDatabase(schema_parms) Else MsgBox Err.Description & Err.Source End If End If Set oTaskTable = Connection.GetTable("tbTask") oTaskTable.Open oTaskTable.MoveBeforeFirst oTaskTable.MoveFirst If Err.Number <> ULSQLCode.ulSQLE_NOERROR Then MsgBox Err.Description ExitHandler: Exit SubErrHandler: RaiseErr Me, "LoadTasks"End Sub
This code connects to the TaskMaster database, and opens the tbTask table.
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Code Sample # 2
• Private Sub AddNew()• Dim sName As String• Dim sDescription As String• Dim dDate As Date• Dim nStatus As Integer• Dim nCategory As Integer• Dim nPriority As Integer
• sName = txtName.Text• sDescription = txtDescription.Text• If IsDate(txtDate.Text) Then• dDate = CDate(txtDate.Text)• Else• dDate = Date• End If• nStatus = cboStatus.ListIndex• nCategory = cboCategory.ListIndex• nPriority = cboPriority.ListIndex• • On Error GoTo InsertError• oTaskTable.InsertBegin• oTaskTable.Column("Name").StringValue = sName• oTaskTable.Column("Description").StringValue = sDescription• oTaskTable.Column("DateDue").DatetimeValue = dDate• oTaskTable.Column("Status").IntegerValue = nStatus• oTaskTable.Column("Category").IntegerValue = nCategory• oTaskTable.Column("Priority").IntegerValue = nPriority• oTaskTable.Insert• oTaskTable.MoveLast• DisplayCurrentRow• Exit Sub
• InsertError:• MsgBox "Error: " & CStr(Err.Description)• End Sub
This code inserts a new Task record into the database.
CS 8628 – n-tier Client-ServerArchitectures, Dr. Guimaraes
Conclusion
• AppForge’s MobileVB environment is an acceptable way to develop for for the PocketPC, but in many ways is inferior to the environment provided by VisualStudio.NET.
• Ultralite for MobileVB is a useful tool for deploying and synchronizing remote databases, but could stand to be more intuitive.