Exemple #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;
			}
		}
	}
}
Exemple #2
0
void CuDlgReplicationServerPageStartupSetting::EnableButtons()
{
	BOOL bEnableSaveButton      = FALSE;
	BOOL bEnableEditButton      = FALSE;
	BOOL bEnableRestorButton    = FALSE;
	BOOL bEnableRestoreAllButton= FALSE;

	if (m_cListCtrl.GetItemCount() > 0)
	{
		bEnableRestoreAllButton = TRUE;
		int nCount = m_cListCtrl.GetItemCount();
		for (int i=0; i<nCount; i++)
		{
			CaReplicationItem* pItem = (CaReplicationItem*)m_cListCtrl.GetItemData(i);
			if (pItem->IsValueModifyByUser())
			{
				bEnableSaveButton = TRUE;
				break;
			}
		}
		int nSelected = m_cListCtrl.GetNextItem (-1, LVNI_SELECTED);
		if (nSelected != -1)
		{
			CaReplicationItem* pItem = (CaReplicationItem*)m_cListCtrl.GetItemData(nSelected);
			if (!pItem->IsReadOnlyFlag())
			{
				bEnableRestorButton = TRUE;
				bEnableEditButton   = TRUE;
			}
		}
	}
	GetDlgItem(IDC_BUTTON1)->EnableWindow (bEnableSaveButton);
	GetDlgItem(IDC_BUTTON2)->EnableWindow (bEnableEditButton);
	GetDlgItem(IDC_BUTTON3)->EnableWindow (bEnableRestorButton);
	GetDlgItem(IDC_BUTTON4)->EnableWindow (bEnableRestoreAllButton);
}