예제 #1
0
 // ---------------------------------------------------------------------------------
 bool operator == (dp::Action const& lhs, dp::Action const& rhs)
 {
   if(!lhs.isValid())
   {
     return (!rhs.isValid());
   }
   return lhs.id() == rhs.id();
 }
예제 #2
0
파일: action.cpp 프로젝트: surfhh/dontpanic
 // ---------------------------------------------------------------------------------
 success Action::assign_query_values_to_entity ( QSqlQuery &query, dp::Action &a ) const
 {
   QUuid const& task_id = query.value ( 1 ).toString();
   a.setTask ( task_id );
   QUuid const& project_id = query.value ( 2 ).toString();
   a.setProject ( project_id );
   QDateTime _start, _end;
   QUuid const& collaboration_id = query.value ( 3 ).toString();
   a.setCollaborationType(collaboration_id);
   a.setName ( query.value ( 4 ).toString() );
   a.setComment ( query.value ( 5 ).toString() );
   uint starttime = query.value ( 6 ).toUInt();
   if(starttime > 0)
   {
     _start.setTime_t ( starttime );
   }
   a.setStartTime ( _start );
   uint endtime = query.value ( 7 ).toUInt();
   if(endtime>0)
   {
     _end.setTime_t ( endtime );
   }
   a.setEndTime ( _end );
   a.setReviewed ( query.value ( 8 ).toBool() );
   a.setBilled ( query.value ( 9 ).toBool() );
   return successful();
 }
예제 #3
0
파일: action.cpp 프로젝트: surfhh/dontpanic
 // ---------------------------------------------------------------------------------
 success Action::update ( dp::Action const& _a ) const
 {
   if ( _a.id().isNull() )
   {
     return error();
   }
   kDebug()<<_a.id().toString();
   QSqlQuery query;
   query.prepare ( UPDATE_ACTION );
   query.addBindValue ( _a.task().toString() );
   query.addBindValue ( _a.project().toString() );
   query.addBindValue ( _a.collaborationType().toString() );
   query.addBindValue ( _a.name() );
   query.addBindValue ( _a.comment() );
   bindTimeValue ( query, _a.startTime() );
   bindTimeValue ( query, _a.endTime() );
   query.addBindValue ( _a.reviewed() );
   query.addBindValue ( _a.billed() );
   query.addBindValue ( _a.id().toString() );
   return execute ( query );
 }