public DataSet getNotes(bool isShopping, bool isDoneShopping, bool isCheckedOut, string orderby)
{
//this is for checkout, so that i can pull data separately based on which statuses are desired
if (isShopping == false && isDoneShopping == false && isCheckedOut == false)
{
return null;
}
else
{
string query = "SELECT Package.checkoutNotes FROM CinderellaTimestamp, (SELECT ID, lastname + ', ' + firstname AS NAME FROM Cinderella) CN, (SELECT ID, lastName + ', ' + firstName AS fgname FROM FairyGodmother) FGN, Cinderella JOIN CinderellaFGPairing ON Cinderella.ID=CinderellaFGPairing.cinderellaID JOIN FairyGodmother ON FairyGodmother.ID=CinderellaFGPairing.fairyGodmotherID LEFT OUTER JOIN Package ON CinderellaFGPairing.cinderellaID=Package.cinderellaID WHERE CN.ID=CinderellaTimestamp.cinderellaID AND FGN.ID=FairyGodmother.ID AND transID IN (SELECT MAX(transID) FROM CinderellaTimestamp WHERE CN.ID = CinderellaTimestamp.cinderellaID) AND Cinderella.ID=CinderellaTimestamp.cinderellaID AND (";
if (isShopping == true)
{
query += "cinderellaTimestamp.status='Shopping'";
if (isDoneShopping == false && isCheckedOut == false)
{
query += ")";
}
}
if (isDoneShopping == true)
{
if (isShopping == false)
{
query += "cinderellaTimestamp.status='Done Shopping'";
}
else
{
query += " OR cinderellaTimestamp.status='Done Shopping'";
}
if (isCheckedOut == false)
{
query += ")";
}
}
if (isCheckedOut == true)
{
if (isShopping == false && isDoneShopping == false)
{
query += "cinderellaTimestamp.status='Checked-Out')";
}
else
{
query += " OR cinderellaTimestamp.status='Checked-Out')";
}
}
query += " ORDER BY " + orderby;
return database.getDataSet(query, "tableName");
}
}