CinderellaMGS.SQL_Queries.getGodmotherStatusByShift C# (CSharp) Method

getGodmotherStatusByShift() public method

Returns godmothers working a specific shift with a specific status.
public getGodmotherStatusByShift ( string statustocheck, string orderby, string shiftID ) : DataSet
statustocheck string Status that you are checking for (ie. shopping, pending, etc)
orderby string How the data should be ordered (ie. lname)
shiftID string Id of the shift you are checking
return System.Data.DataSet
        public DataSet getGodmotherStatusByShift(string statustocheck, string orderby, string shiftID)
        {
            string sql = "Select transID, FairyGodmotherTimestamp.fairyGodmotherID, n.Name, FairyGodmotherTimestamp.timestamp, FairyGodmotherTimestamp.status, b.shiftID From FairyGodmotherTimestamp, (Select ID, lastname + ', ' + firstname AS Name FROM FairyGodmother) n, (Select fairyGodmotherID, shiftID From FairyGodmotherShift) b, (Select fairyGodmotherID, max(timestamp) as TimeStamp FROM FairyGodmotherTimestamp Group BY fairyGodmotherID) a Where a.fairyGodmotherID= FairyGodmotherTimestamp.fairyGodmotherID and a.timestamp= FairyGodmotherTimestamp.timestamp and n.ID= fairyGodmotherTimestamp.fairyGodmotherID and b.fairyGodmotherID = FairyGodmotherTimestamp.fairyGodmotherID and FairyGodmotherTimestamp.status = '";
            sql += statustocheck + "' and b.shiftID =" + shiftID + " Order By " + orderby;

            return database.getDataSet(sql, "tableName");
        }