public void CompleteOrder(int orderId) { var order = GetOrder(orderId); order.OrderProgressState.Complete(() => { order.Finished = true; var eventDesc = $"Orden lista."; order.OrderHistory += $"\r\n{_calendarRepository.LocalTimeAsString()} - {eventDesc}"; _appDbContext.SaveChanges(); //Send mail }, () => { if (_env.IsProduction()) { if (order.Registration != null && order.Registration.PhoneNumberConfirmed) { var user = order.Registration; _smsRepository.SendSms(user.PhoneNumber, $"{user.FirstName}, ¡Tu pedido {order.FriendlyBookingId} ya está listo! De las Artes."); } _emailRepository.NotifyOrderCompleteAsync(order); } }); }
public async Task SendSmsAsync(List <string> phoneList, string message) { foreach (var phone in phoneList) { _smsRepository.SendSms(phone, message); } }
public async Task <string> SendValidationCode(ApplicationUser user, string phone) { var token = String.Concat(DateTime.Now.Ticks.ToString().ToArray().TakeLast(4)); try { await _smsRepository.SendSms(phone, $"Tu código de activación es R-{token}. De las Artes."); user.ValidationPhoneToken = token; user.PhoneNumberDeclared = phone; await _userManager.UpdateAsync(user); return(token); } catch { return(string.Empty); } }
public async Task <SmsStatusResponse> Send(SmsRequest sms) { Sms smsEntity = new Sms() { CustomerName = sms.CustomerName, BranchId = sms.BranchId, BookingRef = sms.BookingRef, BPoints = sms.BPoints, Phone = sms.Phone, ProductType = sms.ProductType, SalesChannel = "ONLINE-DC", CompanyID = "BC", EventName = sms.EventName }; return(await _smsRepository.SendSms(smsEntity)); }
public async Task <IActionResult> SendPromoSms(string tel, string body) { if (string.IsNullOrEmpty(tel) || string.IsNullOrEmpty(body)) { return(BadRequest()); } try { await _smsRepo.SendSms(tel, body); return(Ok()); } catch { return(BadRequest()); } }
public async Task CompleteOrderAsync(int orderId) { var order = await GetOrderByIdAsync(orderId); await order.OrderProgressState.Complete(() => { order.Finished = true; var eventDesc = $"Orden lista."; order.OrderHistory += $"\r\n{_calendarRepository.LocalTimeAsString()} - {eventDesc}"; _appDbContext.SaveChanges(); }, async() => { if (order.Registration != null && order.Registration.PhoneNumberConfirmed) { var user = order.Registration; await _smsRepository.SendSms(user.PhoneNumber, $"{user.FirstName}, Tu pedido {order.FriendlyBookingId} ya esta {(order.DeliveryAddressId.HasValue ? "en camino" : "listo")}! De las Artes."); } await _emailRepository.NotifyOrderCompleteAsync(order); }); }
public async Task <IActionResult> PromoSms(PromoSmsViewModel vm) { if (!ModelState.IsValid) { return(View(vm)); } else { var mobiles = _marketingRepo.GetAllMobiles(); var resources = await _smsRepo.GetFormattedNumbers(mobiles); if (_env.IsProduction()) { foreach (var phone in resources) { await _smsRepo.SendSms(phone, vm.Body); } } return(RedirectToAction("Index", "Admin")); } }
public void TestSendSms() { string body = "Join Earth's mightiest heroes. Like Kevin Bacon."; _repository.SendSms(_toPhone, body); }