Пример #1
0
 ///<summary>Called by local practice db to query HQ for EService setup info. Must remain very lite and versionless. Will be used by signup portal.
 ///If any args are null or not provided then they will be retrieved from Prefs.</summary>
 public static EServiceSetup.SignupOut GetEServiceSetupLite(
     SignupPortalPermission permission, string registrationKey = null, string practiceTitle = null, string practicePhone = null, string programVersion = null)
 {
     return(ReadXml <EServiceSetup.SignupOut>
            (
                WebSerializer.DeserializePrimitiveOrThrow <string>
                (
                    GetWebServiceMainHQInstance().EServiceSetup
                    (
                        CreateWebServiceHQPayload
                        (
                            WriteXml(new EServiceSetup.SignupIn()
     {
         MethodNameInt = (int)EServiceSetup.SetupMethod.GetEServiceSetupLite,
         SignupPortalPermissionInt = (int)permission,
     }),
                            eServiceCode.Undefined,
                            //null is allowed for the rest. Will get converted to RegKey Pref.
                            registrationKey,
                            practiceTitle,
                            practicePhone,
                            programVersion
                        )
                    )
                )
            ));
 }
Пример #2
0
 ///<summary>Called by local practice db to query HQ for EService setup info. Must remain very lite and versionless. Will be used by signup portal.
 ///If HasClinics==true then any SignupOut.EServices entries where ClinicNum==0 are invalid and should be ignored.
 ///If HasClinics==false then SignupOut.EServices should only pay attention items where ClinicNum==0.
 ///This list is kept completely unfiltered by ClinicNum for forward compatibility reasons.
 ///The ClinicNum 0 items are always used by the Signup portal to determine default signup preferences.
 ///However, these items are only used for validation and billing in the case where HasClinics==true.</summary>
 public static EServiceSetup.SignupOut GetEServiceSetupFull(
     SignupPortalPermission permission,
     long clinicNum,
     string programVersionStr,
     List <EServiceSetup.SignupIn.ClinicLiteIn> clinics)
 {
     return(ReadXml <EServiceSetup.SignupOut>
            (
                WebSerializer.DeserializePrimitiveOrThrow <string>
                (
                    GetWebServiceMainHQInstance().EServiceSetup
                    (
                        CreateWebServiceHQPayload
                        (
                            WriteXml(new EServiceSetup.SignupIn()
     {
         MethodNameInt = (int)EServiceSetup.SetupMethod.GetSignupOutFull,
         HasClinics = PrefC.HasClinicsEnabled,
         ClinicNum = clinicNum,
         ProgramVersionStr = programVersionStr,
         SignupPortalPermissionInt = (int)permission,
         Clinics = clinics
     }), eServiceCode.Undefined
                        )
                    )
                )
            ));
 }
Пример #3
0
        private SignupPortalPermission GetUserSignupPortalPermissions()
        {
            SignupPortalPermission perm = SignupPortalPermission.ReadOnly;

            if (Security.IsAuthorized(Permissions.SecurityAdmin, true))
            {
                perm = SignupPortalPermission.FullPermission;
            }
            else if (Security.IsAuthorized(Permissions.EServicesSetup, true))
            {
                perm = SignupPortalPermission.ReadOnly;
            }
            else
            {
                perm = SignupPortalPermission.Denied;
            }
            return(perm);
        }
