Re-fabrication
This commit is contained in:
175
Yavsc.Server/Models/HairCut/BrusherProfile.cs
Normal file
175
Yavsc.Server/Models/HairCut/BrusherProfile.cs
Normal file
@ -0,0 +1,175 @@
|
||||
|
||||
//
|
||||
// BrusherProfile.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// Copyright (c) 2015 - 2017 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;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
using Workflow;
|
||||
using Relationship;
|
||||
using Calendar;
|
||||
|
||||
public class BrusherProfile : ISpecializationSettings
|
||||
{
|
||||
public BrusherProfile()
|
||||
{
|
||||
}
|
||||
|
||||
[Key]
|
||||
public string UserId
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[JsonIgnore,ForeignKey("UserId")]
|
||||
public virtual PerformerProfile BaseProfile { get; set; }
|
||||
|
||||
[Display(Name="Portfolio")]
|
||||
public virtual List<HyperLink> Links { get; set; }
|
||||
|
||||
|
||||
[Display(Name="Rayon d'action"),DisplayFormat(DataFormatString="{0} km")]
|
||||
|
||||
public int ActionDistance { get; set; }
|
||||
/// <summary>
|
||||
/// StartOfTheDay In munutes
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
[DisplayFormat(ConvertEmptyStringToNull = true, NullDisplayText = "[Pas d'emploi du temps spécifié]")]
|
||||
[Display(Name="Emploi du temps")]
|
||||
public virtual Schedule Schedule { get; set; }
|
||||
|
||||
[Display(Name="Coupe femme cheveux longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
|
||||
public decimal WomenLongCutPrice { get; set; }
|
||||
|
||||
[Display(Name="Coupe femme cheveux mi-longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal WomenHalfCutPrice { get; set; }
|
||||
|
||||
[Display(Name="Coupe femme cheveux courts"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal WomenShortCutPrice { get; set; }
|
||||
|
||||
[Display(Name="Coupe homme"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal ManCutPrice { get; set; }
|
||||
|
||||
[Display(Name="brushing homme"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal ManBrushPrice { get; set; }
|
||||
|
||||
|
||||
|
||||
[Display(Name="Coupe enfant"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal KidCutPrice { get; set; }
|
||||
|
||||
[Display(Name="Brushing cheveux longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal LongBrushingPrice { get; set; }
|
||||
|
||||
[Display(Name="Brushing cheveux mi-longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal HalfBrushingPrice { get; set; }
|
||||
|
||||
[Display(Name="Brushing cheveux courts"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal ShortBrushingPrice { get; set; }
|
||||
|
||||
[Display(Name="couleur cheveux longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal LongColorPrice { get; set; }
|
||||
|
||||
[Display(Name="couleur cheveux mi-longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal HalfColorPrice { get; set; }
|
||||
|
||||
[Display(Name="couleur cheveux courts"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal ShortColorPrice { get; set; }
|
||||
|
||||
[Display(Name="couleur multiple cheveux longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal LongMultiColorPrice { get; set; }
|
||||
|
||||
[Display(Name="couleur multiple cheveux mi-longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal HalfMultiColorPrice { get; set; }
|
||||
|
||||
[Display(Name="couleur multiple cheveux courts"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal ShortMultiColorPrice { get; set; }
|
||||
|
||||
[Display(Name="permanente cheveux longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal LongPermanentPrice { get; set; }
|
||||
|
||||
[Display(Name="permanente cheveux mi-longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal HalfPermanentPrice { get; set; }
|
||||
|
||||
[Display(Name="permanente cheveux courts"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal ShortPermanentPrice { get; set; }
|
||||
|
||||
[Display(Name="défrisage cheveux longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal LongDefrisPrice { get; set; }
|
||||
|
||||
[Display(Name="défrisage cheveux mi-longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal HalfDefrisPrice { get; set; }
|
||||
|
||||
[Display(Name="défrisage cheveux courts"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal ShortDefrisPrice { get; set; }
|
||||
|
||||
[Display(Name="mêches sur cheveux longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
|
||||
public decimal LongMechPrice { get; set; }
|
||||
|
||||
[Display(Name="mêches sur cheveux mi-longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal HalfMechPrice { get; set; }
|
||||
|
||||
[Display(Name="mêches sur cheveux courts"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal ShortMechPrice { get; set; }
|
||||
|
||||
[Display(Name="balayage cheveux longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
|
||||
public decimal LongBalayagePrice { get; set; }
|
||||
|
||||
[Display(Name="balayage cheveux mi-longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal HalfBalayagePrice { get; set; }
|
||||
|
||||
[Display(Name="balayage cheveux courts"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal ShortBalayagePrice { get; set; }
|
||||
|
||||
|
||||
[Display(Name="Mise en plis cheveux longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
|
||||
public decimal LongFoldingPrice { get; set; }
|
||||
|
||||
[Display(Name="Mise en plis cheveux mi-longs"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal HalfFoldingPrice { get; set; }
|
||||
|
||||
[Display(Name="Mise en plis cheveux courts"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal ShortFoldingPrice { get; set; }
|
||||
|
||||
[Display(Name="Shampoing"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
|
||||
public decimal ShampooPrice { get; set; }
|
||||
|
||||
[Display(Name="Soin"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
|
||||
public decimal CarePrice { get; set; }
|
||||
|
||||
[Display(Name="Remise au forfait coupe+technique"),DisplayFormat(DataFormatString="{0:C}")]
|
||||
|
||||
public decimal FlatFeeDiscount { get; set; }
|
||||
|
||||
}
|
||||
}
|
17
Yavsc.Server/Models/HairCut/HairCutGenders.cs
Normal file
17
Yavsc.Server/Models/HairCut/HairCutGenders.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public enum HairCutGenders : int
|
||||
{
|
||||
[Display(Name="Femme")]
|
||||
Women,
|
||||
|
||||
[Display(Name="Homme")]
|
||||
Man,
|
||||
|
||||
[Display(Name="Enfant")]
|
||||
Kid
|
||||
|
||||
}
|
||||
}
|
76
Yavsc.Server/Models/HairCut/HairCutPaymentEvent.cs
Normal file
76
Yavsc.Server/Models/HairCut/HairCutPaymentEvent.cs
Normal file
@ -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()}
|
||||
|
||||
";
|
||||
}
|
||||
}
|
||||
}
|
416
Yavsc.Server/Models/HairCut/HairCutQuery.cs
Normal file
416
Yavsc.Server/Models/HairCut/HairCutQuery.cs
Normal file
@ -0,0 +1,416 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
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;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Yavsc.ViewModels.PayPal;
|
||||
using Yavsc.Models.HairCut;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public class HairCutQuery : NominativeServiceCommand
|
||||
{
|
||||
|
||||
// Bill description
|
||||
public override string GetDescription()
|
||||
{
|
||||
string type = ResourcesHelpers.DefaultResourceManager
|
||||
.GetString(this.GetType().Name);
|
||||
string gender = ResourcesHelpers.DefaultResourceManager
|
||||
.GetString(this.Prestation.Gender.ToString());
|
||||
|
||||
return $"{type} ({gender})";
|
||||
}
|
||||
|
||||
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
override public long Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public long PrestationId { get; set; }
|
||||
|
||||
[ForeignKey("PrestationId"), Required, Display(Name = "Préstation")]
|
||||
public virtual HairPrestation Prestation { get; set; }
|
||||
|
||||
[ForeignKey("LocationId")]
|
||||
[Display(Name = "Lieu du rendez-vous")]
|
||||
[DisplayFormat(ConvertEmptyStringToNull = true, NullDisplayText = "[Pas de lieu spécifié]")]
|
||||
public virtual Location Location { get; set; }
|
||||
|
||||
[Display(Name = "Date et heure")]
|
||||
[DisplayFormat(NullDisplayText = "[Pas de date ni heure]", ApplyFormatInEditMode = true, DataFormatString = "{0:d}")]
|
||||
public DateTime? EventDate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public long? LocationId
|
||||
{
|
||||
get;
|
||||
|
||||
set;
|
||||
}
|
||||
|
||||
[Display(Name = "Informations complémentaires"),
|
||||
StringLengthAttribute(512)]
|
||||
[DisplayFormat(ConvertEmptyStringToNull = true, NullDisplayText = "[pas d'informations complémentaires]")]
|
||||
public string AdditionalInfo { get; set; }
|
||||
|
||||
|
||||
|
||||
public override List<IBillItem> GetBillItems()
|
||||
{
|
||||
string longhairsuffix = " (cheveux longs)";
|
||||
string halflonghairsuffix = " (cheveux mi-longs)";
|
||||
string shorthairsuffix = " (cheveux courts)";
|
||||
|
||||
List<IBillItem> bill = new List<IBillItem>();
|
||||
|
||||
if (this.Prestation==null) throw new InvalidOperationException("Prestation property is null");
|
||||
if (this.SelectedProfile==null) throw new InvalidOperationException("SelectedProfile property is null");
|
||||
// Le shampoing
|
||||
if (this.Prestation.Shampoo)
|
||||
bill.Add(new CommandLine { Name = "Shampoing", Description="Shampoing", UnitaryCost = SelectedProfile.ShampooPrice });
|
||||
|
||||
// la coupe
|
||||
if (Prestation.Cut) {
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
|
||||
Name = "Coupe",
|
||||
Description = $"Coupe "+
|
||||
ResourcesHelpers.DefaultResourceManager
|
||||
.GetString(Prestation.Gender.ToString())+ " "+
|
||||
(Prestation.Gender == HairCutGenders.Women ?
|
||||
Prestation.Length == HairLength.Long ? longhairsuffix :
|
||||
Prestation.Length == HairLength.HalfLong ? halflonghairsuffix :
|
||||
shorthairsuffix: null),
|
||||
UnitaryCost =
|
||||
Prestation.Gender == HairCutGenders.Women ?
|
||||
Prestation.Length == HairLength.Long ? SelectedProfile.WomenLongCutPrice :
|
||||
Prestation.Length == HairLength.HalfLong ? SelectedProfile.WomenHalfCutPrice :
|
||||
SelectedProfile.WomenShortCutPrice : Prestation.Gender == HairCutGenders.Man ?
|
||||
SelectedProfile.ManCutPrice : SelectedProfile.KidCutPrice
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Les techniques
|
||||
switch (Prestation.Tech)
|
||||
{
|
||||
case HairTechnos.Color:
|
||||
{
|
||||
bool multicolor = Prestation.Taints.Count > 1;
|
||||
string name = multicolor ? "Couleur" : "Multi-couleur";
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = multicolor ? SelectedProfile.LongMultiColorPrice :
|
||||
SelectedProfile.LongColorPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = multicolor ? SelectedProfile.HalfMultiColorPrice : SelectedProfile.HalfColorPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name = name + shorthairsuffix,
|
||||
UnitaryCost = multicolor ? SelectedProfile.ShortMultiColorPrice : SelectedProfile.ShortColorPrice
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HairTechnos.Balayage:
|
||||
{
|
||||
string name = "Balayage";
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongBalayagePrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfBalayagePrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortBalayagePrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HairTechnos.Defris:
|
||||
{
|
||||
string name = "Defrisage";
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongDefrisPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfDefrisPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortDefrisPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HairTechnos.Mech:
|
||||
{
|
||||
string name = "Mèches";
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongMechPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfMechPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortMechPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HairTechnos.Permanent:
|
||||
{
|
||||
string name = "Mèches";
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongPermanentPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfPermanentPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortPermanentPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Les coiffages
|
||||
switch (Prestation.Dressing)
|
||||
{
|
||||
case HairDressings.Brushing:
|
||||
{
|
||||
string name = "Brushing";
|
||||
|
||||
|
||||
switch (Prestation.Gender)
|
||||
{
|
||||
case HairCutGenders.Women:
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongBrushingPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfBrushingPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortBrushingPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HairCutGenders.Man:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ManBrushPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HairDressings.Coiffage:
|
||||
// est offert
|
||||
/* bill.Add(new CommandLine
|
||||
{
|
||||
Name = "Coiffage (offert)",
|
||||
UnitaryCost = 0m
|
||||
}); */
|
||||
break;
|
||||
case HairDressings.Folding:
|
||||
{
|
||||
string name = "Mise en plis";
|
||||
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongFoldingPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfFoldingPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortFoldingPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// les soins
|
||||
if (Prestation.Cares) {
|
||||
bill.Add(new CommandLine { Name = "Soins",
|
||||
Description = "Soins",
|
||||
UnitaryCost = SelectedProfile.CarePrice });
|
||||
|
||||
}
|
||||
return bill;
|
||||
}
|
||||
|
||||
public HairCutPayementEvent CreatePaymentEvent(PaymentInfo info, IStringLocalizer localizer)
|
||||
{
|
||||
|
||||
return new HairCutPayementEvent(Client.UserName,info,this, localizer);
|
||||
}
|
||||
|
||||
public virtual BrusherProfile SelectedProfile { get; set; }
|
||||
|
||||
public HairCutQueryEvent CreateEvent(string subTopic, string reason, string sender) {
|
||||
|
||||
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,
|
||||
BillingCode = BillingCodes.Brush
|
||||
};
|
||||
return yaev;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
42
Yavsc.Server/Models/HairCut/HairCutQueryEvent.cs
Normal file
42
Yavsc.Server/Models/HairCut/HairCutQueryEvent.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using Yavsc.Interfaces.Workflow;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public class HairCutQueryEvent : RdvQueryProviderInfo, IEvent
|
||||
{
|
||||
public HairCutQueryEvent(string subTopic)
|
||||
{
|
||||
Topic = "/topic/HairCutQuery";
|
||||
if (subTopic!=null) Topic+="/"+subTopic;
|
||||
}
|
||||
public string CreateBody()
|
||||
{
|
||||
return $"{Reason}\r\n-- \r\n{Previsional}\r\n{EventDate}\r\n";
|
||||
}
|
||||
|
||||
public string CreateBoby()
|
||||
{
|
||||
return string.Format(ResourcesHelpers.DefaultResourceManager
|
||||
.GetString("RdvToPerf"), Client.UserName,
|
||||
EventDate?.ToString("dddd dd/MM/yyyy à HH:mm"),
|
||||
Location.Address,
|
||||
ActivityCode);
|
||||
}
|
||||
|
||||
public string Sender
|
||||
{
|
||||
get;
|
||||
|
||||
set;
|
||||
}
|
||||
|
||||
public string Topic
|
||||
{
|
||||
get;
|
||||
|
||||
private set;
|
||||
}
|
||||
|
||||
HairCutQuery Data { get; set; }
|
||||
}
|
||||
}
|
14
Yavsc.Server/Models/HairCut/HairDressings.cs
Normal file
14
Yavsc.Server/Models/HairCut/HairDressings.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public enum HairDressings {
|
||||
|
||||
Coiffage,
|
||||
|
||||
Brushing,
|
||||
|
||||
[Display(Name="Mise en plis")]
|
||||
Folding
|
||||
}
|
||||
}
|
12
Yavsc.Server/Models/HairCut/HairLength.cs
Normal file
12
Yavsc.Server/Models/HairCut/HairLength.cs
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public enum HairLength : int
|
||||
{
|
||||
HalfLong=0,
|
||||
Short=1,
|
||||
|
||||
Long=2
|
||||
}
|
||||
}
|
52
Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs
Normal file
52
Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Models.Relationship;
|
||||
using Yavsc.Billing;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public class HairPrestationCollectionItem {
|
||||
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
public long PrestationId { get; set; }
|
||||
[ForeignKeyAttribute("PrestationId")]
|
||||
public virtual HairPrestation Prestation { get; set; }
|
||||
|
||||
public long QueryId { get; set; }
|
||||
|
||||
[ForeignKeyAttribute("QueryId")]
|
||||
public virtual HairMultiCutQuery Query { get; set; }
|
||||
}
|
||||
|
||||
public class HairMultiCutQuery : NominativeServiceCommand
|
||||
{
|
||||
// Bill description
|
||||
public override string GetDescription()
|
||||
{
|
||||
return "Prestation en coiffure à domicile [commande groupée]";
|
||||
}
|
||||
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
override public long Id { get; set; }
|
||||
|
||||
[InversePropertyAttribute("Query")]
|
||||
public virtual List<HairPrestationCollectionItem> Prestations { get; set; }
|
||||
|
||||
public Location Location { get; set; }
|
||||
|
||||
public DateTime EventDate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public override List<IBillItem> GetBillItems()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
57
Yavsc.Server/Models/HairCut/HairPrestation.cs
Normal file
57
Yavsc.Server/Models/HairCut/HairPrestation.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public class HairPrestation
|
||||
{
|
||||
// Homme ou enfant => Coupe seule
|
||||
// Couleur => Shampoing
|
||||
// Forfaits : Coupe + Technique
|
||||
// pas de coupe => technique
|
||||
|
||||
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
[Display(Name="Longueur de cheveux")]
|
||||
public HairLength Length { get; set; }
|
||||
|
||||
[Display(Name="Pour qui")]
|
||||
public HairCutGenders Gender { get; set; }
|
||||
|
||||
[Display(Name="Coupe")]
|
||||
public bool Cut { get; set; }
|
||||
|
||||
[Display(Name="Coiffage")]
|
||||
|
||||
public HairDressings Dressing { get; set; }
|
||||
|
||||
[Display(Name="Technique")]
|
||||
public HairTechnos Tech { get; set; }
|
||||
|
||||
[Display(Name="Shampoing")]
|
||||
public bool Shampoo { get; set; }
|
||||
|
||||
[Display(Name="Couleurs"),JsonIgnore,InverseProperty("Prestation")]
|
||||
|
||||
public virtual List<HairTaintInstance> Taints { get; set; }
|
||||
|
||||
[Display(Name="Soins")]
|
||||
public bool Cares { get; set; }
|
||||
|
||||
|
||||
}
|
||||
public class HairTaintInstance {
|
||||
|
||||
public long TaintId { get; set; }
|
||||
|
||||
[ForeignKey("TaintId")]
|
||||
public virtual HairTaint Taint { get; set; }
|
||||
public long PrestationId { get; set; }
|
||||
|
||||
[ForeignKey("PrestationId")]
|
||||
public virtual HairPrestation Prestation { get; set; }
|
||||
}
|
||||
}
|
21
Yavsc.Server/Models/HairCut/HairTaint.cs
Normal file
21
Yavsc.Server/Models/HairCut/HairTaint.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
using Drawing;
|
||||
public class HairTaint
|
||||
{
|
||||
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set;}
|
||||
|
||||
public string Brand { get; set; }
|
||||
|
||||
[Required]
|
||||
public long ColorId { get; set; }
|
||||
|
||||
[ForeignKeyAttribute("ColorId")]
|
||||
public virtual Color Color {get; set;}
|
||||
}
|
||||
}
|
22
Yavsc.Server/Models/HairCut/HairTechnos.cs
Normal file
22
Yavsc.Server/Models/HairCut/HairTechnos.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
|
||||
public enum HairTechnos
|
||||
{
|
||||
[Display(Name="Aucune technique spécifique")]
|
||||
NoTech,
|
||||
|
||||
[Display(Name="Couleur")]
|
||||
Color,
|
||||
|
||||
[Display(Name="Permantante")]
|
||||
Permanent,
|
||||
[Display(Name="Défrisage")]
|
||||
Defris,
|
||||
[Display(Name="Mêches")]
|
||||
Mech,
|
||||
Balayage
|
||||
}
|
||||
}
|
65
Yavsc.Server/Models/HairCut/Haircut.cs
Normal file
65
Yavsc.Server/Models/HairCut/Haircut.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using System;
|
||||
namespace Yavsc.Haircut
|
||||
{
|
||||
public interface IProviderInfo
|
||||
{
|
||||
|
||||
string UserId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
string UserName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
string Avatar
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaircutQuery
|
||||
{
|
||||
|
||||
IProviderInfo ProviderInfo
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
long Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
IHairPrestation Prestation
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
long Status
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
ILocation Location
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
DateTime EventDate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
19
Yavsc.Server/Models/HairCut/IHairPrestation.cs
Normal file
19
Yavsc.Server/Models/HairCut/IHairPrestation.cs
Normal file
@ -0,0 +1,19 @@
|
||||
namespace Yavsc
|
||||
{
|
||||
public interface IHairPrestation
|
||||
{
|
||||
long Id { get; set; }
|
||||
int Length { get; set; }
|
||||
int Gender { get; set; }
|
||||
bool Cut { get; set; }
|
||||
|
||||
int Dressing { get; set; }
|
||||
int Tech { get; set; }
|
||||
|
||||
bool Shampoo { get; set; }
|
||||
|
||||
long[] Taints { get; set; }
|
||||
|
||||
bool Cares { get; set; }
|
||||
}
|
||||
}
|
73
Yavsc.Server/Models/HairCut/Views/HaircutQueryInfo.cs
Normal file
73
Yavsc.Server/Models/HairCut/Views/HaircutQueryInfo.cs
Normal file
@ -0,0 +1,73 @@
|
||||
|
||||
//
|
||||
// HaircutQueryInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// Copyright (c) 2015 - 2017 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;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Yavsc.Models.Auth;
|
||||
using Yavsc.Models.Relationship;
|
||||
|
||||
namespace Yavsc.Models.Haircut.Views
|
||||
{
|
||||
public class HaircutQueryProviderInfo : HaircutQueryComonInfo {
|
||||
public HaircutQueryProviderInfo(HairCutQuery query) : base (query)
|
||||
{
|
||||
ClientInfo = new UserInfo(query.Client.Id, query.Client.UserName, query.Client.Avatar);
|
||||
}
|
||||
public UserInfo ClientInfo { get; set; }
|
||||
|
||||
}
|
||||
public class HaircutQueryClientInfo : HaircutQueryComonInfo {
|
||||
public HaircutQueryClientInfo(HairCutQuery query) : base (query)
|
||||
{
|
||||
var user = query.PerformerProfile.Performer;
|
||||
ProviderInfo = new UserInfo(user.Id, user.UserName, user.Avatar);
|
||||
}
|
||||
public UserInfo ProviderInfo { get; set; }
|
||||
|
||||
}
|
||||
public class HaircutQueryComonInfo
|
||||
{
|
||||
public HaircutQueryComonInfo(HairCutQuery query)
|
||||
{
|
||||
Id = query.Id;
|
||||
Prestation = query.Prestation;
|
||||
Status = query.Status;
|
||||
Location = query.Location;
|
||||
EventDate = query.EventDate;
|
||||
AdditionalInfo = query.AdditionalInfo;
|
||||
}
|
||||
public long Id { get; set; }
|
||||
public HairPrestation Prestation { get; set; }
|
||||
|
||||
public QueryStatus Status { get; set; }
|
||||
|
||||
public virtual Location Location { get; set; }
|
||||
public DateTime? EventDate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Display(Name="Informations complémentaires")]
|
||||
public string AdditionalInfo { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user