home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / LANCELOT / LINFONB.CPP < prev    next >
C/C++ Source or Header  |  1995-05-01  |  32KB  |  707 lines

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