![]() Gravitybox WebSchedule.NET
1998-2005 Gravitybox Software LLC
Page 50 of 65
controller, given a connection string, connects to the specified database and queries for
providers, rooms, categories, and appointments. You need only one line of code to load
and one line of code to save. The code below demonstrates.
'Get all appointments
ScheduleDomainController1.GetScheduleDataSet("")
'Get appointments from a date range
Schedule1.DataSource = ScheduleDomainController1.GetScheduleDataSet( _
"", #1/1/2005#, #1/31/2005#)
'Get a specific appointment by IDSchedule1.DataSource =
Schedule1.DataSource = ScheduleDomainController1.GetScheduleDataSet( _
"", "163c61b3-504e-4e45-b1af-ebfe205fa141")
There are currently three different ways to query the database based on different
criteria. They are shown above. You only need to call one of them to load the schedule.
There is however only one way to update the database as follows.
ScheduleDomainController1.UpdateData("", Schedule1.DataSource)
When the dataset is updated, you need to immediately re-query the database to avoid
getting an error.
You will also notice that the first parameter is set to empty string. In the database
schema defined there is an account_guid that parses all objects into account buckets.
This allows you to build applications that load only data specific to one account. This is
quite useful if you are building an application that you wish to use to host different,
distinct users. For example, you may want to build an application for dentists and also
you want to host the dentists data. If you sell your application to multiple dentists then
you need some way to separate each dentist data. None of the doctor practices need
(nor do you want them) to know about each other. You could host all of the offices data
in the same database and no office would be aware of any other office, since each
piece of data is marked with a specific account. In the above example, I assume that
you have only one account and it is empty string.
The ScheduleController makes all of this seamless. You need only setup your database
properly. This means making sure that at least the minimal amount of fields are in table
and the proper stored procedures are present. This is all provided as SQL scripts in the
installation application.
WebController
The ScheduleController is fine if you have direct access to the database server.
However, in todays world of distributed applications and global networks, often it is
desirable to build robust client applications that integrate with remote databases. You
can write your own remoting objects to create proxies that your application accesses
across the Internet, or you can use the Gravitybox WebController. This companion
|