enoyer la notification à la demande de devis

* blanc.png:
* logo-white.png:
* musician-923526_1280.jpg:
* musician-923526_1.nb.jpg:
* musician-923526_1.nbb.jpg:
* musician-923526_1280.s.jpg:
* musician-923526_1.nbbi.jpg:
* musician-923526_1.nb.xs.jpg:
* live-concert-388160_1280.jpg:
* musician-923526_1280.xxs.jpg:
* musician-923526_1.nbb.xs.jpg:
* musician-923526_1.nb.xxs.jpg:
* musician-923526_1.nbbi.xs.jpg:
* musician-923526_1.nbb.xxs.jpg:
* musician-923526_1.nbbi.xxs.jpg:
* live-concert-388160_1280.s.jpg:
* live-concert-388160_1280.xxs.jpg: images

* EventCirclesPub.cs:
* BackOfficeController.cs:
* FrontOfficeController.cs:
* NominativeEventPub.cs:
* BackOfficeController.cs: refabrication

* Commande.cs: implémente une description pour toute commande, dans la
  classe concrete

* SimpleBookingQuery.cs: la description d'une commande simple de rdv

* GoogleHelpers.cs: implemente l'envoi d'une notification nominative
  (à un prestataire en particulier)

* LocalizedText.resx:
* LocalizedText.fr.resx:
* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: traductions

* WorkFlowManager.cs: envoie une notification à la demande de devis
  d'un client

* YavscModel.csproj: notifications privée.
This commit is contained in:
Paul Schneider 2015-12-23 19:02:39 +01:00
commit e5cf31fbf3
33 changed files with 503 additions and 318 deletions

View file

@ -102,35 +102,59 @@ namespace Yavsc.Model.Google.Api
/// </summary>
/// <returns>The event.</returns>
/// <param name="evpub">Evpub.</param>
public static MessageWithPayloadResponse NotifyEvent(EventPub evpub) {
public static MessageWithPayloadResponse NotifyEvent(EventCirclesPub evpub) {
using (var r =
new SimpleJsonPostMethod<MessageWithPayload<YaEvent>,MessageWithPayloadResponse>(
"https://gcm-http.googleapis.com/gcm/send")) {
var users = Circle.Union (evpub.CircleIds);
var regids = new List<string> ();
var to = new List<string> ();
foreach (var u in users) {
var p = ProfileBase.Create (u);
if (p != null) {
var regid = p.GetPropertyValue("gregid");
if (regid == null) {
var muser = Membership.GetUser (u);
to.Add (muser.Email);
if (evpub.CircleIds != null) {
var users = Circle.Union (evpub.CircleIds);
var regids = new List<string> ();
var to = new List<string> ();
foreach (var u in users) {
var p = ProfileBase.Create (u);
if (p != null) {
var regid = p.GetPropertyValue ("gregid");
if (regid == null) {
var muser = Membership.GetUser (u);
to.Add (muser.Email);
} else
regids.Add ((string)regid);
}
else regids.Add ((string)regid);
}
if (regids.Count == 0)
throw new InvalidOperationException
("No recipient where found for this circle list");
var msg = new MessageWithPayload<YaEvent> () {
notification = new Notification() { title = evpub.Title, body = evpub.Description, icon = "event" },
data = new YaEvent[] { (YaEvent)evpub }, registration_ids = regids.ToArray() };
return r.Invoke (msg);
} else {
throw new NotImplementedException ();
}
if (regids.Count == 0)
throw new InvalidOperationException
("No recipient where found for this circle list");
}
}
/// <summary>
/// Notifies the event.
/// </summary>
/// <returns>The event.</returns>
/// <param name="evpub">Evpub.</param>
public static MessageWithPayloadResponse NotifyEvent (NominativeEventPub evpub)
{
using (var r =
new SimpleJsonPostMethod<MessageWithPayload<YaEvent>,MessageWithPayloadResponse> (
"https://gcm-http.googleapis.com/gcm/send")) {
var userprofile = ProfileBase.Create (evpub.PerformerName);
var regid = userprofile.GetPropertyValue ("gregid") as string;
if (regid == null)
throw new NotImplementedException ("Notification via e-mail");
var msg = new MessageWithPayload<YaEvent> () {
notification = new Notification() { title = evpub.Title, body = evpub.Description, icon = "event" },
data = new YaEvent[] { (YaEvent)evpub }, registration_ids = regids.ToArray() };
data = new YaEvent[] { (YaEvent)evpub }, registration_ids = new string[] { regid } };
return r.Invoke (msg);
}
}
}
}