send email

vnext
Paul Schneider 8 years ago
parent 57a6ecb654
commit ebfad459fb
1 changed files with 16 additions and 13 deletions

@ -81,20 +81,21 @@ namespace Yavsc.Controllers
var yaev = command.CreateEvent(_localizer); var yaev = command.CreateEvent(_localizer);
MessageWithPayloadResponse grep = null; MessageWithPayloadResponse grep = null;
if (pro.AcceptNotifications if (pro.AcceptPublicContact)
&& pro.AcceptPublicContact)
{ {
if (pro.Performer.Devices.Count > 0) { if (pro.AcceptNotifications) {
var regids = command.PerformerProfile.Performer if (pro.Performer.Devices.Count > 0) {
.Devices.Select(d => d.GCMRegistrationId); var regids = command.PerformerProfile.Performer
grep = await _GCMSender.NotifyHairCutQueryAsync(_googleSettings,regids,yaev); .Devices.Select(d => d.GCMRegistrationId);
grep = await _GCMSender.NotifyHairCutQueryAsync(_googleSettings,regids,yaev);
}
// TODO setup a profile choice to allow notifications
// both on mailbox and mobile
// if (grep==null || grep.success<=0 || grep.failure>0)
ViewBag.GooglePayload=grep;
if (grep!=null)
_logger.LogWarning($"Performer: {command.PerformerProfile.Performer.UserName} success: {grep.success} failure: {grep.failure}");
} }
// TODO setup a profile choice to allow notifications
// both on mailbox and mobile
// if (grep==null || grep.success<=0 || grep.failure>0)
ViewBag.GooglePayload=grep;
if (grep!=null)
_logger.LogWarning($"Performer: {command.PerformerProfile.Performer.UserName} success: {grep.success} failure: {grep.failure}");
await _emailSender.SendEmailAsync( await _emailSender.SendEmailAsync(
_siteSettings, _smtpSettings, _siteSettings, _smtpSettings,
@ -103,6 +104,9 @@ namespace Yavsc.Controllers
$"{yaev.Message}\r\n-- \r\n{yaev.Previsional}\r\n{yaev.EventDate}\r\n" $"{yaev.Message}\r\n-- \r\n{yaev.Previsional}\r\n{yaev.EventDate}\r\n"
); );
} }
else {
// TODO if (AcceptProContact) try & find a bookmaker to send him this query
}
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode); ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
ViewBag.GoogleSettings = _googleSettings; ViewBag.GoogleSettings = _googleSettings;
return View("CommandConfirmation",command); return View("CommandConfirmation",command);
@ -110,7 +114,6 @@ namespace Yavsc.Controllers
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode); ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
ViewBag.GoogleSettings = _googleSettings; ViewBag.GoogleSettings = _googleSettings;
return View(command); return View(command);
} }
public ActionResult HairCut(string performerId, string activityCode) public ActionResult HairCut(string performerId, string activityCode)

Loading…