newntui/discovermdi/src/qatree.cpp
//--------------------------------------------------------------------------------------------
// This callback will run when user press "Run Selected" button.
//--------------------------------------------------------------------------------------------
This callback will run when user press "Run Selected" button.
This callback will run when user press " Run Selected " button .
void CQATree::OnRunSelected()  {
CString query;
BSTR    sysQuery;
CTreeNodeInfo* info;
CQAParams* view;
CMainFrame* main;
main=(CMainFrame *)AfxGetMainWnd(); 
   view=(CQAParams* )(((CSplitterWnd *)GetParent())->GetPane(0,1));
   HTREEITEM item = m_Tree.GetSelectedItem();
   CString scope;
   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 are 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 are selected in the browser.\nPlease select groups to process.","QA Error",
	        MB_ICONSTOP|MB_OK);
			return;
		}
   }
   if(item==NULL)  {
	   MessageBox("No query selected.\nPlease select a query to run first.","QA Error",MB_ICONEXCLAMATION);
	   return;
   }
   info=(CTreeNodeInfo *)m_Tree.GetItemData(item);
   query.Format("sev_run \"%s\" {%s}",info->m_NodeName,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());
   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 :: OnRunSelected ( ) { CString query ; BSTR sysQuery ; CTreeNodeInfo * info ; CQAParams * view ; CMainFrame * main ; main = ( CMainFrame * ) AfxGetMainWnd ( ) ; view = ( CQAParams * ) ( ( ( CSplitterWnd * ) GetParent ( ) ) -> GetPane ( 0 , 1 ) ) ; HTREEITEM item = m_Tree . GetSelectedItem ( ) ; CString scope ; 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 ( item == NULL ) { MessageBox ( " \n " , " " , MB_ICONEXCLAMATION ) ; return ; } info = ( CTreeNodeInfo * ) m_Tree . GetItemData ( item ) ; query . Format ( " \" \" " , info -> m_NodeName , 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 ( ) ) ; 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 Selected" button.
This callback will run when user press " Run Selected " button .