68 lines
1.4 KiB
C++
68 lines
1.4 KiB
C++
#include "User.h"
|
|
|
|
|
|
User::~User()
|
|
{
|
|
std::map<unsigned int, std::map<unsigned int, std::vector<operation> >* >::iterator it;
|
|
|
|
for (it = _operations.begin(); it != _operations.end(); it++)
|
|
{
|
|
if (_operations[it->first])
|
|
{
|
|
delete it->second;
|
|
}
|
|
}
|
|
}
|
|
|
|
wxString User::GetCategoryName(wxString catId)
|
|
{
|
|
if (_preferences._categories.find(catId) == _preferences._categories.end())
|
|
return _("Unknown") ;
|
|
return _preferences._categories[catId];
|
|
}
|
|
|
|
wxString User::GetCategoryId(wxString catName)
|
|
{
|
|
std::map<wxString, wxString>::iterator it;
|
|
for (it=_preferences._categories.begin(); it !=_preferences._categories.end(); it++)
|
|
if (it->second == catName)
|
|
return it->first;
|
|
|
|
return _("0") ;
|
|
}
|
|
|
|
wxString User::GetAccountName(wxString accountId)
|
|
{
|
|
std::vector<Account>::iterator it;
|
|
for (it=_accounts.begin(); it !=_accounts.end(); it++)
|
|
if (it->id == accountId)
|
|
return it->name;
|
|
|
|
return _("Unknown") ;
|
|
}
|
|
|
|
wxString User::GetAccountId(wxString accountName)
|
|
{
|
|
std::vector<Account>::iterator it;
|
|
for (it=_accounts.begin(); it !=_accounts.end(); it++)
|
|
if (it->name == accountName)
|
|
return it->id;
|
|
|
|
return _("0") ;
|
|
}
|
|
|
|
int User::GetCategoriesNumber()
|
|
{
|
|
return _preferences._categories.size();
|
|
}
|
|
|
|
int User::GetAccountsNumber()
|
|
{
|
|
return _accounts.size();
|
|
}
|
|
|
|
int User::GetOperationsNumber(int month, int year)
|
|
{
|
|
return (*_operations[year])[month].size();
|
|
}
|