refactoring messages
parent
edd91faa96
commit
6c18f32f61
@ -0,0 +1,11 @@
|
||||
|
||||
MAKE=make
|
||||
SUBDIRS=Yavsc.Abstract Yavsc
|
||||
|
||||
all: $(SUBDIRS)
|
||||
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
||||
.PHONY: all $(SUBDIRS)
|
||||
|
@ -0,0 +1,9 @@
|
||||
namespace Yavsc.Abstract.Messaging
|
||||
{
|
||||
public static class MessagingConstants {
|
||||
public static readonly string TopicGeneral = "/topic/general";
|
||||
public static readonly string TopicRdvQuery = "/topic/RdvQuery";
|
||||
public static readonly string TopicEstimation = "/topic/Estimation";
|
||||
public static readonly string TopicHairCutQuery = "/topic/HairCutQuery";
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,78 @@
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using Models;
|
||||
using Models.Identity;
|
||||
|
||||
public class GCMDevicesController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
|
||||
public GCMDevicesController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: GCMDevices
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
|
||||
var applicationDbContext = _context.GCMDevices.Include(g => g.DeviceOwner).Where(d=>d.DeviceOwnerId == uid);
|
||||
return View(await applicationDbContext.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: GCMDevices/Details/5
|
||||
public async Task<IActionResult> Details(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
GoogleCloudMobileDeclaration googleCloudMobileDeclaration = await _context.GCMDevices.SingleAsync(m => m.DeviceId == id);
|
||||
if (googleCloudMobileDeclaration == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
return View(googleCloudMobileDeclaration);
|
||||
}
|
||||
|
||||
// GET: GCMDevices/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public async Task<IActionResult> Delete(string id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
GoogleCloudMobileDeclaration googleCloudMobileDeclaration = await _context.GCMDevices.SingleAsync(m => m.DeviceId == id);
|
||||
if (googleCloudMobileDeclaration == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
return View(googleCloudMobileDeclaration);
|
||||
}
|
||||
|
||||
// POST: GCMDevices/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||
{
|
||||
GoogleCloudMobileDeclaration googleCloudMobileDeclaration = await _context.GCMDevices.SingleAsync(m => m.DeviceId == id);
|
||||
_context.GCMDevices.Remove(googleCloudMobileDeclaration);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
using Microsoft.Extensions.Localization;
|
||||
using System.Linq;
|
||||
|
||||
using Yavsc.Interfaces.Workflow;
|
||||
using Yavsc.Models.Haircut;
|
||||
using Yavsc.ViewModels.PayPal;
|
||||
using Yavsc.Helpers;
|
||||
|
||||
namespace Yavsc.Models.HairCut
|
||||
{
|
||||
public class HairCutPayementEvent: IEvent
|
||||
{
|
||||
public HairCutPayementEvent(string sender, PaymentInfo info, HairCutQuery query, IStringLocalizer localizer)
|
||||
{
|
||||
Sender = sender;
|
||||
this.query = query;
|
||||
invoiceId = info.DetailsFromPayPal.GetExpressCheckoutDetailsResponseDetails.InvoiceID;
|
||||
payerName = info.DetailsFromPayPal.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.Name;
|
||||
phone = info.DetailsFromPayPal.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.Phone;
|
||||
payerEmail = info.DetailsFromPayPal.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Payer;
|
||||
amount = string.Join(", ",
|
||||
info.DetailsFromPayPal.GetExpressCheckoutDetailsResponseDetails.PaymentDetails.Select(
|
||||
p => $"{p.OrderTotal.value} {p.OrderTotal.currencyID}"));
|
||||
gender = query.Prestation.Gender;
|
||||
date = query.EventDate?.ToString("dd MM yyyy hh:mm");
|
||||
lieu = query.Location.Address;
|
||||
clientFinal = (gender == HairCutGenders.Women) ? localizer["Women"] +
|
||||
" " + localizer[query.Prestation.Length.ToString()] : localizer[gender.ToString()];
|
||||
token = info.DetailsFromPayPal.GetExpressCheckoutDetailsResponseDetails.Token;
|
||||
payerId = info.DetailsFromPayPal.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerID;
|
||||
}
|
||||
|
||||
public string Topic => "/topic/HaircutPayment";
|
||||
|
||||
public string Sender { get; set; }
|
||||
|
||||
HairCutQuery query;
|
||||
|
||||
private string invoiceId;
|
||||
private string payerName;
|
||||
private string phone;
|
||||
private string payerEmail;
|
||||
private string amount;
|
||||
private HairCutGenders gender;
|
||||
private string date;
|
||||
private string lieu;
|
||||
private string clientFinal;
|
||||
private string token;
|
||||
private string payerId;
|
||||
|
||||
public string CreateBody()
|
||||
{
|
||||
return $@"# Paiment confirmé: {amount}
|
||||
|
||||
Effectué par : {payerName} [{payerEmail}]
|
||||
Identifiant PayPal du paiment: {token}
|
||||
Identifiant PayPal du payeur: {payerId}
|
||||
Identifiant de la facture sur site: {invoiceId}
|
||||
|
||||
|
||||
# La prestation concernée:
|
||||
|
||||
Demandeur: {query.Client.UserName}
|
||||
|
||||
Date: {date}
|
||||
|
||||
Lieu: {lieu}
|
||||
|
||||
Le client final: {clientFinal}
|
||||
|
||||
{query.GetBillText()}
|
||||
|
||||
";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
//
|
||||
// BaseEvent.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.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Messaging
|
||||
{
|
||||
public class GeneralEvent: BaseEvent, ITitle
|
||||
{
|
||||
/// <summary>
|
||||
/// The title.
|
||||
/// </summary>
|
||||
[Required(ErrorMessageResourceName="ChooseATitle")]
|
||||
[Display(Name="Title")]
|
||||
public string Title { get; set; }
|
||||
/// <summary>
|
||||
/// The description.
|
||||
/// </summary>
|
||||
[Required(ErrorMessageResourceName="ChooseADescription")]
|
||||
[Display(Name="Description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
//
|
||||
// NFEvent.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// Copyright (c) 2015 Paul Schneider
|
||||
//
|
||||
// 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.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Messaging
|
||||
{
|
||||
/// <summary>
|
||||
/// NF event.
|
||||
/// </summary>
|
||||
public class YaEvent : BaseEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// The NF provider identifier.
|
||||
/// </summary>
|
||||
[Display(Name="From")]
|
||||
public string FromUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The event web page.
|
||||
/// </summary>
|
||||
[Display(Name="EventWebPage")]
|
||||
public string EventWebPage { get; set; }
|
||||
/// <summary>
|
||||
/// The image locator.
|
||||
/// </summary>
|
||||
[Display(Name="Photo")]
|
||||
public string Photo { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
@model Yavsc.Models.Identity.GoogleCloudMobileDeclaration
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Delete";
|
||||
}
|
||||
|
||||
<h2>Delete</h2>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>GoogleCloudMobileDeclaration</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.DeclarationDate)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.DeclarationDate)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.GCMRegistrationId)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.GCMRegistrationId)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Model)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Model)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Platform)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Platform)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Version)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Version)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<form asp-action="Delete">
|
||||
<div class="form-actions no-color">
|
||||
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,48 @@
|
||||
@model Yavsc.Models.Identity.GoogleCloudMobileDeclaration
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Details";
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
|
||||
<div>
|
||||
<h4>GoogleCloudMobileDeclaration</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.DeclarationDate)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.DeclarationDate)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.GCMRegistrationId)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.GCMRegistrationId)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Model)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Model)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Platform)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Platform)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Version)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Version)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
<a asp-action="Edit" asp-route-id="@Model.DeviceId">Edit</a> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</p>
|
@ -0,0 +1,52 @@
|
||||
@model IEnumerable<Yavsc.Models.Identity.GoogleCloudMobileDeclaration>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Index";
|
||||
}
|
||||
|
||||
<h2>Index</h2>
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.DeclarationDate)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.GCMRegistrationId)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Model)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Platform)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Version)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.DeclarationDate)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.GCMRegistrationId)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Model)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Platform)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Version)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="Details" asp-route-id="@item.DeviceId">Details</a> |
|
||||
<a asp-action="Delete" asp-route-id="@item.DeviceId">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.NET.Test.Sdk" version="15.5.0" targetFramework="net45" />
|
||||
<package id="xunit" version="2.3.1" targetFramework="net45" />
|
||||
<package id="xunit.runner.visualstudio" version="2.3.1" targetFramework="net45" />
|
||||
<package id="xunit.runner.console" version="2.3.1" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Reference in New Issue