示例#1
0
        ///<summary>Sends text message to callfire.  If patNum=0 will not create commlog entry.</summary>
        private bool SendCallFire(long patNum, string wirelessPhone, string message)
        {
            string key = ProgramProperties.GetPropVal(ProgramName.CallFire, "Key From CallFire");
            string msg = wirelessPhone + "," + message.Replace(",", "");     //ph#,msg Commas in msg cause error.

            try {
                CallFireService.SMSService callFire = new CallFireService.SMSService();
                callFire.sendSMSCampaign(
                    key,
                    new string[] { msg },
                    "Open Dental");
            }
            catch (Exception ex) {
                MsgBox.Show(this, "Error sending text message.\r\n\r\n" + ex.Message);
                return(false);
            }
            if (patNum == 0)             //No patient selected, do not make commlog.
            {
                return(true);
            }
            Commlog commlog = new Commlog();

            commlog.CommDateTime   = DateTime.Now;
            commlog.DateTStamp     = DateTime.Now;
            commlog.CommType       = Commlogs.GetTypeAuto(CommItemTypeAuto.TEXT);
            commlog.Mode_          = CommItemMode.Text;
            commlog.Note           = msg;//phone,note
            commlog.PatNum         = patNum;
            commlog.SentOrReceived = CommSentOrReceived.Sent;
            commlog.UserNum        = Security.CurUser.UserNum;
            commlog.DateTimeEnd    = DateTime.Now;
            Commlogs.Insert(commlog);
            SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, "Insert Text Message");
            return(true);
        }
示例#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.) </summary>
        public void SendText(long patNum, string wirelessPhone, string message, YN txtMsgOk)
        {
            if (Plugins.HookMethod(this, "FormTxtMsgEdit.SendText_Start", patNum, wirelessPhone, message, txtMsgOk))
            {
                return;
            }
            if (wirelessPhone == "")
            {
                MsgBox.Show(this, "Please enter a phone number.");
                return;
            }
            if (!Programs.IsEnabled(ProgramName.CallFire))
            {
                MsgBox.Show(this, "CallFire Program Link must be enabled.");
                return;
            }
            if (txtMsgOk == YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo))
            {
                MsgBox.Show(this, "It is not OK to text this patient.");
                return;
            }
            if (txtMsgOk == YN.No)
            {
                MsgBox.Show(this, "It is not OK to text this patient.");
                return;
            }
            string key = ProgramProperties.GetPropVal(ProgramName.CallFire, "Key From CallFire");
            string msg = wirelessPhone + "," + message.Replace(",", "");     //ph#,msg Commas in msg cause error.

            try {
                CallFireService.SMSService callFire = new CallFireService.SMSService();
                callFire.sendSMSCampaign(
                    key,
                    new string[] { msg },
                    "Open Dental");
            }
            catch (Exception ex) {
                MsgBox.Show(this, "Error sending text message.\r\n\r\n" + ex.Message);
                return;
            }
            Commlog commlog = new Commlog();

            commlog.CommDateTime   = DateTime.Now;
            commlog.DateTStamp     = DateTime.Now;
            commlog.CommType       = DefC.Short[(int)DefCat.CommLogTypes][0].DefNum; //The first one in the list.  We can enhance later.
            commlog.Mode_          = CommItemMode.Text;
            commlog.Note           = msg;                                            //phone,note
            commlog.PatNum         = patNum;
            commlog.SentOrReceived = CommSentOrReceived.Sent;
            commlog.UserNum        = Security.CurUser.UserNum;
            commlog.DateTimeEnd    = DateTime.Now;
            Commlogs.Insert(commlog);
            SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, "Insert Text Message");
        }