Example: Simple Maintain Table Screen

From OpenPetra Wiki
Jump to navigation Jump to search

Example Screens

There are two example screens for two different scenarios: the first one needs to be used for DB Tables where the Primary Key is a String, the second example for for DB Tables where the Primary Key is a number.

Example Screen Where the Primary Key of the DB Table is a String

The example screen can be found here:

   U:\openpetraorg\csharp\ICT\Petra\Client\MPersonnel\gui\setup\AbilityAreaSetup.yaml
   U:\openpetraorg\csharp\ICT\Petra\Client\MPersonnel\gui\setup\AbilityAreaSetup.ManualCode.cs

That's how it looks like:

Simple Maintain Table Screen Example

Example Screen Where the Primary Key of the DB Table is a Number

Those screens are marked with '(*5)' in the 'Comment' column!

The example screen can be found here:

   U:\openpetraorg\csharp\ICT\Petra\Client\MPersonnel\gui\setup\AbilityLevelSetup.yaml
   U:\openpetraorg\csharp\ICT\Petra\Client\MPersonnel\gui\setup\AbilityLevelSetup.ManualCode.cs

That's how it looks like:

TODO

How to Copy the Example Screens

When copying one of the example screens as a starting point for the individual Maintain Table screens the layout does not need to be changed because it is identical for all of the screens. There is only one exception to that for the screens where the Primary Key of the DB Table is a string: the width of the TextBox for the 'Code' (=the first TextBox in the Detail Panel) as the number of characters which can be entered there is varying for each of the screens [see DB definition 'varchar(X)', where X is the number of characters allowed]:

  • don't specify a width if the varchar value is greater than 10, we will go with the default with (which is 150 pixel) in this case;
  • if the varchar value is lower than 10: specify a width that allows the number of characters to be displayed ('Width=xxx').
  • For the screens which are marked with '(*5)' in the 'Comment' column: make the 'Code' TextBox as wide as needed for displaying two-digit numbers (the maximum value is '99' for those TextBoxes).

Methods in the ManualCode.cs file

  • 'RunOnceOnActivationManual': This Method needs to be in the ManualCode.cs file but you don't need to change anything in that Method.
  • 'EnableDisableUnassignableDate': This Method needs to be in the ManualCode.cs file but you don't need to change anything in that Method.
  • 'GetDetailDataFromControlsManual': This method needs to be left out of all ManualCode.cs files except for the ManualCode.cs files of screens where this manual assignment is needed (for instance in screen 'Positions').

See this wiki section for an explanation of these Methods.