Order processing

This small application allows to enter - and update - goods, customers and orders. Not more, not less. It is based on access to a database - in our case we use a small client/server protocol which finally uses the Eiffel STORABLE class for persistent store.

It is easy possible to replace this by any other storage format - just change the SERVER and the CLIENT class. We show these classes in a separate page - just for your information. Then we need a main program - and this main program contains the only connection with the RAD tool - the only one call of display.

The whole system is based on the following classes:

In addition we need the following support classes:

class DB_ACCESS

feature

	db: CLIENT is
		once
			!! Result
		end

end -- class DB_ACCESS
class DB_ITEM

feature

	number: INTEGER

	set_number (n: INTEGER) is
		do
			number := n
		end

end -- class DB_ITEM
class MAIN

inherit
	DISPLAYABLE
	DB_ACCESS

creation
	make

feature

	make is
		local
			order: ORDER
		do
			db.open;
			display (1);
			db.server.close
		end

end -- class MAIN

Look at the picture below, which demonstrates the main screen of the application.

We press the New Order button in order to open the window below. Now we can select customer and different line items:

We decided to press the Select Customer button. The result is the list of actual customers. We select one and press Update:

Now we can update the address information and the name - but not the turnover:

 We return and can select a new line item.

Now the windows looks as one can see above ...

We changed the numbers of items for each line item by entering the proper number (in our case a 4) into the edit field beside Enter Item. Finally we press Accept in order to store the actual order - and can inspect all orders.

We should mention that these windows appear stacked on the screen  as one can see on the right.

Of course we can now change everything - similar as we have done it with the with the calculator example. To do this we must start the interface builder and open our project. It consists of 7 windows. We will have a short look into one if them - the new order, which is associated to the ORDER class.

We open this window and show the property of the Select Customer button - to be exact the action connected with this button.

It tells us that at first the routine display(2) of  the CLIENT class is called. From the picture above we can see that the form#2 of CLIENT is called Customer List - it will open a subwindow to select the customer. Then the local routine set_customer with the parameter actual_customer of the CLIENT will be called.

We demonstrated how we specify the columns of the listbox. This is done with the proper property tab: With drag and drop we can move all available features with basic (or STRING) types to the selection. In our case it is trivial to remove for example the street and to include the actual turnover.

In the next step we specify the action performed when an element of the list is clicked (in fact here nothing happens) or double-clicked. In our case two things happen:

This seems to be enough for a first view on our example. It is probably possible to see how it can be expanded - and how our virtual machine concept can be expanded in order to produce big real life applications.


Copyright © Object Tools -- info@object-tools.com
Last updated: 2005/02/02 11:51:14