コード例 #1
0
 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);
     }
 }
コード例 #2
0
        private void menuItemMedical_Click(object sender, EventArgs e)
        {
            if (gridMain.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select a terminal first.");
                return;
            }
            TerminalActive terminal = TerminalList[gridMain.GetSelectedIndex()].Copy();

            if (terminal.TerminalStatus == TerminalStatusEnum.Standby)
            {
                MsgBox.Show(this, "Please load a patient onto this terminal first.");
                return;
            }
            //See if the selected patient already has diseases attached
            Disease[] DiseaseList = Diseases.Refresh(terminal.PatNum);
            if (DiseaseList.Length > 0)
            {
                MsgBox.Show(this, "This patient already has diseases attached.  This function is only intended for new patients.  Patient cannot be loaded.");
                return;
            }
            //See if the selected patient already has questions attached

            /*if(Questions.PatHasQuest(terminal.PatNum)) {
             *      MsgBox.Show(this,"This patient already has questions attached.  This function is only intended for new patients.  Patient cannot be loaded.");
             *      return;
             * }*/
            if (!MsgBox.Show(this, true, "A patient is currently using the terminal.  If you continue, they will lose the information that is on their screen.  Continue anyway?"))
            {
                return;
            }
            terminal.TerminalStatus = TerminalStatusEnum.Medical;
            TerminalActives.Update(terminal);
            FillGrid();
        }
コード例 #3
0
        private void butLoad_Click(object sender, EventArgs e)
        {
            if (listSheets.Items.Count == 0)
            {
                MsgBox.Show(this, "There are no sheets to send to the kiosk for the current patient.");
                return;
            }
            if (gridMain.GetSelectedIndex() == -1 || gridMain.GetSelectedIndex() >= _terminalList.Count)
            {
                MsgBox.Show(this, "Please select a terminal first.");
                return;
            }
            TerminalActive terminal = _terminalList[gridMain.GetSelectedIndex()];

            if (terminal.PatNum != 0 &&
                !MsgBox.Show(this, true, "A patient is currently using the terminal.  If you continue, they will lose the information that is on their "
                             + "screen.  Continue anyway?"))
            {
                return;
            }
            TerminalActives.SetPatNum(terminal.TerminalActiveNum, _patNumCur);
            Signalods.SetInvalid(InvalidType.Kiosk, KeyType.ProcessId, Process.GetCurrentProcess().Id);
            FillGrid();
            FillPat();
        }
コード例 #4
0
        private void butUpdatePatient_Click(object sender, EventArgs e)
        {
            if (gridMain.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select a terminal first.");
                return;
            }
            TerminalActive terminal = TerminalList[gridMain.GetSelectedIndex()].Copy();

            if (terminal.TerminalStatus != TerminalStatusEnum.Standby)
            {
                if (!MsgBox.Show(this, true, "A patient is currently using the terminal.  If you continue, they will lose the information that is on their screen.  Continue anyway?"))
                {
                    return;
                }
            }
            if (FormOpenDental.CurPatNum == 0)
            {
                MsgBox.Show(this, "Please select a patient in the main window first.");
                return;
            }
            //FormPatientSelect FormP=new FormPatientSelect();
            //FormP.ShowDialog();
            //if(FormP.DialogResult!=DialogResult.OK) {
            //	return;
            //}
            //int patNum=
            terminal.PatNum         = FormOpenDental.CurPatNum;
            terminal.TerminalStatus = TerminalStatusEnum.UpdateOnly;
            TerminalActives.Update(terminal);
            FillGrid();
        }
コード例 #5
0
        private void butLoad_Click(object sender, EventArgs e)
        {
            if (gridMain.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select a terminal first.");
                return;
            }
            TerminalActive terminal = TerminalList[gridMain.GetSelectedIndex()].Copy();

            if (terminal.PatNum != 0)
            {
                if (!MsgBox.Show(this, true, "A patient is currently using the terminal.  If you continue, they will lose the information that is on their screen.  Continue anyway?"))
                {
                    return;
                }
            }
            long patNum = FormOpenDental.CurPatNum;

            terminal.PatNum = patNum;
            TerminalActives.Update(terminal);
            FillGrid();

            /*
             * else {
             *      //just load up a terminal on this computer in a modal window.  The terminal window itself will handle clearing it from the db when done.
             *      TerminalActives.DeleteAllForComputer(Environment.MachineName);
             *      TerminalActive terminal=new TerminalActive();
             *      terminal.ComputerName=Environment.MachineName;
             *      terminal.PatNum=FormOpenDental.CurPatNum;
             *      TerminalActives.Insert(terminal);
             *      //Still need to start the modal window
             * }*/
        }
コード例 #6
0
ファイル: FormTerminal.cs プロジェクト: royedwards/DRDNet
        ///<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();
            }
        }
コード例 #7
0
        ///<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();
            }
        }
コード例 #8
0
        private void panelClose_Click(object sender, EventArgs e)
        {
            //It is fairly safe to not have a password, because the program will close completely in remote mode,
            //and in simple mode, the patient is usually supervised.
            if (PrefC.GetString(PrefName.TerminalClosePassword) == "")
            {
                if (!IsSimpleMode)
                {
                    TerminalActives.DeleteAllForComputer(Environment.MachineName);
                }
                Close();
                return;
            }
            InputBox input = new InputBox("Password");

            input.ShowDialog();
            if (input.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (input.textResult.Text != PrefC.GetString(PrefName.TerminalClosePassword))
            {
                MsgBox.Show(this, "Invalid password.");
                return;
            }
            if (!IsSimpleMode)
            {
                TerminalActives.DeleteAllForComputer(Environment.MachineName);
            }
            Close();
        }
コード例 #9
0
 ///<summary>Delete the Kiosk or MobileDevice.</summary>
 public void Delete()
 {
     if (IsKiosk)
     {
         TerminalActives.DeleteForCmptrSessionAndId(_computerKiosk.ComputerName, _computerKiosk.SessionId, processId: _computerKiosk.ProcessId);
     }
     else
     {
         MobileAppDevices.Delete(_mobileDevice.MobileAppDeviceNum);
     }
 }
コード例 #10
0
		private void butDelete_Click(object sender,EventArgs e) {
			if(gridMain.GetSelectedIndex()==-1) {
				MsgBox.Show(this,"Please select a terminal first.");
				return;
			}
			if(!MsgBox.Show(this,MsgBoxButtons.OKCancel,"A terminal row should not be deleted unless it is showing erroneously and there really is no terminal running on the computer shown.  Continue anyway?")) {
				return;
			}
			//string computerName=
			TerminalActives.DeleteAllForComputer(TerminalList[gridMain.GetSelectedIndex()].ComputerName);
			FillGrid();
		}
コード例 #11
0
        private void FillGrid()
        {
            try{
                TerminalList = TerminalActives.Refresh();
            }
            catch {           //SocketException if db connection gets lost.
                return;
            }
            int selected = gridMain.GetSelectedIndex();

            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableTerminals", "Computer Name"), 150);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableTerminals", "Status"), 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableTerminals", "Patient"), 150);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < TerminalList.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(TerminalList[i].ComputerName);
                row.Cells.Add(Lan.g("TerminalStatusEnum", TerminalList[i].TerminalStatus.ToString()));

                /*switch (TerminalList[i].TerminalStatus){
                 *      case TerminalStatusEnum.Standby:
                 *              row.Cells.Add("");
                 *              break;
                 * }*/
                if (TerminalList[i].PatNum == 0)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(Patients.GetLim(TerminalList[i].PatNum).GetNameLF());
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            gridMain.SetSelected(selected, true);
            if (gridMain.GetSelectedIndex() == -1 && gridMain.Rows.Count > 0)
            {
                gridMain.SetSelected(0, true);
            }
        }
コード例 #12
0
        ///<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;
        }
コード例 #13
0
		private void butClear_Click(object sender,EventArgs e) {
			if(gridMain.GetSelectedIndex()==-1) {
				MsgBox.Show(this,"Please select a terminal first.");
				return;
			}
			TerminalActive terminal=TerminalList[gridMain.GetSelectedIndex()].Copy();
			if(terminal.PatNum==0) {
				return;
			}
			if(!MsgBox.Show(this,true,"A patient is currently using the terminal.  If you continue, they will lose the information that is on their screen.  Continue anyway?")) {
				return;
			}
			terminal.PatNum=0;
			TerminalActives.Update(terminal);
			FillGrid();
		}
