events refactoring
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Yavsc.Model;
|
||||
using Yavsc.Models.Booking;
|
||||
using Yavsc.Models.Messaging;
|
||||
|
||||
@ -11,17 +12,14 @@ namespace Yavsc.Helpers
|
||||
{
|
||||
var yaev = new BookQueryEvent
|
||||
{
|
||||
Title = query.Client.UserName + " "+ SR["is asking you for a date"]+".",
|
||||
Comment = (query.Previsional != null) ?
|
||||
SR["Deposit"] + string.Format(": {0:00}",
|
||||
query.Previsional) : SR["No deposit."],
|
||||
Description = SR["Address"] + ": " + query.Location.Address + "\n" +
|
||||
SR["Date"] + ": " + query.EventDate.ToString("D"),
|
||||
StartDate = query.EventDate,
|
||||
Client = new ClientProviderView { UserName = query.Client.UserName , UserId = query.ClientId } ,
|
||||
Previsional = query.Previsional,
|
||||
EventDate = query.EventDate,
|
||||
Location = query.Location,
|
||||
CommandId = query.Id
|
||||
Id = query.Id
|
||||
};
|
||||
return yaev;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -21,11 +21,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Auth;
|
||||
using Yavsc.Models.Google.Messaging;
|
||||
@ -37,7 +34,7 @@ namespace Yavsc.Helpers
|
||||
/// </summary>
|
||||
public static class GoogleHelpers
|
||||
{
|
||||
|
||||
/* WAZA
|
||||
/// <summary>
|
||||
/// Notifies the event.
|
||||
/// </summary>
|
||||
@ -70,18 +67,17 @@ namespace Yavsc.Helpers
|
||||
var payload = JObject.Parse(await response.Content.ReadAsStringAsync());
|
||||
return payload.Value<MessageWithPayloadResponse>();
|
||||
}
|
||||
|
||||
*/
|
||||
public static MessageWithPayloadResponse NotifyEvent<Event>
|
||||
(this GoogleAuthSettings googleSettings, IEnumerable<string> regids, Event ev)
|
||||
where Event : YaEvent
|
||||
where Event : IEvent
|
||||
{
|
||||
var msg = new MessageWithPayload<Event>()
|
||||
{
|
||||
notification = new Notification()
|
||||
{
|
||||
title = ev.Title,
|
||||
body = ev.Description + ev.Comment == null ?
|
||||
"" : "(" + ev.Comment + ")",
|
||||
title = ev.Topic+" "+ev.Sender,
|
||||
body = ev.Message,
|
||||
icon = "icon"
|
||||
},
|
||||
data = ev,
|
||||
|
Reference in New Issue
Block a user