eFinancialPlanner  V1.0 (proof of concept)
Personal Financial Planning based on Maslowian Portfolio Theory
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
asset_class.class.cpp
Go to the documentation of this file.
1 /*
2  *
3  * class assets_class
4  *
5  * copyright: (c) Philippe De Brouwer 2014
6  *
7  * last modification:
8  *
9  */
10 
12 {
13 public:
16  float E_R;
17 
18  string dropDown_assetClass(int defaultAC = 0);
19  bool exists(int acID);
20  std::map <int, string> get_assetList();
21 
22 private:
23 };
24 
25 
26 /* **********************************************
27  *
28  * exists
29  * **********************************************/
30 /* returns "" if investment is valid */
31 bool asset_class::exists(int acID)
32 {
33  // if exists asset_class
34 
35  // correct currency
36  return true;
37 }
38 
39 /*************************************
40  * dropDown_assetClass
41  *
42  * returns a string that is a dropdown box of all asset classes
43  * ***********************************/
44 string asset_class::dropDown_assetClass(int defaultAC)
45 {
46  string s;
47 
48  s = s + "<select required name=\"asset_class\">";
49  db.res = db.stmt->executeQuery("SELECT asset_class_id, asset_class_name FROM " + oConfig.tbl_prefix + "_asset_classes;");
50  while (db.res->next())
51  {
52  s = s + "<option value=\"" + db.res->getString("asset_class_id") + "\"";
53  if (db.res->getString("asset_class_id") == std::to_string(defaultAC)) {s = s + " selected "; }
54  s = s + ">" + db.res->getString("asset_class_name") + "</option>";
55  }
56  s = s + "</select>";
57  return s;
58  }
59 
60 
64 std::map<int, string> asset_class::get_assetList()
65 {
66  int i;
67  std::map<int, string> theList;
68  db.res = db.stmt->executeQuery("SELECT * FROM " + oConfig.tbl_prefix + "_asset_classes ORDER BY asset_class_id;");
69  while (db.res->next())
70  {
71  i = atoi(db.res->getString("asset_class_id").c_str());
72  theList[i] = db.res->getString("asset_class_name");
73  }
74  return theList;
75 }
std::map< int, string > get_assetList()
sql::ResultSet * res
sql::Statement * stmt
bool exists(int acID)
const string tbl_prefix
tables start with "" + oConfig.tbl_prefix + "_" if the prefix is eg. "tbl" then we have "tbl_invesotr...
string dropDown_assetClass(int defaultAC=0)
db_helper db
Definition: efp.cpp:183
config oConfig
mysql connection mysql connector from dev.mysql.com
Definition: efp.cpp:149