Пример #1
0
PlanEntryModel::PlanEntryModel(MSXML2::IXMLDOMNode *pNode, 
													unsigned __int64 start, 
													unsigned __int64 stop, 
													unsigned __int64 taskID, TCHAR *pOwner, TCHAR *pTaskname) :
	m_pNode(pNode)
{
	SecureZeroMemory(m_bstrs, sizeof(m_bstrs));
	m_pNode->AddRef();
	SetID(ModelUtils::GenerateID());
	setTaskStart(start);
	setTaskStop(stop);
	setTaskID(taskID);
	SetOwner(pOwner);
	SetCreatedDate(GetID());
	SetEntryType(TimeEntry::TaskBillableEntry);
	if(pTaskname)setTaskName(pTaskname);
}
Пример #2
0
PlanEntryModel::PlanEntryModel(MSXML2::IXMLDOMNode *pNode, 
													unsigned __int64 id,
													unsigned __int64 start, 
													unsigned __int64 stop, 
													unsigned __int64 taskID, 
													TCHAR *pOwner, 
													unsigned __int64 created, 
													unsigned __int64 modified) :
	m_pNode(pNode)
{
	SecureZeroMemory(m_bstrs, sizeof(m_bstrs));
	m_pNode->AddRef();
	SetID(id);
	setTaskStart(start);
	setTaskStop(stop);
	setTaskID(taskID);
	SetOwner(pOwner);
	SetCreatedDate(created);
	SetModifiedDate(modified);
	SetEntryType(TimeEntry::TaskBillableEntry);
}
Пример #3
0
   INT32 _omTaskStrategyInfo::fromBSON( const BSONObj &obj )
   {
      INT32 rc = SDB_OK ;
      BSONElement beField ;
      BSONObj ipsObj ;

      beField = obj.getField( OM_REST_FIELD_RULE_ID ) ;
      if ( !beField.isNumber() )
      {
         PD_LOG( PDERROR, "Field[%s] must be number",
                 beField.toString( TRUE, TRUE ).c_str() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }
      setID( beField.numberLong() ) ;

      beField = obj.getField( OM_REST_FIELD_TASK_ID ) ;
      if ( !beField.isNumber() )
      {
         PD_LOG( PDERROR, "Field[%s] must be number",
                 beField.toString( TRUE, TRUE ).c_str() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }
      setTaskID( beField.numberLong() ) ;

      beField = obj.getField( OM_REST_FIELD_TASK_NAME ) ;
      if ( String != beField.type() )
      {
         PD_LOG( PDERROR, "Field[%s] must be string",
                 beField.toString( TRUE, TRUE ).c_str() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }
      setTaskName( beField.str() ) ;

      beField = obj.getField( OM_REST_FIELD_NICE ) ;
      if ( !beField.isNumber() )
      {
         PD_LOG( PDERROR, "Field[%s] must be number",
                 beField.toString( TRUE, TRUE ).c_str() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }
      setNice( beField.numberInt() ) ;

      beField = obj.getField( OM_REST_FIELD_USER_NAME ) ;
      if ( String != beField.type() )
      {
         PD_LOG( PDERROR, "Field[%s] must be string",
                 beField.toString( TRUE, TRUE ).c_str() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }
      setUserName( beField.str() ) ;

      beField = obj.getField( OM_REST_FIELD_IPS ) ;
      if ( Array != beField.type() )
      {
         PD_LOG( PDERROR, "Field[%s] must be string array",
                 beField.toString( TRUE, TRUE ).c_str() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }
      else
      {
         clearIPSet() ;

         string tmpStr ;
         BSONElement e ;
         BSONObjIterator itr( beField.embeddedObject() ) ;
         while( itr.more() )
         {
            e = itr.next() ;
            if ( String != beField.type() )
            {
               PD_LOG( PDERROR, "Field[%s] must be string array",
                       beField.toString( TRUE, TRUE ).c_str() ) ;
               rc = SDB_INVALIDARG ;
               goto error ;
            }
            tmpStr = e.str() ;

            if ( !tmpStr.empty() )
            {
               addIP( tmpStr ) ;
            }
         }
      }

   done:
      return rc ;
   error:
      goto done ;
   }