Esempio n. 1
0
        private void butGenerate_Click(object sender, EventArgs e)
        {
            if (textOnlinePassword.ReadOnly)
            {
                MessageBox.Show("Please use the Provide Online Access button first.");
                return;
            }
            Cursor = Cursors.WaitCursor;
            textOnlinePassword.Text = GenerateRandomPassword(8, 10);
            PatCur.OnlinePassword   = textOnlinePassword.Text;
            Patients.Update(PatCur, PatOld);
            PatOld.OnlinePassword = textOnlinePassword.Text;          //so that subsequent Updates will work.
            string interval = PrefC.GetStringSilent(PrefName.MobileSyncIntervalMinutes);

            if (interval == "" || interval == "0")         //not a paid customer or chooses not to synch
            {
                Cursor = Cursors.Default;
                MessageBox.Show("Synch must be setup first from the Tools menu, Mobile and Patient Portal Synch.");
                return;
            }
            //we won't check PrefName.MobileSyncWorkstationName because we are forcing the synch
            if (System.Environment.MachineName.ToUpper() != PrefC.GetStringSilent(PrefName.MobileSyncWorkstationName).ToUpper())
            {
                Cursor = Cursors.Default;
                //Since GetStringSilent returns "" before OD is connected to db, this gracefully loops out
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel,
                                 "Warning.  Workstation is not entered in the Tools menu, Mobile and Patient Portal Synch.  No automatic synch is taking place.  Continue anyway?"))
                {
                    return;
                }
            }
            if (PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate).Year < 1880)
            {
                Cursor = Cursors.Default;
                MessageBox.Show("Full Synch must be run first first from the Tools menu, Mobile and Patient Portal Synch.");
                return;
            }
            FormMobile.SynchFromMain(true);
            Cursor = Cursors.Default;
        }
Esempio n. 2
0
        private void butGiveAccess_Click(object sender, EventArgs e)
        {
            string interval = PrefC.GetStringSilent(PrefName.MobileSyncIntervalMinutes);

            if (interval == "" || interval == "0")         //not a paid customer or chooses not to synch
            {
                MessageBox.Show("Synch must be setup first from the Tools menu, Mobile and Patient Portal Synch.  Interval must not be blank or zero.");
                return;
            }
            //we won't check PrefName.MobileSyncWorkstationName because we are forcing the synch
            if (System.Environment.MachineName.ToUpper() != PrefC.GetStringSilent(PrefName.MobileSyncWorkstationName).ToUpper())
            {
                //Since GetStringSilent returns "" before OD is connected to db, this gracefully loops out
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel,
                                 "Warning.  Workstation is not entered in the Tools menu, Mobile and Patient Portal Synch.  No automatic synch is taking place.  Continue anyway?"))
                {
                    return;
                }
            }
            if (PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate).Year < 1880)
            {
                MessageBox.Show("Full Synch must be run first first from the Tools menu, Mobile and Patient Portal Synch.");
                return;
            }
            if (butGiveAccess.Text == "Provide Online Access")           //When form open opens with a blank password
            {
                Cursor = Cursors.WaitCursor;
                //1. Fill password.
                textOnlinePassword.Text = GenerateRandomPassword(8, 10);             //won't save until OK or Print
                //2. Fill link.
                textOnlineLink.Text = GetPatientPortalLink();
                //3. Reset timestamps for this patient to trigger all their objects to upload with the next synch
                LabPanels.ResetTimeStamps(PatCur.PatNum);
                Diseases.ResetTimeStamps(PatCur.PatNum);
                Allergies.ResetTimeStamps(PatCur.PatNum);
                MedicationPats.ResetTimeStamps(PatCur.PatNum);
                Statements.ResetTimeStamps(PatCur.PatNum);
                Documents.ResetTimeStamps(PatCur.PatNum);
                //4. Make the password editable in case they want to change it.
                textOnlinePassword.ReadOnly = false;
                //5. Save password to db
                PatCur.OnlinePassword = textOnlinePassword.Text;
                Patients.Update(PatCur, PatOld);
                PatOld.OnlinePassword = textOnlinePassword.Text;              //so that subsequent Updates will work.
                //6. Force a synch
                FormMobile.SynchFromMain(true);
                //7. Insert EhrMeasureEvent
                EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();
                newMeasureEvent.DateTEvent = DateTime.Now;
                newMeasureEvent.EventType  = EhrMeasureEventType.OnlineAccessProvided;
                newMeasureEvent.PatNum     = PatCur.PatNum;
                newMeasureEvent.MoreInfo   = "";
                EhrMeasureEvents.Insert(newMeasureEvent);
                //8. Rename button
                butGiveAccess.Text = "Remove Online Access";
                Cursor             = Cursors.Default;
            }
            else              //remove access
            {
                Cursor = Cursors.WaitCursor;
                //1. Clear password
                textOnlinePassword.Text = "";
                //2. Make in uneditable
                textOnlinePassword.ReadOnly = true;
                //3. Save password to db
                PatCur.OnlinePassword = textOnlinePassword.Text;
                Patients.Update(PatCur, PatOld);
                PatOld.OnlinePassword = textOnlinePassword.Text;
                //5. Force a synch
                FormMobile.SynchFromMain(true);
                //no event to insert
                //6. Rename button
                butGiveAccess.Text = "Provide Online Access";
                Cursor             = Cursors.Default;
            }
        }