コード例 #1
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));
 }
コード例 #2
0
 /// <summary>May be called from other parts of the program without showing this form. You must still create an instance of this form though.
 /// Checks CallFire bridge, if it is OK to send a text, etc. (Buttons to load this form are usually disabled if it is not OK,
 /// but this is needed for Confirmations, Recalls, etc.). CanIncreaseLimit will prompt the user to increase the spending limit if sending the
 /// text would exceed that limit. Should only be true when this method is called from this form. </summary>
 public bool SendText(long patNum, string wirelessPhone, string message, YN txtMsgOk, long clinicNum, SmsMessageSource smsMessageSource, bool canIncreaseLimit = false)
 {
     if (Plugins.HookMethod(this, "FormTxtMsgEdit.SendText_Start", patNum, wirelessPhone, message, txtMsgOk))
     {
         return(false);
     }
     if (Plugins.HookMethod(this, "FormTxtMsgEdit.SendText_Start2", patNum, wirelessPhone, message, txtMsgOk))
     {
         return(true);
     }
     if (wirelessPhone == "")
     {
         MsgBox.Show(this, "Please enter a phone number.");
         return(false);
     }
     if (SmsPhones.IsIntegratedTextingEnabled())
     {
         if (!PrefC.HasClinicsEnabled && PrefC.GetDateT(PrefName.SmsContractDate).Year < 1880)                //Checking for practice (clinics turned off).
         {
             MsgBox.Show(this, "Integrated Texting has not been enabled.");
             return(false);
         }
         else if (PrefC.HasClinicsEnabled && !Clinics.IsTextingEnabled(clinicNum))                  //Checking for specific clinic.
         //This is likely to happen a few times per office until they setup texting properly.
         {
             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(false);
         }
     }
     else if (!Programs.IsEnabled(ProgramName.CallFire))
     {
         MsgBox.Show(this, "CallFire Program Link must be enabled.");
         return(false);
     }
     if (patNum != 0 && txtMsgOk == YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo))
     {
         MsgBox.Show(this, "It is not OK to text this patient.");
         return(false);
     }
     if (patNum != 0 && txtMsgOk == YN.No)
     {
         MsgBox.Show(this, "It is not OK to text this patient.");
         return(false);
     }
     if (SmsPhones.IsIntegratedTextingEnabled())
     {
         try {
             SmsToMobiles.SendSmsSingle(patNum, wirelessPhone, message, clinicNum, smsMessageSource, user: Security.CurUser);                //Can pass in 0 as PatNum if no patient selected.
             return(true);
         }
         catch (Exception ex) {
             //ProcessSendSmsException handles the spending limit has been reached error, or returns false if the exception is different.
             if (!canIncreaseLimit || !FormEServicesSetup.ProcessSendSmsException(ex))
             {
                 MsgBox.Show(this, ex.Message);
             }
             return(false);
         }
     }
     else
     {
         if (message.Length > 160)           //only a limitation for CallFire
         {
             MsgBox.Show(this, "Text length must be less than 160 characters.");
             return(false);
         }
         return(SendCallFire(patNum, wirelessPhone, message));               //Can pass in 0 as PatNum if no patient selected.
     }
 }