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; } } }
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); }