2 #include <Wtx/Dbo/QueryModel.h> 3 #include <Wtx/Core/Core.h> 9 Wtx::Crm::Activity::Item::MapClass( session );
30 Wt::Dbo::ptr< Wtx::Crm::Activity::Item > retVal;
34 Wt::Dbo::Transaction t(session);
37 .where(
"UPPER(\"keyField\") = UPPER(?)").bind( key )
38 .where(
"\"dateStart\" = ?").bind( date )
45 std::cout << __FILE__ <<
":" << __LINE__
47 <<
" " << date.toString()
48 <<
" " << retVal-> keyField().value()
59 Wt::Dbo::Transaction t(session);
61 retVal.modify()-> dateStart().setValue( date );
76 Wt::Dbo::ptr< Wtx::Crm::Activity::Item > retVal;
80 Wt::Dbo::Transaction t(session);
83 .where(
"UPPER(\"keyField\") = UPPER(?)").bind( key )
84 .where(
"\"dateStart\" = ?").bind( dateTime.date() )
85 .where(
"\"timeStart\" = ?").bind( dateTime.time() )
92 std::cout << __FILE__ <<
":" << __LINE__
93 <<
" " << retVal << retVal-> keyField().value()
94 <<
" " << dateTime.toString()
105 Wt::Dbo::Transaction t(session);
107 retVal.modify()-> dateStart().setValue( dateTime.date() );
108 retVal.modify()-> timeStart().setValue( dateTime.time() );
118 Wt::Dbo::ptr< Wtx::Sys::Lookup::Item > Wtx::Sys::Lookup::find(
const std::string & key,
Wtx::Dbo::Session & session )
120 Wt::Dbo::ptr< Wtx::Sys::Lookup::Item > retVal;
124 if( key.at(0) ==
'[' )
126 auto v = Wtx::Core::split( key,
':' );
127 int idVal = std::stoi(v.at(1));
131 Wt::Dbo::Transaction t(session);
132 retVal = session.template load<Wtx::Sys::Lookup::Item>(idVal);
141 Wt::Dbo::Transaction t(session);
144 .where(
"\"keyField\" = ?")
157 Wt::Dbo::ptr< Wtx::Sys::Lookup::Item > Wtx::Sys::Lookup::ifind(
const std::string & key,
Wtx::Dbo::Session & session )
159 Wt::Dbo::ptr< Wtx::Sys::Lookup::Item > retVal;
167 Wt::Dbo::Transaction t(session);
170 .where(
"UPPER(\"keyField\") = UPPER(?)")
198 auto retVal = std::make_shared< Wtx::Dbo::QueryModel< Wt::Dbo::ptr<Wtx::Sys::Lookup::Item> > >();
200 Wt::Dbo::Transaction t(session);
206 .where(
"UPPER(\"cfyField\") LIKE UPPER(?) OR \"cfyField\" LIKE '%%*%%'")
207 .bind( Wt::WString(
"%%{1}%%").arg(group) )
208 .orderBy(
"\"keyField\"")
211 retVal-> setQuery( query );
222 retVal-> setQuery( query );
225 retVal-> addColumn(
"id");
226 retVal-> addColumn(
"keyField");
Wt::Dbo::ptr< Wtx::Crm::Activity::Item > add(const std::string &key, const Wt::WDate &date, Wtx::Dbo::Session &session)
Add an item to the lookup table.
static void PostCreateTable(Wt::Dbo::Session &session)
Post Table Create.
std::shared_ptr< Wt::WAbstractItemModel > getComboBoxModel(int tid, const std::string &group, Wtx::Dbo::Session &session, bool includeBlank=false)
Get a Combo-Box Model.