PRACTICAL COURSE: BLUESKY CHARTERS
9.0. Copy the BlueSkyCharters KB to your local disk.
This KB contains defined objects and has a .NET Web prototype model setup to get connected to SQL Server 2000. Data has been loaded in the database.
The created transactions contain a default Web Form as well as BlueSkyCharters business rules. Take some minutes to study the existing objects.
Part 1 - Entering data in Web Backoffice
Compile and execute the Developer Menu (Use Compile & Execute button).
Execute and observe the following behaviors:
Client side validation in web
We will see some examples of controls executed in the browser without performing a post to the server.
- In the Country Transaction
Enter to the 'Country' transaction and program a rule not to allow the country name to remain empty, and another rule to display a warning in case the Short Name is left empty. Try to enter a country in runtime leaving the name empty and then the Short Name empty. Try to use the IsEmpty() method (insted of the null() function) to query for the empty value of an attribute. Thus, you will see the advantage represented by the intellitips provided by the use of methods.
You will see that you do not need a roundtrip to the server to know the error. GeneXus
is automatically generating the required jscripts for the validation in the browser.
- In the Passengers Transaction
Define a flight passengers transaction where luggage overweight will be controlled. Note that it will be parallel to Flights.
In the structure, it should have:
TIP: bear in mind that, by typing "." when you enter an attribute in the structure, the transaction name is placed as prefix of the attribute name. Also remember the scroll between names starting with the same letters, using the keyboard arrows. You can also try the Domains inline definition as well as the formulas inline definition.
Modify theme Error and Messsages classes to try this feature.
The following formulas are defined:
PassOverweigth: It has been established that each passenger is allowed a maximum luggage weight of 50 kilos and there will be an additional charge equivalent to 5 kilos per each kilo exceeding the weight limit.
Besides, luggage must controlled so that passengers do not carry luggage weighting more than allowed by the charter, and passengers must be warned in case they carry more than two luggage items.
For this, you must define rules:
Error("Grant flight weight exceeded") if FliGrantWeight > CharterMaxHeight;
Msg("Warning: The passenger has more than two luggages") if PassLuggageQty > 2;
Execute the transaction and verify that these controls must be made not only in the server but also in the client.