예제 #1
0
 private void FillTabPatientPortal()
 {
     //Office may have set a customer URL
     textPatientFacingUrlPortal.Text = PrefC.GetString(PrefName.PatientPortalURL);
     //HQ provides this URL for this customer.
     _urlsFromHQ = WebServiceMainHQProxy.GetSignups <WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService>(_signupOut, eServiceCode.PatientPortal).FirstOrDefault() ?? new WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService()
     {
         HostedUrl = "", HostedUrlPayment = ""
     };
     textHostedUrlPortal.Text = _urlsFromHQ.HostedUrl;
     if (textPatientFacingUrlPortal.Text == "")            //Customer has not set their own URL so use the URL provided by OD.
     {
         textPatientFacingUrlPortal.Text = _urlsFromHQ.HostedUrl;
     }
     textBoxNotificationSubject.Text = PrefC.GetString(PrefName.PatientPortalNotifySubject);
     _webMailNotificationBody        = PrefC.GetString(PrefName.PatientPortalNotifyBody);
     RefreshEmail(browserWebMailNotificatonBody, _webMailNotificationBody);
     _listPatPortalInviteRules = ApptReminderRules.GetForTypes(ApptReminderType.PatientPortalInvite);
     if (PrefC.HasClinicsEnabled)
     {
         _clinicCurPPInvite = comboClinicsPPInvites.GetSelectedClinic();
     }
     else
     {
         _clinicCurPPInvite = Clinics.GetPracticeAsClinicZero();
         checkUseDefaultsPPInvites.Visible = false;
         checkIsPPInvitesEnabled.Visible   = false;
         //comboPPClinicUrl.Visible=false;//automatic
     }
     FillPatPortalInvites();
 }
예제 #2
0
 private void ButSupplementalSaveDefaults_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(textSupplementalBackupCopyNetworkPath.Text) && !Directory.Exists(textSupplementalBackupCopyNetworkPath.Text))
     {
         MsgBox.Show(this, "Invalid or inaccessible " + labelSupplementalBackupCopyNetworkPath.Text + ".");           //This label text will rarely change.
         return;
     }
     if (Prefs.UpdateBool(PrefName.SupplementalBackupEnabled, checkSupplementalBackupEnabled.Checked))
     {
         try {
             //Inform HQ when the supplemental backups are enabled/disabled and which security admin performed the change.
             PayloadItem pliStatus = new PayloadItem(
                 (int)(checkSupplementalBackupEnabled.Checked?SupplementalBackupStatuses.Enabled:SupplementalBackupStatuses.Disabled),
                 "SupplementalBackupStatus");
             PayloadItem pliAdminUserName = new PayloadItem(Security.CurUser.UserName, "AdminUserName");
             string      officeData       = PayloadHelper.CreatePayload(new List <PayloadItem>()
             {
                 pliStatus, pliAdminUserName
             }, eServiceCode.SupplementalBackup);
             WebServiceMainHQProxy.GetWebServiceMainHQInstance().SetSupplementalBackupStatus(officeData);
         }
         catch (Exception ex) {
             ex.DoNothing();                    //Internet probably is unavailble right now.
         }
         SecurityLogs.MakeLogEntry(Permissions.SupplementalBackup, 0,
                                   "Supplemental backup has been " + (checkSupplementalBackupEnabled.Checked?"Enabled":"Disabled") + ".");
     }
     if (Prefs.UpdateString(PrefName.SupplementalBackupNetworkPath, textSupplementalBackupCopyNetworkPath.Text))
     {
         SecurityLogs.MakeLogEntry(Permissions.SupplementalBackup, 0,
                                   labelSupplementalBackupCopyNetworkPath.Text + " changed to '" + textSupplementalBackupCopyNetworkPath.Text + "'.");
     }
     MsgBox.Show(this, "Saved");
 }
예제 #3
0
        private APIKey GenerateNewKey()
        {
            APIKey apiKey = new APIKey();
            //prepare the xml document to send--------------------------------------------------------------------------------------
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent      = true;
            settings.IndentChars = ("    ");
            StringBuilder strbuild = new StringBuilder();
            //Send the message and get the result-------------------------------------------------------------------------------------
            string result = "";

            try {
                string officeData = WebServiceMainHQProxy.CreateWebServiceHQPayload(strbuild.ToString(), eServiceCode.FHIR);
                result = WebServiceMainHQProxy.GetWebServiceMainHQInstance().GenerateFHIRAPIKey(officeData);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return(null);
            }
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(result);
            //Process errors------------------------------------------------------------------------------------------------------------
            XmlNode node = doc.SelectSingleNode("//Error");

            if (node != null)
            {
                MessageBox.Show(node.InnerText);
                return(null);
            }
            //Process a valid return value------------------------------------------------------------------------------------------------
            node = doc.SelectSingleNode("//APIKey");
            if (node != null)
            {
                apiKey.Key = node.InnerText;
            }
            node = doc.SelectSingleNode("//FHIRAPIKeyNum");
            if (node != null)
            {
                apiKey.FHIRAPIKeyNum = PIn.Long(node.InnerText);
            }
            node = doc.SelectSingleNode("//KeyStatus");
            if (node != null)
            {
                APIKeyStatus status;
                if (Enum.TryParse(node.InnerText, out status))
                {
                    apiKey.KeyStatus = status;
                }
                else
                {
                    apiKey.KeyStatus = APIKeyStatus.ReadEnabled;
                }
            }
            return(apiKey);
        }
예제 #4
0
 private void FormDropboxAuthorize_Load(object sender, EventArgs e)
 {
     try {
         string url = WebSerializer.DeserializePrimitiveOrThrow <string>(
             WebServiceMainHQProxy.GetWebServiceMainHQInstance().BuildOAuthUrl(PrefC.GetString(PrefName.RegistrationKey), OAuthApplicationNames.Dropbox.ToString()));
         System.Diagnostics.Process.Start(url);
     }
     catch (Exception ex) {
         MessageBox.Show(Lan.g(this, "Error:") + "  " + ex.Message);
     }
 }
