Exemple #1
0
        ///<summary>Only in nonSimpleMode.  Occurs every 4 seconds. Checks the database to verify that this kiosk should still be running and that the
        ///correct patient's forms are loaded.  If there shouldn't be forms loaded, clears the forms.  If this kiosk (terminalactive row) has been deleted
        ///then this form is closed.  If FormSheetFillEdit is visible, signals that form to force it closed (user will lose any unsaved data).</summary>
        private void timer1_Tick(object sender, EventArgs e)
        {
            TerminalActive terminal = null;

            try{
                Process processCur = Process.GetCurrentProcess();
                terminal = TerminalActives.GetForCmptrSessionAndId(Environment.MachineName, processCur.SessionId, processCur.Id);
                labelConnection.Visible = false;
            }
            catch (Exception) {           //SocketException if db connection gets lost.
                labelConnection.Visible = true;
                return;
            }
            if (terminal == null)
            {
                //this terminal shouldn't be running, receptionist must've deleted this kiosk, close the form (causes application exit if NOT IsSimpleMode)
                if (_formSheetFillEdit != null && !_formSheetFillEdit.IsDisposed)
                {
                    _formSheetFillEdit.ForceClose();
                }
                Close();
                return;
            }
            if (_formSheetFillEdit == null || _formSheetFillEdit.IsDisposed)
            {
                return;
            }
            List <Sheet> listSheets = Sheets.GetForTerminal(terminal.PatNum);

            if (terminal.PatNum == 0 || terminal.PatNum != PatNum || listSheets.Count == 0 || listSheets.All(x => x.SheetNum != _formSheetFillEdit.SheetCur.SheetNum))
            {
                //patient has been changed or cleared, or there are no forms to fill for the selected patient, force FormSheetFillEdit closed if open
                _formSheetFillEdit.ForceClose();
            }
        }
 ///<summary>Refills form based on FormOpenDental.CurPatNum</summary>
 private void FillPat()
 {
     if (FormOpenDental.CurPatNum == 0)
     {
         _patNumCur          = 0;
         labelPatient.Text   = Lan.g(this, "none");
         labelSheets.Visible = false;
         listSheets.Visible  = false;
         butLoad.Visible     = false;
     }
     else
     {
         if (FormOpenDental.CurPatNum != _patNumCur)               //if pat changed or on load, get the patient name from db
         {
             _patNumCur        = FormOpenDental.CurPatNum;
             labelPatient.Text = Patients.GetLim(_patNumCur).GetNameFL();
         }
         labelSheets.Visible = true;
         listSheets.Visible  = true;
         butLoad.Visible     = true;
         listSheets.Items.Clear();
         //refresh the sheet list for the current patient even if the patient loaded has not changed, in case they've added some sheets in OD
         Sheets.GetForTerminal(_patNumCur).ForEach(x => listSheets.Items.Add(x.Description));
     }
 }
Exemple #3
0
 ///<summary>Used in both modes.  Loads the list of sheets into the listbox.  Then launches the first sheet and goes through the sequence of sheets.  If user clicks cancel, the seqeunce will exit.  If not IsSimpleMode, then the TerminalManager can also send a signal to immediately terminate the sequence.</summary>
 private void LoadPatient()
 {
     SheetList = Sheets.GetForTerminal(PatNum);
     listForms.Items.Clear();
     if (SheetList.Count == 0)
     {
         return;
     }
     for (int i = 0; i < SheetList.Count; i++)
     {
         listForms.Items.Add(SheetList[i].Description);
     }
     for (int i = 0; i < SheetList.Count; i++)
     {
         //we want the very freshest copy of the sheet, so we go straight to the database for it
         Sheet sheet = Sheets.GetSheet(SheetList[i].SheetNum);
         formSheetFillEdit = new FormSheetFillEdit(sheet);
         formSheetFillEdit.IsInTerminal = true;
         if (!IsSimpleMode)
         {
             formSheetFillEdit.TerminalListenShut = true;
         }
         formSheetFillEdit.ShowDialog();
         if (formSheetFillEdit.DialogResult != DialogResult.OK) //either patient clicked cancel, or in not IsSimpleMode a close signal was received.
         {
             return;                                            //breaks out of looping through sheets.
         }
     }
 }
        private void FillPat()
        {
            bool isRowSelected = gridMain.GetSelectedIndex() > -1;

            groupBoxPatient.Enabled = isRowSelected;
            listSheets.Visible      = isRowSelected;
            butPatForms.Visible     = isRowSelected;
            if (!isRowSelected)
            {
                groupBoxPatient.Text = "Select a Device First";
                labelPatient.Text    = "";
                labelSheets.Text     = "";
                return;
            }
            SheetDevice device = (SheetDevice)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag;

            listSheets.Items.Clear();
            if (device.PatNum == 0)
            {
                groupBoxPatient.Text = "Patient to Load to Device";
                labelSheets.Text     = "Forms to Load to Device";
                if (FormOpenDental.CurPatNum == 0)
                {
                    labelPatient.Text   = "None Selected";
                    butPatForms.Enabled = false;
                }
                else
                {
                    labelPatient.Text   = Patients.GetLim(FormOpenDental.CurPatNum).GetNameLF();
                    butPatForms.Enabled = true;
                    Sheets.GetForTerminal(FormOpenDental.CurPatNum).ForEach(x => listSheets.Items.Add(new ODBoxItem <Sheet>(x.Description, tag: x)));
                }
            }
            else
            {
                groupBoxPatient.Text = "Patient on Device";
                labelSheets.Text     = "Forms on Device";
                labelPatient.Text    = device.PatName;
                butPatForms.Enabled  = !device.IsKiosk;
                Sheets.GetForTerminal(device.PatNum).ForEach(x => listSheets.Items.Add(new ODBoxItem <Sheet>(x.Description, x)));
            }
        }
		private void FillPat() {
			if(FormOpenDental.CurPatNum==0) {
				labelPatient.Text=Lan.g(this,"none");
				labelSheets.Visible=false;
				listSheets.Visible=false;
				butLoad.Visible=false;
			}
			else {
				Patient pat=Patients.GetLim(FormOpenDental.CurPatNum);
				labelPatient.Text=pat.GetNameFL();
				labelSheets.Visible=true;
				listSheets.Visible=true;
				butLoad.Visible=true;
				listSheets.Items.Clear();
				List<Sheet> sheetList=Sheets.GetForTerminal(FormOpenDental.CurPatNum);
				for(int i=0;i<sheetList.Count;i++) {
					listSheets.Items.Add(sheetList[i].Description);
				}
			}
		}