Пример #4
0
        ///<summary>Called by local practice db to query HQ for EService setup info. Must remain very lite and versionless. Will be used by signup portal.
        ///If HasClinics==true then any SignupOut.EServices entries where ClinicNum==0 are invalid and should be ignored.
        ///If HasClinics==false then SignupOut.EServices should only pay attention items where ClinicNum==0.
        ///This list is kept completely unfiltered by ClinicNum for forward compatibility reasons.
        ///The ClinicNum 0 items are always used by the Signup portal to determine default signup preferences.
        ///However, these items are only used for validation and billing in the case where HasClinics==true.</summary>
        public static EServiceSetup.SignupOut GetEServiceSetupFull(SignupPortalPermission permission, bool isSwitchClinicPref = false)
        {
            //Clinics will be stored in this order at HQ to allow signup portal to display them in proper order.
            List <Clinic> clinics = Clinics.GetDeepCopy().OrderBy(x => x.ItemOrder).ToList();

            if (PrefC.GetBool(PrefName.ClinicListIsAlphabetical))
            {
                clinics = clinics.OrderBy(x => x.Abbr).ToList();
            }
#if DEBUG
            bool isMockChanged = false;
            if (WebServiceMainHQProxy.MockWebServiceMainHQ == null)
            {
                WebServiceMainHQProxy.MockWebServiceMainHQ = new WebServiceMainHQMockDemo();
                isMockChanged = true;
            }
#endif
            EServiceSetup.SignupOut signupOut = ReadXml <EServiceSetup.SignupOut>
                                                (
                WebSerializer.DeserializePrimitiveOrThrow <string>
                (
                    GetWebServiceMainHQInstance().EServiceSetup
                    (
                        CreateWebServiceHQPayload
                        (
                            WriteXml(new EServiceSetup.SignupIn()
            {
                MethodNameInt = (int)EServiceSetup.SetupMethod.GetSignupOutFull,
                HasClinics    = PrefC.HasClinicsEnabled,
                //ClinicNum is not currently used as input.
                ClinicNum                 = 0,
                ProgramVersionStr         = PrefC.GetString(PrefName.ProgramVersion),
                SignupPortalPermissionInt = (int)permission,
                Clinics = clinics
                          .Select(x => new EServiceSetup.SignupIn.ClinicLiteIn()
                {
                    ClinicNum   = x.ClinicNum,
                    ClinicTitle = x.Abbr,
                    IsHidden    = x.IsHidden,
                }).ToList(),
                IsSwitchClinicPref = isSwitchClinicPref,
            }), eServiceCode.Undefined
                        )
                    )
                )
                                                );
#if DEBUG
            if (isMockChanged)
            {
                WebServiceMainHQProxy.MockWebServiceMainHQ = null;
            }
#endif
            //We just got the latest sync info from HQ so update the local db to reflect what HQ says is true.
            #region Reconcile Phones
            List <SmsPhone> listPhonesHQ = signupOut.Phones.Select(x => new SmsPhone()
            {
                ClinicNum        = x.ClinicNum,
                CountryCode      = x.CountryCode,
                DateTimeActive   = x.DateTimeActive,
                DateTimeInactive = x.DateTimeInactive,
                InactiveCode     = x.InactiveCode,
                PhoneNumber      = x.PhoneNumber,
            }).ToList();
            SmsPhones.UpdateOrInsertFromList(listPhonesHQ);
            #endregion
            #region Reconcile practice and clinics
            List <EServiceSetup.SignupOut.SignupOutSms> smsSignups = GetSignups <EServiceSetup.SignupOut.SignupOutSms>(signupOut, eServiceCode.IntegratedTexting);
            bool isCacheInvalid = false;
            bool isSmsEnabled   = false;
            if (PrefC.HasClinicsEnabled)              //Clinics are ON so loop through all clinics and reconcile with HQ.
            {
                List <Clinic> listClinicsAll = Clinics.GetDeepCopy();
                foreach (Clinic clinicDb in listClinicsAll)
                {
                    WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutSms clinicSignup =
                        smsSignups.FirstOrDefault(x => x.ClinicNum == clinicDb.ClinicNum) ?? new WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutSms()
                    {
                        //Not found so turn it off.
                        SmsContractDate = DateTime.MinValue,
                        MonthlySmsLimit = 0,
                        IsEnabled       = false,
                    };
                    Clinic clinicNew = clinicDb.Copy();
                    clinicNew.SmsContractDate = clinicSignup.SmsContractDate;
                    clinicNew.SmsMonthlyLimit = clinicSignup.MonthlySmsLimit;
                    isCacheInvalid           |= Clinics.Update(clinicNew, clinicDb);
                    isSmsEnabled |= clinicSignup.IsEnabled;
                }
            }
            else               //Clinics are off so ClinicNum 0 is the practice clinic.
            {
                WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutSms practiceSignup =
                    smsSignups.FirstOrDefault(x => x.ClinicNum == 0) ?? new WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutSms()
                {
                    //Not found so turn it off.
                    SmsContractDate = DateTime.MinValue,
                    MonthlySmsLimit = 0,
                    IsEnabled       = false,
                };
                isCacheInvalid
                    |= Prefs.UpdateDateT(PrefName.SmsContractDate, practiceSignup.SmsContractDate)
                       | Prefs.UpdateLong(PrefName.TextingDefaultClinicNum, 0)
                       | Prefs.UpdateDouble(PrefName.SmsMonthlyLimit, practiceSignup.MonthlySmsLimit);
                isSmsEnabled |= practiceSignup.IsEnabled;
            }
            #endregion
            #region Reconcile CallFire
            //Turn off CallFire if SMS has been activated.
            //This only happens the first time SMS is turned on and CallFire is still activated.
            if (isSmsEnabled && Programs.IsEnabled(ProgramName.CallFire))
            {
                Program callfire = Programs.GetCur(ProgramName.CallFire);
                if (callfire != null)
                {
                    callfire.Enabled = false;
                    Programs.Update(callfire);
                    Signalods.Insert(new Signalod()
                    {
                        IType = InvalidType.Providers
                    });
                    signupOut.Prompts.Add("Call Fire has been disabled. Cancel Integrated Texting and access program properties to retain Call Fire.");
                }
            }
            #endregion
            #region eConfirmations
            if (Prefs.UpdateBool(PrefName.ApptConfirmAutoSignedUp, IsEServiceActive(signupOut, eServiceCode.ConfirmationRequest)))
            {
                //HQ does not match the local pref. Make it match with HQ.
                isCacheInvalid = true;
                SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Automated appointment eConfirmations automatically changed by HQ.  Local pref set to "
                                          + IsEServiceActive(signupOut, eServiceCode.ConfirmationRequest).ToString() + ".");
            }
            #endregion
            if (isCacheInvalid)              //Something changed in the db. Alert other workstations and change this workstation immediately.
            {
                Signalods.Insert(new Signalod()
                {
                    IType = InvalidType.Prefs
                });
                Prefs.RefreshCache();
                Signalods.Insert(new Signalod()
                {
                    IType = InvalidType.Providers
                });
                Providers.RefreshCache();
                Clinics.RefreshCache();
            }
            return(signupOut);
        }
