45 #include <Wtx/Core/Core.h> 46 #include <Wtx/Util/Util.h> 47 #include <Wtx/Dbo/QueryModel.h> 54 Wtx::Crm::Person::Item::MapClass( session );
63 std::string Wtx::Crm::Person::key(
const std::string & lastName,
const std::string & firstName )
66 Wt::WString(
"{1}, {2}")
74 Wtx::Crm::Person::Item::Ptr Wtx::Crm::Person::load(
int id,
Wtx::Dbo::Session & session )
76 Wt::Dbo::Transaction t( session );
82 Wtx::Crm::Person::Item::Ptr Wtx::Crm::Person::load(
const std::string & idstring,
Wtx::Dbo::Session & session )
84 Wtx::Crm::Person::Item::Ptr retVal;
86 if( idstring.length() < 0 )
89 if( idstring.at(0) !=
'[' )
92 auto ids = Wtx::Core::split( idstring,
':' );
104 std::cout << __FILE__ <<
":" << __LINE__ <<
" " << std::endl;
108 return load(
id, session );
110 std::cout << __FILE__ <<
":" << __LINE__ <<
" " << ids.size() << std::endl;
111 std::cout << __FILE__ <<
":" << __LINE__ <<
" " << ids.at(0) << std::endl;
112 std::cout << __FILE__ <<
":" << __LINE__ <<
" " << ids.at(1) << std::endl;
123 Wtx::Crm::Person::Item::Ptr Wtx::Crm::Person::xfind(
const std::string & xid,
Wtx::Dbo::Session & session )
125 Wt::Dbo::Transaction t( session );
128 .where(
"xid = ? AND xid != ''")
135 Wtx::Crm::Person::Item::Ptr Wtx::Crm::Person::add(
const std::string & lastName,
const std::string & firstName,
Wtx::Dbo::Session & session )
137 Wt::Dbo::Transaction t( session );
142 std::shared_ptr<Wt::WAbstractItemModel> Wtx::Crm::Person::getComboBoxModel(
int sid,
int tid,
const std::string & where,
Wtx::Dbo::Session & session )
144 auto retVal = std::make_shared< Wtx::Dbo::QueryModel< std::tuple<int,std::string> > >();
146 Wt::Dbo::Transaction t( session );
150 w = Wt::WString(
"WHERE id={1}").arg(tid).toUTF8();
153 std::cout << __FILE__ <<
":" << __LINE__
164 "SELECT id,\"keyField\" || ' ~ ' || \"cfyField\" AS key FROM \"crmPerson\"" 167 "SELECT -1 as id, '' as key" 176 session.query< std::tuple<int,std::string> >( sql )
179 retVal-> setQuery( query );
180 retVal-> addColumn(
"id");
181 retVal-> addColumn(
"key");
static void PostCreateTable(Wt::Dbo::Session &session)
Post Table Create.
int stoi(const std::string &value)
Convert a String to an Integer.