///<summary>Sets the IsDeleted flag to true (1) for the specified sheetNum. The sheet and associated sheetfields are not deleted.</summary> public static void Delete(long sheetNum, long patNum = 0, byte showInTerminal = 0) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), sheetNum, patNum, showInTerminal); return; } string command = "UPDATE sheet SET IsDeleted=1,ShowInTerminal=0 WHERE SheetNum=" + POut.Long(sheetNum); Db.NonQ(command); if (patNum > 0 && showInTerminal > 0) //showInTerminal must be at least 1, so decrementing those that are at least 2 { command = "UPDATE sheet SET ShowInTerminal=ShowInTerminal-1 " + "WHERE PatNum=" + POut.Long(patNum) + " " + "AND IsDeleted=0 " + "AND ShowInTerminal>" + POut.Byte(showInTerminal); //decrement ShowInTerminal for all sheets with a bigger ShowInTerminal than the one deleted Db.NonQ(command); } }