Esempio n. 1
0
        public void ComposeNewRxDoseSpot()
        {
            string additionalHeaders = "Content-Type: application/x-www-form-urlencoded\r\n";
            string doseSpotUrl       = Introspection.GetOverride(Introspection.IntrospectionEntity.DoseSpotSingleSignOnURL, "https://my.dosespot.com/LoginSingleSignOn.aspx");

#if DEBUG
            doseSpotUrl = "https://my.staging.dosespot.com/LoginSingleSignOn.aspx?b=2";
#endif
            OIDExternal oidPatID = DoseSpot.GetDoseSpotPatID(PatCur.PatNum);
            if (oidPatID == null)
            {
                browser.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.GetPatientIdFromWebBrowser);
            }
            browser.Navigate(doseSpotUrl, "", PostDataBytes, additionalHeaders);
        }
Esempio n. 2
0
        private void GetPatientIdFromWebBrowser(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            WebBrowser myWebBrowser = sender as WebBrowser;

            if (e.Url != null && !string.IsNullOrEmpty(e.Url.Query))
            {
                int    doseSpotPatID;
                string patIdStr = DoseSpot.GetQueryParameterFromQueryString(e.Url.Query, "PatientId");
                if ((!string.IsNullOrEmpty(patIdStr)) && int.TryParse(patIdStr.Trim(), out doseSpotPatID))
                {
                    if (doseSpotPatID != 0)
                    {
                        DoseSpot.CreateOIDForPatient(doseSpotPatID, PatCur.PatNum);
                    }
                }
            }
            myWebBrowser.DocumentCompleted -= new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.GetPatientIdFromWebBrowser);
        }
Esempio n. 3
0
 public void DoseSpot_IsPhoneNumberValid()
 {
     Assert.AreEqual(true, DoseSpot.IsPhoneNumberValid("(959)-230-4007"));
     Assert.AreEqual(true, DoseSpot.IsPhoneNumberValid("9592304007"));
     Assert.AreEqual(true, DoseSpot.IsPhoneNumberValid("959-230-4007"));
     Assert.AreEqual(true, DoseSpot.IsPhoneNumberValid("(959)230-4007"));
     Assert.AreEqual(true, DoseSpot.IsPhoneNumberValid("(959)230-4007X1234"));
     Assert.AreEqual(true, DoseSpot.IsPhoneNumberValid("(959)230-4007x1234"));
     Assert.AreEqual(false, DoseSpot.IsPhoneNumberValid("1-(959)230-4007"));
     Assert.AreEqual(false, DoseSpot.IsPhoneNumberValid("1-959-230-4007"));
     Assert.AreEqual(false, DoseSpot.IsPhoneNumberValid("1-(959)230-4007X1234"));
     Assert.AreEqual(false, DoseSpot.IsPhoneNumberValid("1-(959)230-4007x1234"));
     Assert.AreEqual(false, DoseSpot.IsPhoneNumberValid("1-(959)230-40071"));
     Assert.AreEqual(false, DoseSpot.IsPhoneNumberValid("(959)230t-4007"));
     Assert.AreEqual(false, DoseSpot.IsPhoneNumberValid("(555)230-4007"));
     Assert.AreEqual(false, DoseSpot.IsPhoneNumberValid("(959)222-2222"));
     Assert.AreEqual(false, DoseSpot.IsPhoneNumberValid("(059)230-4007"));
     Assert.AreEqual(false, DoseSpot.IsPhoneNumberValid("(159)230-4007"));
 }
Esempio n. 4
0
 private void butRegisterClinic_Click(object sender, EventArgs e)
 {
     Cursor = Cursors.WaitCursor;
     try {
         Program         programErx = Programs.GetCur(ProgramName.eRx);
         ProgramProperty ppClinicID = ListProperties
                                      .FirstOrDefault(x => x.ClinicNum != _clinicCur.ClinicNum && x.PropertyDesc == Erx.PropertyDescs.ClinicID && x.PropertyValue != "");
         ProgramProperty ppClinicKey = null;
         if (ppClinicID != null)
         {
             ppClinicKey = ListProperties
                           .FirstOrDefault(x => x.ClinicNum == ppClinicID.ClinicNum && x.PropertyDesc == Erx.PropertyDescs.ClinicKey && x.PropertyValue != "");
         }
         if (ppClinicID == null || string.IsNullOrWhiteSpace(ppClinicID.PropertyValue) ||
             ppClinicKey == null || string.IsNullOrWhiteSpace(ppClinicKey.PropertyValue))
         {
             //Should never happen since we disable this button if we can't find a valid clinicID/clinicKey combo ahead of time
             throw new ODException("No registered clinics found.  "
                                   + "There must be at least one registered clinic before adding additional clinics.");
         }
         string clinicID  = "";
         string clinicKey = "";
         DoseSpot.RegisterClinic(_clinicCur.ClinicNum, ppClinicID.PropertyValue, ppClinicKey.PropertyValue
                                 , DoseSpot.GetUserID(Security.CurUser, _clinicCur.ClinicNum), out clinicID, out clinicKey);
         textClinicID.Text  = clinicID;
         textClinicKey.Text = clinicKey;
     }
     catch (ODException ex) {
         MsgBox.Show(this, ex.Message);
         return;
     }
     catch (Exception ex) {
         MessageBox.Show(Lan.g(this, "Error: ") + ex.Message);
         return;
     }
     finally {
         Cursor = Cursors.Default;
     }
     MsgBox.Show(this, "This clinic has successfully been registered with DoseSpot.\r\n"
                 + "If patients in this clinic can be shared with other clinics, contact DoseSpot to link this clinic before using.");
 }
Esempio n. 5
0
        private void GetPatientIdFromWebBrowser(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            WebBrowser myWebBrowser = sender as WebBrowser;

            if (e.Url != null && !string.IsNullOrEmpty(e.Url.Query))
            {
                int    doseSpotPatID;
                string patIdStr = DoseSpot.GetQueryParameterFromQueryString(e.Url.Query, "PatientId");
                if ((!string.IsNullOrEmpty(patIdStr)) && int.TryParse(patIdStr.Trim(), out doseSpotPatID))
                {
                    if (doseSpotPatID != 0)
                    {
                        OIDExternal oidExternalForPat = new OIDExternal();
                        oidExternalForPat.rootExternal = DoseSpot.GetDoseSpotRoot() + "." + POut.Int((int)IdentifierType.Patient);
                        oidExternalForPat.IDExternal   = doseSpotPatID.ToString();
                        oidExternalForPat.IDInternal   = PatCur.PatNum;
                        oidExternalForPat.IDType       = IdentifierType.Patient;
                        OIDExternals.Insert(oidExternalForPat);
                    }
                }
            }
            myWebBrowser.DocumentCompleted -= new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.GetPatientIdFromWebBrowser);
        }
Esempio n. 6
0
 ///<summary>Throws exceptions for invalid Patient data.</summary>
 public static byte[] BuildDoseSpotPostDataBytesRefillsErrors(string clinicID, string clinicKey, string userID, out string queryString)
 {
     queryString = DoseSpot.GetSingleSignOnQueryString(clinicID, clinicKey, userID, "", null);
     return(ASCIIEncoding.ASCII.GetBytes(queryString));
 }
Esempio n. 7
0
 ///<summary>Throws exceptions for invalid Patient data.</summary>
 public static byte[] BuildDoseSpotPostDataBytes(string clinicID, string clinicKey, string userID, string onBehalfOfUserId, Patient pat, out string queryString)
 {
     queryString = DoseSpot.GetSingleSignOnQueryString(clinicID, clinicKey, userID, onBehalfOfUserId, pat);
     return(ASCIIEncoding.ASCII.GetBytes(queryString));
 }
Esempio n. 8
0
        private void FormUserEdit_Load(object sender, System.EventArgs e)
        {
            checkIsHidden.Checked = UserCur.IsHidden;
            if (UserCur.UserNum != 0)
            {
                textUserNum.Text = UserCur.UserNum.ToString();
            }
            textUserName.Text   = UserCur.UserName;
            textDomainUser.Text = UserCur.DomainUser;
            if (!PrefC.GetBool(PrefName.DomainLoginEnabled))
            {
                labelDomainUser.Visible   = false;
                textDomainUser.Visible    = false;
                butPickDomainUser.Visible = false;
            }
            checkRequireReset.Checked = UserCur.IsPasswordResetRequired;
            _listUserGroups           = UserGroups.GetList();
            _isFillingList            = true;
            for (int i = 0; i < _listUserGroups.Count; i++)
            {
                listUserGroup.Items.Add(new ODBoxItem <UserGroup>(_listUserGroups[i].Description, _listUserGroups[i]));
                if (!_isFromAddUser && UserCur.IsInUserGroup(_listUserGroups[i].UserGroupNum))
                {
                    listUserGroup.SetSelected(i, true);
                }
                if (_isFromAddUser && _listUserGroups[i].UserGroupNum == PrefC.GetLong(PrefName.DefaultUserGroup))
                {
                    listUserGroup.SetSelected(i, true);
                }
            }
            if (listUserGroup.SelectedIndex == -1)          //never allowed to delete last group, so this won't fail
            {
                listUserGroup.SelectedIndex = 0;
            }
            _isFillingList = false;
            securityTreeUser.FillTreePermissionsInitial();
            RefreshUserTree();
            listEmployee.Items.Clear();
            listEmployee.Items.Add(Lan.g(this, "none"));
            listEmployee.SelectedIndex = 0;
            _listEmployees             = Employees.GetDeepCopy(true);
            for (int i = 0; i < _listEmployees.Count; i++)
            {
                listEmployee.Items.Add(Employees.GetNameFL(_listEmployees[i]));
                if (UserCur.EmployeeNum == _listEmployees[i].EmployeeNum)
                {
                    listEmployee.SelectedIndex = i + 1;
                }
            }
            listProv.Items.Clear();
            listProv.Items.Add(Lan.g(this, "none"));
            listProv.SelectedIndex = 0;
            _listProviders         = Providers.GetDeepCopy(true);
            for (int i = 0; i < _listProviders.Count; i++)
            {
                listProv.Items.Add(_listProviders[i].GetLongDesc());
                if (UserCur.ProvNum == _listProviders[i].ProvNum)
                {
                    listProv.SelectedIndex = i + 1;
                }
            }
            _listClinics           = Clinics.GetDeepCopy(true);
            _listUserAlertTypesOld = AlertSubs.GetAllForUser(UserCur.UserNum);
            List <long> listSubscribedClinics;
            bool        isAllClinicsSubscribed = false;

            if (_listUserAlertTypesOld.Select(x => x.ClinicNum).Contains(-1))             //User subscribed to all clinics
            {
                isAllClinicsSubscribed = true;
                listSubscribedClinics  = _listClinics.Select(x => x.ClinicNum).Distinct().ToList();
            }
            else
            {
                listSubscribedClinics = _listUserAlertTypesOld.Select(x => x.ClinicNum).Distinct().ToList();
            }
            List <long> listAlertCatNums = _listUserAlertTypesOld.Select(x => x.AlertCategoryNum).Distinct().ToList();

            listAlertSubMulti.Items.Clear();
            _listAlertCategories = AlertCategories.GetDeepCopy();
            List <long> listUserAlertCatNums = _listUserAlertTypesOld.Select(x => x.AlertCategoryNum).ToList();

            foreach (AlertCategory cat in _listAlertCategories)
            {
                int index = listAlertSubMulti.Items.Add(Lan.g(this, cat.Description));
                listAlertSubMulti.SetSelected(index, listUserAlertCatNums.Contains(cat.AlertCategoryNum));
            }
            if (!PrefC.HasClinicsEnabled)
            {
                tabClinics.Enabled = false;              //Disables all controls in the clinics tab.  Tab is still selectable.
                listAlertSubsClinicsMulti.Visible = false;
                labelAlertClinic.Visible          = false;
            }
            else
            {
                listClinic.Items.Clear();
                listClinic.Items.Add(Lan.g(this, "All"));
                listAlertSubsClinicsMulti.Items.Add(Lan.g(this, "All"));
                listAlertSubsClinicsMulti.Items.Add(Lan.g(this, "Headquarters"));
                if (UserCur.ClinicNum == 0)               //Unrestricted
                {
                    listClinic.SetSelected(0, true);
                    checkClinicIsRestricted.Enabled = false; //We don't really need this checkbox any more but it's probably better for users to keep it....
                }
                if (isAllClinicsSubscribed)                  //They are subscribed to all clinics
                {
                    listAlertSubsClinicsMulti.SetSelected(0, true);
                }
                else if (listSubscribedClinics.Contains(0))                 //They are subscribed to Headquarters
                {
                    listAlertSubsClinicsMulti.SetSelected(1, true);
                }
                List <UserClinic> listUserClinics = UserClinics.GetForUser(UserCur.UserNum);
                for (int i = 0; i < _listClinics.Count; i++)
                {
                    listClinic.Items.Add(_listClinics[i].Abbr);
                    listClinicMulti.Items.Add(_listClinics[i].Abbr);
                    listAlertSubsClinicsMulti.Items.Add(_listClinics[i].Abbr);
                    if (UserCur.ClinicNum == _listClinics[i].ClinicNum)
                    {
                        listClinic.SetSelected(i + 1, true);
                    }
                    if (UserCur.ClinicNum != 0 && listUserClinics.Exists(x => x.ClinicNum == _listClinics[i].ClinicNum))
                    {
                        listClinicMulti.SetSelected(i, true);                       //No "All" option, don't select i+1
                    }
                    if (!isAllClinicsSubscribed && _listUserAlertTypesOld.Exists(x => x.ClinicNum == _listClinics[i].ClinicNum))
                    {
                        listAlertSubsClinicsMulti.SetSelected(i + 2, true);                     //All+HQ
                    }
                }
                checkClinicIsRestricted.Checked = UserCur.ClinicIsRestricted;
            }
            if (string.IsNullOrEmpty(UserCur.PasswordHash))
            {
                butPassword.Text = Lan.g(this, "Create Password");
            }
            if (!PrefC.IsODHQ)
            {
                butJobRoles.Visible = false;
            }
            if (IsNew)
            {
                butUnlock.Visible = false;
            }
            _listDoseSpotUserPrefOld = UserOdPrefs.GetByUserAndFkeyAndFkeyType(UserCur.UserNum,
                                                                               Programs.GetCur(ProgramName.eRx).ProgramNum, UserOdFkeyType.Program,
                                                                               Clinics.GetForUserod(Security.CurUser, true).Select(x => x.ClinicNum)
                                                                               .Union(new List <long>()
            {
                0
            })                                                //Always include 0 clinic, this is the default, NOT a headquarters only value.
                                                                               .Distinct()
                                                                               .ToList());
            _listDoseSpotUserPrefNew = _listDoseSpotUserPrefOld.Select(x => x.Clone()).ToList();
            _doseSpotUserPrefDefault = _listDoseSpotUserPrefNew.Find(x => x.ClinicNum == 0);
            if (_doseSpotUserPrefDefault == null)
            {
                _doseSpotUserPrefDefault = DoseSpot.GetDoseSpotUserIdFromPref(UserCur.UserNum, 0);
                _listDoseSpotUserPrefNew.Add(_doseSpotUserPrefDefault);
            }
            textDoseSpotUserID.Text = _doseSpotUserPrefDefault.ValueString;
            if (_isFromAddUser && !Security.IsAuthorized(Permissions.SecurityAdmin, true))
            {
                butPassword.Visible       = false;
                checkRequireReset.Checked = true;
                checkRequireReset.Enabled = false;
                butUnlock.Visible         = false;
                butJobRoles.Visible       = false;
            }
            if (!PrefC.HasClinicsEnabled)
            {
                butDoseSpotAdditional.Visible = false;
            }
        }
