Esempio n. 1
0
void CxDlgUserMod::OnButtonTables()
{
	int iret;
	m_lpTblParam.bRefuseTblWithDupName = TRUE;
	_tcscpy((LPTSTR)m_lpTblParam.DBName, (LPCTSTR)m_csDBName);
	iret = DlgAuditDBTable (m_hWnd , &m_lpTblParam);
}
Esempio n. 2
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
   LPAUDITDBPARAMS lpauditdb = GetDlgProp (hwnd);
   BOOL Success;

   switch (id)
   {
       case IDOK:
           if (lpauditdb->bStartSinceTable)
           {
             char szTblOwner[MAXOBJECTNAME];
             OwnerFromString(table.lpTable->lpObject, szTblOwner);
             if ( IsTheSameOwner(GetCurMdiNodeHandle(),szTblOwner) == FALSE )
               break;
             if ( table.bRefuseTblWithDupName && IsTableNameUnique(GetCurMdiNodeHandle(),lpauditdb->DBName,table.lpTable->lpObject) == FALSE)
               break;
           }
           Success = FillStructureFromControls (hwnd);

           if (!Success)
               break;
           else
           {
               FreeObjectList (table.lpTable);
               table.lpTable = NULL;
               lpfile = FreeTableAndFile (lpfile);
               EndDialog (hwnd, TRUE);
           }
           break;

       case IDCANCEL:
           FreeObjectList (table.lpTable);
           table.lpTable = NULL;
           lpfile = FreeTableAndFile (lpfile);

           EndDialog (hwnd, FALSE);
           break;

       case IDC_AUDITDB_CKP:
           EnableDisableControls (hwnd);
           break;

       case IDC_AUDITDB_CKP_BUTTON:
           {
               char szCurChkPtNum[MAXOBJECTNAME];
               char szUserName    [MAXOBJECTNAME];
               int ires;
               LPUCHAR vnodeName = GetVirtNodeName (GetCurMdiNodeHandle ());

               DBAGetUserName (GetVirtNodeName ( GetCurMdiNodeHandle ()), szUserName);
               ires = MfcDlgCheckPointLst(lpauditdb->DBName ,szUserName, vnodeName, szCurChkPtNum);
               if (ires != IDCANCEL)
                   Edit_SetText   (GetDlgItem (hwnd, IDC_AUDITDB_CKP_NUMBER), szCurChkPtNum);
               break;
           }
       case IDC_AUDITDB_IDTABLE:
           {
               int   iret;
               char* aString;
               char  szTable [MAXOBJECTNAME];
               LPOBJECTLIST ls;
               LPTABLExFILE lf;

               x_strcpy (table.DBName,  lpauditdb->DBName);
               table.bRefuseTblWithDupName = TRUE;
               iret = DlgAuditDBTable (hwnd, &table);

               ls = table.lpTable;
               EnableDisableControls (hwnd);

               while (ls)
               {
                   aString = (char *)ls->lpObject;
                   if (!FindStringInListTableAndFile (lpfile, aString))
                   {
                       //
                       // Add table  into TABLExFILE
                       //
                       lpfile = AddElement (lpfile, aString);
                   }
                   ls = ls->lpNext;
               }
               AddFile (hwnd, lpfile);

               lf = lpfile;
               while (lf)
               {
                   if (!FindStringInListObject (table.lpTable, lf->TableName))
                   {
                       //
                       // Delete table from TABLExFILE
                       //
                       x_strcpy (szTable, lf->TableName);
                       lf = lf->next;
                       lpfile = RemoveElement (lpfile, szTable);
                   }
                   else lf = lf->next;
               }
           }
           break;

       case IDC_AUDITDB_IDFILE:
           {
               int iret;
               AUDITDBFPARAMS file;
               ZEROINIT (file);

               x_strcpy (file.DBName,  lpauditdb->DBName);
               file.lpTableAndFile = lpfile;
               iret   = DlgAuditDBFile (hwnd, &file);
               if (iret)
                   lpfile = file.lpTableAndFile;
           }
           break;

       case IDC_AUDITDB_TABLES:
           EnableDisableControls (hwnd);
           break;
       case IDC_AUDITDB_FILES:
           EnableDisableControls (hwnd);
           break;
   }
}