public static void SendAsyncSMS(SMSMessageEntity message) { Task.Factory.StartNew(() => { SendSMS(message); }); }
private static void SendOneMessage(SMSMessageEntity message) { using (OperationLogic.AllowSave <SMSMessageEntity>()) { try { message.MessageID = GetProvider().SMSSendAndGetTicket(message); message.SendDate = TimeZoneManager.Now.TrimToSeconds(); message.State = SMSMessageState.Sent; message.Save(); } catch (Exception e) { var ex = e.LogException(); using (Transaction tr = Transaction.ForceNew()) { message.Exception = ex.ToLite(); message.State = SMSMessageState.SendFailed; message.Save(); tr.Commit(); } throw; } } }
public static void SendSMS(SMSMessageEntity message) { if (!message.DestinationNumber.Contains(',')) { SendOneMessage(message); } else { var numbers = message.DestinationNumber.Split(',').Select(n => n.Trim()).Distinct(); message.DestinationNumber = numbers.FirstEx(); SendOneMessage(message); foreach (var number in numbers.Skip(1)) { SendOneMessage(new SMSMessageEntity { DestinationNumber = number, Certified = message.Certified, EditableMessage = message.EditableMessage, From = message.From, Message = message.Message, Referred = message.Referred, State = SMSMessageState.Created, Template = message.Template, SendPackage = message.SendPackage, UpdatePackage = message.UpdatePackage, UpdatePackageProcessed = message.UpdatePackageProcessed, }); } } }
private static void SendOneMessage(SMSMessageEntity message) { message.MessageID = Provider.SMSSendAndGetTicket(message); message.SendDate = TimeZoneManager.Now.TrimToSeconds(); message.State = SMSMessageState.Sent; message.Save(); }
public static List <SMSMessageEntity> CreateAndSendMultipleSMSMessages(MultipleSMSModel template, List <string> phones) { var messages = new List <SMSMessageEntity>(); var IDs = GetProvider().SMSMultipleSendAction(template, phones); var sendDate = TimeZoneManager.Now.TrimToSeconds(); for (int i = 0; i < phones.Count; i++) { var message = new SMSMessageEntity { Message = template.Message, From = template.From }; message.SendDate = sendDate; //message.SendState = SendState.Sent; message.DestinationNumber = phones[i]; message.MessageID = IDs[i]; message.Save(); messages.Add(message); } return(messages); }
public async Task <ActionResult> SMSPost(SMSMessageEntity model) { return(RentoJson(await CallApiTask("Message/SendSMS", model))); }
private void removeNonSMSChars_Click(object sender, RoutedEventArgs e) { MessageDC.Message = SMSCharacters.RemoveNoSMSCharacters(MessageDC.Message); MessageDC = MessageDC; }