BigBlueBox
An Inventory Management System for a NYLT Course or other Boy Scout Programs
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
bbb::DbConnect Class Reference

DataBase Comm. Layer : Singleton. More...

#include <dbconnect.h>

Collaboration diagram for bbb::DbConnect:
Collaboration graph
[legend]

Public Member Functions

 ~DbConnect ()
 Default non-args de-constructor. More...
 
QVector< ItemgetFullInvAsVector ()
 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< GearNotegetGearNotes (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 DbConnectgetInstance ()
 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 DbConnectinstance = nullptr
 Singleton Pointer. More...
 

Detailed Description

DataBase Comm. Layer : Singleton.

Contains all push/pull/update functions for communication between DataBase Layer and Business Object Layers.

Author
Bob Baker

Constructor & Destructor Documentation

DbConnect::DbConnect ( )
private

Default no-args constructor.

Private: No objects can be instantiated. Sets the path for the database.

Author
Bob Baker

Here is the call graph for this function:

Here is the caller graph for this function:

DbConnect::~DbConnect ( )

Default non-args de-constructor.

Closes database.

Author
Bob Baker

Member Function Documentation

void DbConnect::addNewItem ( Item  newItem)

Addes a new item to the database.

Items must be unique or the sql will fail.

Parameters
ItemnewItem
Author
Bob Baker

Here is the caller graph for this function:

void DbConnect::addNote ( int  catId,
int  idvId,
QString  note,
QString  author 
)

Adds new Gear Note to DB.

Addes a new note for an Gear Item based on catId and idvId. It will handle the time stamp local to the function.

Author
Bob Baker

Here is the caller graph for this function:

void DbConnect::checkInGear ( int  catId,
int  idvId 
)

Here is the caller graph for this function:

void DbConnect::checkOutGear ( int  catId,
int  idvId,
QString  pid 
)

Here is the caller graph for this function:

void DbConnect::deleteItem ( QString  name)

Deletes a item from the database.

Removes a item from the db based on a matching Item name

Parameters
QStringitemName
Author
Bob Baker

Here is the caller graph for this function:

bool DbConnect::gearItemExists ( int  catId,
int  idvId 
)

Here is the caller graph for this function:

QStringList DbConnect::getDefaultNotes ( )

Gets Default Notes.

Will return all default notes in the DB.

Returns
QStringList defaultNotesList
Author
Bob Baker

Here is the caller graph for this function:

QVector< Item > DbConnect::getFullInvAsVector ( )

Gets full inventory.

Returns a QVector of all items in the inventory table in the database.

Returns
QVector<Item> fullInventory
Author
Bob Baker

Here is the caller graph for this function:

QStringList DbConnect::getGearHealthStatusList ( )

Gets all Heath Statuses.

Returns a QStringList containing all of the Health Status Text Code in the DB.

Returns
QStringList healthStatusList
Author
Bob Baker
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

Author
Bob Baker

Here is the caller graph for this function:

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.

Returns
QVector<GearNote>
Author
Bob Baker

Here is the caller graph for this function:

DbConnect * DbConnect::getInstance ( )
static

Singleton pointer return function.

Returns pointer to singleton object.

Returns
DbConnect* instanceSingletonClass
Author
Bob Baker

Here is the call graph for this function:

Here is the caller graph for this function:

QStringList DbConnect::getPatrolNamesByTroop ( int  troopNum)

Gets Patrol names.

Will return all patrol names for the given troop id in a QStringList

Returns
QStringList patrolNamesList
Author
Bob Baker
QStringList DbConnect::getTroopNames ( )

Gets Troop names.

Will return all troop names in the DB in a QStringList

Returns
QStringList troopNamesList
Author
Bob Baker
bool DbConnect::isCheckedOut ( int  catId,
int  idvId 
)

Checks if Gear is checked out.

Returns a bool if the Gear Item, based on catId and idvId, is checked out.

Returns
bool isCheckedOut
Author
Bob Baker

Here is the caller graph for this function:

QString DbConnect::isCheckedOutBy ( int  catId,
int  idvId 
)

Here is the caller graph for this function:

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.

Returns
boolItemAlreadyExists
Author
Bob Baker

Here is the caller graph for this function:

void DbConnect::sysLog ( QString  log)

System Log.

Pushes a log with a timestamp to the DB.

Author
Bob Baker

Here is the caller graph for this function:

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

Author
Bob Baker

Here is the caller graph for this function:

void DbConnect::updateItem ( QString  orgName,
Row  newRowInfo 
)

Updates the contents of one item.

Take a QString containing the org name, and a Row containing the new info for the item. A Row is a empty inheritance of Item.

Parameters
QStringorgName, Row newRowInfo
Author
Bob Baker

Here is the caller graph for this function:

Member Data Documentation

QSqlDatabase bbb::DbConnect::bbb_db
private

Database object.

const QString bbb::DbConnect::dateFormat = "yyyy/MM/dd hh:mm::ss"

Server DateTime format for all Date.toString()'s.

DbConnect * DbConnect::instance = nullptr
staticprivate

Singleton Pointer.


The documentation for this class was generated from the following files: