///<summary>Surround with Try/Catch. Sent as time sensitive message. Returns an instance of the new SmsToMobile row.</summary> public static SmsToMobile SendSmsSingle(long patNum, string wirelessPhone, string message, long clinicNum, SmsMessageSource smsMessageSource, bool makeCommLog = true, Userod user = null, bool canCheckBal = true) { //No need to check RemotingRole; no call to db. if (Plugins.HookMethod(null, "SmsToMobiles.SendSmsSingle_start", patNum, wirelessPhone, message, clinicNum)) { return(null); } double balance = SmsPhones.GetClinicBalance(clinicNum); if (balance - CHARGE_PER_MSG < 0 && canCheckBal) //ODException.ErrorCode 1 will be processed specially by caller. { throw new ODException("To send this message first increase spending limit for integrated texting from eServices Setup.", 1); } string countryCodeLocal = CultureInfo.CurrentCulture.Name.Substring(CultureInfo.CurrentCulture.Name.Length - 2); //Example "en-US"="US" string countryCodePhone = SmsPhones.GetFirstOrDefault(x => x.ClinicNum == clinicNum)?.CountryCode ?? ""; SmsToMobile smsToMobile = new SmsToMobile(); smsToMobile.ClinicNum = clinicNum; smsToMobile.GuidMessage = Guid.NewGuid().ToString(); smsToMobile.GuidBatch = smsToMobile.GuidMessage; smsToMobile.IsTimeSensitive = true; smsToMobile.MobilePhoneNumber = ConvertPhoneToInternational(wirelessPhone, countryCodeLocal, countryCodePhone); smsToMobile.PatNum = patNum; smsToMobile.MsgText = message; smsToMobile.MsgType = smsMessageSource; SmsToMobiles.SendSms(new List <SmsToMobile>() { smsToMobile }); //Will throw if failed. HandleSentSms(new List <SmsToMobile>() { smsToMobile }, makeCommLog, user); return(smsToMobile); }
///<summary></summary> public static void Update(SmsToMobile smsToMobile, SmsToMobile oldSmsToMobile) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), smsToMobile); return; } Crud.SmsToMobileCrud.Update(smsToMobile, oldSmsToMobile); }
///<summary></summary> public static long Insert(SmsToMobile smsToMobile) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { smsToMobile.SmsToMobileNum = Meth.GetLong(MethodBase.GetCurrentMethod(), smsToMobile); return(smsToMobile.SmsToMobileNum); } return(Crud.SmsToMobileCrud.Insert(smsToMobile)); }
public static bool SendSmsSingle(SmsToMobile sms) { return(SendSms(new List <SmsToMobile> { sms })); }
public static void SendSmsSingle(SmsToMobile sms) { SendSms(new List <SmsToMobile> { sms }); }