Question Networked Till Software - datatypes

supersi

New member
Joined
Dec 5, 2009
Messages
4
Programming Experience
1-3
Hi,

I'm writing the software to control tills in a club that are networked together. The tills are to acts as slaves connected to a MySQL database on a backend server. All the sales will be recorded on the backend server. Also, the products and layout for the tills are stored in the MySQL db.

My thought was to connect to the db from the till at startup (of the software) and retrieve the till layout and product tables (only about 150 rows in the product table) and save this data into memory so that it can be accessed quickly (i.e. so that a request isn't send over the network to the MySQL server everytime a product button is pressed to retrieve product price etc).

What would be the best method for saving this data ? A datatable or a collection ? or something different. The tills are touchscreen and I'm planning on using the tag property to store the product id for each button. Therefore the stored data would need to be queried to return the product price, then the product id, name and price are added to another temporary data store, maybe an arraylist ?

Once the transaction is complete, the data is then sent to the MySQL server and stored permanently.

My main query is how to handle the data on the slave (till) machines ?

Any help/advice is much appreciated

Si
 
You would retrieve the data into a DataTable to begin with regardless. Whether you would then transfer it to a custom object of your own creation depends on how you want to use it. If you'll keep referring to it repeatedly then your own class would be good, otherwise just use the DataTable.
 
I had decided on a DataTable to retrieve the data from the database as I can use the MySqlDataAdapter to fill the DataTable based on a SQL Select statement.

What would be the best way to access/store the datatable ? At the moment I have a module with an initialisation sub that is triggered from the splash screen load. I have a public datatable in the module that is populated when the initialisation occurs. Then I have functions within the module to retrieve specific data from the datatable. i.e. to return the product price/name based on the productID. Is this the correct/best way to do it ? It seems very procedural and not OOP, but I need to data to be accessible globally (from different forms)

My next query is that I need a variable that will hold the items in the transaction. My thought was an arraylist of a structure (that's how I've done it previously) but I also now need to make it such that I can have multiple lists linked to different users. i.e. if one user doesn't finish their transaction and another user logs in, then when the previous user logs in their contents are still there.
The thoughts I've had for this are to create a class that stores the items for the transaction then create a new object for each user. But that would mean that an object is instantiated for a user who may never log in. Would it be possible to create an object for a user and dispose of the object when the transaction is complete. So that when they log in it can check if that user has an instantiated object linked to them, if so continue using that, if not start a new object ? If the latter is possible, would you hold the instantiated object in a collection ?

Any help, ideas, examples would be very much appreciated.

Si
 
If you have two tills behind the same bar, and user A logged out of till 1, would it be useful if they could log back in to till 2 to carry on the transaction?
 
I thought about that and in that case I'd use a temporary table on the backend server, but the guy who it's for said that he only wanted the continuation to be on one till. I'm still tempted to it on the backend server, because I think that's the right way to do it.

I'm just wondering about the user to be able to login to 2 or more tills at the same time and whether that would be an issue. Or whether it would be advisable to create a user lock so that if a user is logged in no more connections can be made by that user, until the lock is cleared.

Then I could either hold the data locally at runtime and only transfer to the backend server if the user changed or maintain the whole transaction on the backend server ?

What is the opinion on running everything off the backend server as oppose to using the software locally for most part and only use the backend server to complete the transaction ?

Many thanks,
Si
 
The tills are to acts as slaves connected to a MySQL database
WOuldnt be my first choice of database; I know it's free, but it'll cost a lot to develop for. There are cheaper free databases

so that a request isn't send over the network to the MySQL server everytime a product button is pressed to retrieve product price etc).
You'd be amazed how quick this is. On a LAN, there's be nearly no point in going to the effort to cache this data locally; it will be retrieved so quickly your users won't even notice (unless you do something really daft with the query)


My main query is how to handle the data on the slave (till) machines ?

Seems sensible that you can use the DB to define the layout of the screens.. every product can have an X, Y, ID and Description. The till will query the DB, add buttons to the form at the X and Y, with the specified Text and the ID.. You could at this moment store price info too (make a small object class to assign to the tag instead of a string) - depends if it will change or go unavailable during the night depending on sales
 
Cjard,

Thank for relplying to my queries.

The reason for choosing MySQL is that I have quite a bit of experience with it as I do a lot of PHP/MySQL web programming, but I'm willing to consider and learn different DB systems if they would suit this language better. I also used to do quite a bit with VB6 and MSAccess, but decided to jump and learn VB.NET and move away from the access db to a server orientated one.

At the moment I have 6 layout options on the main screen, one for popular drinks, then one for beers, one for spirits etc. The DB has a table for layouts:
layoutID | layoutName | btn1ID | btn1Colour | btn2ID | btn2Colour ... btn45Colour
1 | Popular | 1 | Red | 5 | Green etc
2 | Beers | 1 | Red | 2 | Red etc

There are 45 product buttons available per each layout and there are 6 buttons for layouts. The buttons are generated dynamically at run time, within a panel.
Each time I click a layout button it clears all the buttons within the panel and recreates the new ones, based on the current layout. This is one of the things I'd like to cache locally. At the moment I'm using a datatable that retrieves the whole layout table off the server and then scrolls through the datatable for a particular layoutID and creates the new buttons. I'm open to opinions on this... should I be creating a class to hold the layout info. i.e. 6 instances of the class for the 6 layouts ?

The products don't have an X and Y, the buttons are created with a loop nested inside another loop. (i.e. for i=0 to 8/for j=0 to 4/next j/next i) to create the 45 buttons. There is a separate layout table to define the button layouts (see previous paragraph).

I'm thinking to maybe use a tab control and add all the buttons for each layout (6 tabs), then all the buttons are created and don't need recreating each time a layout is changed - is there a performance difference doing it this way ? Could the tab control be created at startup and stored globally, then imported into the transaction form each time a transaction occurs ?

Each product has 3 prices - discounted, normal, event. There is a separate schedule table to let the software know which price to use. This event is triggered each time a new transaction takes place. I like the idea of assigning a small object class to the tag, would you then generate the transaction locally using this info in the small object classes, then either transfer that to a sale/saleitems table if the transaction completes or a temporary table if the user is logged out of the station ?

I'm racking my head to look at the best design for doing this. Any help, opinions, ideas would be very much appreciated

Si
 

Latest posts

Back
Top