CinderellaMGS.SQL_Queries.endShift C# (CSharp) Method

endShift() public method

Resets all godmothers back to a status of pending.
public endShift ( ) : void
return void
        public void endShift()
        {
            string sql = "INSERT INTO [FairyGodmotherTimestamp]([fairyGodmotherID], [timestamp], [status]) Select CONVERT(VARCHAR(50),FairyGodmotherTimestamp.fairyGodmotherID) , GetDate(), 'Pending' From FairyGodmotherTimestamp, (Select ID, lastname + ', ' + firstname AS Name FROM FairyGodmother) n, (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 FairyGodmotherTimestamp.status <> 'Pending' Order By transID";
            database.ExecuteQuery(sql);
        }