コード例 #14
0
        private void butDelete_Click(object sender, EventArgs e)
        {
            if (gridMain.GetSelectedIndex() == -1 || gridMain.GetSelectedIndex() >= _terminalList.Count)
            {
                MsgBox.Show(this, "Please select a terminal first.");
                return;
            }
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "A terminal row should not be deleted unless it is showing erroneously and there really is no "
                             + "terminal running on the computer shown.  Continue anyway?"))
            {
                return;
            }
            TerminalActive selectedTerm = _terminalList[gridMain.GetSelectedIndex()];

            TerminalActives.DeleteForCmptrSessionAndId(selectedTerm.ComputerName, selectedTerm.SessionId, processId: selectedTerm.ProcessId);
            Signalods.SetInvalid(InvalidType.Kiosk, KeyType.ProcessId, Process.GetCurrentProcess().Id);
            FillGrid();
            FillPat();
        }
コード例 #15
0
 ///<summary>Sets the PatNum for the selected Kiosk or MobileDevice.</summary>
 public void SetPatNum(long patNum)
 {
     if (IsKiosk)
     {
         TerminalActives.SetPatNum(_computerKiosk.TerminalActiveNum, patNum);
         Signalods.SetInvalid(InvalidType.Kiosk, KeyType.ProcessId, Process.GetCurrentProcess().Id);                  //signal the terminal manager to refresh its grid
     }
     else
     {
         MobileAppDevices.SetPatNum(_mobileDevice.MobileAppDeviceNum, patNum);
         if (patNum > 0)
         {
             OpenDentBusiness.WebTypes.PushNotificationUtils.CI_CheckinPatient(patNum, _mobileDevice.MobileAppDeviceNum);
         }
         else
         {
             OpenDentBusiness.WebTypes.PushNotificationUtils.CI_GoToCheckin(_mobileDevice.MobileAppDeviceNum);
         }
     }
 }
コード例 #16
0
ファイル: FormTerminal.cs プロジェクト: royedwards/DRDNet
        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);
            }
        }
コード例 #17
0
 private void FormTerminal_Load(object sender, EventArgs e)
 {
     this.Size               = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Size;
     this.Location           = new Point(0, 0);
     labelConnection.Visible = false;
     if (IsSimpleMode)
     {
         timer1.Enabled      = false;
         textWelcome.Visible = false;
     }
     else
     {
         //tell the database that a terminal is newly active on this computer.
         TerminalActives.DeleteAllForComputer(Environment.MachineName);
         TerminalActive terminal = new TerminalActive();
         terminal.ComputerName = Environment.MachineName;
         TerminalActives.Insert(terminal);
         UnloadPatient();
         //do not load a patient
     }
 }
コード例 #18
0
ファイル: FormTerminal.cs プロジェクト: royedwards/DRDNet
        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
            }
        }
コード例 #19
0
        /*private void menuItemQuestions_Click(object sender,EventArgs e) {
         *      if(gridMain.GetSelectedIndex()==-1) {
         *              MsgBox.Show(this,"Please select a terminal first.");
         *              return;
         *      }
         *      TerminalActive terminal=TerminalList[gridMain.GetSelectedIndex()].Copy();
         *      if(terminal.TerminalStatus==TerminalStatusEnum.Standby) {
         *              MsgBox.Show(this,"Please load a patient onto this terminal first.");
         *              return;
         *      }
         *      //See if the selected patient already has questions attached
         *      if(Questions.PatHasQuest(terminal.PatNum)) {
         *              MsgBox.Show(this,"This patient already has questions attached.  This function is only intended for new patients.  Patient cannot be loaded.");
         *              return;
         *      }
         *      if(!MsgBox.Show(this,true,"A patient is currently using the terminal.  If you continue, they will lose the information that is on their screen.  Continue anyway?")) {
         *              return;
         *      }
         *      terminal.TerminalStatus=TerminalStatusEnum.Questions;
         *      terminal.Update();
         *      FillGrid();
         * }*/

        private void menuItemUpdateOnly_Click(object sender, EventArgs e)
        {
            if (gridMain.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select a terminal first.");
                return;
            }
            TerminalActive terminal = TerminalList[gridMain.GetSelectedIndex()].Copy();

            if (terminal.TerminalStatus == TerminalStatusEnum.Standby)
            {
                MsgBox.Show(this, "Please load a patient onto this terminal first.");
                return;
            }
            if (!MsgBox.Show(this, true, "A patient is currently using the terminal.  If you continue, they will lose the information that is on their screen.  Continue anyway?"))
            {
                return;
            }
            terminal.TerminalStatus = TerminalStatusEnum.UpdateOnly;
            TerminalActives.Update(terminal);
            FillGrid();
        }
コード例 #20
0
        private void FillGrid()
        {
            long selectedTermNum = -1;

            if (gridMain.GetSelectedIndex() > -1)
            {
                selectedTermNum = (long)gridMain.Rows[gridMain.GetSelectedIndex()].Tag;              //set selectedTermNum before refreshing the _terminalList
            }
            try{
                _terminalList = TerminalActives.Refresh();
            }
            catch (Exception) {           //SocketException if db connection gets lost.
                return;
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableTerminals", "Computer Name"), 110));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableTerminals", "Session Name"), 110));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableTerminals", "Patient"), 185));
            gridMain.Rows.Clear();
            ODGridRow row;
            int       selectedIndex = -1;

            foreach (TerminalActive termCur in _terminalList)
            {
                row = new ODGridRow();
                row.Cells.Add(termCur.ComputerName);
                row.Cells.Add(termCur.SessionName);
                row.Cells.Add(termCur.PatNum > 0?Patients.GetLim(termCur.PatNum).GetNameLF():"");
                row.Tag = termCur.TerminalActiveNum;
                gridMain.Rows.Add(row);
                if (termCur.TerminalActiveNum == selectedTermNum)
                {
                    selectedIndex = gridMain.Rows.Count - 1;
                }
            }
            gridMain.EndUpdate();
            gridMain.SetSelected(Math.Max(selectedIndex, 0), true);          //selectedIndex could be -1 if the selected term is not in the list, default to row 0
        }
コード例 #21
0
        private void butClear_Click(object sender, EventArgs e)
        {
            if (gridMain.GetSelectedIndex() == -1 || gridMain.GetSelectedIndex() >= _terminalList.Count)
            {
                MsgBox.Show(this, "Please select a terminal first.");
                return;
            }
            TerminalActive terminal = _terminalList[gridMain.GetSelectedIndex()];

            if (terminal.PatNum == 0)
            {
                return;
            }
            if (!MsgBox.Show(this, true, "A patient is currently using the terminal.  If you continue, they will lose the information that is on their screen.  "
                             + "Continue anyway?"))
            {
                return;
            }
            TerminalActives.SetPatNum(terminal.TerminalActiveNum, 0);
            Signalods.SetInvalid(InvalidType.Kiosk, KeyType.ProcessId, Process.GetCurrentProcess().Id);
            FillGrid();
            FillPat();
        }
コード例 #22
0
ファイル: FormTerminal.cs プロジェクト: royedwards/DRDNet
        ///<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();
            }
        }
コード例 #23
0
        private void FillGrid()
        {
            SheetDevice selected = new SheetDevice(new MobileAppDevice());          //just instantiate to something random that won't match any of our actual devices

            if (gridMain.GetSelectedIndex() > -1)
            {
                selected = (SheetDevice)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag;
            }
            List <SheetDevice> listDevices = new List <SheetDevice>();

            foreach (TerminalActive kiosk in TerminalActives.Refresh())
            {
                listDevices.Add(new SheetDevice(kiosk));
            }
            List <MobileAppDevice> listMobileDevices = new List <MobileAppDevice>();

            if (PrefC.HasClinicsEnabled)
            {
                //Option "All" is selected and at least one clinic is signed up for the eClipboard feature
                if (contrClinicPicker.IsAllSelected && PrefC.GetString(PrefName.EClipboardClinicsSignedUp) != "")
                {
                    listMobileDevices = MobileAppDevices.GetForUser(Security.CurUser).FindAll(x => x.IsAllowed);
                }
                //A specific clinic is selected and that is signed up for the eClipboard feature
                else if (MobileAppDevices.IsClinicSignedUpForEClipboard(contrClinicPicker.SelectedClinicNum))
                {
                    listMobileDevices = MobileAppDevices.GetForUser(Security.CurUser).FindAll(x => x.IsAllowed && x.ClinicNum == contrClinicPicker.SelectedClinicNum);
                }
            }
            //We aren't using clinics and the zero clinic is signed up
            else if (MobileAppDevices.IsClinicSignedUpForEClipboard(0))
            {
                listMobileDevices = MobileAppDevices.GetForUser(Security.CurUser).FindAll(x => x.IsAllowed);
            }
            //Add the clinics we decided on the the d
            foreach (MobileAppDevice device in listMobileDevices)
            {
                listDevices.Add(new SheetDevice(device));
            }
            int selectedIndex = -1;

            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            gridMain.AddColumn("Device Name", 150);
            gridMain.AddColumn("Session Name", 110);
            gridMain.AddColumn("Patient", 185);
            if (PrefC.HasClinicsEnabled)
            {
                gridMain.AddColumn("Clinic", 150);
            }
            gridMain.ListGridColumns.Add(new GridColumn("Action", 50)
            {
                TextAlign = HorizontalAlignment.Center
            });
            if (_isSetupMode)
            {
                gridMain.ListGridColumns.Add(new GridColumn("Delete", 50)
                {
                    TextAlign = HorizontalAlignment.Center
                });
            }
            gridMain.ListGridRows.Clear();
            foreach (SheetDevice device in listDevices)
            {
                GridRow row = new GridRow();
                row.Tag = device;
                if (device.IsMobileAppDevice)
                {
                    row.Cells.Add(new GridCell(device.Name + "\r\n(" + device.MobileDevice.UniqueID + ")"));
                }
                else
                {
                    row.Cells.Add(new GridCell(device.Name));
                }
                row.Cells.Add(new GridCell(device.SessionName));
                row.Cells.Add(new GridCell(device.PatName));
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(new GridCell(device.ClinicDesc));
                }
                #region Load/Clear click handler
                void CellClick(object sender, EventArgs e)
                {
                    FillGrid();
                    if (device.PatNum == 0)                    //we are trying to load the patient
                    {
                        if (FormOpenDental.CurPatNum == 0)
                        {
                            MsgBox.Show(this, "There is currently no patient selected to send to the device. Select a patient in Open Dental " +
                                        "in order to continue.");
                            return;
                        }
                        if (device.IsKiosk)                          //kiosk only
                        {
                            if (listSheets.Items.Count == 0)         //eClipboard will allow to continue to load here in case we just want to take a photo
                            {
                                MsgBox.Show(this, "There are no sheets to send to the computer or device for the current patient.");
                                return;
                            }
                        }
                        else                           //eclipboard only
                        {
                            if (MobileAppDevices.PatientIsAlreadyUsingDevice(FormOpenDental.CurPatNum))
                            {
                                MsgBox.Show(this, "The patient you have selected is already using another device. Select a patient who is not currently " +
                                            "using a device in order to continue.");
                                return;
                            }
                            Appointment apptForToday = Appointments.GetAppointmentsForPat(FormOpenDental.CurPatNum).FirstOrDefault(x => x.AptDateTime.Date == DateTime.Today.Date);
                            if (apptForToday == null)
                            {
                                MsgBox.Show(this, "The patient you have selected does not have an appointment today. Only patients with an " +
                                            "appointment on the same day can be sent to eClipboard.");
                                return;
                            }
                            List <Sheet> listNonMobileSheets = listSheets.AllTags <Sheet>().FindAll(x => !x.HasMobileLayout);
                            if (listNonMobileSheets.Count > 0)
                            {
                                if (!MsgBox.Show(MsgBoxButtons.YesNo, "The following sheets that have been queued for this patient cannot be " +
                                                 $"loaded onto an eClipboard device because they do not have a mobile layout: \r\n" +
                                                 $"{string.Join(", ",listNonMobileSheets.Select(x => x.Description))}. \r\nDo you still wish to continue?"))
                                {
                                    return;
                                }
                            }
                            //They are in setup mode (not normal workflow) and there are no sheets for this patient. They have not run the rules to generate
                            //sheets as the patient has not been marked as arrived. When they push the patient to the device, they will not generate the sheets
                            //from there either. Ask them if they want to generate the sheets in this case.
                            if (_isSetupMode && listSheets.Items.Count == 0 && ClinicPrefs.GetBool(PrefName.EClipboardCreateMissingFormsOnCheckIn, apptForToday.ClinicNum))
                            {
                                bool generateSheets = MsgBox.Show(MsgBoxButtons.YesNo, "This patient has no forms to load. Would you like to generate the " +
                                                                  "forms based on the eClipboard rules?");
                                if (generateSheets)
                                {
                                    //We do not need to update the UI here. It will be updated at the end of this click method.
                                    Sheets.CreateSheetsForCheckIn(apptForToday);
                                }
                            }
                        }
                        device.SetPatNum(FormOpenDental.CurPatNum);
                    }
                    else                       //we are trying to clear the patient
                    {
                        if (!MsgBox.Show(this, true, "A patient is currently using the terminal.  If you continue, they will lose the information that is on their "
                                         + "screen.  Continue anyway?"))
                        {
                            return;
                        }
                        device.SetPatNum(0);
                    }
                    FillGrid();
                }

                #endregion Load/Clear click handler
                GridCell cell = new GridCell(device.PatNum == 0?"Load":"Clear");
                cell.ColorBackG = Color.LightGray;
                cell.ClickEvent = CellClick;
                row.Cells.Add(cell);
                if (_isSetupMode)
                {
                    #region Delete click handler
                    void DeleteClick(object sender, EventArgs e)
                    {
                        FillGrid();
                        if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "A row should not be deleted unless it is showing erroneously and there really is " +
                                         "nothing running on the computer or device shown.  Continue anyway?"))
                        {
                            return;
                        }
                        device.Delete();
                        FillGrid();
                    }

                    #endregion Delete click handler
                    cell            = new GridCell("Delete");
                    cell.ColorBackG = Color.LightGray;
                    cell.ClickEvent = DeleteClick;
                    row.Cells.Add(cell);
                }
                gridMain.ListGridRows.Add(row);
                if (selected != null && device.Matches(selected))
                {
                    selectedIndex = gridMain.ListGridRows.Count - 1;
                }
            }
            gridMain.EndUpdate();
            gridMain.SetSelected(selectedIndex, true);           //selectedIndex could be -1 if the selected term is not in the list, default to row 0
            FillPat();
        }
