BigBlueBox
An Inventory Management System for a NYLT Course or other Boy Scout Programs
|
DataBase Comm. Layer : Singleton. More...
#include <dbconnect.h>
Public Member Functions | |
~DbConnect () | |
Default non-args de-constructor. More... | |
QVector< Item > | getFullInvAsVector () |
Gets full inventory. More... | |
void | updateItem (QString orgName, Row newRowInfo) |
Updates the contents of one item. More... | |
void | addNewItem (Item newItem) |
Addes a new item to the database. More... | |
void | deleteItem (QString name) |
Deletes a item from the database. More... | |
bool | itemAlreadyExists (QString name) |
Checks to see if an item exists. More... | |
QVector< GearNote > | getGearNotes (int catId, int idvId) |
Gets notes for a gear item. More... | |
Gear | getGearInfo (int catId, int idvId) |
Gets all info for a gear item. More... | |
QStringList | getGearHealthStatusList () |
Gets all Heath Statuses. More... | |
bool | isCheckedOut (int catId, int idvId) |
Checks if Gear is checked out. More... | |
QStringList | getTroopNames () |
Gets Troop names. More... | |
QStringList | getPatrolNamesByTroop (int troopNum) |
Gets Patrol names. More... | |
QStringList | getDefaultNotes () |
Gets Default Notes. More... | |
void | addNote (int catId, int idvId, QString note, QString author) |
Adds new Gear Note to DB. More... | |
bool | gearItemExists (int catId, int idvId) |
void | checkOutGear (int catId, int idvId, QString pid) |
void | checkInGear (int catId, int idvId) |
void | sysLog (QString log) |
System Log. More... | |
void | updateGearItemHealth (int catId, int idvId, int health) |
Updates Health Status. More... | |
QString | isCheckedOutBy (int catId, int idvId) |
Static Public Member Functions | |
static DbConnect * | getInstance () |
Singleton pointer return function. More... | |
Public Attributes | |
const QString | dateFormat = "yyyy/MM/dd hh:mm::ss" |
Server DateTime format for all Date.toString()'s. More... | |
Private Member Functions | |
DbConnect () | |
Default no-args constructor. More... | |
Private Attributes | |
QSqlDatabase | bbb_db |
Database object. More... | |
Static Private Attributes | |
static DbConnect * | instance = nullptr |
Singleton Pointer. More... | |
DataBase Comm. Layer : Singleton.
Contains all push/pull/update functions for communication between DataBase Layer and Business Object Layers.
|
private |
Default no-args constructor.
Private: No objects can be instantiated. Sets the path for the database.
DbConnect::~DbConnect | ( | ) |
Default non-args de-constructor.
Closes database.
void DbConnect::addNewItem | ( | Item | newItem | ) |
Addes a new item to the database.
Items must be unique or the sql will fail.
Item | newItem |
void DbConnect::addNote | ( | int | catId, |
int | idvId, | ||
QString | note, | ||
QString | author | ||
) |
void DbConnect::checkInGear | ( | int | catId, |
int | idvId | ||
) |
void DbConnect::checkOutGear | ( | int | catId, |
int | idvId, | ||
QString | pid | ||
) |
void DbConnect::deleteItem | ( | QString | name | ) |
Deletes a item from the database.
Removes a item from the db based on a matching Item name
QString | itemName |
bool DbConnect::gearItemExists | ( | int | catId, |
int | idvId | ||
) |
QStringList DbConnect::getDefaultNotes | ( | ) |
Gets Default Notes.
Will return all default notes in the DB.
QVector< Item > DbConnect::getFullInvAsVector | ( | ) |
Gets full inventory.
Returns a QVector of all items in the inventory table in the database.
QStringList DbConnect::getGearHealthStatusList | ( | ) |
Gets all Heath Statuses.
Returns a QStringList containing all of the Health Status Text Code in the DB.
Gear DbConnect::getGearInfo | ( | int | catId, |
int | idvId | ||
) |
Gets all info for a gear item.
Queries DB with catId and idvId to find all related info for a certain gear item. Gear gearItem
QVector< GearNote > DbConnect::getGearNotes | ( | int | catId, |
int | idvId | ||
) |
Gets notes for a gear item.
Queries DB with catId and idvId to find all related node for a certain gear item in chrono order.
|
static |
Singleton pointer return function.
Returns pointer to singleton object.
QStringList DbConnect::getPatrolNamesByTroop | ( | int | troopNum | ) |
Gets Patrol names.
Will return all patrol names for the given troop id in a QStringList
QStringList DbConnect::getTroopNames | ( | ) |
Gets Troop names.
Will return all troop names in the DB in a QStringList
bool DbConnect::isCheckedOut | ( | int | catId, |
int | idvId | ||
) |
QString DbConnect::isCheckedOutBy | ( | int | catId, |
int | idvId | ||
) |
bool DbConnect::itemAlreadyExists | ( | QString | name | ) |
Checks to see if an item exists.
Queries DB with itemName to see if any records with the same name exist. If they exist, the function will return true.
void DbConnect::sysLog | ( | QString | log | ) |
System Log.
Pushes a log with a timestamp to the DB.
void DbConnect::updateGearItemHealth | ( | int | catId, |
int | idvId, | ||
int | health | ||
) |
Updates Health Status.
Updates Health Status for an item. Health must be passed as an int, not a enum
void DbConnect::updateItem | ( | QString | orgName, |
Row | newRowInfo | ||
) |
|
private |
Database object.
const QString bbb::DbConnect::dateFormat = "yyyy/MM/dd hh:mm::ss" |
Server DateTime format for all Date.toString()'s.
|
staticprivate |
Singleton Pointer.