示例#1
0
/************************************************************************************
函数名称:
bool CField::SetAsInteger(int Value)
功能说明:虚函數,将m_pValve所指向的数据修改为传入的int型数据.

详细解释:1.如果子类没有实现,则仅实现错误提示,以示不能转换.
         2.如果子类实现,将调用子类的方法.

出入参数:
[in]: 无.      
  
[out]:无. 

返回类型:bool

制作:YTLI 2002/07/15

修改: 
************************************************************************************/
bool CField::SetAsInteger(int Value)
{
	if(m_nNextModifyField == -1)
		return false;
	else
	{
		if(m_pFields->IsConvertToLastVersion(this))
		{
			NewData();
			SetAsInteger(Value);
			CField* pNewField = m_pFields->m_FieldVersion.GetFieldByAbsolutePos(m_nNextModifyField);			
			pNewField ->ConvertToCurField(this);
			DeleteData();
		}
	}
	return true;
}
示例#2
0
 virtual void
 SetFromCombo(int iDataFieldIndex, TCHAR *sValue)
 {
   SetAsInteger(iDataFieldIndex);
 }
示例#3
0
void
DataFieldInteger::Dec(void)
{
  SetAsInteger(mValue - mStep * SpeedUp(false));
}
示例#4
0
void
DataFieldInteger::Inc(void)
{
  SetAsInteger(mValue + mStep * SpeedUp(true));
}
示例#5
0
void
DataFieldInteger::SetAsString(const TCHAR *Value)
{
  SetAsInteger(_ttoi(Value));
}
示例#6
0
void
DataFieldInteger::Dec()
{
  SetAsInteger(value - step * SpeedUp(false));
}
示例#7
0
void
DataFieldInteger::Inc()
{
  SetAsInteger(value + step * SpeedUp(true));
}
示例#8
0
void
DataFieldInteger::SetAsString(const TCHAR *_value)
{
  SetAsInteger(ParseString(_value));
}
示例#9
0
//将原来版本的字段数据转换到当前字段的数据。
//1。如果本字段空间为空,生成空间
//2。要进行原来字段空值判断!
//2。1如果为空则本字段为空
//2。2如果不为空则将原来的数据以原来的数据类型读    出,然后调用本字段的SetAs***设置。
//然后,如果有新的next字段,则调用该字段的ConvertToCurField函数,并且负责释放本空间,并且清0
void CField::ConvertToCurField(CField* pOldField)
{
	/*
	if(this->GetFieldType() == fString)
	{
		ConvertToCurField(pOldField);
		return ;
	}
*/
	if(!m_pValue)
	{//本字段也为中间字段
		NewData();

		if(pOldField->IsNull())
			SetNull();
		else
		{
			CFieldType ftType = pOldField->GetFieldType();
			if( ftType == fBoolean )			
				SetAsBool( pOldField->GetAsBool());

			else if( ftType == fCurrency )			
				SetAsCurrency( pOldField->GetAsCurrency());

			else if( ftType == fDate )			
				//SetAsBool( pOldField->GetAsDateTime());
				SetAsBool( true);//#_修改 2002-12-2 $ 10:01:35 zlq
			else if( ftType == fDouble )			
				SetAsDouble( pOldField->GetAsDouble());

			else if( ftType == fInt )			
				SetAsInteger( pOldField->GetAsInteger());

			else if( ftType == fString )			
				SetAsString( pOldField->GetAsString());		

			//assert(m_nNextModifyField != -1);

			CField* pNewField = m_pFields->m_FieldVersion.GetFieldByAbsolutePos(m_nNextModifyField);
			pNewField->ConvertToCurField(this); 			
		}
		DeleteData();
	}
	else   //最后一层转换.
	{
		if(pOldField->IsNull())		
			SetNull();			
		else
		{
			if( pOldField->GetFieldType() == fBoolean )			
				SetAsBool( pOldField->GetAsBool());

			else if( pOldField->GetFieldType() == fCurrency )			
				SetAsCurrency( pOldField->GetAsCurrency());

			else if( pOldField->GetFieldType() == fDate )			
				//SetAsBool( pOldField->GetAsDateTime());
				SetAsBool( true);

			else if( pOldField->GetFieldType() == fDouble )			
				SetAsDouble( pOldField->GetAsDouble());

			else if( pOldField->GetFieldType() == fInt )			
				SetAsInteger( pOldField->GetAsInteger());

			else if( pOldField->GetFieldType() == fString )			
				SetAsString( pOldField->GetAsString());		

			//assert(m_nNextModifyField == -1);
		}
	}
}