Example: Simple Maintain Table Screen: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
(Created page with '==Example Screen== The example screen can be found here: U:\openpetraorg\csharp\ICT\Petra\Client\lib\MPersonnel\gui\setup\AbilityAreaSetup.yaml U:\openpetraorg\csharp\ICT…')
 
No edit summary
Line 12: Line 12:
* 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).
* 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).


===Explanation of Methods in the ManualCode.cs file===
===Methods in the ManualCode.cs file===
* '<code>RunOnceOnActivationManual</code>' is necessary to prevent the user from changing the value of the Control '<code>chkDetailDeletableFlag</code>'. The WinForms Generator does this automatically if a Control named '<code>chkDetailDeletable</code>' exists, but as in those screens the database field ends with the suffix '<code>_flag_l</code>', the Control ends with the suffix '<code>...Flag</code>' and the Generator cannot find it and therefore not deactivate it automatically. This Method needs to be in the ManualCode.cs file but you don't need to change anything in that Method.
* '<code>RunOnceOnActivationManual</code>': This Method needs to be in the ManualCode.cs file but you don't need to change anything in that Method.
* '<code>EnableDisableUnassignableDate</code>' is enabling/disabling as well as clearing the content of the Control '<code>dtpDetailUnassignableDate</code>' if the user is changing the value of Control '<code>chkDetailUnassignableFlag</code>'. This Method needs to be in the ManualCode.cs file but you don't need to change anything in that Method.
* '<code>EnableDisableUnassignableDate</code>': This Method needs to be in the ManualCode.cs file but you don't need to change anything in that Method.
* '<code>GetDetailDataFromControlsManual</code>': This method is needed ''only'' in case a column in a DB Table has the constraint 'NOT NULL' ''and'' if this column is not put on the Maintain Table screen. Under those circumstances an Exception would be thrown in case the user would try to save changed data using the 'Save' button. The reason for that is that openPETRA wouldn't assign a value to that DB Table column (not even empty string, "") as it is not used in the screen. '<code>GetDetailDataFromControlsManual</code>' gets around this problem by manually assigning an empty string value to such DB Table columns before the changed data is sent to the PetraServer for saving. ''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')''.
* '<code>GetDetailDataFromControlsManual</code>': ''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 [[How-To: Creating a Maintain Table_screen#Explanation_of_Commonly_Used_Methods_in_the_ManualCode.cs_File|this wiki section]] for an explanation of these Methods.

Revision as of 05:00, 18 December 2010

Example Screen

The example screen can be found here:

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

That's how it looks like:

Simple Maintain Table Screen Example

When copying the example screen 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: 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.