コード例 #24
0
ファイル: FormTerminal.cs プロジェクト: royedwards/DRDNet
        private void FormTerminal_Load(object sender, EventArgs e)
        {
            Size     = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Size;
            Location = new Point(0, 0);
            labelConnection.Visible = false;
            _listSheets             = new List <Sheet>();
            if (IsSimpleMode)
            {
                //PatNum set externally (in FormPatientForms)
                return;
            }
            //NOT SimpleMode from here down
            Process processCur = Process.GetCurrentProcess();

            //Delete all terminalactives for this computer, except new one, based on CompName and SessionID
            TerminalActives.DeleteForCmptrSessionAndId(Environment.MachineName, processCur.SessionId, excludeId: processCur.Id);
            string clientName = null;
            string userName   = null;

            try {
                clientName = Environment.GetEnvironmentVariable("ClientName");
                userName   = Environment.GetEnvironmentVariable("UserName");
            }
            catch (Exception) {
                //user may not have permission to access environment variables or another error could happen
            }
            if (string.IsNullOrWhiteSpace(clientName))
            {
                //ClientName only set for remote sessions, try to find suitable replacement.
                clientName = userName;
                if (processCur.SessionId < 2 || string.IsNullOrWhiteSpace(userName))
                {
                    //if sessionId is 0 or 1, this is not a remote session, use MachineName
                    clientName = Environment.MachineName;
                }
            }
            if (string.IsNullOrWhiteSpace(clientName) || TerminalActives.IsCompClientNameInUse(Environment.MachineName, clientName))
            {
                InputBox iBox = new InputBox("Please enter a unique name to identify this kiosk.");
                iBox.setTitle(Lan.g(this, "Kiosk Session Name"));
                iBox.ShowDialog();
                while (iBox.DialogResult == DialogResult.OK && TerminalActives.IsCompClientNameInUse(Environment.MachineName, iBox.textResult.Text))
                {
                    MsgBox.Show(this, "The name entered is invalid or already in use.");
                    iBox.ShowDialog();
                }
                if (iBox.DialogResult != DialogResult.OK)
                {
                    DialogResult = DialogResult.Cancel;
                    return;                    //not allowed to enter kiosk mode unless a unique human-readable name is entered for this computer session
                }
                clientName = iBox.textResult.Text;
            }
            //if we get here, we have a SessionId (which could be 0 if not in a remote session) and a unique client name for this kiosk
            TerminalActive terminal = new TerminalActive();

            terminal.ComputerName = Environment.MachineName;
            terminal.SessionId    = processCur.SessionId;
            terminal.SessionName  = clientName;
            terminal.ProcessId    = processCur.Id;
            TerminalActives.Insert(terminal);                                          //tell the database that a terminal is newly active on this computer
            Signalods.SetInvalid(InvalidType.Kiosk, KeyType.ProcessId, processCur.Id); //signal FormTerminalManager to re-fill grids
            timer1.Enabled = true;
        }