예제 #5
0
        private void butInstallEConnector_Click(object sender, EventArgs e)
        {
            DialogResult result;
            //Check to see if the update server preference is set.
            //If set, make sure that this is set to the computer currently logged on.
            string updateServerName = PrefC.GetString(PrefName.WebServiceServerName);

            if (!string.IsNullOrEmpty(updateServerName) && !ODEnvironment.IdIsThisComputer(updateServerName.ToLower()))
            {
                result = MessageBox.Show(Lan.g(this, "The eConnector service should be installed on the Update Server") + ": " + updateServerName + "\r\n"
                                         + Lan.g(this, "Are you trying to install the eConnector on a different computer by accident?"), "", MessageBoxButtons.YesNoCancel);
                //Only saying No to this message box pop up will allow the user to continue (meaning they fully understand what they are getting into).
                if (result != DialogResult.No)
                {
                    return;
                }
            }
            //Only ask the user if they want to set the Update Server Name preference if it is not already set.
            if (string.IsNullOrEmpty(updateServerName))
            {
                result = MessageBox.Show(Lan.g(this, "The computer that has the eConnector service installed should be set as the Update Server.") + "\r\n"
                                         + Lan.g(this, "Would you like to make this computer the Update Server?"), "", MessageBoxButtons.YesNoCancel);
                if (result == DialogResult.Cancel)
                {
                    return;
                }
                else if (result == DialogResult.Yes)
                {
                    Prefs.UpdateString(PrefName.WebServiceServerName, Dns.GetHostName());
                }
                try {
                    WebServiceMainHQProxy.SetEConnectorOn();
                }
                catch {
                    MsgBox.Show(this, "The eConnector was disabled.  Please contact support.");
                    return;
                }
            }
            //At this point the user wants to install the eConnector service (or upgrade the old cust listener to the eConnector).
            bool isListening;

            if (!PrefL.UpgradeOrInstallEConnector(false, out isListening))
            {
                //Warning messages would have already been shown to the user, simply return.
                return;
            }
            //The eConnector service was successfully installed and is running, set the EConnectorEnabled flag true if false.
            Prefs.UpdateBool(PrefName.EConnectorEnabled, true);
            MsgBox.Show(this, "eConnector successfully installed");
            butInstallEConnector.Enabled = false;
            FillTextListenerServiceStatus();
            FillGridListenerService();
        }
예제 #6
0
        private void FillTabMobileWeb()
        {
            string urlFromHQ = (
                WebServiceMainHQProxy.GetSignups <WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService>(_signupOut, eServiceCode.MobileWeb).FirstOrDefault() ??
                new WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService()
            {
                HostedUrl = ""
            }
                ).HostedUrl;

            textHostedUrlMobileWeb.Text = urlFromHQ;
        }
예제 #7
0
 private void FormDropboxAuthorize_Load(object sender, EventArgs e)
 {
     browserOAuth.Dock = DockStyle.Fill;
     try {
         string url = WebSerializer.DeserializePrimitiveOrThrow <string>(
             WebServiceMainHQProxy.GetWebServiceMainHQInstance().BuildOAuthUrl(PrefC.GetString(PrefName.RegistrationKey), OAuthApplicationNames.Dropbox.ToString()));
         browserOAuth.Navigate(new Uri(url));
     }
     catch (Exception ex) {
         MessageBox.Show(Lan.g(this, "Error:") + "  " + ex.Message);
     }
 }
