home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / lancelot / linfonb.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  31.2 KB  |  708 lines

  1. /******************************************************************************
  2. * .FILE:         linfonb.cpp                                                  *
  3. *                                                                             *
  4. * .DESCRIPTION:  Lancelot Sample Program:              Class Implementation   *
  5. *                                                                             *
  6. * .CLASSES:      LInfoNotebook                                                *
  7. *                                                                             *
  8. * .COPYRIGHT:                                                                 *
  9. *                                                                             *
  10. * .DISCLAIMER:                                                                *
  11. *                                                                             *
  12. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  13. *                                                                             *
  14. ******************************************************************************/
  15.  
  16. #ifndef _IBASE_                         //Make sure ibase.hpp is included
  17.   #include <ibase.hpp>                  //  since that is where IC_<environ>
  18. #endif                                  //  is defined.
  19. #include <irect.hpp>
  20. #include <ifont.hpp>
  21. #include <istring.hpp>
  22. #include <ireslib.hpp>
  23. #include <ipagehdr.hpp>
  24. #include "linfowin.hpp"
  25. #include "lancelot.h"
  26. #include "linfonb.hpp"
  27. #include "lperswin.hpp"
  28. #include "ldbqry.hpp"
  29. #include "lgoodies.hpp"
  30. #include "lmainwin.hpp"
  31.  
  32. /******************************************************************************
  33. * Class LInfoNotebook :: LInfoNotebook - Constructor for information notebook *
  34. *   given an employee.                                                        *
  35. *                                                                             *
  36. * Define yourself as an INoteBook                                             *
  37. * Ignore query data                                                           *
  38. * Create the general notebook page                                            *
  39. * Create the account notebook page                                            *
  40. * Create the badge notebook page                                              *
  41. * Create the skill notebook page                                              *
  42. * Create the status notebook page                                             *
  43. * Create the project notebook page                                            *
  44. * Create the task notebook page                                               *
  45. * Create the timecard notebook page                                           *
  46. * Define the general page query as NULL                                       *
  47. * Define the account page query as NULL                                       *
  48. * Define the skill page query as NULL                                         *
  49. * Define the badge page query as NULL                                         *
  50. * Define the status page query as NULL                                        *
  51. ******************************************************************************/
  52. LInfoNotebook::LInfoNotebook( IWindow* parent,
  53.                               IWindow* owner,
  54.                               LEmployeeData& employee,
  55.                               Boolean isQuery )
  56.      :INotebook            ( ID_INFO_NOTEBOOK, parent, owner ),
  57.       queryData            ( "" ),
  58.       generalPage          ( this, employee.employeeNumber() ),
  59.       accountPage          ( this, generalPage.key() ),
  60.       badgePage            ( this, generalPage.key() ),
  61.       skillPage            ( this, generalPage.key() ),
  62.       statusPage           ( this, generalPage.key() ),
  63.       pProjectPage         ( new ProjectPage( this, generalPage.key() ) ),
  64.       pTasksPage           ( new TasksPage( this, generalPage.key() ) ),
  65.       pTimeCardPage        ( new TimeCardPage( this, pProjectPage, pTasksPage,
  66.                              generalPage.key() ) ),
  67.       pQueryGenl           ( NULL ),
  68.       pQueryAcct           ( NULL ),
  69.       pQuerySkill          ( NULL ),
  70.       pQueryBadge          ( NULL ),
  71.       pQueryStatus         ( NULL ),
  72.       pCnr                 ( NULL )
  73. {
  74. /*-----------------------------------------------------------------------------
  75. | Start handling any command events for the notebook                          |
  76. -----------------------------------------------------------------------------*/
  77.    ICommandHandler::handleEventsFor( this );
  78.  
  79. /*-----------------------------------------------------------------------------
  80. | Set the notebook characteristics                                            |
  81. -----------------------------------------------------------------------------*/
  82.    setBinding( INotebook::spiral );
  83.    setOrientation( INotebook::backpagesBottomTabsRight );
  84.    refresh();
  85.  
  86. /*-----------------------------------------------------------------------------
  87. | In order to correctly size the notebook tabs                                |
  88. | - Get the current font size                                                 |
  89. | - Size the tabs based on the current font size                              |
  90. -----------------------------------------------------------------------------*/
  91.    IFont
  92.       notebookFont( this );
  93.    setTabShape( INotebook::rounded );
  94.    setMajorTabSize( ISize( notebookFont.avgCharWidth() *
  95.                            ID_INFO_NOTEBOOK_TAB_CHARS,
  96.                            notebookFont.maxCharHeight() * 2 ) );
  97.  
  98. /*-----------------------------------------------------------------------------
  99. | Add each page to the notebook                                               |
  100. -----------------------------------------------------------------------------*/
  101.    addLastPage( generalPage.pageSettings(),
  102.                 &generalPage );
  103.  
  104.    addLastPage( accountPage.pageSettings(),
  105.                 &accountPage );
  106.  
  107.    addLastPage( badgePage.pageSettings(),
  108.                 &badgePage );
  109.  
  110.    addLastPage( skillPage.pageSettings(),
  111.                 &skillPage );
  112.  
  113.    addLastPage( statusPage.pageSettings(),
  114.                 &statusPage );
  115.  
  116.    addLastPage( pProjectPage->pageSettings(),
  117.                 pProjectPage );
  118.  
  119.    addLastPage( pTasksPage->pageSettings(),
  120.                 pTasksPage );
  121.  
  122.    phTimeCardPage = addLastPage( pTimeCardPage->pageSettings(),
  123.                                  pTimeCardPage );
  124.  
  125. /*-----------------------------------------------------------------------------
  126. | When a page is added to a notebook and using the autoPageSize style,        |
  127. | the pages are automatically resized to the current notebook size.           |
  128. | Therefore, we need to resize the notebook pages to their minimum size       |
  129. | so that the notebook can properly calculate it's minimum size.              |
  130. -----------------------------------------------------------------------------*/
  131.    turnToPage( firstPage() );
  132.  
  133. /*-----------------------------------------------------------------------------
  134. | Start handling any page events for the notebook                             |
  135. -----------------------------------------------------------------------------*/
  136.    IPageHandler::handleEventsFor( this );
  137.  
  138. /*-----------------------------------------------------------------------------
  139. | When a page is added to a notebook and using the autoPageSize style,        |
  140. | the pages are automatically resized to the current notebook size.           |
  141. | Therefore, we need to resize the notebook pages to their minimum size       |
  142. | so that the notebook can properly calculate it's minimum size.              |
  143. -----------------------------------------------------------------------------*/
  144.    generalPage.sizeTo( generalPage.minimumSize() );
  145.    accountPage.sizeTo( accountPage.minimumSize() );
  146.    badgePage.sizeTo( badgePage.minimumSize() );
  147.    skillPage.sizeTo( skillPage.minimumSize() );
  148.    statusPage.sizeTo( statusPage.minimumSize() );
  149.    pProjectPage->sizeTo( pProjectPage->minimumSize() );
  150.    pTasksPage->sizeTo( pTasksPage->minimumSize() );
  151.    pTimeCardPage->sizeTo( pTimeCardPage->minimumSize() );
  152. }
  153.  
  154.  
  155. /******************************************************************************
  156. * Class LInfoNotebook :: LInfoNotebook - Constructor for information notebook *
  157. *   given a query.                                                            *
  158. *                                                                             *
  159. * Define yourself as an INoteBook                                             *
  160. * Store the query data                                                        *
  161. * Create the general notebook page                                            *
  162. * Create the account notebook page                                            *
  163. * Create the badge notebook page                                              *
  164. * Create the skill notebook page                                              *
  165. * Create the status notebook page                                             *
  166. * Define the project notebook page as NULL                                    *
  167. * Define the task notebook page as NULL                                       *
  168. * Define the timecard notebook page as NULL                                   *
  169. * Create the general page query                                               *
  170. * Create the account page query                                               *
  171. * Create the skill page query                                                 *
  172. * Create the badge page query                                                 *
  173. * Create the status page query                                                *
  174. * Store a pointer to the container                                            *
  175. ******************************************************************************/
  176. LInfoNotebook::LInfoNotebook( IWindow* parent,
  177.                               IWindow* owner,
  178.                               LMainCnr* cnr,
  179.                               const IString queryName )
  180.      :INotebook            ( ID_INFO_NOTEBOOK, parent, owner ),
  181.       queryData            ( queryName ),
  182.       generalPage          ( this, queryData ),
  183.       accountPage          ( this, queryData ),
  184.       badgePage            ( this, queryData ),
  185.       skillPage            ( this, queryData ),
  186.       statusPage           ( this, queryData ),
  187.       pProjectPage         ( NULL ),
  188.       pTasksPage           ( NULL ),
  189.       pTimeCardPage        ( NULL ),
  190.       pQueryGenl           ( new QueryGenl() ),
  191.       pQueryAcct           ( new QueryAcct() ),
  192.       pQuerySkill          ( new QuerySkill() ),
  193.       pQueryBadge          ( new QueryBadge() ),
  194.       pQueryStatus         ( new QueryStatus() ),
  195.       pCnr                 ( cnr )
  196. {
  197. /*-----------------------------------------------------------------------------
  198. | Start handling any command events for the notebook                          |
  199. -----------------------------------------------------------------------------*/
  200.    ICommandHandler::handleEventsFor( this );
  201.  
  202. /*-----------------------------------------------------------------------------
  203. | Set the notebook characteristics                                            |
  204. -----------------------------------------------------------------------------*/
  205.    setBinding( INotebook::spiral );
  206.    setOrientation( INotebook::backpagesBottomTabsRight );
  207.    refresh();
  208.  
  209. /*-----------------------------------------------------------------------------
  210. | In order to correctly size the notebook tabs                                |
  211. | - Get the current font size                                                 |
  212. | - Size the tabs based on the current font size                              |
  213. -----------------------------------------------------------------------------*/
  214.    IFont
  215.       notebookFont( this );
  216.    setTabShape( INotebook::rounded );
  217.    setMajorTabSize( ISize( notebookFont.avgCharWidth() *
  218.                            ID_INFO_NOTEBOOK_TAB_CHARS,
  219.                            notebookFont.maxCharHeight() * 2 ) );
  220.  
  221. /*-----------------------------------------------------------------------------
  222. | Add each page to the notebook                                               |
  223. -----------------------------------------------------------------------------*/
  224.    addLastPage( generalPage.pageSettings(),
  225.                 &generalPage );
  226.  
  227.    addLastPage( accountPage.pageSettings(),
  228.                 &accountPage );
  229.  
  230.    addLastPage( badgePage.pageSettings(),
  231.                 &badgePage );
  232.  
  233.    addLastPage( skillPage.pageSettings(),
  234.                 &skillPage );
  235.  
  236.    addLastPage( statusPage.pageSettings(),
  237.                 &statusPage );
  238.  
  239. /*-----------------------------------------------------------------------------
  240. | When a page is added to a notebook and using the autoPageSize style,        |
  241. | the pages are automatically resized to the current notebook size.           |
  242. | Therefore, we need to resize the notebook pages to their minimum size       |
  243. | so that the notebook can properly calculate it's minimum size.              |
  244. -----------------------------------------------------------------------------*/
  245.    turnToPage( firstPage() );
  246.    generalPage.sizeTo( generalPage.minimumSize() );
  247.    accountPage.sizeTo( accountPage.minimumSize() );
  248.    badgePage.sizeTo( badgePage.minimumSize() );
  249.    skillPage.sizeTo( skillPage.minimumSize() );
  250.    statusPage.sizeTo( statusPage.minimumSize() );
  251. }
  252.  
  253.  
  254. /******************************************************************************
  255. * Class LInfoNotebook :: ~LInfoNotebook - Destructor for the info window      *
  256. ******************************************************************************/
  257. LInfoNotebook::~LInfoNotebook()
  258. {
  259. /*-----------------------------------------------------------------------------
  260. | Delete the dynamically allocated notebook pages.                            |
  261. -----------------------------------------------------------------------------*/
  262.    delete( pProjectPage );
  263.    delete( pTasksPage );
  264.    delete( pTimeCardPage );
  265.  
  266. /*-----------------------------------------------------------------------------
  267. | Delete the dynamically allocated notebook page queries.                     |
  268. -----------------------------------------------------------------------------*/
  269.    delete( pQueryGenl );
  270.    delete( pQueryAcct );
  271.    delete( pQuerySkill );
  272.    delete( pQueryBadge );
  273.    delete( pQueryStatus );
  274. }
  275.  
  276.  
  277. /******************************************************************************
  278. * Class LInfoNotebook :: verifyPages                                          *
  279. *   Verify data for each notebook page and save to the database               *
  280. ******************************************************************************/
  281. IBase::Boolean LInfoNotebook::verifyPages( IString queryName )
  282. {
  283.    Boolean
  284.       retCode = true;
  285.    IString
  286.       badString,
  287.       badControl;
  288.    IString
  289.       message = IApplication::current().userResourceLibrary().
  290.                 loadString( STR_INCOMPLETE_DATA );
  291.  
  292. /*-----------------------------------------------------------------------------
  293. | Verify and save each page                                                   |
  294. -----------------------------------------------------------------------------*/
  295.    try
  296.    {
  297.       if ( !generalPage.verifyAndSave( badString, badControl, queryName ) )
  298.       {
  299.          IMessageBox
  300.             msg( parent() );
  301.          msg.show( badControl +
  302.                    " " + message + " " +
  303.                    badString,
  304.                    IMessageBox::catastrophic );
  305.          retCode = false;
  306.       }
  307.       else if ( !accountPage.verifyAndSave( badString, badControl,
  308.                                             generalPage.key() ) )
  309.       {
  310.          IMessageBox
  311.             msg( parent() );
  312.          msg.show( badControl +
  313.                    " " + message + " " +
  314.                    badString,
  315.                    IMessageBox::catastrophic );
  316.          retCode = false;
  317.       }
  318.       else if ( !badgePage.verifyAndSave( badString, badControl,
  319.                                           generalPage.key() ) )
  320.       {
  321.          IMessageBox
  322.             msg( parent() );
  323.          msg.show( badControl +
  324.                    " " + message + " " +
  325.                    badString,
  326.                    IMessageBox::catastrophic );
  327.          retCode = false;
  328.       }
  329.       else if ( !skillPage.verifyAndSave( badString, badControl,
  330.                                           generalPage.key() ) )
  331.       {
  332.          IMessageBox
  333.             msg( parent() );
  334.          msg.show( badControl +
  335.                    " " + message + " " +
  336.                    badString,
  337.                    IMessageBox::catastrophic );
  338.          retCode = false;
  339.       }
  340.       else if ( !statusPage.verifyAndSave( badString, badControl,
  341.                                            generalPage.key() ) )
  342.       {
  343.          IMessageBox
  344.             msg( parent() );
  345.          msg.show( badControl +
  346.                    " " + message + " " +
  347.                    badString,
  348.                    IMessageBox::catastrophic );
  349.          retCode = false;
  350.       }
  351.       else if ( pProjectPage )
  352.       {
  353.          if ( !pProjectPage->verifyAndSave( badString, badControl,
  354.                                             generalPage.key() ) )
  355.          {
  356.             IMessageBox
  357.                msg( parent() );
  358.             msg.show( badControl +
  359.                       " " + message + " " +
  360.                       badString,
  361.                       IMessageBox::catastrophic );
  362.             retCode = false;
  363.          }
  364.       }
  365.       if ( pTasksPage)
  366.       {
  367.          if ( !pTasksPage->verifyAndSave( badString, badControl,
  368.                                           generalPage.key() ) )
  369.          {
  370.             IMessageBox
  371.                msg( parent() );
  372.             msg.show( badControl +
  373.                       " " + message + " " +
  374.                       badString,
  375.                       IMessageBox::catastrophic );
  376.             retCode = false;
  377.          }
  378.       }
  379.       if ( pTimeCardPage )
  380.       {
  381.          if ( !pTimeCardPage->verifyAndSave( badString, badControl,
  382.                                              generalPage.key() ) )
  383.          {
  384.             IMessageBox
  385.                msg( parent() );
  386.             msg.show( badControl +
  387.                       " " + message + " " +
  388.                       badString,
  389.                       IMessageBox::catastrophic );
  390.             retCode = false;
  391.          }
  392.       }
  393.  
  394.     return retCode;
  395.  
  396.    }
  397.    catch ( IAccessError& exc )
  398.    {
  399.       IMessageBox
  400.          msgBox( this );
  401.       IString
  402.          expt = exc.text();
  403.       if ( ( expt == "PrfQueryProfileData" ) ||
  404.            ( expt == "PrfOpenProfile" ) ||
  405.            ( expt == "PrfWriteProfileString" ) ||
  406.            ( expt == "PrfWriteProfileData" ) )
  407.          msgBox.show( STR_DB_ERROR,
  408.                       IMessageBox::okButton
  409.                       | IMessageBox::errorIcon );
  410.       else
  411.          msgBox.show( STR_DB_UNKNOWN_ERROR,
  412.                       IMessageBox::okButton
  413.                       | IMessageBox::errorIcon );
  414.    }
  415.  
  416.   return retCode;
  417. }
  418.  
  419.  
  420. /******************************************************************************
  421. * Class LInfoNotebook :: command - Catch and process command events.          *
  422. ******************************************************************************/
  423. IBase::Boolean LInfoNotebook::command( ICommandEvent& event )
  424. {
  425.    Boolean
  426.       retCode = false;
  427.  
  428.    switch ( event.commandId() )
  429.    {
  430. /*-----------------------------------------------------------------------------
  431. | If the user pressed the QUERY button                                        |
  432. -----------------------------------------------------------------------------*/
  433.       case ID_BUTTON_QUERY :
  434.       {
  435.          IString
  436.             aId,
  437.             allIds;;
  438.          IMessageBox
  439.             msgBox( this );
  440. /*-----------------------------------------------------------------------------
  441. | If the database is empty, ask user if they want to create a new employee    |
  442. -----------------------------------------------------------------------------*/
  443.          if ( pQueryGenl->isDBempty() )
  444.          {
  445.             IMessageBox::Response
  446.                choice = msgBox.show( STR_DB_EMPTY,
  447.                                     IMessageBox::queryIcon
  448.                                     | IMessageBox::yesNoButton
  449.                                     | IMessageBox::defButton1 );
  450.             if ( choice == IMessageBox::yes )
  451.             {
  452. /*-----------------------------------------------------------------------------
  453. | Create a new employee                                                       |
  454. | - Create a "blank" person                                                   |
  455. | - Create an information window to collect the data                          |
  456. | - Delete the information window when no longer valid                        |
  457. -----------------------------------------------------------------------------*/
  458.                LEmployeeData
  459.                   tempData( "" );
  460.                LInfoWindow
  461.                   *pNewEmp = new LInfoWindow( ID_INFO_WINDOW, 0, owner(),
  462.                                               IPoint( 100, 100 ),
  463.                                               NULL,
  464.                                               tempData,
  465.                                               false );
  466.                pNewEmp->setAutoDeleteObject( true );
  467.             }
  468.          }
  469.          else
  470.          {
  471. /*-----------------------------------------------------------------------------
  472. | Query the database for each page's search criteria                          |
  473. -----------------------------------------------------------------------------*/
  474.             delete( pQueryGenl );
  475.             delete( pQueryAcct );
  476.             delete( pQuerySkill );
  477.             delete( pQueryBadge );
  478.             delete( pQueryStatus );
  479.  
  480.             pQueryGenl = new QueryGenl();
  481.             pQueryAcct = new QueryAcct();
  482.             pQuerySkill = new QuerySkill();
  483.             pQueryBadge = new QueryBadge();
  484.             pQueryStatus = new QueryStatus();
  485.  
  486. /*-----------------------------------------------------------------------------
  487. | General page query                                                          |
  488. -----------------------------------------------------------------------------*/
  489.             pQueryGenl->getMatchList( generalPage );
  490.             if ( pQueryGenl->numberOfMatches() )
  491.             {
  492.                pQueryGenl->setFirstMatchId();
  493.                while ( pQueryGenl->getMatchId( aId ) )
  494.                {
  495.                   pQueryGenl->getNextMatchId();
  496.                }
  497.             }
  498.  
  499. /*-----------------------------------------------------------------------------
  500. | Account page query                                                          |
  501. -----------------------------------------------------------------------------*/
  502.             pQueryAcct->getMatchList( accountPage );
  503.             if ( pQueryAcct->numberOfMatches() )
  504.             {
  505.                pQueryAcct->setFirstMatchId();
  506.                while ( pQueryAcct->getMatchId( aId ) )
  507.                {
  508.                   pQueryAcct->getNextMatchId();
  509.                }
  510.             }
  511.  
  512. /*-----------------------------------------------------------------------------
  513. | Badge page query                                                            |
  514. -----------------------------------------------------------------------------*/
  515.             pQueryBadge->getMatchList( badgePage );
  516.             if ( pQueryBadge->numberOfMatches() )
  517.             {
  518.                pQueryBadge->setFirstMatchId();
  519.                while ( pQueryBadge->getMatchId( aId ) )
  520.                {
  521.                   pQueryBadge->getNextMatchId();
  522.                }
  523.             }
  524.  
  525. /*-----------------------------------------------------------------------------
  526. | Skill page query                                                            |
  527. -----------------------------------------------------------------------------*/
  528.             pQuerySkill->getMatchList( skillPage );
  529.             if ( pQuerySkill->numberOfMatches() )
  530.             {
  531.                pQuerySkill->setFirstMatchId();
  532.                while ( pQuerySkill->getMatchId( aId ) )
  533.                {
  534.                   pQuerySkill->getNextMatchId();
  535.                }
  536.             }
  537.  
  538. /*-----------------------------------------------------------------------------
  539. | Status page query                                                           |
  540. -----------------------------------------------------------------------------*/
  541.             pQueryStatus->getMatchList( statusPage );
  542.             if ( pQueryStatus->numberOfMatches() )
  543.             {
  544.                pQueryStatus->setFirstMatchId();
  545.                while ( pQueryStatus->getMatchId( aId ) )
  546.                {
  547.                   pQueryStatus->getNextMatchId();
  548.                }
  549.             }
  550.  
  551. /*-----------------------------------------------------------------------------
  552. | Get the intersection of each page's search results                          |
  553. -----------------------------------------------------------------------------*/
  554.             QueryIntersection
  555.                bagOfIds = QueryIntersection( pQueryGenl,
  556.                                              pQuerySkill,
  557.                                              pQueryAcct,
  558.                                              pQueryStatus,
  559.                                              pQueryBadge );
  560.  
  561. /*-----------------------------------------------------------------------------
  562. | If the search is not empty,                                                 |
  563. | - Create a personnel window with a list of employees                        |
  564. | - Delete the personnel window when no longer valid                          |
  565. -----------------------------------------------------------------------------*/
  566.             if ( !bagOfIds.isIntersectionEmpty() )
  567.             {
  568.                LPersonnelWindow
  569.                  *persWin = new LPersonnelWindow( owner()->owner(),
  570.                                                   bagOfIds,
  571.                                                   pQueryGenl->deptQuery() );
  572.                persWin->setAutoDeleteObject( true );
  573.             }
  574.             else
  575. /*-----------------------------------------------------------------------------
  576. | No match found                                                              |
  577. -----------------------------------------------------------------------------*/
  578.             msgBox.show( STR_DB_NO_MATCH,
  579.                          IMessageBox::okButton
  580.                          | IMessageBox::informationIcon );
  581.          }
  582.          retCode = true;
  583.          break;
  584.       }
  585.  
  586.       case ID_BUTTON_SAVE:
  587.       {
  588.          Boolean
  589.             isNewObject;
  590. /*-----------------------------------------------------------------------------
  591. | Ask the user for a name for the query                                       |
  592. -----------------------------------------------------------------------------*/
  593.          LAskUser
  594.             askUser( ID_ASKUSER, IWindow::desktopWindow(), this,
  595.                      IApplication::current().userResourceLibrary().
  596.                      loadString( STR_ENTER_QUERY_NAME ) );
  597.          if ( askUser.pressedOk() )
  598.          {
  599.             IString
  600.                queryName = askUser.text();
  601.             if ( queryName.length() )
  602.             {
  603. /*-----------------------------------------------------------------------------
  604. | Fill the page                                                               |
  605. | Write the query data                                                        |
  606. -----------------------------------------------------------------------------*/
  607.                pQueryGenl->fillPage( generalPage );
  608.                pQueryGenl->saveToQueryData( &queryData, "GENERAL " );
  609.  
  610.                pQueryAcct->fillPage( accountPage );
  611.                pQueryAcct->saveToQueryData( &queryData, "ACCOUNT " );
  612.  
  613.                pQueryBadge->fillPage( badgePage );
  614.                pQueryBadge->saveToQueryData( &queryData,"BADGE " );
  615.  
  616.                pQuerySkill->fillPage( skillPage );
  617.                pQuerySkill->saveToQueryData( &queryData,"SKILL " );
  618.  
  619.                pQueryStatus->fillPage( statusPage );
  620.                pQueryStatus->saveToQueryData( &queryData,"STATUS " );
  621.  
  622. /*-----------------------------------------------------------------------------
  623. | Attempt to save the query data to an IProfile                               |
  624. -----------------------------------------------------------------------------*/
  625.                try
  626.                {
  627.                   isNewObject = queryData.saveIni( queryName );
  628.                }
  629.                catch ( IAccessError& exc )
  630.                {
  631.                   IMessageBox
  632.                      msgBox( this );
  633.                   IString
  634.                      expt = exc.text();
  635.                   if ( ( expt == "PrfQueryProfileData" ) ||
  636.                        ( expt == "PrfOpenProfile" ) ||
  637.                        ( expt == "PrfWriteProfileString" ) ||
  638.                        ( expt == "PrfWriteProfileData" ) )
  639.                      msgBox.show( STR_DB_ERROR,
  640.                                   IMessageBox::okButton
  641.                                   | IMessageBox::errorIcon );
  642.                   else
  643.                      msgBox.show( STR_DB_UNKNOWN_ERROR,
  644.                                   IMessageBox::okButton
  645.                                   | IMessageBox::errorIcon );
  646.                   retCode = true;
  647.                }
  648.  
  649.                unsigned long
  650.                   whichMsg = STR_SAVED_QUERY_NAME;
  651.  
  652.                if ( isNewObject )
  653.                {
  654.                   if ( pCnr )
  655.                      pCnr->addLastQuery( queryName );
  656.                }
  657.                else
  658.                   whichMsg = STR_REPLACED_QUERY_NAME;
  659.  
  660.                IMessageBox
  661.                   msg( this );
  662.                msg.show( IApplication::current().userResourceLibrary().
  663.                          loadString( whichMsg ) +
  664.                          "'" + queryName + "'.",
  665.                          IMessageBox::informationIcon
  666.                          | IMessageBox::okButton );
  667.                retCode = true;
  668.             }
  669.          }
  670.          break;
  671.       }
  672.    }
  673.  
  674.    return retCode;
  675. }
  676.  
  677.  
  678. /******************************************************************************
  679. * Class LInfoNotebook :: select - Catch and process select events.            *
  680. ******************************************************************************/
  681. IBase::Boolean LInfoNotebook::select( IPageSelectEvent& pageevt )
  682. {
  683.    IPageHandle
  684.       testPage;
  685.    IString
  686.       pString,
  687.       theEntry;
  688.  
  689.    testPage = pageevt.previousSelectedPageHandle();
  690.  
  691. /*-----------------------------------------------------------------------------
  692. | Verify the page.  If an error, turn to previous page.                       |
  693. -----------------------------------------------------------------------------*/
  694.    if ( testPage != topPage() )
  695.    {
  696.       if ( topPage() == phTimeCardPage )
  697.       {
  698. /*-----------------------------------------------------------------------------
  699. | Update dropdown comboboxes.                                                 |
  700. -----------------------------------------------------------------------------*/
  701.          pTimeCardPage->fillCBagain();
  702.          return false;
  703.       }
  704.    }
  705.  
  706.    return false;
  707. }
  708.