4.4. Summary

A lot happened in this chapter. The framework for all screens is now developed and linked in with the business logic layer and the data access layer built in the previous two chapters. Most of the code is not in the pages themselves — it is either in the master page or in the business layer, and the pages the user sees become quite trivial to code.

Note the following key points to remember for the menu controls:

  • Records that do not have a ParentENTMenuItemId will appear on the tabs at the top of the screen.

  • Any record that has a ParentENTMenuItemId will appear on the side menu in the TreeView control.

  • The side menu can have nested nodes in the TreeView control. This is controlled by the ParentENTMenuItemId.

  • Use the DisplaySequence to set the order in which you want the menu item to appear.

  • If the menu item has a URL, it will appear as a link on the menu; otherwise, it will appear as a label.

  • The menu is cached in the Globals class.

The key points to remember when implementing a grid page are as follows:

  • Use the PaidTimeOffEditGrid.master page.

  • Add a MasterType tag in the HTML markup that points to the PaidTimeOffEditGrid.master page.

  • Inherit from the BasePage class.

  • Hook up the AddButton_Click event handler in the Page_Load event.

  • Add a Response.Redirect statement in the AddButton_Click event that redirects the user to the edit page and pass an ID of zero in the query string. Be sure to encrypt the query string.

  • Override the MenuItemName with the side menu or top menu that belongs to the page.

  • Add a custom grid control to display the data to the user.

  • Add code in the Page_Load event to set the custom GridView's ListClassName.

  • Add code in the Page_Load event to set the custom GridView's LoadMethodName.

  • Add code in the Page_Load event to add the columns you want to display in the grid.

  • Add constants that represent the column index for each column in the grid.

  • Add code to the RowDataBound event to add controls to each row in the GridView. Usually, there is at least an Edit link that navigates to the edit page. Any query strings should be encrypted.

Keep in mind the following key points when implementing an edit page:

  • Use the PaidTimeOffEditPage.master page.

  • Add a MasterType tag in the HTML markup that points to the PaidTimeOffEditPage.master page.

  • Inherit from the BaseEditPage class.

  • Hook up the SaveButton_Click and CancelButton_Click event handlers in the Page_Load event.

  • Add a Response.Redirect in the GoToGridPage method that redirects the user to the list page.

  • Override the MenuItemName with the side menu or top menu that belongs to this page.

  • Add code to the LoadControls method to load list boxes or drop-down lists. If there is nothing to load, then remove the NotImplementedException from the method.

  • Add a call to the GoToGridPage method in the CancelButton_Click event.

  • Add a constant for the ViewState key that contains the serialized edit object.

  • Add code to the SaveButton_Click event that creates an ENTValidationErrors object, loads the edit object with the values from the screen, calls the save method, and displays any errors or redirects to the list page by calling the GoToGridPage method if there are no errors.

  • Add the HTML and ASP.NET controls to display the data on the form.

  • Add code to the LoadObjectFromScreen method that maps the values in the controls to the properties on the object.

  • Add code to the LoadScreenFromObject method that maps the properties of the object to the controls on the screen.

So far, this book has covered the data layer, the business logic layer, and now the user interface. Only one more chapter is considered part of the core framework before getting into the functionality of the application that uses this pattern. The next chapter discusses exception handling and creates a standard for managing exceptions in this application. Once you've finished the next chapter, you'll be ready to start building the functionality of the application or even take the base classes in the first five chapters and start building your own applications.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.5.86