newntui/discovermdi/src/qatree.cpp
//--------------------------------------------------------------------------------------------
// This callback will run when user press "Run All" button.
//--------------------------------------------------------------------------------------------
This callback will run when user press "Run All" button.
This callback will run when user press " Run All " button .
void CQATree::OnRunAll()  {
CString query;
BSTR    sysQuery;
CQAParams* view;
CTreeNodeInfo* info;
CMainFrame* main;
main=(CMainFrame *)AfxGetMainWnd(); 
 CString scope;
    view=(CQAParams* )(((CSplitterWnd *)GetParent())->GetPane(0,1));
    view->GetScope(scope);
	if(scope=="Browser Selection" && (main->m_SelectionSize==0 || (main->m_wndBrowser.SelectionHasKind("module")==FALSE) && main->m_wndBrowser.SelectionHasKind("proj")==FALSE)) {
		MessageBox("No projects/modules were selected in the browser.\nPlease select modules to process.","QA Error",
	    MB_ICONSTOP|MB_OK);
		return;
	}
	if(scope=="Group Selection") {
		query = "size [filter {kind==\"module\" || kind==\"proj\"} $DiscoverGroups]";
        sysQuery=query.AllocSysString();
        CString res = DataSourceAccessSync(&sysQuery);
        SysFreeString(sysQuery); 
		if(atoi(res)==0) {
		    MessageBox("No groups containing projects/modules were selected in the browser.\nPlease select groups to process.","QA Error",
	        MB_ICONSTOP|MB_OK);
			return;
		}
	}
	if(MessageBox("Running your queries will take a long time.\nAre you sure that you want to do this?",
		          "QA Warning",
				  MB_ICONQUESTION|MB_OKCANCEL)==IDOK) {
            query.Format("sev_run \"/\" \"%s\"",scope);
            sysQuery=query.AllocSysString();
            CString res = DataSourceAccessSync(&sysQuery);
            SysFreeString(sysQuery); 
			if(res.GetLength()>0) {
                CString errorMsg;
		        errorMsg="================== ERRORS DETECTED ==================\r\n";
			    errorMsg+=res;
	            main->m_wndErrors.SetErrorLog(errorMsg);
                main->ShowControlBar( &main->m_wndErrors, TRUE, FALSE);	
			} else 
				GenerateReport(GetReportName());
            HTREEITEM item = m_Tree.GetSelectedItem();
	        if(item!=NULL) {
 	            info=(CTreeNodeInfo *)m_Tree.GetItemData(item);
				view->Refresh(info->m_NodeName);
			    CQAChildFrame* parent = (CQAChildFrame *)GetParent()->GetParent();
			    parent->SetCurrentSetEnable(view->GetCurrentSetEnable());
			}
	}			
}
void CQATree :: OnRunAll ( ) { CString query ; BSTR sysQuery ; CQAParams * view ; CTreeNodeInfo * info ; CMainFrame * main ; main = ( CMainFrame * ) AfxGetMainWnd ( ) ; CString scope ; view = ( CQAParams * ) ( ( ( CSplitterWnd * ) GetParent ( ) ) -> GetPane ( 0 , 1 ) ) ; view -> GetScope ( scope ) ; if ( scope == " " && ( main -> m_SelectionSize == 0 || ( main -> m_wndBrowser . SelectionHasKind ( " " ) == FALSE ) && main -> m_wndBrowser . SelectionHasKind ( " " ) == FALSE ) ) { MessageBox ( " \n " , " " , MB_ICONSTOP | MB_OK ) ; return ; } if ( scope == " " ) { query = " \" \" \" \" " ; sysQuery = query . AllocSysString ( ) ; CString res = DataSourceAccessSync ( & sysQuery ) ; SysFreeString ( sysQuery ) ; if ( atoi ( res ) == 0 ) { MessageBox ( " \n " , " " , MB_ICONSTOP | MB_OK ) ; return ; } } if ( MessageBox ( " \n " , " " , MB_ICONQUESTION | MB_OKCANCEL ) == IDOK ) { query . Format ( " \" \" \" \" " , scope ) ; sysQuery = query . AllocSysString ( ) ; CString res = DataSourceAccessSync ( & sysQuery ) ; SysFreeString ( sysQuery ) ; if ( res . GetLength ( ) > 0 ) { CString errorMsg ; errorMsg = " \r \n " ; errorMsg += res ; main -> m_wndErrors . SetErrorLog ( errorMsg ) ; main -> ShowControlBar ( & main -> m_wndErrors , TRUE , FALSE ) ; } else GenerateReport ( GetReportName ( ) ) ; HTREEITEM item = m_Tree . GetSelectedItem ( ) ; if ( item != NULL ) { info = ( CTreeNodeInfo * ) m_Tree . GetItemData ( item ) ; view -> Refresh ( info -> m_NodeName ) ; CQAChildFrame * parent = ( CQAChildFrame * ) GetParent ( ) -> GetParent ( ) ; parent -> SetCurrentSetEnable ( view -> GetCurrentSetEnable ( ) ) ; } } }
This callback will run when user press "Run All" button.
This callback will run when user press " Run All " button .