Exemplo n.º 1
0
int CuDlgMain::GetInstallationParam(int nSchema)
{
	int nInstallation = -1;
	CRect r1, r2, re;
	CComboBoxEx* pComboDatabase = (nSchema == 1)? &m_cComboDatabase1: &m_cComboDatabase2;
	CEdit*       pEditFile  = (nSchema == 1)? &m_cEditFile1: &m_cEditFile2;
	if (pEditFile->IsWindowVisible())
	{
		CString strFile;
		pEditFile->GetWindowText(strFile);
		strFile.TrimLeft();
		strFile.TrimRight();
		if (strFile.IsEmpty())
			return -1;
		if (_taccess(strFile, 0) == -1)
			return -1;
		nInstallation = IsInstallationFile(strFile);
	}
	else
	{
		int nSel = pComboDatabase->GetCurSel();
		if (nSel != CB_ERR)
		{
			CaDatabase* pDatabase = (CaDatabase*)pComboDatabase->GetItemDataPtr(nSel);
			if (pDatabase)
			{
				CString strDb = pDatabase->GetItem();
				nInstallation = strDb.IsEmpty()? 1: 0;
			}
		}
	}
	return nInstallation;
}
Exemplo n.º 2
0
BOOL DML_QueryDatabase(CdSda* pDoc, CaNode* pNode, CTypedPtrList< CObList, CaDBObject* >& listObj)
{
	BOOL bOK = FALSE;
	CaLLQueryInfo queryInfo (OBT_DATABASE, pNode->GetName());
	queryInfo.SetFetchObjects (CaLLQueryInfo::FETCH_USER);
	queryInfo.SetIndependent(TRUE);

	CaSessionManager& sessionMgr = theApp.GetSessionManager();
	bOK = INGRESII_llQueryObject (&queryInfo, listObj, (void*)&sessionMgr);
#if defined (_IGNORE_STAR_DATABASE)
	if (bOK)
	{
		POSITION p = NULL, pos = listObj.GetHeadPosition();
		while (pos != NULL)
		{
			p = pos;
			CaDatabase* pDb = (CaDatabase*)listObj.GetNext(pos);
			if (pDb->GetStar() != OBJTYPE_NOTSTAR)
			{
				listObj.RemoveAt(p);
				delete pDb;
			}
		}
	}
#endif
	return bOK;
}
Exemplo n.º 3
0
void CuDlgMain::InitializeCheckIOW()
{
	int nSel = CB_ERR;
	CStringArray arrayDB;
	CEdit* pEdit[2] = {&m_cEditFile1, &m_cEditFile2};
	CComboBoxEx* pArray[2] = {&m_cComboDatabase1, &m_cComboDatabase2};
	for (int i=0; i<2; i++)
	{
		if (pEdit[i]->IsWindowVisible())
		{
			CString strFile;
			pEdit[i]->GetWindowText(strFile);
			strFile.TrimLeft();
			strFile.TrimRight();
			if (!strFile.IsEmpty() && _taccess(strFile, 0) != -1)
			{
				int nInst = IsInstallationFile(strFile);
				if (nInst == 1)
					arrayDB.Add(_T(""));
				else
					arrayDB.Add(_T("???"));
			}
		}
		else
		{
			nSel = pArray[i]->GetCurSel();
			if (nSel != CB_ERR)
			{
				CaDatabase* pDatabase = (CaDatabase*)pArray[i]->GetItemDataPtr(nSel);
				if (pDatabase)
				{
					arrayDB.Add(pDatabase->GetItem());
				}
			}
		}
	}

	if (arrayDB.GetSize() == 2)
	{
		CString s1 = arrayDB[0];
		CString s2 = arrayDB[1];
		if (s1.IsEmpty() && s2.IsEmpty())
		{
			m_cCheckIgnoreOwner.ShowWindow (SW_SHOW);
		}
		else
		{
			m_cCheckIgnoreOwner.SetCheck(1);
			m_cCheckIgnoreOwner.ShowWindow (SW_HIDE);
		}
	}
}
Exemplo n.º 4
0
BOOL CuDlgMain::CheckInstallation()
{
	int nSel = CB_ERR;
	CComboBoxEx* pArray[2] = {&m_cComboDatabase1, &m_cComboDatabase2};
	for (int i=0; i<2; i++)
	{
		if (pArray[i]->IsWindowVisible())
		{
			nSel = pArray[i]->GetCurSel();
			if (nSel != CB_ERR)
			{
				CaDatabase* pDatabase = (CaDatabase*)pArray[i]->GetItemDataPtr(nSel);
				if (pDatabase)
				{
					if (pDatabase->GetItem().IsEmpty())
						return TRUE;
				}
			}
		}
	}
	return FALSE;
}
Exemplo n.º 5
0
BOOL CuDlgMain::GetSchemaParam (int nSchema, CString& strNode, CString& strDatabase, CString& strUser)
{
	int nSel = -1;
	CComboBoxEx* pComboNode = (nSchema == 1)? &m_cComboNode1: &m_cComboNode2;
	CComboBoxEx* pComboDatabase   = (nSchema == 1)? &m_cComboDatabase1: &m_cComboDatabase2;
	CComboBoxEx* pComboUser   = (nSchema == 1)? &m_cComboUser1: &m_cComboUser2;

	nSel = pComboNode->GetCurSel();
	if (nSel == CB_ERR)
		throw (int)1;
	CaNode* pNode = (CaNode*)pComboNode->GetItemDataPtr(nSel);
	if (!pNode)
		throw (int)1;
	nSel = pComboDatabase->GetCurSel();
	if (nSel == CB_ERR)
		throw (int)2;
	CaDatabase* pDatabase = (CaDatabase*)pComboDatabase->GetItemDataPtr(nSel);
	if (!pDatabase)
		throw (int)2;
	nSel = pComboUser->GetCurSel();
	if (nSel == CB_ERR)
		throw (int)3;
	CaUser* pUser = (CaUser*)pComboUser->GetItemDataPtr(nSel);
	if (!pUser)
		throw (int)3;

	strNode = pNode->GetName();
	strDatabase = pDatabase->GetItem();
	strUser = pUser->GetItem();
	if (strNode.IsEmpty())
		return FALSE;
	if (strDatabase.IsEmpty())
		strUser = _T("");

	return TRUE;
}
Exemplo n.º 6
0
static void PreselectUser(CComboBoxEx* pComboSource, CComboBoxEx* pComboUser)
{
	int nSel = pComboSource->GetCurSel();
	if (nSel != CB_ERR)
	{
		CaDatabase* pDatabase = (CaDatabase*)pComboSource->GetItemDataPtr(nSel);
		if (pDatabase)
		{
			if (pDatabase->GetItem().IsEmpty())
			{
				pComboUser->SetCurSel(0); // <All Schemas>
				pComboUser->EnableWindow(FALSE);
			}
			else
			{
				if (pComboUser->GetCurSel() == CB_ERR)
				{
					pComboUser->SetCurSel(1);  // <Default Schema>
				}
				pComboUser->EnableWindow(TRUE);
			}
		}
	}
}
Exemplo n.º 7
0
void CuDlgMain::QueryDatabase(CComboBoxEx* pComboDatabase, CaNode* pNode, CString& strSelectedDatabase)
{
	int nIdx = CB_ERR;
	CWaitCursor doWaitCursor;
	UINT uFlag = (pComboDatabase == &m_cComboDatabase1)? REFRESH_DATABASE1: REFRESH_DATABASE2;
	CTypedPtrList< CObList, CaDBObject* >* lDatabase = (pComboDatabase == &m_cComboDatabase1)? &m_lDatabase1: &m_lDatabase2;
	//
	// Clean the combobox:
	pComboDatabase->ResetContent();
	if ((m_nAlreadyRefresh & uFlag) == 0)
	{
		while (!lDatabase->IsEmpty())
			delete lDatabase->RemoveHead();
		CaInstallationItem* pInstallation = new CaInstallationItem (_T("<Installation>"));
		lDatabase->AddHead(pInstallation);
		DML_QueryDatabase(NULL, pNode, *lDatabase);
	}

	COMBOBOXEXITEM cbitem;
	memset (&cbitem, 0, sizeof(cbitem));
	cbitem.mask = CBEIF_IMAGE | CBEIF_TEXT | CBEIF_SELECTEDIMAGE | CBEIF_LPARAM ;
	cbitem.iImage = 0;
	cbitem.iSelectedImage = 0;

	POSITION pos = lDatabase->GetHeadPosition();
	while (pos != NULL)
	{
		CaDatabase* pDatabase = (CaDatabase*)lDatabase->GetNext(pos);
		cbitem.pszText = (LPTSTR)(LPCTSTR)pDatabase->GetName();
		cbitem.lParam  = (LPARAM)pDatabase;
		cbitem.iItem   = pComboDatabase->GetCount();
		switch ( pDatabase->GetStar() )
		{
		case OBJTYPE_NOTSTAR:
			cbitem.iImage  = (pDatabase->GetItem().IsEmpty())? 1: 0;
			break;
		case OBJTYPE_STARNATIVE:
			cbitem.iImage  = 2;
			break;
		case OBJTYPE_STARLINK:
			cbitem.iImage  = 3;
			break;
		}
		cbitem.iSelectedImage = cbitem.iImage;
		pComboDatabase->InsertItem (&cbitem);
	}
	if (m_bPreselectDBxUser)
	{
		if (!strSelectedDatabase.IsEmpty())
		{
			nIdx = pComboDatabase->FindStringExact(-1, strSelectedDatabase);
			if (nIdx != CB_ERR)
				pComboDatabase->SetCurSel(nIdx);
			else
				pComboDatabase->SetCurSel(0);
		}
		else
		{
			pComboDatabase->SetCurSel(0);
		}
	}
	m_nAlreadyRefresh |= uFlag;
}