refactoring the haircut messaging

This commit is contained in:
Paul Schneider 2017-06-02 21:34:18 +02:00
commit 8ec60de3f3
12 changed files with 199 additions and 80 deletions

View file

@ -6,6 +6,10 @@ using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Billing;
using Yavsc.Models.Relationship;
using Yavsc.Billing;
using System.Globalization;
using Yavsc.Helpers;
using Yavsc.Models.Messaging;
using System.Linq;
namespace Yavsc.Models.Haircut
{
@ -337,5 +341,33 @@ Prestation.Gender == HairCutGenders.Women ?
public virtual BrusherProfile SelectedProfile { get; set; }
public HairCutQueryEvent CreateEvent(string subTopic, string reason, string sender, string message) {
string evdate = EventDate?.ToString("dddd dd/MM/yyyy à HH:mm")??"[pas de date spécifiée]";
string address = Location?.Address??"[pas de lieu spécifié]";
var p = Prestation;
string total = GetBillItems().Addition().ToString("C",CultureInfo.CurrentUICulture);
string strprestation = GetDescription();
string bill = string.Join("\n", GetBillItems().Select(
l=> $"{l.Name} {l.Description} {l.UnitaryCost} € " +
((l.Count != 1) ? "*"+l.Count.ToString() : "")));
var yaev = new HairCutQueryEvent(subTopic)
{
Client = new ClientProviderInfo { 
UserName = Client.UserName ,
UserId =ClientId,
Avatar = Client.Avatar } ,
Previsional = Previsional,
EventDate = EventDate,
Location = Location,
Id = Id,
ActivityCode = ActivityCode,
Reason = reason,
Sender = sender,
Message = message
};
return yaev;
}
}
}

View file

@ -4,11 +4,11 @@ namespace Yavsc.Models.Haircut
{
public class HairCutQueryEvent : RdvQueryProviderInfo, IEvent
{
public HairCutQueryEvent()
public HairCutQueryEvent(string subTopic)
{
Topic = "HairCutQuery";
}
Topic = GetType().Name+"/"+subTopic;
}
public string Message
{
get;
@ -27,9 +27,9 @@ namespace Yavsc.Models.Haircut
{
get;
set;
private set;
}
HairCutQuery Data { get; set; }
}
}
}