Example #1
0
        ///<summary>Returns true if this form needs to be shown to the user based on practice and patient settings.  False otherwise.</summary>
        public static void PromptIfNecessary(Patient pat, long clinicNum)
        {
            PatComm patComm = Patients.GetPatComms(pat.SingleItemToList()).FirstOrDefault();

            if (patComm is null)
            {
                return;
            }
            bool isClinicPrompting = ClinicPrefs.GetBool(PrefName.ShortCodeOptInOnApptComplete, clinicNum);

            if (!isClinicPrompting &&        //Auto prompt is disabled (practice pref if not found for clinic)
                patComm.IsPatientShortCodeEligible(clinicNum) &&                //The patient might be able to receive short code sms.
                pat.ShortCodeOptIn == YN.Unknown)                 //And the patient has not explicitly opted in or out yet.
            {
                //Provider has acknowledged they will have the Appt Text opt-in conversation with the patient in absence of this prompt, and that this will
                //cause "Unknown" patients to be automatically opted-in.  HQ has a preference to disable auto Unknown->Yes if necessary.
                TrySendToHq(pat.WirelessPhone, YN.Yes, pat.PatNum, clinicNum, isSilent: true);
                return;
            }
            bool isPromptNecessary = isClinicPrompting &&       //Auto prompt is enabled (practice pref if not found for clinic)
                                     patComm.IsPatientShortCodeEligible(clinicNum) &&
                                     pat.ShortCodeOptIn == YN.Unknown; //Patient has not opted in or out for short codes yet.

            if (!isPromptNecessary)
            {
                return;
            }
            new FormShortCodeOptIn(pat).ShowDialog();
        }
Example #2
0
 public PatientDetail(PatComm patComm)
 {
     if (patComm == null)
     {
         return;
     }
     PatName = patComm.LName + ", " + patComm.FName;
     PatNum  = patComm.PatNum;
 }
        private void FillShortCodes()
        {
            bool enabled = PatComm.IsAnyShortCodeServiceEnabled(comboShortCodeClinic.SelectedClinicNum);

            labelUnsavedShortCodeChanges.Visible  = false;
            checkOptInPrompt.Enabled              = enabled;
            checkOptInPrompt.Checked              = ClinicPrefs.GetBool(PrefName.ShortCodeOptInOnApptComplete, comboShortCodeClinic.SelectedClinicNum);
            textShortCodeOptInClinicTitle.Enabled = enabled;
            textShortCodeOptInClinicTitle.Text    = GetShortCodeOptInClinicTitle();
        }
Example #4
0
 ///<summary>Sends a text message to this patient if it is feasible.</summary>
 private bool SendText(PatComm patComm, long clinicNum, string message)
 {
     if (!patComm.IsSmsAnOption)
     {
         Cursor = Cursors.Default;
         MessageBox.Show(Lan.g(this, "It is not OK to text patient") + " " + patComm.FName + " " + patComm.LName + ".");
         Cursor = Cursors.WaitCursor;
         return(false);
     }
     return(SmsToMobiles.SendSmsSingle(patComm.PatNum, patComm.SmsPhone, message, clinicNum, _messageSource, true, Security.CurUser));
 }
        private void ShowShortCodes()
        {
            List <long> listClinicNums = 0L.SingleItemToList();

            if (PrefC.HasClinicsEnabled)
            {
                listClinicNums.AddRange(Clinics.GetDeepCopy().Select(x => x.ClinicNum));
            }
            groupShortCode.Visible = listClinicNums
                                     .Where(x => PatComm.IsAnyShortCodeServiceEnabled(x))
                                     .Count() > 0;
            FillShortCodes();
        }
Example #6
0
        private void butSend_Click(object sender, EventArgs e)
        {
            if (!SmsPhones.IsIntegratedTextingEnabled())
            {
                MsgBox.Show(this, "Integrated Texting has not been enabled.");
                return;
            }
            if (textMessage.Text == "")
            {
                MsgBox.Show(this, "Please enter a message first.");
                return;
            }
            if (textMessage.Text.ToLower().Contains("[date]") || textMessage.Text.ToLower().Contains("[time]"))
            {
                MsgBox.Show(this, "Please replace or remove the [Date] and [Time] tags.");
                return;
            }
            if (PrefC.HasClinicsEnabled && !Clinics.IsTextingEnabled(_clinicNum))              //Checking for specific clinic.
            {
                if (_clinicNum != 0)
                {
                    MessageBox.Show(Lans.g(this, "Integrated Texting has not been enabled for the following clinic") + ":\r\n" + Clinics.GetClinic(_clinicNum).Description + ".");
                }
                else
                {
                    //Should never happen. This message is precautionary.
                    MsgBox.Show(this, "The default texting clinic has not been set.");
                }
                return;
            }
            Cursor = Cursors.WaitCursor;
            int numTextsSent = 0;

            foreach (List <PatComm> listPatComms in gridMain.ListGridRows.Select(x => x.Tag).Cast <List <PatComm> >())
            {
                try {
                    //Use the guarantor if in the list, otherwise use the first name alphabetically.
                    PatComm patComm     = listPatComms.OrderByDescending(x => x.PatNum == x.Guarantor).ThenBy(x => x.FName).First();
                    string  textMsgText = textMessage.Text.Replace("[NameF]", patComm.FName);
                    if (SendText(patComm, _clinicNum, textMsgText))
                    {
                        numTextsSent++;
                    }
                }
                catch (Exception ex) {
                    ex.DoNothing();
                    Cursor = Cursors.Default;
                    string errorMsg = Lan.g(this, "There was an error sending to") + " " + listPatComms.First().WirelessPhone + ". "
                                      + Lan.g(this, "Do you want to continue sending messages?");
                    if (MessageBox.Show(errorMsg, "", MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        break;
                    }
                    Cursor = Cursors.WaitCursor;
                }
            }
            Cursor = Cursors.Default;
            MessageBox.Show(numTextsSent + " " + Lan.g(this, "texts sent successfully."));
            DialogResult = DialogResult.OK;
            Close();
        }