DumontEXE 0.0.1
cmcItemField.cpp
00001 /* ***************************************************************************
00002 **
00003 ** Copyright (C) 2007 Lorimark Solutions, LLC. All rights reserved.
00004 **
00005 ** This file is part of the DumontEXE Scripting Extension Kit
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://dumont.showoff-db.org/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://dumont.showoff-db.org/licensing.html 
00017 ** or contact the sales department at sales@lorimarksolutions.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ** author: Mark Petryk ~ Lorimark Solutions, LLC
00023 ** **************************************************************************/
00024 
00025 #include <QString>
00026 #include <QDomDocument>
00027 #include <QDomNode>
00028 #include <QDomElement>
00029 #include <QDate>
00030 
00031 #include "cmcItemField.h"
00032 #include "cmcForm.h"
00033 #include "cmcFieldDefs.h"
00034 #include "cmcFieldDef.h"
00035 
00036 namespace cmcDatabaseApi {
00037 
00038 cmcItemField::cmcItemField( const cmcItemField & copy ):
00039   cmcField( copy )
00040 {
00041 }
00042 
00043 cmcItemField::cmcItemField
00044 (
00045   const QString & fieldName,
00046   cmcApplication * application,
00047   cmcItem * parentItem
00048 ):
00049   cmcField( fieldName, application, (QObject*) parentItem )
00050 {
00051 //  TRACE_FUNCTION
00052 }
00053 
00054 cmcItemField::~cmcItemField()
00055 {
00056 //  TRACE_FUNCTION
00057 }
00058 
00059 QString cmcItemField::label()
00060 {
00061   return( "" );
00062 }
00063 
00064 QString cmcItemField::value()
00065 {
00066   if( !item() )
00067   {
00068     CMC_ERROR( 1, "no item" );
00069     return( error()-> description() );
00070   }
00071 
00072   if( !rowset() )
00073   {
00074     CMC_ERROR( 2, "no edit rowset" );
00075     return( error()-> description()  );
00076   }
00077 
00078   return( rowset()-> getRowValue( row(), name() ) );
00079 }
00080 
00081 bool cmcItemField::ok()
00082 {
00083   if( !item() )
00084   {
00085     CMC_ERROR( 1, "no item" );
00086     return(false);
00087   }
00088 
00089   if( !rowset() )
00090   {
00091     CMC_ERROR( 2, "no edit rowset" );
00092     return(false);
00093   }
00094 
00095   return(true);
00096 
00097 }
00098 
00099 void cmcItemField::value( QString value )
00100 {
00101   if( ok() ) 
00102     rowset()-> 
00103       modifyRow( row(), name(), value );
00104 }
00105 
00106 
00107 void cmcItemField::value( bool value )
00108 {
00109   if( ok() )
00110     rowset()-> 
00111       modifyRow( row(), name(), value? "TRUE":"FALSE" );
00112 }
00113 
00114 cmcItem * cmcItemField::item()
00115 {
00116   return( qobject_cast<cmcItem*>(parent()) );
00117 }
00118 
00119 cmcRowSet * cmcItemField::rowset()
00120 {
00121   return( item()-> rowset() );
00122 }
00123 
00124 long cmcItemField::row()
00125 {
00126   return( item()-> row() );
00127 }
00128 
00129 
00130 } // endnamespace cmcDatabaseApi
00131 
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties




~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
 
Commence Database User Support Group Forum
http://newsgroup.showoff-db.org/
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC
mark@lorimarksolutions.com