Esempio n. 9
0
        private void FormRepeatChargeEdit_Load(object sender, EventArgs e)
        {
            SetPatient();
            if (IsNew)
            {
                FormProcCodes FormP = new FormProcCodes();
                FormP.IsSelectionMode = true;
                FormP.ShowDialog();
                if (FormP.DialogResult != DialogResult.OK)
                {
                    DialogResult = DialogResult.Cancel;
                    return;
                }
                ProcedureCode procCode = ProcedureCodes.GetProcCode(FormP.SelectedCodeNum);
                if (procCode.TreatArea != TreatmentArea.Mouth &&
                    procCode.TreatArea != TreatmentArea.None)
                {
                    MsgBox.Show(this, "Procedure codes that require tooth numbers are not allowed.");
                    DialogResult = DialogResult.Cancel;
                    return;
                }
                RepeatCur.ProcCode     = ProcedureCodes.GetStringProcCode(FormP.SelectedCodeNum);
                RepeatCur.IsEnabled    = true;
                RepeatCur.CreatesClaim = false;
            }
            textCode.Text      = RepeatCur.ProcCode;
            textDesc.Text      = ProcedureCodes.GetProcCode(RepeatCur.ProcCode).Descript;
            textChargeAmt.Text = RepeatCur.ChargeAmt.ToString("F");
            if (RepeatCur.DateStart.Year > 1880)
            {
                textDateStart.Text = RepeatCur.DateStart.ToShortDateString();
            }
            if (RepeatCur.DateStop.Year > 1880)
            {
                textDateStop.Text = RepeatCur.DateStop.ToShortDateString();
            }
            textNote.Text = RepeatCur.Note;
            _isErx        = false;
            if (PrefC.GetBool(PrefName.DistributorKey) && Regex.IsMatch(RepeatCur.ProcCode, "^Z[0-9]{3,}$"))            //Is eRx if HQ and a using an eRx Z code.
            {
                _isErx = true;
                labelPatNum.Visible       = true;
                textPatNum.Visible        = true;
                butMoveTo.Visible         = true;
                labelNpi.Visible          = true;
                textNpi.Visible           = true;
                labelProviderName.Visible = true;
                textProvName.Visible      = true;
                labelErxAccountId.Visible = true;
                textErxAccountId.Visible  = true;
                if (IsNew && RepeatCur.ProcCode == "Z100")               //DoseSpot Procedure Code
                {
                    List <string> listDoseSpotAccountIds = ClinicErxs.GetAccountIdsForPatNum(RepeatCur.PatNum)
                                                           .Union(ProviderErxs.GetAccountIdsForPatNum(RepeatCur.PatNum))
                                                           .Union(
                        RepeatCharges.GetForErx()
                        .FindAll(x => x.PatNum == RepeatCur.PatNum && x.ProcCode == "Z100")
                        .Select(x => x.ErxAccountId)
                        .ToList()
                        )
                                                           .Distinct()
                                                           .ToList()
                                                           .FindAll(x => DoseSpot.IsDoseSpotAccountId(x));
                    if (listDoseSpotAccountIds.Count == 0)
                    {
                        listDoseSpotAccountIds.Add(DoseSpot.GenerateAccountId(RepeatCur.PatNum));
                    }
                    if (listDoseSpotAccountIds.Count == 1)
                    {
                        textErxAccountId.Text = listDoseSpotAccountIds[0];
                    }
                    else if (listDoseSpotAccountIds.Count > 1)
                    {
                        InputBox inputAccountIds = new InputBox(Lans.g(this, "Multiple Account IDs found.  Select one to assign to this repeat charge."), listDoseSpotAccountIds, 0);
                        inputAccountIds.ShowDialog();
                        if (inputAccountIds.DialogResult == DialogResult.OK)
                        {
                            textErxAccountId.Text = listDoseSpotAccountIds[inputAccountIds.SelectedIndex];
                        }
                    }
                }
                else                  //Existing eRx repeating charge.
                {
                    textNpi.Text              = RepeatCur.Npi;
                    textErxAccountId.Text     = RepeatCur.ErxAccountId;
                    textProvName.Text         = RepeatCur.ProviderName;
                    textNpi.ReadOnly          = true;
                    textErxAccountId.ReadOnly = true;
                    textProvName.ReadOnly     = true;
                }
            }
            checkCopyNoteToProc.Checked = RepeatCur.CopyNoteToProc;
            checkCreatesClaim.Checked   = RepeatCur.CreatesClaim;
            checkIsEnabled.Checked      = RepeatCur.IsEnabled;
            if (PrefC.GetBool(PrefName.DistributorKey))             //OD HQ disable the IsEnabled and CreatesClaim checkboxes
            {
                checkCreatesClaim.Enabled = false;
                checkIsEnabled.Enabled    = false;
            }
            if (PrefC.IsODHQ && EServiceCodeLink.IsProcCodeAnEService(RepeatCur.ProcCode))
            {
                if (IsNew)
                {
                    MsgBox.Show(this, "You cannot manually create any eService repeating charges.\r\n"
                                + "Use the Signup Portal instead.\r\n\r\n"
                                + "The Charge Amount can be manually edited after the Signup Portal has created the desired eService repeating charge.");
                    DialogResult = DialogResult.Abort;
                    return;
                }
                //The only things that users should be able to do for eServices are:
                //1. Change the repeating charge amount.
                //2. Manipulate the Start Date.
                //3. Manipulate the Note.
                //4. Manipulate Billing Day because not all customers will have a non-eService repeating charge in order to manipulate.
                //This is because legacy users (versions prior to 17.1) need the ability to manually set their monthly charge amount, etc.
                SetFormReadOnly(this, butOK, butCancel
                                , textChargeAmt, labelChargeAmount
                                , textDateStart, labelDateStart
                                , textNote, labelNote
                                , textBillingDay, labelBillingCycleDay);
            }
            Patient pat = Patients.GetPat(RepeatCur.PatNum);          //pat should never be null. If it is, this will fail.

            //If this is a new repeat charge and no other active repeat charges exist, set the billing cycle day to today
            if (IsNew && !RepeatCharges.ActiveRepeatChargeExists(RepeatCur.PatNum))
            {
                textBillingDay.Text = DateTimeOD.Today.Day.ToString();
            }
            else
            {
                textBillingDay.Text = pat.BillingCycleDay.ToString();
            }
            if (PrefC.GetBool(PrefName.BillingUseBillingCycleDay))
            {
                labelBillingCycleDay.Visible = true;
                textBillingDay.Visible       = true;
            }
            checkUsePrepay.Checked = RepeatCur.UsePrepay;
        }