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:
2015-12-23 19:02:39 +01:00
parent 2a1301d93c
commit e5cf31fbf3
33 changed files with 977 additions and 792 deletions

View File

@ -43,7 +43,7 @@ namespace Yavsc.ApiControllers
/// <param name="evpub">Evpub.</param>
[Authorize(Roles="BackOffice")]
[AcceptVerbs("POST")]
public MessageWithPayloadResponse NotifyEvent(EventPub evpub) {
public MessageWithPayloadResponse NotifyEvent(EventCirclesPub evpub) {
return GoogleHelpers.NotifyEvent(evpub);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -1,3 +1,27 @@
2015-12-23 Paul Schneider <paul@pschneider.fr>
* 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:
* BackOfficeController.cs:
* FrontOfficeController.cs:
* BackOfficeController.cs: refabrication
2015-12-23 Paul Schneider <paul@pschneider.fr>
* AccountController.cs: implémente la methode de login de

View File

@ -31,7 +31,7 @@ namespace Yavsc.Controllers
/// </summary>
/// <returns>The event.</returns>
/// <param name="evpub">Evpub.</param>
public ActionResult NotifyEvent(EventPub evpub)
public ActionResult NotifyEvent(EventCirclesPub evpub)
{
if (ModelState.IsValid) {
ViewData ["NotifyEvent"] = evpub;

View File

@ -50,7 +50,7 @@ namespace Yavsc.Controllers
/// </summary>
/// <returns>The pub.</returns>
/// <param name="model">Model.</param>
public ActionResult EventPub (EventPub model)
public ActionResult EventPub (EventCirclesPub model)
{
return View (model);
}

View File

@ -24,19 +24,19 @@ using System.ComponentModel.DataAnnotations;
using Yavsc.Model;
using Yavsc.Model.RolesAndMembers;
using Yavsc.Model.Circles;
using Yavsc.Model.FrontOffice;
namespace Yavsc.Model.Calendar
{
/// <summary>
/// Event pub.
/// </summary>
public class EventPub: YaEvent
public class EventCirclesPub: YaEvent
{
/// <summary>
/// Gets or sets the circles.
/// </summary>
/// <value>The circles.</value>
[Required(ErrorMessageResourceName="DoSpecifyCircles",ErrorMessageResourceType=typeof(LocalizedText)),
Display(ResourceType=typeof(LocalizedText),Name="Circles")]
public long [] CircleIds { get; set; }

View File

@ -0,0 +1,46 @@
//
// NominativeEventPub.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
using Yavsc.Model;
using Yavsc.Model.RolesAndMembers;
using Yavsc.Model.Circles;
using Yavsc.Model.FrontOffice;
namespace Yavsc.Model.Calendar
{
public class NominativeEventPub: YaEvent, INominative
{
#region INominative implementation
public string PerformerName {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
#endregion
}
}

View File

@ -1,3 +1,27 @@
2015-12-23 Paul Schneider <paul@pschneider.fr>
* EventCirclesPub.cs:
* NominativeEventPub.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.
2015-12-23 Paul Schneider <paul@pschneider.fr>
* INominative.cs: Interface d'un objet destiné à un

View File

@ -153,6 +153,7 @@ namespace Yavsc.Model.FrontOffice
var cmd = ci.Invoke (new object[]{ });
return cmd as Command;
}
public abstract string GetDescription ();
}
}

View File

@ -33,6 +33,19 @@ namespace Yavsc.Model.FrontOffice
/// </summary>
public class SimpleBookingQuery: Command
{
#region implemented abstract members of Command
public override string GetDescription ()
{
return
string.Format (
LocalizedText.SomeoneAskingYouForAnEstimate,
ClientName,
LocalizedText.aprestation+" "+ PreferedDate.ToString("D"));
}
#endregion
/// <summary>
/// Gets or sets the MEA code.
/// </summary>

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

File diff suppressed because it is too large Load Diff

View File

@ -454,12 +454,6 @@ namespace Yavsc.Model {
}
}
public static string AboutContent {
get {
return ResourceManager.GetString("AboutContent", resourceCulture);
}
}
public static string YourNeed {
get {
return ResourceManager.GetString("YourNeed", resourceCulture);
@ -526,9 +520,9 @@ namespace Yavsc.Model {
}
}
public static string Logout {
public static string About {
get {
return ResourceManager.GetString("Logout", resourceCulture);
return ResourceManager.GetString("About", resourceCulture);
}
}
@ -568,15 +562,21 @@ namespace Yavsc.Model {
}
}
public static string YourEstimates {
get {
return ResourceManager.GetString("YourEstimates", resourceCulture);
}
}
public static string Name {
get {
return ResourceManager.GetString("Name", resourceCulture);
}
}
public static string Non_existent_user {
public static string aprestation {
get {
return ResourceManager.GetString("Non_existent_user", resourceCulture);
return ResourceManager.GetString("aprestation", resourceCulture);
}
}
@ -670,9 +670,9 @@ namespace Yavsc.Model {
}
}
public static string YourEstimates {
public static string Logout {
get {
return ResourceManager.GetString("YourEstimates", resourceCulture);
return ResourceManager.GetString("Logout", resourceCulture);
}
}
@ -736,18 +736,24 @@ namespace Yavsc.Model {
}
}
public static string yourquerytransmitted {
get {
return ResourceManager.GetString("yourquerytransmitted", resourceCulture);
}
}
public static string Hide_source {
get {
return ResourceManager.GetString("Hide_source", resourceCulture);
}
}
public static string AskForAnEstimate {
get {
return ResourceManager.GetString("AskForAnEstimate", resourceCulture);
}
}
public static string SomeoneAskingYouForAnEstimate {
get {
return ResourceManager.GetString("SomeoneAskingYouForAnEstimate", resourceCulture);
}
}
public static string DocTemplateException {
get {
return ResourceManager.GetString("DocTemplateException", resourceCulture);
@ -760,9 +766,9 @@ namespace Yavsc.Model {
}
}
public static string About {
public static string yourquerytransmitted {
get {
return ResourceManager.GetString("About", resourceCulture);
return ResourceManager.GetString("yourquerytransmitted", resourceCulture);
}
}
@ -850,12 +856,24 @@ namespace Yavsc.Model {
}
}
public static string Non_existent_user {
get {
return ResourceManager.GetString("Non_existent_user", resourceCulture);
}
}
public static string Profile_edition {
get {
return ResourceManager.GetString("Profile_edition", resourceCulture);
}
}
public static string prestation {
get {
return ResourceManager.GetString("prestation", resourceCulture);
}
}
public static string My_Estimates {
get {
return ResourceManager.GetString("My_Estimates", resourceCulture);

View File

@ -20,6 +20,7 @@
<data name="AnIMessageHasbeenSent"><value>Un message instantané a été envoyé à {0},
lui présentant votre demande. Vous devriez être contacté très rapidement.</value></data>
<data name="AskForAnEstimate"><value>Demander un devis</value></data>
<data name="aprestation"><value>une prestation</value></data>
<data name="available"><value>disponible</value></data>
<data name="AuthenticatedOnly"><value>Seuls les utilisateurs authentifiés peuvent accèder à cette information.</value></data>
<data name="Basket"><value>Panier</value></data>
@ -111,6 +112,7 @@
<data name="Product_reference"><value>Référence produit</value></data>
<data name="ReadMore"><value>Lire la suite ...</value></data>
<data name="Role"><value>Rôle</value></data>
<data name="prestation"><value>prestation</value></data>
<data name="ProviderId"><value>Identifiant du fournisseur</value></data>
<data name="ProviderName"><value>Nom du fournisseur</value></data>
<data name="Register"><value>Enregistez-vous</value></data>
@ -121,7 +123,8 @@
<data name="SiteSkills"><value>Talents/Compétences/Spécialités gérés sur ce site</value></data>
<data name="Skill"><value>Compétence</value></data>
<data name="Skills"><value>Talents/Compétences/Spécialités</value></data>
<data name="StartDate"><value>Date de début</value></data>
<data name="SomeoneAskingYouForAnEstimate"><value>{0} would want you to establish an estimate concerning {1}</value></data>
<data name="StartDate"><value>Date de début</value></data>
<data name="StartDateAfterEndDate"><value>La date de fin doit être postérieure à la date de début.</value></data>
<data name="StartHour"><value>Heure de début</value></data>
<data name="Submit"><value>Soumettre</value></data>

View File

@ -21,6 +21,7 @@
<data name="Activities"><value>Activities</value></data>
<data name="AnIMessageHasbeenSent"><value>An instant message has been sent to {0},
showing to him your query. You should be contacted very soon.</value></data>
<data name="aprestation"><value>a prestation</value></data>
<data name="AskForAnEstimate"><value>Ask for an estimate</value></data>
<data name="available"><value>available</value></data>
<data name="AuthenticatedOnly"><value>You must be authenticated in order to access this information</value></data>
@ -124,6 +125,7 @@
<data name="role_created"><value>role created</value></data>
<data name="Search"><value>Search</value></data>
<data name="SiteSkills"><value>Talents/Compétences/Spécialités gérés sur ce site</value></data>
<data name="SomeoneAskingYouForAnEstimate"><value>{0} would want you to establish an estimate concerning {1}</value></data>
<data name="Skill"><value>Skill</value></data>
<data name="Skills"><value>Skills</value></data>
<data name="StartDate"><value>Start date</value></data>

View File

@ -8,6 +8,8 @@ using Yavsc.Model.FrontOffice.Catalog;
using System.Collections.Generic;
using Yavsc.Model.Skill;
using System.Linq;
using Yavsc.Model.Calendar;
using Yavsc.Model.Google.Api;
namespace Yavsc.Model.WorkFlow
{
@ -75,7 +77,16 @@ namespace Yavsc.Model.WorkFlow
/// <param name="com">COM.</param>
public static long RegisterCommand(Command com)
{
return DefaultProvider.RegisterCommand (com);
long cmdid = DefaultProvider.RegisterCommand (com);
if (com.GetType ().GetInterface ("INominative") != null) {
INominative cmdn = com as INominative;
NominativeEventPub ev = new NominativeEventPub ();
ev.PerformerName = cmdn.PerformerName;
ev.Description = com.GetDescription ();
GoogleHelpers.NotifyEvent (ev);
}
return cmdid;
}
/// <summary>

View File

@ -153,7 +153,6 @@
<Compile Include="Google\CalendarEventList.cs" />
<Compile Include="Google\GDate.cs" />
<Compile Include="Google\Resource.cs" />
<Compile Include="Calendar\EventPub.cs" />
<Compile Include="Calendar\OpenDay.cs" />
<Compile Include="Calendar\Period.cs" />
<Compile Include="Calendar\Periodicity.cs" />
@ -246,6 +245,8 @@
<Compile Include="FrontOffice\NominativeSimpleBookingQuery.cs" />
<Compile Include="FrontOffice\INominative.cs" />
<Compile Include="RolesAndMembers\IUserName.cs" />
<Compile Include="Calendar\EventCirclesPub.cs" />
<Compile Include="Calendar\NominativeEventPub.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>