예제 #8
0
 private void butOK_Click(object sender, EventArgs e)
 {
     try {
         string accessTokenFinal = WebSerializer.DeserializePrimitiveOrThrow <string>(
             WebServiceMainHQProxy.GetWebServiceMainHQInstance().GetDropboxAccessToken(WebSerializer.SerializePrimitive <string>(textAccessToken.Text)));
         ProgramPropertyAccessToken.PropertyValue = accessTokenFinal;
         ProgramProperties.Update(ProgramPropertyAccessToken);
         DataValid.SetInvalid(InvalidType.Programs);
     }
     catch (Exception ex) {
         MessageBox.Show(Lan.g(this, "Error:") + "  " + ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
예제 #9
0
        private void FillGridWebSchedNewPatApptHostedURLs()
        {
            panelHostedURLs.Controls.Clear();
            List <Clinic> clinicsAll   = Clinics.GetDeepCopy();
            var           eServiceData = WebServiceMainHQProxy.GetSignups <WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService>(_signupOut, eServiceCode.WebSchedNewPatAppt)
                                         .Select(x => new {
                Signup     = x,
                ClinicName = (clinicsAll.FirstOrDefault(y => y.ClinicNum == x.ClinicNum) ?? new Clinic()
                {
                    Abbr = "N\\A"
                }).Abbr
            })
                                         .Where(x =>
                                                //When clinics off, only show headquarters
                                                (!PrefC.HasClinicsEnabled && x.Signup.ClinicNum == 0) ||
                                                //When clinics are on, only show if not hidden.
                                                (PrefC.HasClinicsEnabled && clinicsAll.Any(y => y.ClinicNum == x.Signup.ClinicNum && !y.IsHidden))
                                                )
                                         //Alpha sorted
                                         .OrderBy(x => x.ClinicName);

            _listClinicPrefsWebSchedNewPats.Clear();
            foreach (var clinic in eServiceData)
            {
                ContrNewPatHostedURL contr = new ContrNewPatHostedURL(clinic.Signup);
                if (!PrefC.HasClinicsEnabled || eServiceData.Count() == 1)
                {
                    contr.IsExpanded         = true;
                    contr.DoHideExpandButton = true;
                }
                Lan.C(this, contr);
                panelHostedURLs.Controls.Add(contr);
                comboWSNPClinics.Items.Add(new ODBoxItem <WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService>(clinic.ClinicName, clinic.Signup));
                if (clinic.Signup.ClinicNum == 0)
                {
                    continue;
                }
                else
                {
                    AddClinicPrefToList(PrefName.WebSchedNewPatAllowChildren, clinic.Signup.ClinicNum);
                    AddClinicPrefToList(PrefName.WebSchedNewPatVerifyInfo, clinic.Signup.ClinicNum);
                    AddClinicPrefToList(PrefName.WebSchedNewPatDoAuthEmail, clinic.Signup.ClinicNum);
                    AddClinicPrefToList(PrefName.WebSchedNewPatDoAuthText, clinic.Signup.ClinicNum);
                    AddClinicPrefToList(PrefName.WebSchedNewPatWebFormsURL, clinic.Signup.ClinicNum);
                }
            }
        }
        private void FillGridWebSchedNewPatApptHostedURLs()
        {
            List <Clinic> clinicsAll   = Clinics.GetDeepCopy();
            var           eServiceData = WebServiceMainHQProxy.GetSignups <WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService>(_signupOut, eServiceCode.WebSchedNewPatAppt)
                                         .Select(x => new {
                Signup     = x,
                ClinicName = x.ClinicNum == 0 ? Lan.g(this, "Headquarters") : (clinicsAll.FirstOrDefault(y => y.ClinicNum == x.ClinicNum) ?? new Clinic()
                {
                    Abbr = "N\\A"
                }).Abbr
            })
                                         .Where(x =>
                                                //Always show HQ
                                                x.Signup.ClinicNum == 0 ||
                                                //If not HQ then only show if not hidden.
                                                clinicsAll.Any(y => y.ClinicNum == x.Signup.ClinicNum && !y.IsHidden)
                                                )
                                         //HQ to the top.
                                         .OrderBy(x => x.Signup.ClinicNum != 0)
                                         //Everything else is alpha sorted.
                                         .ThenBy(x => x.ClinicName);

            _listClinicPrefsWebSchedNewPats.Clear();
            foreach (var clinic in eServiceData)
            {
                ContrNewPatHostedURL contr = new ContrNewPatHostedURL(clinic.Signup);
                Lan.C(this, contr);
                panelHostedURLs.Controls.Add(contr);
                comboWSNPClinics.Items.Add(new ODBoxItem <WebServiceMainHQProxy.EServiceSetup.SignupOut.SignupOutEService>(clinic.ClinicName, clinic.Signup));
                if (clinic.Signup.ClinicNum == 0)
                {
                    continue;
                }
                else
                {
                    AddClinicPrefToList(PrefName.WebSchedNewPatAllowChildren, clinic.Signup.ClinicNum);
                    AddClinicPrefToList(PrefName.WebSchedNewPatVerifyInfo, clinic.Signup.ClinicNum);
                    AddClinicPrefToList(PrefName.WebSchedNewPatDoAuthEmail, clinic.Signup.ClinicNum);
                    AddClinicPrefToList(PrefName.WebSchedNewPatDoAuthText, clinic.Signup.ClinicNum);
                    AddClinicPrefToList(PrefName.WebSchedNewPatWebFormsURL, clinic.Signup.ClinicNum);
                }
            }
        }
예제 #11
0
        ///<summary>Makes web call to WebServicesMainHQ with the update list of API keys. Returns true if the update was successful.</summary>
        private bool UpdateKeysForOffice(List <APIKey> _listApiKeysLocal)
        {
            APIKey apiKey = new APIKey();
            //prepare the xml document to send--------------------------------------------------------------------------------------
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent      = true;
            settings.IndentChars = ("    ");
            StringBuilder strbuild = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(strbuild, WebServiceMainHQProxy.CreateXmlWriterSettings(true))) {
                writer.WriteStartElement("Payload");
                writer.WriteStartElement("ListAPIKeysUpdated");
                WriteListAPIKeys(writer, _listApiKeysLocal);
                writer.WriteEndElement();
                writer.WriteEndElement();                 //Payload
            }
            //Send the message and get the result-------------------------------------------------------------------------------------
            string result = "";

            try {
                string officeData = WebServiceMainHQProxy.CreateWebServiceHQPayload(strbuild.ToString(), eServiceCode.FHIR);
                result = WebServiceMainHQProxy.GetWebServiceMainHQInstance().UpdateFHIRAPIKeys(officeData);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return(false);
            }
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(result);
            //Process errors------------------------------------------------------------------------------------------------------------
            XmlNode node = doc.SelectSingleNode("//Error");

            if (node != null)
            {
                MessageBox.Show(node.InnerText);
                return(false);
            }
            return(true);
        }
        private void butActivateInvites_Click(object sender, EventArgs e)
        {
            if (!WebServiceMainHQProxy.IsEServiceActive(_signupOut, eServiceCode.PatientPortal))             //Not yet activated with HQ.
            {
                MsgBox.Show(this, "You must first signup for Patient Portal via the Signup tab before activating Patient Portal Invites.");
                return;
            }
            bool isPatPortalInvitesEnabled = PrefC.GetBool(PrefName.PatientPortalInviteEnabled);

            isPatPortalInvitesEnabled = !isPatPortalInvitesEnabled;
            Prefs.UpdateBool(PrefName.PatientPortalInviteEnabled, isPatPortalInvitesEnabled);
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Patient Portal Invites " + (isPatPortalInvitesEnabled ? "activated" : "deactivated") + ".");
            Prefs.RefreshCache();
            Signalods.SetInvalid(InvalidType.Prefs);
            FillPPInviteActivationButton();
            if (isPatPortalInvitesEnabled && _listPatPortalInviteRules.Count == 0)
            {
                _listPatPortalInviteRules.Add(ApptReminderRules.CreateDefaultReminderRule(ApptReminderType.PatientPortalInvite, 0, isBeforeAppointment: false));
                _listPatPortalInviteRules.Add(ApptReminderRules.CreateDefaultReminderRule(ApptReminderType.PatientPortalInvite, 0, isBeforeAppointment: true));
                FillPatPortalInvites();
            }
        }
예제 #13
0
        private void FormEServicesSetup_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult == DialogResult.Abort || !Security.IsAuthorized(Permissions.EServicesSetup, true))
            {
                return;
            }
            //Anything they could have modified should have been disabled on load anyways.
            if (!SaveForm())              //Something failed. Ask the user if they are ok with exiting and not saving.
            {
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Validation failed and no changes were saved. Would you like to close without saving?"))
                {
                    //User wants to keep the form open.
                    e.Cancel = true;
                }
            }
            //Call this a second time so we can log if any important changes were made to this form.
            //_signupOut gets filled on load and should not be null at this point
            Action actionCloseProgress = ODProgress.Show(ODEventType.EServices, typeof(EServicesEvent), "Saving eServices...");

            WebServiceMainHQProxy.GetEServiceSetupFull(GetUserSignupPortalPermissions(), oldSignupOut: _signupOut);
            actionCloseProgress?.Invoke();
        }
예제 #14
0
 private void WebhookHelper(string username, string key, long clinicNum)
 {
     if (username == "" || key == "")
     {
         return;
     }
     try {
         Cursor = Cursors.WaitCursor;
         List <PaySimple.ApiWebhookResponse> listWebhooks = PaySimple.GetAchWebhooks(clinicNum);
         List <string> listHooksNeeded = new List <string>();
         if (listWebhooks.SelectMany(x => x.WebhookTypes.FindAll(y => y == "payment_failed")).Count() == 0)
         {
             //no payment_failed webhook exists, created one.
             listHooksNeeded.Add("payment_failed");
         }
         if (listWebhooks.SelectMany(x => x.WebhookTypes.FindAll(y => y == "payment_returned")).Count() == 0)
         {
             //no payment_returned webhook exists, created one.
             listHooksNeeded.Add("payment_returned");
         }
         if (listWebhooks.SelectMany(x => x.WebhookTypes.FindAll(y => y == "payment_settled")).Count() == 0)
         {
             //no payment_settled webhook exists, created one.
             listHooksNeeded.Add("payment_settled");
         }
         if (listHooksNeeded.Count > 0)
         {
             string url = WebServiceMainHQProxy.GetWebServiceMainHQInstance().GetPaySimpleWebHookUrl();
             PaySimple.PostWebhook(clinicNum, listHooksNeeded.ToArray(), url);
         }
     }
     catch (Exception ex) {
         FriendlyException.Show("Unable to register for payment responses from PaySimple.", ex);
     }
     finally {
         Cursor = Cursors.Default;
     }
 }
예제 #15
0
        private void ButOK_Click(object sender, EventArgs e)
        {
            if (textKey.Text == "")
            {
                MsgBox.Show(this, "Please enter an API key.");
                return;
            }
            string officeData = PayloadHelper.CreatePayload(PayloadHelper.CreatePayloadContent(textKey.Text, "APIKey"), eServiceCode.FHIR);
            string result;

            try {
                Cursor = Cursors.WaitCursor;
                result = WebServiceMainHQProxy.GetWebServiceMainHQInstance().AssignFHIRAPIKey(officeData);
                PayloadHelper.CheckForError(result);
            }
            catch (Exception ex) {
                MsgBox.Show(ex.Message);
                Cursor = Cursors.Default;
                return;
            }
            MsgBox.Show(this, WebSerializer.DeserializeTag <string>(result, "Response"));
            DialogResult = DialogResult.OK;
        }
예제 #16
0
        private void butActivateConfirm_Click(object sender, EventArgs e)
        {
            if (!WebServiceMainHQProxy.IsEServiceActive(_signupOut, eServiceCode.ConfirmationRequest))             //Not yet activated with HQ.
            {
                MsgBox.Show(this, "You must first signup for eConfirmations via the Signup tab before activating eConfirmations.");
                return;
            }
            bool isApptConfirmAutoEnabled = PrefC.GetBool(PrefName.ApptConfirmAutoEnabled);

            isApptConfirmAutoEnabled = !isApptConfirmAutoEnabled;
            Prefs.UpdateBool(PrefName.ApptConfirmAutoEnabled, isApptConfirmAutoEnabled);
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Automated appointment eConfirmations " + (isApptConfirmAutoEnabled ? "activated" : "deactivated") + ".");
            Prefs.RefreshCache();
            Signalods.SetInvalid(InvalidType.Prefs);
            FillECRActivationButtons();
            //Add a default confirmation rule if none exists.
            if (isApptConfirmAutoEnabled && _dictClinicRules[0].Count(x => x.TypeCur == ApptReminderType.ConfirmationFutureDay) == 0)
            {
                ApptReminderRule arr = ApptReminderRules.CreateDefaultReminderRule(ApptReminderType.ConfirmationFutureDay, 0);             //defaults to 7 days before appt
                _dictClinicRules[0].Add(arr);
                FillRemindConfirmData();
            }
        }
예제 #17
0
        private void ButDisable_Click(object sender, EventArgs e)
        {
            FHIRKeyStatus newStatus;
            DateTime      dateDisabled;

            if (_apiKeyCur.KeyStatus.In(FHIRKeyStatus.Enabled, FHIRKeyStatus.EnabledReadOnly))
            {
                newStatus    = FHIRKeyStatus.DisabledByCustomer;
                dateDisabled = DateTime.Now;
            }
            else              //DisabledByCustomer
            {
                newStatus    = FHIRKeyStatus.Enabled;
                dateDisabled = DateTime.MinValue;
            }
            string officeData = PayloadHelper.CreatePayload(PayloadHelper.CreatePayloadContent(new List <PayloadItem> {
                new PayloadItem(textKey.Text, "APIKey"),
                new PayloadItem(newStatus.ToString(), "FHIRKeyStatus"),
            }), eServiceCode.FHIR);
            string result;

            try {
                Cursor = Cursors.WaitCursor;
                result = WebServiceMainHQProxy.GetWebServiceMainHQInstance().UpdateFHIRKeyStatus(officeData);
                PayloadHelper.CheckForError(result);
            }
            catch (Exception ex) {
                MsgBox.Show(ex.Message);
                Cursor = Cursors.Default;
                return;
            }
            HasChanged              = true;
            Cursor                  = Cursors.Default;
            _apiKeyCur.KeyStatus    = newStatus;
            _apiKeyCur.DateDisabled = dateDisabled;
            FillForm();
        }