Пример #5
0
        ///<summary>Makes a web call to WebServiceMainHQ to get the corresponding EServiceSetupFull information and then attempts to fill each tab.
        ///If anything goes wrong within this method a message box will show to the user and then the window will auto close via Abort.</summary>
        private void FillForm()
        {
            Action actionCloseProgress = ODProgressOld.ShowProgressStatus("EServicesSetupProgress", this, "Validating eServices...");

            try {
                if (MiscUtils.TryUpdateIeEmulation())
                {
                    throw new Exception("Browser emulation version updated.\r\nYou must restart this application before accessing the Signup Portal.");
                }
                //Send light version of clinics to HQ to be used by signup portal below. Get back all args needed from HQ in order to perform the operations of this window.
                SignupPortalPermission perm = SignupPortalPermission.ReadOnly;
                if (Security.IsAuthorized(Permissions.SecurityAdmin, true))
                {
                    perm = SignupPortalPermission.FullPermission;
                }
                else if (Security.IsAuthorized(Permissions.EServicesSetup, true))
                {
                    perm = SignupPortalPermission.ReadOnly;
                }
                else
                {
                    perm = SignupPortalPermission.Denied;
                }
                _signupOut = WebServiceMainHQProxy.GetEServiceSetupFull(perm);
                //Show user any prompts that were generated by GetEServiceSetupFull().
                if (_signupOut.Prompts.Count > 0)
                {
                    MessageBox.Show(string.Join("\r\n", _signupOut.Prompts.Select(x => Lans.g(this, x))));
                }
                #region Fill
                EServicesEvent.Fire(new ODEventArgs("EServicesSetupProgress", Lan.g(this, "Loading tab - Signup")));
                FillTabSignup();
                EServicesEvent.Fire(new ODEventArgs("EServicesSetupProgress", Lan.g(this, "Loading tab - eConnector Service")));
                FillTabEConnector();
                EServicesEvent.Fire(new ODEventArgs("EServicesSetupProgress", Lan.g(this, "Loading tab - Mobile Synch (old-style)")));
                FillTabMobileSynch();
                EServicesEvent.Fire(new ODEventArgs("EServicesSetupProgress", Lan.g(this, "Loading tab - Mobile Web")));
                FillTabMobileWeb();
                EServicesEvent.Fire(new ODEventArgs("EServicesSetupProgress", Lan.g(this, "Loading tab - Patient Portal")));
                FillTabPatientPortal();
                EServicesEvent.Fire(new ODEventArgs("EServicesSetupProgress", Lan.g(this, "Loading tab - Web Sched Recall")));
                FillTabWebSchedRecall();
                EServicesEvent.Fire(new ODEventArgs("EServicesSetupProgress", Lan.g(this, "Loading tab - Web Sched New Pat Appt")));
                FillTabWebSchedNewPat();
                EServicesEvent.Fire(new ODEventArgs("EServicesSetupProgress", Lan.g(this, "Loading tab - Web Sched Verify")));
                FillTabWebSchedVerify();
                EServicesEvent.Fire(new ODEventArgs("EServicesSetupProgress", Lan.g(this, "Loading tab - Texting Services")));
                FillTabTexting();
                EServicesEvent.Fire(new ODEventArgs("EServicesSetupProgress", Lan.g(this, "Loading tab - eReminders & eConfirmations")));
                FillTabECR();
                EServicesEvent.Fire(new ODEventArgs("EServicesSetupProgress", Lan.g(this, "Loading tab - Miscellaneous")));
                FillTabMisc();
                #endregion
                #region Authorize editing
                //Disable certain buttons but let them continue to view.
                bool allowEdit = Security.IsAuthorized(Permissions.EServicesSetup, true);
                AuthorizeTabSignup(allowEdit);
                AuthorizeTabEConnector(allowEdit);
                AuthorizeTabMobileSynch(allowEdit);
                AuthorizeTabPatientPortal(allowEdit);
                AuthorizeTabWebSchedRecall(allowEdit);
                AuthorizeTabWebSchedNewPat(allowEdit);
                AuthorizeTabTexting(allowEdit);
                AuthorizeTabECR(allowEdit);
                AuthorizeTabMisc(allowEdit);
                ((Control)tabMobileSynch).Enabled = allowEdit;
                #endregion
            }
            catch (WebException we) {
                actionCloseProgress?.Invoke();
                FriendlyException.Show(Lan.g(this, "Could not reach HQ.  Please make sure you have an internet connection and try again or call support."), we);
                //Set the dialog result to Abort so that FormClosing knows to not try and save any changes.
                DialogResult = DialogResult.Abort;
                Close();
            }
            catch (Exception e) {
                actionCloseProgress?.Invoke();
                FriendlyException.Show(Lan.g(this, "There was a problem loading the eServices Setup window.  Please try again or call support."), e);
                //Set the dialog result to Abort so that FormClosing knows to not try and save any changes.
                DialogResult = DialogResult.Abort;
                Close();
            }
            actionCloseProgress?.Invoke();
        }
