The buttons follow a special
naming convention that makes them identifiable from the code.
All button names start with submit and end with the ID of the department. In the middle of the name is the code
for the button type, which specifies what operation to do with the mentioned department. This code can be one of
the following:
??? add_dept for the Add buttons
??? edit_dept for the Edit buttons
??? update_dept for the Update buttons
??? delete_dept for the Delete buttons
??? edit_cat for the Edit Categories buttons
The object recognizes which button was clicked and knows what to do after parsing the list of posted variables
and reading the clicked button??™s name. A button named submit_edit_dept_1 tells the presentation object to
enter edit mode for the department with a department_id value of 1.
Note that with the Add department button, the department??™s ID specified in the button name becomes irrelevant,
because its value is automatically generated by the database (department_id is an AUTO_INCREMENT column).
Depending on the type of the clicked button, one of the corresponding business tier methods is called. Let??™s
consider these methods next.
Implementing the Business Tier
You called four middle tier methods from the AdminDepartments class. Now it??™s time to add
their business tier counterparts:
??? GetDepartmentsWithDescriptions returns the list of departments to be displayed in the
department??™s administration page.
Pages:
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412