예제 #18
0
 private void FormShowFeatures_Load(object sender, System.EventArgs e)
 {
     checkCapitation.Checked    = !PrefC.GetBool(PrefName.EasyHideCapitation);
     checkMedicaid.Checked      = !PrefC.GetBool(PrefName.EasyHideMedicaid);
     checkPublicHealth.Checked  = !PrefC.GetBool(PrefName.EasyHidePublicHealth);
     checkDentalSchools.Checked = !PrefC.GetBool(PrefName.EasyHideDentalSchools);
     checkHospitals.Checked     = !PrefC.GetBool(PrefName.EasyHideHospitals);
     checkInsurance.Checked     = !PrefC.GetBool(PrefName.EasyHideInsurance);
     checkClinical.Checked      = !PrefC.GetBool(PrefName.EasyHideClinical);
     checkBasicModules.Checked  = PrefC.GetBool(PrefName.EasyBasicModules);
     _isClinicsEnabledInDb      = PrefC.HasClinicsEnabled;
     RestoreClinicCheckBox();
     checkRepeatCharges.Checked = !PrefC.GetBool(PrefName.EasyHideRepeatCharges);
     checkMedicalIns.Checked    = PrefC.GetBool(PrefName.ShowFeatureMedicalInsurance);
     checkEhr.Checked           = PrefC.GetBool(PrefName.ShowFeatureEhr);
     checkSuperFam.Checked      = PrefC.GetBool(PrefName.ShowFeatureSuperfamilies);
     checkPatClone.Checked      = PrefC.GetBool(PrefName.ShowFeaturePatientClone);
     checkQuestionnaire.Checked = PrefC.GetBool(PrefName.AccountShowQuestionnaire);
     checkTrojanCollect.Checked = PrefC.GetBool(PrefName.AccountShowTrojanExpressCollect);
     if (Security.IsAuthorized(Permissions.SecurityAdmin, true))
     {
         //Default error until this thread finishes.
         _signupException    = new Exception(Lan.g(this, "Signup info is still loading"));
         _threadSignupPortal = new ODThread(new ODThread.WorkerDelegate((th) => {
             _signupOut = WebServiceMainHQProxy.GetEServiceSetupFull(SignupPortalPermission.FullPermission);
             //We go this far so allow checkNoClinics_Click().
             _signupException = null;
         }));
         _threadSignupPortal.AddExceptionHandler(new ODThread.ExceptionDelegate((ex) => { _signupException = ex; }));
         _threadSignupPortal.AddExitHandler(new ODThread.WorkerDelegate((th) => { _threadSignupPortal = null; }));
         _threadSignupPortal.Start();
     }
     else
     {
         _signupException = new Exception(Lan.g("Security", "Not authorized for") + "\r\n" + GroupPermissions.GetDesc(Permissions.SecurityAdmin));
     }
 }
예제 #19
0
        ///<summary>Sends a request to HQ to update the Short Code Opt In status of this patient.  Can be sent silently without any feedback in the UI.
        ///</summary>
        private static bool TrySendToHq(string wirelessPhone, YN optIn, long patNum, long clinicNum, bool isSilent = false)
        {
            List <PayloadItem> listPayloadItems = new List <PayloadItem>()
            {
                new PayloadItem(wirelessPhone, "PhonePat"),
                new PayloadItem((int)optIn, "ShortCodeOptInInt"),
                new PayloadItem(patNum, "PatNum"),
                new PayloadItem(clinicNum, "ClinicNum"),
                new PayloadItem(false, "IsWebSchedNewPat"),
                new PayloadItem(isSilent, "IsSilentUpdate"),
            };
            string result = "";

            if (isSilent)
            {
                ODThread threadSilent = new ODThread((o) => WebServiceMainHQProxy.GetWebServiceMainHQInstance()
                                                     .SetSmsPatientPhoneOptIn(PayloadHelper.CreatePayload(listPayloadItems, eServiceCode.IntegratedTexting)));
                threadSilent.AddExceptionHandler((ex) => ex.DoNothing());
                threadSilent.Name = "ShortCodeOptIn";
                threadSilent.Start();
                return(true);
            }
            ODProgress.ShowAction(() => {
                result = WebServiceMainHQProxy.GetWebServiceMainHQInstance()
                         .SetSmsPatientPhoneOptIn(PayloadHelper.CreatePayload(listPayloadItems, eServiceCode.IntegratedTexting));
            });
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(result);
            XmlNode node = doc.SelectSingleNode("//ListSmsToMobiles");

            if (node is null)
            {
                node = doc.SelectSingleNode("//Error");
                if (!(node is null))
                {
                    MessageBox.Show(Lan.g("ShortCodes", "An error occurred: ") + node.InnerText);
                }
                return(false);
            }
            List <SmsToMobile> listSmsToMobiles;

            using (XmlReader reader = XmlReader.Create(new System.IO.StringReader(node.InnerXml))) {
                System.Xml.Serialization.XmlSerializer xmlListSmsToMobileSerializer = new System.Xml.Serialization.XmlSerializer(typeof(List <SmsToMobile>));
                listSmsToMobiles = (List <SmsToMobile>)xmlListSmsToMobileSerializer.Deserialize(reader);
            }
            if (listSmsToMobiles == null)            //List should always be there even if it's empty.
            {
                MessageBox.Show(Lan.g("ShortCodes", "An error occurred: ") + node.InnerText);
                return(false);
            }
            //Should only be 0 or 1.
            if (listSmsToMobiles.Count > 0)
            {
                listSmsToMobiles.ForEach(x => x.DateTimeSent = DateTime.Now);
                SmsToMobiles.InsertMany(listSmsToMobiles);
                string message = $"{wirelessPhone} will shortly receive the following message{(listSmsToMobiles.Count>1 ? "s" : "")}:\n"
                                 + string.Join("\n", listSmsToMobiles.Select((x, i) => $"{i+1}) {x.MsgText}"));
                MessageBox.Show(message, "Appointment Texts");
            }
            //Local OptIn status for this patient will be updated by a Transmission from HQ, resulting from this call to SetSmsPatientPhoneOptIn().
            return(true);
        }
