private void butDone_Click(object sender, EventArgs e) { if (IsSimpleMode) { labelForms.Visible = false; listForms.Visible = false; butDone.Visible = false; Sheets.ClearFromTerminal(PatNum); PatNum = 0; labelThankYou.Visible = true; } else { Sheets.ClearFromTerminal(PatNum); UnloadPatient(); //tell the database about it so that the terminal manager can see TerminalActive terminal = TerminalActives.GetTerminal(Environment.MachineName); if (terminal == null) { return; } terminal.PatNum = 0; TerminalActives.Update(terminal); } }
private void FormTerminal_FormClosing(object sender, FormClosingEventArgs e) { if (IsSimpleMode) { return; } Process processCur = Process.GetCurrentProcess(); try { Sheets.ClearFromTerminal(PatNum); TerminalActives.DeleteForCmptrSessionAndId(Environment.MachineName, processCur.SessionId, processId: processCur.Id); //Just in case, close remaining forms that are open _formSheetFillEdit.ForceClose(); } catch (Exception) { //SocketException if db connection gets lost. //if either fail, do nothing, the terminalactives will be cleaned up the next time the kiosk mode is enabled for this computer } finally { Signalods.SetInvalid(InvalidType.Kiosk, KeyType.ProcessId, processCur.Id); } }
private void butDone_Click(object sender, EventArgs e) { Sheets.ClearFromTerminal(PatNum); labelForms.Visible = false; listForms.Visible = false; butDone.Visible = false; if (IsSimpleMode) //not subscribed to signals if IsSimpleMode { PatNum = 0; _listSheets = new List <Sheet>(); labelThankYou.Visible = true; return; } //NOT IsSimpleMode from here down TerminalActive terminal; Process processCur = Process.GetCurrentProcess(); try{ terminal = TerminalActives.GetForCmptrSessionAndId(Environment.MachineName, processCur.SessionId, processCur.Id); labelConnection.Visible = false; } catch (Exception) { //SocketException if db connection gets lost. labelConnection.Visible = true; return; } //this terminal shouldn't be running, receptionist must've deleted this kiosk, close the form (causes application exit if NOT IsSimpleMode). if (terminal == null) { Close(); //signal sent in form closing return; } if (terminal.PatNum != 0) { labelWelcome.Visible = true; TerminalActives.SetPatNum(terminal.TerminalActiveNum, 0); PatNum = 0; _listSheets = new List <Sheet>(); Signalods.SetInvalid(InvalidType.Kiosk, KeyType.ProcessId, processCur.Id); //signal the terminal manager to refresh its grid } }