本文整理汇总了C++中Account::GetID方法的典型用法代码示例。如果您正苦于以下问题:C++ Account::GetID方法的具体用法?C++ Account::GetID怎么用?C++ Account::GetID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::GetID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveObject
bool
PersistentAccount::CreateInbox(const Account &account)
{
std::shared_ptr<IMAPFolder> inbox = std::shared_ptr<IMAPFolder>(new IMAPFolder(account.GetID(), -1));
inbox->SetFolderName("INBOX");
inbox->SetIsSubscribed(true);
return PersistentIMAPFolder::SaveObject(inbox);
}
示例2: CalcStats
void BudgetWindow::CalcStats(const char *cat, Fixed &high, Fixed &low, Fixed &avg)
{
if(!cat)
return;
BString querystring;
Fixed cattotal;
CppSQLite3Query query;
// find the average amount
for(int32 j=0; j<gDatabase.CountAccounts(); j++)
{
Account *acc = gDatabase.AccountAt(j);
querystring = "select sum(amount) from account_" ;
querystring << acc->GetID() << " where category = '"
<< EscapeIllegalCharacters(cat)
<< "';";
query = gDatabase.DBQuery(querystring.String(),
"BudgetWindow::CalcStats:get average");
cattotal.AddPremultiplied(query.getInt64Field(0));
query.finalize();
}
avg = cattotal;
avg /= 12;
// find the highest amount
cattotal=0;
for(int32 j=0; j<gDatabase.CountAccounts(); j++)
{
Account *acc = gDatabase.AccountAt(j);
querystring = "select max(amount) from account_" ;
querystring << acc->GetID() << " where category = '"
<< EscapeIllegalCharacters(cat)
<< "';";
query = gDatabase.DBQuery(querystring.String(),
"BudgetWindow::CalcStats:get highest");
Fixed value;
value.SetPremultiplied(query.getInt64Field(0));
cattotal = MAX(cattotal,value);
query.finalize();
}
high = cattotal;
// find the lowest amount
cattotal=0;
for(int32 j=0; j<gDatabase.CountAccounts(); j++)
{
Account *acc = gDatabase.AccountAt(j);
querystring = "select min(amount) from account_" ;
querystring << acc->GetID() << " where category = '"
<< EscapeIllegalCharacters(cat)
<< "';";
query = gDatabase.DBQuery(querystring.String(),
"BudgetWindow::CalcStats:get highest");
Fixed value;
value.SetPremultiplied(query.getInt64Field(0));
cattotal = MIN(cattotal,value);
query.finalize();
}
low = cattotal;
}
示例3: GenerateBudget
void BudgetWindow::GenerateBudget(const bool &zero)
{
// Generate a budget based on the last year's transactions
ReportGrid income(1,0), spending(1,0);
gDatabase.DBCommand("delete from budgetlist",
"BudgetWindow::GenerateBudget:empty budget");
CppSQLite3Query query;
query = gDatabase.DBQuery("select * from categorylist order by name",
"BudgetWindow::GenerateBudget:get categories");
if(query.eof())
return;
float maxwidth=fCategoryList->StringWidth(TRANSLATE("Category"));
while(!query.eof())
{
BString catname = DeescapeIllegalCharacters(query.getStringField(0));
if(catname.ICompare(TRANSLATE("Transfer"))==0)
{
query.nextRow();
continue;
}
bool isexpense = !query.getIntField(1);
if(isexpense)
{
spending.AddItem();
spending.SetRowTitle(spending.CountItems()-1,catname.String());
}
else
{
income.AddItem();
income.SetRowTitle(income.CountItems()-1,catname.String());
}
float tempwidth = fCategoryList->StringWidth(catname.String());
maxwidth = MAX(maxwidth,tempwidth);
query.nextRow();
}
query.finalize();
// Now that we have the list of categories, query for transactions for each
// account from each category
BString querystring;
Fixed cattotal;
for(int32 i=0; i<income.CountItems(); i++)
{
querystring = "";
cattotal = 0;
if(!zero)
{
for(int32 j=0; j<gDatabase.CountAccounts(); j++)
{
Account *acc = gDatabase.AccountAt(j);
querystring = "select sum(amount) from account_" ;
querystring << acc->GetID() << " where category = '"
<< EscapeIllegalCharacters(income.RowTitle(i))
<< "' and date > " << DecrementDateByYear(GetCurrentDate()) << ";";
query = gDatabase.DBQuery(querystring.String(),
"BudgetWindow::GenerateBudget:get category");
cattotal.AddPremultiplied(query.getInt64Field(0));
query.finalize();
}
cattotal /= 12;
cattotal.Round();
}
income.SetValue(0,i,cattotal);
gDatabase.AddBudgetEntry(BudgetEntry(income.RowTitle(i),cattotal,BUDGET_MONTHLY,false));
}
for(int32 i=0; i<spending.CountItems(); i++)
{
querystring = "";
cattotal = 0;
if(!zero)
{
for(int32 j=0; j<gDatabase.CountAccounts(); j++)
{
Account *acc = gDatabase.AccountAt(j);
querystring = "select sum(amount) from account_" ;
querystring << acc->GetID() << " where category = '"
<< EscapeIllegalCharacters(spending.RowTitle(i))
<< "';";
query = gDatabase.DBQuery(querystring.String(),
"BudgetWindow::GenerateBudget:get category");
cattotal.AddPremultiplied(query.getInt64Field(0));
query.finalize();
}
cattotal /= 12;
cattotal.Round();
}
spending.SetValue(0,i,cattotal);
gDatabase.AddBudgetEntry(BudgetEntry(spending.RowTitle(i),cattotal,BUDGET_MONTHLY,true));
//.........这里部分代码省略.........