예제 #20
0
        ///<summary>Only call this method from SendPushBackground() or SendPushAlert(). See summary of those methods for documentation.
        ///If runAsync==true then spawns a worker thread and makes the web call. This method is passive and returns void so no reason to wait for return.</summary>
        private static void SendPush(PushType pushType, bool isAlert, long mobileAppDeviceNum = 0, long clinicNum = 0, long userNum = 0,
                                     List <long> listPrimaryKeys = null, List <string> listTags = null, string alertTitle           = null, string alertMessage = null, bool runAsync = true)
        {
            void execute()
            {
                eServiceCode eService = eServiceCode.EClipboard;

                switch (pushType)
                {
                case PushType.CI_CheckinPatient:
                case PushType.CI_AddSheet:
                case PushType.CI_RemoveSheet:
                case PushType.CI_GoToCheckin:
                case PushType.CI_NewEClipboardPrefs:
                case PushType.CI_IsAllowedChanged:
                case PushType.CI_TreatmentPlan:
                case PushType.CI_RemoveTreatmentPlan:
                    eService = eServiceCode.EClipboard;
                    break;

                case PushType.ODM_NewTextMessage:
                case PushType.ODM_LogoutODUser:
                    eService = eServiceCode.MobileWeb;
                    break;

                case PushType.None:
                default:
                    throw new Exception("Unsupported PushType: " + pushType.ToString());
                }
                PushNotificationPayload payload = new PushNotificationPayload {
                    IsAlert      = isAlert,
                    AlertMessage = alertMessage ?? "",
                    AlertTitle   = alertTitle ?? "",
                    UserNum      = userNum,
                    PushNotificationActionJSON = JsonConvert.SerializeObject(new PushNotificationAction()
                    {
                        TypeOfPush      = pushType,
                        ListPrimaryKeys = listPrimaryKeys ?? new List <long>(),
                        ListTags        = listTags ?? new List <string>()
                    },
                                                                             typeof(PushNotificationAction),
                                                                             new JsonSerializerSettings())
                };

                if (mobileAppDeviceNum > 0)                //Send to one exact device.
                {
                    MobileAppDevice mad = MobileAppDevices.GetOne(mobileAppDeviceNum);
                    if (mad == null)
                    {
                        throw new Exception("MobileAppDeviceNum not found: " + mobileAppDeviceNum.ToString());
                    }
                    payload.DeviceId  = mad.UniqueID;
                    payload.ClinicNum = mad.ClinicNum;
                }
                else
                {
                    payload.ClinicNum = clinicNum;
                }
                //Validate that this clinic is signed up for eClipboard if the push is related to eClipboard
                if (eService == eServiceCode.EClipboard && !MobileAppDevices.IsClinicSignedUpForEClipboard(payload.ClinicNum))
                {
                    throw new Exception($"ClinicNum {payload.ClinicNum} is not signed up for eClipboard.");
                }
                //Validate that this clinic is signed up for MobileWeb if the push is related to ODMobile
                else if (eService == eServiceCode.MobileWeb && !MobileAppDevices.IsClinicSignedUpForMobileWeb(payload.ClinicNum))
                {
                    if (clinicNum > -1 || pushType != PushType.ODM_LogoutODUser)                  //Logout is allowed to be sent to non-specific clinicNum. All others are not.
                    {
                        throw new Exception($"ClinicNum {payload.ClinicNum} is not signed up for ODMobile.");
                    }
                }
                string jsonPayload = JsonConvert.SerializeObject(payload, typeof(PushNotificationPayload), new JsonSerializerSettings());
                string result      = WebServiceMainHQProxy.GetWebServiceMainHQInstance().SendPushNotification(PayloadHelper.CreatePayload("", eService), jsonPayload);

                if (result.ToLower() != "success")
                {
                    throw new Exception(result);
                }
            }

            ODThread th = new ODThread(new ODThread.WorkerDelegate((o) => { execute(); }));

            th.AddExceptionHandler((e) => {
                if (MockExceptionHandler != null)
                {
                    MockExceptionHandler(e);
                }
                else
                {
                    Logger.WriteException(e, "PushNotifications");
                }
            });
            th.Name = "SendPush_" + pushType.ToString() + "_ClinicNum_" + clinicNum.ToString() + "_UserNum_" + userNum.ToString();
            th.Start();
            if (MockExceptionHandler != null || !runAsync)            //Join back to main thread to cause this to be a blocking call. Unit tests will always block.
            {
                th.Join(Timeout.Infinite);
            }
        }
예제 #21
0
        ///<summary>Send a summary of eConnector statistics to OD HQ. This should only be called from the eConnector.</summary>
        public static void UpdateEConnectorStats()
        {
            EConnectorStatistics eConnStats = new EConnectorStatistics()
            {
                ListEServiceSignals = new List <EServiceSignal>(),
                ListEServicePrefs   = new List <Pref>(),
            };

            eConnStats.EConnectorComputerName   = Environment.MachineName;
            eConnStats.EConnectorDomainUserName = Environment.UserName;
            eConnStats.EConnectorIP             = ODEnvironment.GetLocalIPAddress();
            eConnStats.HasClinicsEnabled        = PrefC.HasClinicsEnabled;
            if (PrefC.HasClinicsEnabled)
            {
                eConnStats.CountActiveClinics   = OpenDentBusiness.Clinics.GetCount();
                eConnStats.CountInactiveClinics = OpenDentBusiness.Clinics.GetCount() - eConnStats.CountActiveClinics;
            }
            else
            {
                eConnStats.CountActiveClinics   = 0;
                eConnStats.CountInactiveClinics = OpenDentBusiness.Clinics.GetCount();
            }
            if (DateTime.Now.Hour == 0)            //These are heavy queries so only run them once a day around midnight.
            {
                eConnStats.CountActivePatients    = OpenDentBusiness.Procedures.GetCountPatsComplete(DateTime.Today.AddYears(-2), DateTime.Today);
                eConnStats.CountNonactivePatients = OpenDentBusiness.Patients.GetPatCountAll() - eConnStats.CountActivePatients;
                eConnStats.ListEServiceSignals    = OpenDentBusiness.EServiceSignals.GetServiceHistory(eServiceCode.ListenerService, DateTime.Today.AddDays(-30),
                                                                                                       DateTime.Today, 30);
            }
            eConnStats.DateTimeNow = DateTime.Now;
            foreach (PrefName prefName in Enum.GetValues(typeof(PrefName)))
            {
                if (prefName.In(
                        PrefName.RegistrationKey,
                        PrefName.ProgramVersion,
                        PrefName.DataBaseVersion,
                        PrefName.TextingDefaultClinicNum,
                        PrefName.WebServiceServerName,
                        PrefName.SendEmailsInDiffProcess,
                        PrefName.EmailAlertMaxConsecutiveFails,
                        PrefName.AutoCommNumClinicsParallel,
                        PrefName.AutomaticCommunicationTimeStart,
                        PrefName.AutomaticCommunicationTimeEnd) ||
                    prefName.ToString().StartsWith("WebSched") ||
                    prefName.ToString().StartsWith("ApptConfirm") ||
                    prefName.ToString().StartsWith("ApptRemind") ||
                    prefName.ToString().StartsWith("ApptEConfirm") ||
                    prefName.ToString().StartsWith("Recall") ||
                    prefName.ToString().StartsWith("PatientPortal") ||
                    prefName.ToString().StartsWith("Sms"))
                {
                    try {
                        eConnStats.ListEServicePrefs.Add(Prefs.GetPref(prefName.ToString()));
                    }
                    catch (Exception ex) {
                        ex.DoNothing();
                    }
                }
            }
            List <EConnectorStatistics> listStatsToSend = new List <EConnectorStatistics> {
                eConnStats
            };
            string dbStats = PrefC.GetString(PrefName.EConnectorStatistics);
            List <EConnectorStatistics> listDbStats = DeserializeListFromJson(dbStats) ?? new List <EConnectorStatistics>();
            bool doCreateAlert = false;

            foreach (EConnectorStatistics stats in listDbStats)
            {
                //If a different eConnector is saving stats, add that one to the list to be sent to HQ.
                if (!AreSameEConnector(eConnStats, stats) && (eConnStats.DateTimeNow - stats.DateTimeNow).TotalHours < 23)
                {
                    stats.ListEServicePrefs   = new List <Pref>();               //To save on bandwidth
                    stats.ListEServiceSignals = new List <EServiceSignal>();
                    listStatsToSend.Add(stats);
                    if ((eConnStats.DateTimeNow - stats.DateTimeNow).TotalHours < 3)
                    {
                        doCreateAlert = true;
                    }
                }
            }
            if (doCreateAlert && AlertItems.RefreshForType(AlertType.MultipleEConnectors).Count == 0)
            {
                AlertItem alert = new AlertItem {
                    Actions     = ActionType.MarkAsRead | ActionType.Delete,
                    Description = Lans.g("EConnectorStats", "eConnector services are being run on these computers:") + " "
                                  + string.Join(", ", listStatsToSend.Select(x => x.EConnectorComputerName)),
                    Severity = SeverityType.High,
                    Type     = AlertType.MultipleEConnectors,
                };
                AlertItems.Insert(alert);
            }
            string statsStr = SerializeToJson(listStatsToSend);

            OpenDentBusiness.Prefs.UpdateString(PrefName.EConnectorStatistics, statsStr);
            string payload = PayloadHelper.CreatePayload(PayloadHelper.CreatePayloadContent(statsStr, "EConnectorStatsStr"),
                                                         eServiceCode.ListenerService);

            WebServiceMainHQProxy.GetWebServiceMainHQInstance().SetEConnectorStatsAsync(payload);
        }
예제 #22
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();
        }
예제 #23
0
        ///<summary>Processes a PaySimple ACH payment via the PaySimple API.</summary>
        private PaySimple.ApiResponse ProcessPaymentACH()
        {
            PaySimple.ApiResponse retVal = null;
            string accountNumber         = textCheckSaveNumber.Text;

            //if the user has chosen to store CC tokens and the stored CC has a token and the token is not expired,
            //then use it instead of the CC number and CC expiration.
            if (!checkOneTimePaymentACH.Checked &&
                _creditCardCur != null &&               //if the user selected a saved CC
                !string.IsNullOrWhiteSpace(_creditCardCur.PaySimpleToken) &&                 //there is a stored token for this card
                _creditCardCur.CCSource == CreditCardSource.PaySimpleACH)
            {
                accountNumber = _creditCardCur.PaySimpleToken;
            }
            else if (PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, PaySimple.PropertyDescs.PaySimplePreventSavingNewCC, _clinicNum)))
            {
                MsgBox.Show(this, "Cannot add a new ACH payment.");
                return(null);
            }
            try {
                if (_isAddingCard)
                {
                    retVal = PaySimple.AddACHAccount(_patCur, textRoutingNumber.Text, textCheckSaveNumber.Text, textBankName.Text, radioCheckings.Checked, _clinicNum);
                }
                else
                {
                    retVal = PaySimple.MakePaymentACH(_patCur, _creditCardCur, PIn.Decimal(textAmountACH.Text), textRoutingNumber.Text, textCheckSaveNumber.Text,
                                                      textBankName.Text, radioCheckings.Checked, checkOneTimePaymentACH.Checked, _clinicNum);
                    try {
                        string result = WebServiceMainHQProxy.GetWebServiceMainHQInstance()
                                        .InsertPaySimpleACHId(PayloadHelper.CreatePayload(
                                                                  PayloadHelper.CreatePayloadContent(retVal.RefNumber.ToString(), "PaymentId"), eServiceCode.PaySimple));
                        PayloadHelper.CheckForError(result);
                    }
                    catch (Exception ex) {
                        FriendlyException.Show("Unable to register for ACH Settled event", ex);
                    }
                }
            }
            catch (PaySimpleException ex) {
                MessageBox.Show(ex.Message);
                if (ex.ErrorType == PaySimpleError.CustomerDoesNotExist && MsgBox.Show(this, MsgBoxButtons.OKCancel,
                                                                                       "Delete the link to the customer id for this patient?"))
                {
                    PatientLinks.DeletePatNumTos(ex.CustomerId, PatientLinkType.PaySimple);
                }
                return(null);
            }
            catch (ODException ex) {
                MessageBox.Show(ex.Message);                //This should have already been Lans.g if applicable.
                return(null);
            }
            catch (Exception ex) {
                FriendlyException.Show(Lan.g(this, "Error:") + " " + ex.Message, ex);
                return(null);
            }
            if (!_isAddingCard)
            {
                retVal.BuildReceiptString(accountNumber, -1, -1, _patCur?.GetNameFL(), _clinicNum, wasSwiped: false, isACH: true);
                PrintReceipt(retVal.TransactionReceipt);
            }
            if (checkOneTimePaymentACH.Checked)             //not storing the account token
            {
                return(retVal);
            }
            UpsertCreditCard(retVal, textCheckSaveNumber.Text.Right(4).PadLeft(textCheckSaveNumber.Text.Length, '*'), CreditCardSource.PaySimpleACH,
                             DateTime.MinValue);
            return(retVal);
        }
예제 #24
0
 ///<summary>Validates that PrefName.EasyNoClinics is ok to be changed and changes it when necessary. Tells HQ about changes and re-syncs with new HQ clinic preference for this practice.
 ///If fails then restores checkEnableClinics to original value when form was opened.</summary>
 private bool IsClinicCheckBoxOk()
 {
     try {
         if (!_hasClinicsEnabledChanged)                  //No change.
         {
             return(true);
         }
         //Make sure signup info was retrieved from HQ.
         ValidateHqValidationComplete();
         //Find any eServices that HQ says are enabled.
         var clinicsEnabled = _signupOut.EServices
                              .FindAll(x => x.IsEnabled)
                              .GroupBy(x => x.ClinicNum)
                              .ToList();
         //Build the prompt.
         string prompt = "";
         foreach (var clinicEnabled in clinicsEnabled)
         {
             if (clinicEnabled.Key != 0)
             {
                 prompt += ODMethodsT.Coalesce(Clinics.GetFirstOrDefault(x => x.ClinicNum == clinicEnabled.Key)
                                               , new Clinic()
                 {
                     Abbr = "Undefined Clinic"
                 }).Abbr + "\r\n";
             }
             else
             {
                 prompt += Lan.g(this, "Practice") + "\r\n";
             }
             //If bundle then don't show others.
             if (clinicEnabled.Any(x => x.EService == eServiceCode.Bundle))
             {
                 prompt += "  - " + eServiceCode.Bundle.GetDescription() + "\r\n";
             }
             else                       //Show all enabled eServices.
             {
                 foreach (var eService in clinicEnabled.ToList())
                 {
                     prompt += "  - " + eService.EService.GetDescription() + "\r\n";
                 }
             }
         }
         //Prompt and take action when necessary.
         if (!string.IsNullOrEmpty(prompt))
         {
             if (checkEnableClinics.Checked)                      //Will be switching clinics on.
             {
                 prompt =
                     Lan.g(this, "Your eServices will need to be reassigned to your clinics once you have created at least one clinic.") + "\r\n\r\n" +
                     Lan.g(this, "Once have created at least one clinic, please visit the Signup Portal using eServices | Signup in order to make the appropriate changes to your service agreement.") + "\r\n\r\n" +
                     Lan.g(this, "You are currently subscribed to the following eServices. Click OK to continue.") + "\r\n\r\n" + prompt;
             }
             else                       //Will be switching clinics off.
             {
                 prompt =
                     Lan.g(this, "Your eServices will all be transferred from individual clinics to your practice.") + "\r\n\r\n" +
                     Lan.g(this, "Once you approve this change, please visit the Signup Portal using eServices | Signup in order to verify the changes to your service agreement are correct.") + "\r\n\r\n" +
                     Lan.g(this, "You are currently subscribed to the following eServices. Click OK to approve this change.") + "\r\n\r\n" + prompt;
             }
             if (MessageBox.Show(prompt, "", MessageBoxButtons.OKCancel) != DialogResult.OK)
             {
                 throw new Exception(Lan.g(this, "Clinic feature modification canceled"));
             }
         }
         //Turn clinics on/off locally and send the signal to other workstations. This must happen before we call HQ so we tell HQ the new value.
         Prefs.UpdateBool(PrefName.EasyNoClinics, !checkEnableClinics.Checked);
         DataValid.SetInvalid(InvalidType.Prefs);
         //This call will perform the changes to the local clinic pref at HQ. It will also re-sync local prefs and table infor HQ's info.
         WebServiceMainHQProxy.GetEServiceSetupFull(SignupPortalPermission.FullPermission, true);
         return(true);
     }
     catch (Exception ex) {
         //Change it back to what the db has.
         RestoreClinicCheckBox();
         MessageBox.Show(ex.Message);
         return(false);
     }
 }
예제 #25
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();
        }
예제 #26
0
        private List <APIKey> GetApiKeys()
        {
            List <APIKey> listApiKeys = new List <APIKey>();
            //prepare the xml document to send--------------------------------------------------------------------------------------
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent      = true;
            settings.IndentChars = ("    ");
            StringBuilder strbuild = new StringBuilder();
            //Send the message and get the result-------------------------------------------------------------------------------------
            string result = "";

            try {
                string officeData = WebServiceMainHQProxy.CreateWebServiceHQPayload(strbuild.ToString(), eServiceCode.FHIR);
                result = WebServiceMainHQProxy.GetWebServiceMainHQInstance().GetFHIRAPIKeysForOffice(officeData);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return(null);
            }
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(result);
            XPathNavigator nav = doc.CreateNavigator();
            //Process errors------------------------------------------------------------------------------------------------------------
            XPathNavigator node = nav.SelectSingleNode("//Error");

            if (node != null)
            {
                MessageBox.Show(node.Value);
                return(null);
            }
            //Process a valid return value------------------------------------------------------------------------------------------------{
            node = nav.SelectSingleNode("//ListAPIKeys");
            if (node != null && node.MoveToFirstChild())
            {
                do
                {
                    APIKey apiKey = new APIKey();
                    apiKey.Key           = node.SelectSingleNode("APIKeyValue").Value;
                    apiKey.FHIRAPIKeyNum = PIn.Long(node.SelectSingleNode("FHIRAPIKeyNum").Value);
                    apiKey.DateDisabled  = DateTime.Parse(node.SelectSingleNode("DateDisabled").Value);
                    APIKeyStatus status;
                    if (Enum.TryParse(node.SelectSingleNode("KeyStatus").Value, out status))
                    {
                        apiKey.KeyStatus = status;
                    }
                    else
                    {
                        apiKey.KeyStatus = APIKeyStatus.ReadEnabled;
                    }
                    apiKey.DeveloperName    = node.SelectSingleNode("DeveloperName").Value;
                    apiKey.DeveloperEmail   = node.SelectSingleNode("DeveloperEmail").Value;
                    apiKey.DeveloperPhone   = node.SelectSingleNode("DeveloperPhone").Value;
                    apiKey.FHIRDeveloperNum = PIn.Long(node.SelectSingleNode("FHIRDeveloperNum").Value);
                    XPathNavigator nodePerms = node.SelectSingleNode("ListAPIPermissions");
                    if (nodePerms != null && nodePerms.MoveToFirstChild())
                    {
                        do
                        {
                            APIPermission perm;
                            if (Enum.TryParse(nodePerms.Value, out perm))
                            {
                                apiKey.ListPermissions.Add(perm);
                            }
                        } while(nodePerms.MoveToNext());
                    }
                    listApiKeys.Add(apiKey);
                } while(node.MoveToNext());
            }
            return(listApiKeys);
        }