Identity reloaded
This commit is contained in:
parent
ef0f5ddcac
commit
333b066e66
33 changed files with 195 additions and 180 deletions
|
|
@ -76,15 +76,21 @@ namespace Yavsc.Helpers
|
|||
{
|
||||
Config.ProfileTypes.Add(c);
|
||||
}
|
||||
if (c.IsClass && !c.IsAbstract &&
|
||||
c.GetInterface(nameof(IBillable)) != null)
|
||||
{
|
||||
BillingService.GlobalBillingMap.Add(c.Name, c.AssemblyQualifiedName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var propertyInfo in typeof(ApplicationDbContext).GetProperties())
|
||||
{
|
||||
foreach (var attr in propertyInfo.CustomAttributes)
|
||||
if (propertyInfo.PropertyType.IsGenericType &&
|
||||
propertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(DbSet<>))
|
||||
{
|
||||
// something like a DbSet?
|
||||
if (typeof(Yavsc.Attributes.ActivitySettingsAttribute).IsAssignableFrom(attr.AttributeType))
|
||||
var entityType = propertyInfo.PropertyType.GetGenericArguments()[0];
|
||||
if (typeof(IUserSettings).IsAssignableFrom(entityType))
|
||||
{
|
||||
BillingService.UserSettings.Add(propertyInfo);
|
||||
}
|
||||
|
|
@ -94,16 +100,16 @@ namespace Yavsc.Helpers
|
|||
RegisterBilling<HairCutQuery>(BillingCodes.Brush, new Func<ApplicationDbContext, long, IQuery>
|
||||
((db, id) =>
|
||||
{
|
||||
var query = db.HairCutQueries.Include(q => q.Prestation).Include(q => q.Regularisation).Single(q => q.Id == id);
|
||||
var query = db.HairCutQueries.Include(q => q.Prestation).Include(q => q.Regularization).Single(q => q.Id == id);
|
||||
query.SelectedProfile = db.BrusherProfile.Single(b => b.UserId == query.PerformerId);
|
||||
return query;
|
||||
}));
|
||||
|
||||
RegisterBilling<HairMultiCutQuery>(BillingCodes.MBrush, new Func<ApplicationDbContext, long, IQuery>
|
||||
((db, id) => db.HairMultiCutQueries.Include(q => q.Regularisation).Single(q => q.Id == id)));
|
||||
((db, id) => db.HairMultiCutQueries.Include(q => q.Regularization).Single(q => q.Id == id)));
|
||||
|
||||
RegisterBilling<RdvQuery>(BillingCodes.Rdv, new Func<ApplicationDbContext, long, IQuery>
|
||||
((db, id) => db.RdvQueries.Include(q => q.Regularisation).Single(q => q.Id == id)));
|
||||
((db, id) => db.RdvQueries.Include(q => q.Regularization).Single(q => q.Id == id)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -290,22 +290,17 @@ namespace Yavsc.Models
|
|||
|
||||
public DbSet<Instrument> Instrument { get; set; }
|
||||
|
||||
[ActivitySettings]
|
||||
public DbSet<DjSettings> DjSettings { get; set; }
|
||||
|
||||
[ActivitySettings]
|
||||
public DbSet<Instrumentation> Instrumentation { get; set; }
|
||||
|
||||
[ActivitySettings]
|
||||
public DbSet<FormationSettings> FormationSettings { get; set; }
|
||||
|
||||
[ActivitySettings]
|
||||
public DbSet<MusicLoverSettings> GeneralSettings { get; set; }
|
||||
public DbSet<MusicLoverSettings> MusicLoverSettings { get; set; }
|
||||
public DbSet<CoWorking> CoWorking { get; set; }
|
||||
|
||||
private void AddTimestamps(string userId)
|
||||
{
|
||||
var entities =
|
||||
private void AddTimestamps(string userId)
|
||||
{ var entities =
|
||||
ChangeTracker.Entries()
|
||||
.Where(x => x.Entity.GetType().GetInterface(nameof(ITrackedEntity)) != null
|
||||
&& (x.State == EntityState.Added || x.State == EntityState.Modified));
|
||||
|
|
@ -360,7 +355,6 @@ namespace Yavsc.Models
|
|||
public DbSet<DismissClicked> DismissClicked { get; set; }
|
||||
|
||||
|
||||
[ActivitySettings]
|
||||
public DbSet<BrusherProfile> BrusherProfile { get; set; }
|
||||
|
||||
public DbSet<BankIdentity> BankIdentity { get; set; }
|
||||
|
|
|
|||
|
|
@ -59,14 +59,14 @@ namespace Yavsc.Models.Billing
|
|||
/// <summary>
|
||||
/// The performer identifier
|
||||
/// </summary>
|
||||
[ForeignKey("PerformerId"),Display(Name="Préstataire")]
|
||||
[ForeignKey("PerformerId"),Display(Name="PerformerProfile")]
|
||||
public PerformerProfile PerformerProfile { get; set; }
|
||||
|
||||
public DateTime? ValidationDate {get; set;}
|
||||
|
||||
|
||||
[Display(Name="Previsional")]
|
||||
public decimal? Previsional { get; set; }
|
||||
[Display(Name="Provisional")]
|
||||
public decimal? Provisional { get; set; }
|
||||
/// <summary>
|
||||
/// The bill
|
||||
/// </summary>
|
||||
|
|
@ -82,7 +82,7 @@ namespace Yavsc.Models.Billing
|
|||
|
||||
public bool GetIsAcquitted()
|
||||
{
|
||||
return Regularisation?.IsOk() ?? false;
|
||||
return Regularization?.IsOk() ?? false;
|
||||
}
|
||||
|
||||
public string GetFileBaseName(IBillingService billingService)
|
||||
|
|
@ -93,11 +93,11 @@ namespace Yavsc.Models.Billing
|
|||
return $"facture-{bcode}-{Id}{ack}";
|
||||
}
|
||||
|
||||
[ForeignKey("Regularisation")]
|
||||
[ForeignKey("Regularization")]
|
||||
|
||||
public string? PaymentId { get; set; }
|
||||
|
||||
[Display(Name = "Acquittement de la facture")]
|
||||
public virtual PayPalPayment Regularisation { get; set; }
|
||||
public virtual PayPalPayment Regularization { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ Prestation.Gender == HairCutGenders.Women ?
|
|||
UserId = ClientId,
|
||||
Avatar = Client.Avatar
|
||||
},
|
||||
Previsional = Previsional,
|
||||
Previsional = Provisional,
|
||||
EventDate = EventDate,
|
||||
Location = Location,
|
||||
Id = Id,
|
||||
|
|
|
|||
|
|
@ -8,33 +8,20 @@ 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
|
||||
string _customDescription = null;
|
||||
public override string Description
|
||||
string _customDescription = null;
|
||||
public override string Description
|
||||
{
|
||||
get {
|
||||
get {
|
||||
return _customDescription ?? "Prestation en coiffure à domicile [commande groupée]" ;
|
||||
}
|
||||
set {
|
||||
_customDescription = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
override public long Id { get; set; }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -12,6 +12,9 @@ namespace Yavsc.Services
|
|||
new Dictionary<string, Func<ApplicationDbContext, long, IQuery>>();
|
||||
public static List<PropertyInfo> UserSettings = new List<PropertyInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// Mapping from activity codes to IUserSettings
|
||||
/// </summary>
|
||||
public static Dictionary<string, string> GlobalBillingMap =
|
||||
new Dictionary<string, string>();
|
||||
|
||||
|
|
@ -30,7 +33,12 @@ namespace Yavsc.Services
|
|||
return Task.FromResult(GetBillable(DbContext, billingCode, queryId));
|
||||
}
|
||||
|
||||
public static IQuery GetBillable(ApplicationDbContext context, string billingCode, long queryId) => Billing[billingCode](context, queryId);
|
||||
public static IQuery GetBillable(ApplicationDbContext context, string billingCode, long queryId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
public async Task<IUserSettings> GetPerformersSettingsAsync(string activityCode, string userId)
|
||||
{
|
||||
var activity = await DbContext.Activities.SingleAsync(a => a.Code == activityCode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue