Exemplo n.º 1
0
void CaReplicationItemList::VerifyValueForFlag()
{
	POSITION pos = GetHeadPosition();
	BOOL bDefault;
	int answ;
	CString Tempo,strValue,strErrorMsg,strDefault;
	while (pos != NULL) {

		CaReplicationItem* obj = GetNext(pos);
		Tempo = obj->GetFlagContent( bDefault );
		strDefault = obj->GetDefaultValue();
		if (Tempo.IsEmpty() == TRUE && ( obj->IsMandatory () || obj->IsDefaultMandatoryInFile())) {
			//"%s (mandatory) parameter not found in runrepl.opt. Will be set to Default."
			strErrorMsg.Format(IDS_F_REP_FLAG_DEFAULT,(LPCTSTR)obj->GetFlagName());
			AfxMessageBox(strErrorMsg, MB_ICONEXCLAMATION | MB_OK | MB_TASKMODAL);
			strValue = obj->GetDefaultValue();
			obj->SetFlagContent(strValue);
			obj->SetValueModifyByUser(TRUE);
		}
		if ( obj->IsReadOnlyFlag() && Tempo.Compare(strDefault) !=0 && ( obj->IsMandatory () || obj->IsDefaultMandatoryInFile()))    {
			//"Inconsistent value for %s parameter.\n"
			//"Value in runrepl.opt file  : %s\n"
			//"Required Value : %s\n"
			//"Apply required value?"
			strErrorMsg.Format(
				IDS_F_REP_FLAG_INCONSISTENT, 
				(LPCTSTR)obj->GetDescription(),
				(LPCTSTR)Tempo,
				(LPCTSTR)strDefault);
			answ = AfxMessageBox(strErrorMsg, MB_ICONEXCLAMATION | MB_YESNO | MB_TASKMODAL);
			if ( answ == IDYES ){
				strValue = obj->GetDefaultValue();
				obj->SetFlagContent(strValue);
				obj->SetValueModifyByUser(TRUE);
			}
			else {
				// remove all flags in the list, no modication available.
				MyRemoveAll();
				return;
			}
		}
	}
}
Exemplo n.º 2
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;
}