Esempio n. 1
0
void CuDlgPropertyPageSqlExpressionInParams::OnButton3Param() 
{
	CxDlgPropertySheetSqlExpressionWizard* pParent = (CxDlgPropertySheetSqlExpressionWizard*)GetParent();
	CxDlgPropertySheetSqlExpressionWizard wizdlg;
	wizdlg.m_queryInfo = pParent->m_queryInfo;
	wizdlg.m_nFamilyID    = FF_DATABASEOBJECTS;
	wizdlg.m_nAggType     = pParent->m_nAggType;
	wizdlg.m_nCompare     = pParent->m_nCompare;
	wizdlg.m_nIn_notIn    = pParent->m_nIn_notIn;
	wizdlg.m_nSub_List    = pParent->m_nSub_List;
	//
	// Initialize Tables or Views:
	POSITION pos = pParent->m_listObject.GetHeadPosition();
	try
	{
		while (pos != NULL)
		{
			CaDBObject* pObject = pParent->m_listObject.GetNext (pos);
			CaDBObject* pNewObject = new CaDBObject(*pObject);
			pNewObject->SetObjectID(pObject->GetObjectID());
			wizdlg.m_listObject.AddTail (pNewObject);
		}
		
		pos = pParent->m_listStrColumn.GetHeadPosition();
		while (pos != NULL)
		{
			CString strItem = pParent->m_listStrColumn.GetNext(pos);
			wizdlg.m_listStrColumn.AddTail (strItem);
		}
	}
	catch (CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
		return;
	}
	catch(...)
	{
		// _T("Cannot initialize the SQL assistant.");
		AfxMessageBox (IDS_MSG_SQL_ASSISTANT, MB_ICONEXCLAMATION|MB_OK);
		return;
	}
	int nResult = wizdlg.DoModal();
	if (nResult == IDCANCEL)
		return;

	CString strStatement;
	wizdlg.GetStatement (strStatement);
	if (strStatement.IsEmpty())
		return;
	m_cParam3.ReplaceSel (strStatement);	
}
Esempio n. 2
0
BOOL CuDlgPropertyPageSqlExpressionInParams::OnSetActive() 
{
	CxDlgPropertySheetSqlExpressionWizard* pParent = (CxDlgPropertySheetSqlExpressionWizard*)GetParent();
	pParent->SetWizardButtons(PSWIZB_FINISH|PSWIZB_BACK);
	CuDlgPropertyPageSqlExpressionMain* pMainPage = &(pParent->m_PageMain);
	GENFUNCPARAMS fparam;
	CaSQLComponent* lpComp = (CaSQLComponent*)pMainPage->GetComponentCategory();
	if (lpComp)
	{
		memset (&fparam, 0, sizeof(fparam));
		FillFunctionParameters (&fparam, lpComp);
		UpdateDisplay (&fparam);
	}
	EnableControls();
	return CPropertyPage::OnSetActive();
}
Esempio n. 3
0
BOOL CuDlgPropertyPageSqlExpressionInParams::OnWizardFinish() 
{
	CxDlgPropertySheetSqlExpressionWizard* pParent = (CxDlgPropertySheetSqlExpressionWizard*)GetParent();
	CuDlgPropertyPageSqlExpressionMain* pMainPage = &(pParent->m_PageMain);
	GENFUNCPARAMS fparam;
	CaSQLComponent* lpComp = (CaSQLComponent*)pMainPage->GetComponentCategory();
	if (lpComp)
	{
		CString strOperant2;
		memset (&fparam, 0, sizeof(fparam));
		FillFunctionParameters (&fparam, lpComp);
		UpdateData (TRUE);
		int nID = GetCheckedRadioButton(IDC_RADIO3, IDC_RADIO4);
		if (nID == IDC_RADIO3)
			strOperant2 = m_strParam2;
		else
		{
			BOOL bOne = TRUE;
			CString strItem;
			int i, nCount = m_cListBox1.GetCount();
			strOperant2 = _T("");

			for (i=0; i<nCount; i++)
			{
				m_cListBox1.GetText(i, strItem);
				if (!bOne)
					strOperant2 += _T(", ");
				strOperant2 += strItem;
				bOne = FALSE;
			}
		}
		//
		// In function always has 3 arguments:
		CString strStatement;
		strStatement.Format ((LPCTSTR)fparam.resultformat3, (LPCTSTR)m_strParam1, _T("in"), (LPCTSTR)strOperant2);
		pParent->SetStatement (strStatement);
	}
	else
		pParent->SetStatement (NULL);
	return TRUE;
}
Esempio n. 4
0
void CuDlgPropertyPageSqlWizardUpdate2::OnButtonCriteria() 
{
	CWaitCursor doWaitCursor;
	CxDlgPropertySheetSqlWizard* pParent = (CxDlgPropertySheetSqlWizard*)GetParent();
	CxDlgPropertySheetSqlExpressionWizard wizdlg;
	wizdlg.m_queryInfo = pParent->m_queryInfo;
	wizdlg.m_nFamilyID    = FF_PREDICATES;
	wizdlg.m_nAggType     = IDC_RADIO1;
	wizdlg.m_nCompare     = IDC_RADIO1;
	wizdlg.m_nIn_notIn    = IDC_RADIO1;
	wizdlg.m_nSub_List    = IDC_RADIO1;
	//
	// Initialize Tables or Views from the checked items:
	try
	{
		CString strItem;
		int i, nCount = m_cListTable.GetItemCount();
		for (i=0; i<nCount; i++)
		{
			if (m_cListTable.GetItemChecked(i))
			{
				CaDBObject* pObj = (CaDBObject*)m_cListTable.GetItemData (i);
				CaDBObject* pNewObject = new CaDBObject(*pObj);
				pNewObject->SetObjectID(OBT_TABLE);
				wizdlg.m_listObject.AddTail (pNewObject);
			}
		}
		nCount = m_cListView.GetItemCount();
		for (i=0; i<nCount; i++)
		{
			if (m_cListView.GetItemChecked(i))
			{
				CaDBObject* pObj = (CaDBObject*)m_cListView.GetItemData (i);
				CaDBObject* pNewObject = new CaDBObject(*pObj);
				pNewObject->SetObjectID(OBT_VIEW);
				wizdlg.m_listObject.AddTail (pNewObject);
			}
		}
		//
		// Append the current Table:
		CComboBox& comboTable = pParent->m_PageUpdate1.m_cComboTable;
		int nSel = comboTable.GetCurSel();
		if (nSel != CB_ERR)
		{
			CaDBObject* pObj = (CaDBObject*)comboTable.GetItemData (nSel);
			//
			// Check to see if the current table has already been added:
			BOOL b2Add = TRUE;
			POSITION pf = wizdlg.m_listObject.GetHeadPosition();
			while (pf != NULL)
			{
				CaDBObject* p = (CaDBObject*) wizdlg.m_listObject.GetNext (pf);
				if (p->GetName().CompareNoCase (pObj->GetName()) == 0 && p->GetOwner().CompareNoCase (pObj->GetOwner()) == 0)
				{
					b2Add = FALSE;
					break;
				}
			}
			if (b2Add)
			{
				CaDBObject* pNewObject = new CaDBObject(*pObj);
				if (pParent->m_PageUpdate1.IsDlgButtonChecked (IDC_RADIO1))
					pNewObject->SetObjectID(OBT_TABLE);
				else
					pNewObject->SetObjectID(OBT_VIEW);
				wizdlg.m_listObject.AddTail (pNewObject);
			}
		}
	}
	catch (CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
		return;
	}
	catch (CeSqlException e)
	{
		AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK);
	}
	catch(...)
	{
		// _T("Cannot initialize the SQL assistant.");
		AfxMessageBox (IDS_MSG_SQL_ASSISTANT, MB_ICONEXCLAMATION|MB_OK);
		return;
	}
	int nResult = wizdlg.DoModal();
	if (nResult == IDCANCEL)
		return;

	CString strStatement;
	wizdlg.GetStatement (strStatement);
	if (strStatement.IsEmpty())
		return;
	m_cEditCriteria.ReplaceSel (strStatement);
}