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); } }
///<summary>Only in nonSimpleMode. Occurs every 4 seconds. Checks database for status changes.</summary> private void timer1_Tick(object sender, EventArgs e) { TerminalActive terminal; try{ terminal = TerminalActives.GetTerminal(Environment.MachineName); labelConnection.Visible = false; } catch { //SocketException if db connection gets lost. labelConnection.Visible = true; return; } if (terminal == null) { return; } if (terminal.PatNum == PatNum) { return; } //someone changed the PatNum remotely from the terminal manager. if (terminal.PatNum == 0) //force clearing of patient (rare) { UnloadPatient(); } else //receptionist wants to load up a patient. This should also work if patient is quickly changed in less than 4 seconds. { PatNum = terminal.PatNum; textWelcome.Visible = false; labelForms.Visible = true; listForms.Visible = true; butDone.Visible = true; LoadPatient(); } }
///<summary>Only if TerminalListenShut. Occurs every 4 seconds. Checks database for status changes. Shouldn't happen very often, because it means user will lose all data that they may have entered.</summary> private void timer1_Tick(object sender, EventArgs e) { TerminalActive terminal = TerminalActives.GetTerminal(Environment.MachineName); if (terminal == null) //no terminal is supposed to be running here. { DialogResult = DialogResult.Cancel; return; } if (terminal.PatNum == SheetCur.PatNum) { return; } //So terminal.PatNum must either be 0 or be an entirely different patient. DialogResult = DialogResult.Cancel; }