Exemplo n.º 1
0
void CuDlgReplicationServerPageStartupSetting::OnButtonRestoreAll()
{
	CString strMessage;
	int i,answ, nCount = m_cListCtrl.GetItemCount();
	if (nCount == 0)
		return;
	m_cListCtrl.HideProperty(TRUE);
	answ = AfxMessageBox(IDS_A_RESTORE_ALL , MB_ICONEXCLAMATION | MB_YESNO );
	if ( answ == IDYES ) {
		for (i=0; i<nCount; i++)
		{
			CaReplicationItem* pItem = (CaReplicationItem*)m_cListCtrl.GetItemData(i);
			if ( pItem != NULL)
			{
				BOOL bNotUsed;
				pItem->SetToDefault();
				pItem->SetValueModifyByUser(TRUE);
				if (pItem->GetType() == CaReplicationItem::REP_BOOLEAN)
				{
					CString strValue = pItem->GetFlagContent(bNotUsed);
					if (strValue.CompareNoCase (_T("TRUE")) == 0)
						m_cListCtrl.SetCheck (i, 1, TRUE);
					else
						m_cListCtrl.SetCheck (i, 1, FALSE);
				}
				else
					m_cListCtrl.SetItemText (i, 1, pItem->GetFlagContent(bNotUsed));
			}
		}
	}
	EnableButtons();
}
Exemplo n.º 2
0
void CuDlgReplicationServerPageStartupSetting::OnButtonRestore()
{
	UINT nState = 0;
	CString strMessage;
	int answ, nCount = m_cListCtrl.GetItemCount(),iIndex = -1;

	m_cListCtrl.HideProperty(TRUE);
	iIndex = m_cListCtrl.GetNextItem (-1, LVNI_SELECTED);

	if (iIndex == -1)
		return;
	CaReplicationItem* pItem = (CaReplicationItem*)m_cListCtrl.GetItemData(iIndex);
	if (!pItem)
		return;
	//"Do you want to restore '%s' "
	//"to its default setting ?"
	strMessage.Format(IDS_F_RESTORE_DEFAULT,(LPCTSTR)pItem->GetDescription());
	answ = AfxMessageBox(strMessage , MB_ICONEXCLAMATION | MB_YESNO);
	if ( answ == IDYES ){
		BOOL bNotUsed;
		pItem->SetToDefault();
		pItem->SetValueModifyByUser(TRUE);
		if (pItem->GetType() == CaReplicationItem::REP_BOOLEAN)
		{
			CString strValue = pItem->GetFlagContent(bNotUsed);
			if (strValue.CompareNoCase (_T("TRUE")) == 0)
				m_cListCtrl.SetCheck (iIndex, 1, TRUE);
			else
				m_cListCtrl.SetCheck (iIndex, 1, FALSE);
		}
		else
			m_cListCtrl.SetItemText (iIndex, 1, pItem->GetFlagContent(bNotUsed));
	}
	EnableButtons();
}
Exemplo n.º 3
0
int CaReplicationItemList::fillReplicServerParam( LPCTSTR RetrievedLine)
{
	CString Tempo;
	CString strErrorMsg;

	if (RetrievedLine[0] != _T('\0')) {
		Tempo = RetrievedLine;
		POSITION pos = GetPosOfFlag(Tempo);
		if (pos != NULL) {
			CaReplicationItem* obj = GetAt(pos);
			if (obj->GetType() != CaReplicationItem::REP_BOOLEAN)   {
				CString strValue = Tempo.Mid(4,Tempo.GetLength()-4);
				if (!strValue.IsEmpty())
					obj->SetFlagContent(strValue);
				else    {
					//"%s :No value for this Parameter / will be set to default value"
					strErrorMsg.Format(IDS_F_REP_FLAG_VALUE,(LPCTSTR)Tempo);
					AfxMessageBox(strErrorMsg, MB_ICONEXCLAMATION | MB_OK);
					strValue = obj->GetDefaultValue();
					obj->SetFlagContent(strValue);
				}
			}
			else {
				if ( !ManageBooleanValue(Tempo) ){
					//"%s : Unknown Parameter"
					strErrorMsg.Format(IDS_F_REP_FLAG_UNKNOWN,(LPCTSTR)Tempo);
					AfxMessageBox(strErrorMsg, MB_ICONEXCLAMATION | MB_OK);
				}
			}
		}
		else {
			// Flag not found
			if ( Tempo[0] == _T('*') ) {
				strErrorMsg = Tempo.Mid(1); // Error send by the remote command DDdispf
				if ( Tempo[1] == _T('*') ) {
					strErrorMsg = Tempo.Mid(2);
					CString strMsg; // T("All Parameters will be set to default values.\n")
					strMsg.LoadString (IDS_MSG_ALLPARAMS_SET_2_DEFAULT);
					strErrorMsg += strMsg;
					SetAllFlagsToDefault();
				}
			}
			else
				//"%s : Unknown Parameter"
				strErrorMsg.Format(IDS_F_REP_FLAG_UNKNOWN,(LPCTSTR)Tempo);
			AfxMessageBox(strErrorMsg, MB_ICONEXCLAMATION | MB_OK);
		}
	}
	return TRUE;
}
Exemplo n.º 4
0
void CuDlgReplicationServerPageStartupSetting::OnButtonEditValue()
{
	CRect r, rCell;
	int iNameCol = 1;
	int iIndex = m_cListCtrl.GetNextItem (-1, LVNI_SELECTED);

	if (iIndex == -1)
		return;
	CaReplicationItem* pItem = (CaReplicationItem*)m_cListCtrl.GetItemData(iIndex);
	if (!pItem)
		return;
	if (pItem->GetType() == CaReplicationItem::REP_BOOLEAN)
		return;
	m_cListCtrl.GetItemRect (iIndex, r, LVIR_BOUNDS);
	BOOL bOk = m_cListCtrl.GetCellRect (r, iNameCol, rCell);
	if (bOk)
	{
		rCell.top    -= 2;
		rCell.bottom += 2;
		m_cListCtrl.EditValue (iIndex, iNameCol, rCell);
	}
}
Exemplo n.º 5
0
int SetReplicServerParams (CdIpmDoc* pIpmDoc, LPREPLICSERVERDATAMIN lpReplicServerDta , CaReplicationItemList *pList )
{
	TCHAR  tchszCommandLine[200];
	TCHAR* tchszCurLine;
	CString LocalDBNameOnServerNode;
	int ires;
	CString InputString=_T("");

	CString strVName = lpReplicServerDta->RunNode;
	// Verify if vnode name exist before start the remote command.
	VerifyAndUpdateVnodeName (&strVName);
	if (strVName.IsEmpty())
		return RES_ERR;

	GenerateVnodeName_DbName (lpReplicServerDta ,&LocalDBNameOnServerNode);
	_stprintf(tchszCommandLine, _T("ddstoref %s %d"), (LPTSTR)(LPCTSTR) LocalDBNameOnServerNode, lpReplicServerDta->serverno);

	// generate input to be sent to rmcmd
	CString strFormatFlag;
	CString strContent;
	BOOL bDefaultValue;
	POSITION pos;

	pos = pList->GetHeadPosition();
	while (pos != NULL) {
		CaReplicationItem* obj = pList->GetNext(pos);
		strFormatFlag.Empty();
		strContent = obj->GetFlagContent(bDefaultValue);
		if ( obj->IsMandatory() || obj->IsDefaultMandatoryInFile() ) {
			if (obj->GetType() != CaReplicationItem::REP_BOOLEAN)
				if (!strContent.IsEmpty())
					strFormatFlag = obj->GetFlagName() + strContent;
				else {
					CString csError;
					csError.Format(IDS_F_NO_VALUE,(LPCTSTR)obj->GetFlagName());//"Flag %s has no value and is not used."
					AfxMessageBox(csError, MB_ICONEXCLAMATION | MB_OK | MB_TASKMODAL);
				}
			else {
				if ( strContent.Compare(_T("TRUE")) == 0)
					strFormatFlag = obj->GetFlagName();
			}
		}
		else {
			if ( bDefaultValue == FALSE) {
				if (obj->GetType() != CaReplicationItem::REP_BOOLEAN) {
					if ( !strContent.IsEmpty() )
						strFormatFlag = obj->GetFlagName() + strContent;
				}
				else {
					if ( strContent.Compare(_T("TRUE")) == 0)
						strFormatFlag = obj->GetFlagName();
					if (strFormatFlag.Compare(_T("-TPC")) == 0)
						strFormatFlag += _T("0"); // Two phase commit is turned off.
				}
			}
		}
		if (!strFormatFlag.IsEmpty())
			InputString += (strFormatFlag + _T("\n"));
		}
	/* empty line in order to stop the ddstoref command*/
	InputString += _T("\n");

	ires=RES_SUCCESS;
	if (!LIBMON_ExecRmcmdInBackground((TCHAR *)lpReplicServerDta->RunNode, tchszCommandLine, (LPTSTR)(LPCTSTR)InputString)) {
		ires=RES_ERR;
	}
	// display error message lines (starting with a '*' character) from output
	for (tchszCurLine=LIBMON_GetFirstTraceLine();tchszCurLine;tchszCurLine = LIBMON_GetNextSignificantTraceLine()) {
		if (tchszCurLine[0]==_T('*')) {
			tchszCurLine++;
			AfxMessageBox(tchszCurLine, MB_ICONEXCLAMATION | MB_OK | MB_TASKMODAL);
				ires=RES_ERR;
		}
	}
	return ires;
}