Exemple #6
0
        ///<summary>Used in both modes.  Loads the list of sheets into the listbox.  Then launches the first sheet and goes through the sequence of sheets.
        ///If user clicks cancel, the seqeunce will exit.  If NOT IsSimpleMode, then the TerminalManager can also send a signal to immediately terminate
        ///the sequence.  If PatNum is 0, this will unload the patient by making the form list not visible and the welcome message visible.</summary>
        private void LoadPatient(bool isRefreshOnly)
        {
            TerminalActive terminal = null;

            _listSheets = new List <Sheet>();
            Process processCur = Process.GetCurrentProcess();

            if (IsSimpleMode)
            {
                if (PatNum > 0)
                {
                    _listSheets = Sheets.GetForTerminal(PatNum);
                }
            }
            else              //NOT IsSimpleMode
            {
                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;
                }
                if (terminal == null)
                {
                    //this terminal shouldn't be running, receptionist must've deleted this kiosk, close the form (causes application exit if NOT IsSimpleMode)
                    Close();                    //signal sent in form closing
                    return;
                }
                if (terminal.PatNum > 0)
                {
                    _listSheets = Sheets.GetForTerminal(terminal.PatNum);
                }
                if (_listSheets.Count == 0)               //either terminal.PatNum is 0 or no sheets for pat
                {
                    labelWelcome.Visible = true;
                    labelForms.Visible   = false;
                    listForms.Visible    = false;
                    butDone.Visible      = false;
                    if (terminal.PatNum > 0)                   //pat loaded but no sheets to show, unload pat, update db, send signal
                    {
                        TerminalActives.SetPatNum(terminal.TerminalActiveNum, 0);
                        Signalods.SetInvalid(InvalidType.Kiosk, KeyType.ProcessId, processCur.Id);
                    }
                    PatNum = 0;
                    if (_formSheetFillEdit != null && !_formSheetFillEdit.IsDisposed)
                    {
                        _formSheetFillEdit.ForceClose();
                    }
                    return;
                }
            }
            //we have a patient loaded who has some sheets to show in the terminal
            labelWelcome.Visible = false;
            labelForms.Visible   = true;
            listForms.Visible    = true;
            butDone.Visible      = true;
            listForms.Items.Clear();
            _listSheets.ForEach(x => listForms.Items.Add(x.Description));
            if (!IsSimpleMode)
            {
                if (PatNum == terminal.PatNum)
                {
                    return;                    //if the pat was not cleared or replaced just return, if sheets are currently being displayed (loop below), continue displaying them
                }
                //PatNum is changed, set it to the db terminalactive and signal others, then begin displaying sheets (loop below)
                PatNum = terminal.PatNum;
                if (_formSheetFillEdit != null && !_formSheetFillEdit.IsDisposed)
                {
                    _formSheetFillEdit.ForceClose();
                }
                Signalods.SetInvalid(InvalidType.Kiosk, KeyType.ProcessId, processCur.Id);
            }
            if (!isRefreshOnly)
            {
                AutoShowSheets();
            }
        }