yavsc/web/ApiControllers/BackOfficeController.cs
Paul Schneider e5cf31fbf3 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.
2015-12-23 19:02:39 +01:00

74 lines
2.2 KiB
C#

//
// BackOfficeController.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 Yavsc.Model.Google;
using Yavsc.Model.Calendar;
using Yavsc.Helpers;
using Yavsc.Model.Circles;
using System.Collections.Generic;
using System.Web.Profile;
using System.Web.Security;
using Yavsc.Model.Google.Api;
using Yavsc.Model.Google.Api.Messaging;
namespace Yavsc.ApiControllers
{
/// <summary>
/// Back office controller.
/// </summary>
public class BackOfficeController: YavscController
{
/// <summary>
/// Notifies the event.
/// </summary>
/// <param name="evpub">Evpub.</param>
[Authorize(Roles="BackOffice")]
[AcceptVerbs("POST")]
public MessageWithPayloadResponse NotifyEvent(EventCirclesPub evpub) {
return GoogleHelpers.NotifyEvent(evpub);
}
/// <summary>
/// Sets the registration identifier.
/// </summary>
/// <param name="registrationId">Registration identifier.</param>
[Authorize]
[AcceptVerbs("GET")]
public string SetRegistrationId(string registrationId)
{
// TODO set registration id
if (string.IsNullOrWhiteSpace(registrationId))
return "Registration id cannot be blank";
var username = User.Identity.Name;
setRegistrationId (username, registrationId);
return "Saved registration for user:"+username;
}
private void setRegistrationId(string username, string regid) {
ProfileBase pr = ProfileBase.Create(username);
pr.SetPropertyValue ("gregid", regid);
pr.Save ();
}
}
}