Пример #6
0
        ///<summary>Makes a web call to WebServiceMainHQ to get the corresponding EServiceSetupFull information and then attempts to fill each tab.
        ///If anything goes wrong within this method a message box will show to the user and then the window will auto close via Abort.</summary>
        private void FillForm()
        {
            Action actionCloseProgress = ODProgress.Show(ODEventType.EServices, typeof(EServicesEvent), "Validating eServices...");

            try {
                if (!ODBuild.IsWeb() && MiscUtils.TryUpdateIeEmulation())
                {
                    throw new Exception("Browser emulation version updated.\r\nYou must restart this application before accessing the Signup Portal.");
                }
                //Send light version of clinics to HQ to be used by signup portal below. Get back all args needed from HQ in order to perform the operations of this window.
                SignupPortalPermission perm = GetUserSignupPortalPermissions();
                SecurityLogs.MakeLogEntry(Permissions.Setup, 0, $"User {Security.CurUser.UserName} entered EService Setup with SignupPortalPermission {perm}");
                if (_signupOut == null)                //the first time this loads _signupOut will be null, so we won't have a previous state to compare
                {
                    _signupOut = WebServiceMainHQProxy.GetEServiceSetupFull(perm);
                }
                else                   //If we are switching from the signup tab to another this will get called again and we don't want to lose the "diff"
                {
                    _signupOut = WebServiceMainHQProxy.GetEServiceSetupFull(perm, oldSignupOut: _signupOut);
                }
                //Show user any prompts that were generated by GetEServiceSetupFull().
                if (_signupOut.Prompts.Count > 0)
                {
                    MessageBox.Show(string.Join("\r\n", _signupOut.Prompts.Select(x => Lans.g(this, x))));
                }
                if (ODBuild.IsWeb())
                {
                    bool isSignupSelected = tabControl.SelectedTab == tabSignup;
                    tabControl.TabPages.Remove(tabSignup);
                    if (isSignupSelected)
                    {
                        actionCloseProgress?.Invoke();
                        this.ForceBringToFront();
                        Process.Start(_signupOut.SignupPortalUrl);
                        DialogResult = DialogResult.Abort;
                        return;
                    }
                }
                #region Fill
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - Signup"));
                FillTabSignup();
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - eConnector Service"));
                FillTabEConnector();
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - Mobile Synch (old-style)"));
                FillTabMobileSynch();
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - Mobile Web"));
                FillTabMobileWeb();
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - Patient Portal"));
                FillTabPatientPortal();
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - Web Sched Recall"));
                FillTabWebSchedRecall();
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - Web Sched New Pat Appt"));
                FillTabWebSchedNewPat();
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - Web Sched Verify"));
                FillTabWebSchedVerify();
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - Texting Services"));
                FillTabTexting();
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - eReminders & eConfirmations"));
                FillTabECR();
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - eClipboard"));
                FillTabEClipboard();
                EServicesEvent.Fire(ODEventType.EServices, Lan.g(this, "Loading tab - Miscellaneous"));
                FillTabMisc();
                #endregion
                #region Authorize editing
                //Disable certain buttons but let them continue to view.
                bool allowEdit = Security.IsAuthorized(Permissions.EServicesSetup, true);
                AuthorizeTabSignup(allowEdit);
                AuthorizeTabEConnector(allowEdit);
                AuthorizeTabMobileSynch(allowEdit);
                AuthorizeTabPatientPortal(allowEdit);
                AuthorizeTabWebSchedRecall(allowEdit);
                AuthorizeTabWebSchedNewPat(allowEdit);
                AuthorizeTabTexting(allowEdit);
                AuthorizeTabECR(allowEdit);
                AuthorizeTabEClipboard(allowEdit);
                AuthorizeTabMisc(allowEdit);
                ((Control)tabMobileSynch).Enabled = allowEdit;
                #endregion
            }
            catch (WebException we) {
                actionCloseProgress?.Invoke();
                this.ForceBringToFront();
                FriendlyException.Show(Lan.g(this, "Could not reach HQ.  Please make sure you have an internet connection and try again or call support."), we);
                //Set the dialog result to Abort so that FormClosing knows to not try and save any changes.
                DialogResult = DialogResult.Abort;
                Close();
            }
            catch (Exception e) {
                actionCloseProgress?.Invoke();
                this.ForceBringToFront();
                FriendlyException.Show(Lan.g(this, "There was a problem loading the eServices Setup window.  Please try again or call support."), e);
                //Set the dialog result to Abort so that FormClosing knows to not try and save any changes.
                DialogResult = DialogResult.Abort;
                Close();
            }
            actionCloseProgress?.Invoke();
            this.ForceBringToFront();
        }