REORG
This commit is contained in:
parent
8d68ee380a
commit
45514010f2
3505 changed files with 154 additions and 523 deletions
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class AccountOptions
|
||||
{
|
||||
public static bool AllowLocalLogin = true;
|
||||
public static bool AllowRememberLogin = true;
|
||||
public static TimeSpan RememberMeLoginDuration = TimeSpan.FromDays(30);
|
||||
|
||||
public static bool ShowLogoutPrompt = true;
|
||||
public static bool AutomaticRedirectAfterSignOut = false;
|
||||
|
||||
public static string InvalidCredentialsErrorMessage = "Invalid username or password";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
using Yavsc;
|
||||
public class Ban : ITrackedEntity
|
||||
{
|
||||
public DateTime DateCreated
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public DateTime DateModified
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
public string UserCreated
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string UserModified
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[Required]
|
||||
public string TargetId
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[ForeignKey("TargetId")]
|
||||
public virtual ApplicationUser TargetUser {
|
||||
get; set;
|
||||
}
|
||||
|
||||
[Required]
|
||||
public string Reason { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class BanByEmail
|
||||
{
|
||||
[Required]
|
||||
public long BanId { get; set; }
|
||||
|
||||
[ForeignKey("BanId")]
|
||||
public virtual Ban UserBan { get; set; }
|
||||
|
||||
[Required]
|
||||
public string email { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class BlackListed: IBlackListed
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string UserId { get; set; }
|
||||
|
||||
[Required]
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
[ForeignKey("OwnerId"), JsonIgnore]
|
||||
public virtual ApplicationUser Owner { get; set; }
|
||||
|
||||
[ForeignKey("UserId"), JsonIgnore]
|
||||
public virtual ApplicationUser User { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
namespace Yavsc.Models.Access
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Models.Relationship;
|
||||
using Newtonsoft.Json;
|
||||
using Blog;
|
||||
using Yavsc.Abstract.Identity.Security;
|
||||
|
||||
public class CircleAuthorizationToBlogPost : ICircleAuthorization
|
||||
{
|
||||
public long CircleId { get; set; }
|
||||
public long BlogPostId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("BlogPostId")]
|
||||
public virtual BlogPost Target { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("CircleId")]
|
||||
public virtual Circle Allowed { get; set; }
|
||||
|
||||
public bool Comment { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class ConsentInputModel
|
||||
{
|
||||
public string Button { get; set; }
|
||||
public IEnumerable<string> ScopesConsented { get; set; }
|
||||
public bool RememberConsent { get; set; }
|
||||
public string ReturnUrl { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class ConsentViewModel : ConsentInputModel
|
||||
{
|
||||
public string ClientName { get; set; }
|
||||
public string ClientUrl { get; set; }
|
||||
public string ClientLogoUrl { get; set; }
|
||||
public bool AllowRememberConsent { get; set; }
|
||||
|
||||
public IEnumerable<ScopeViewModel> IdentityScopes { get; set; }
|
||||
public IEnumerable<ScopeViewModel> ApiScopes { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class DeviceAuthorizationInputModel : ConsentInputModel
|
||||
{
|
||||
public string UserCode { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
|
||||
public class DeviceAuthorizationViewModel : ConsentViewModel
|
||||
{
|
||||
public string UserCode { get; set; }
|
||||
public bool ConfirmUserCode { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class GrantViewModel
|
||||
{
|
||||
public string ClientId { get; set; }
|
||||
public string ClientName { get; set; }
|
||||
public string ClientUrl { get; set; }
|
||||
public string ClientLogoUrl { get; set; }
|
||||
public string Description { get; set; }
|
||||
public DateTime Created { get; set; }
|
||||
public DateTime? Expires { get; set; }
|
||||
public IEnumerable<string> IdentityGrantNames { get; set; }
|
||||
public IEnumerable<string> ApiGrantNames { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class GrantsViewModel
|
||||
{
|
||||
public IEnumerable<GrantViewModel> Grants { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class LoggedOutViewModel
|
||||
{
|
||||
public string PostLogoutRedirectUri { get; set; }
|
||||
public string ClientName { get; set; }
|
||||
public string SignOutIframeUrl { get; set; }
|
||||
|
||||
public bool AutomaticRedirectAfterSignOut { get; set; }
|
||||
|
||||
public string LogoutId { get; set; }
|
||||
public bool TriggerExternalSignout => ExternalAuthenticationScheme != null;
|
||||
public string ExternalAuthenticationScheme { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class LogoutInputModel
|
||||
{
|
||||
public string LogoutId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
using IdentityServer8.Models;
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class ProcessConsentResult
|
||||
{
|
||||
public bool IsRedirect => RedirectUri != null;
|
||||
public string RedirectUri { get; set; }
|
||||
public Client Client { get; set; }
|
||||
|
||||
public bool ShowView => ViewModel != null;
|
||||
public ConsentViewModel ViewModel { get; set; }
|
||||
|
||||
public bool HasValidationError => ValidationError != null;
|
||||
public string ValidationError { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
//
|
||||
// Publishing.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/>.
|
||||
|
||||
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Publishing.
|
||||
/// </summary>
|
||||
public enum Publishing {
|
||||
/// <summary>
|
||||
/// In the context of immediate use, with no related stored content.
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// In the context of private use of an uploaded content.
|
||||
/// </summary>
|
||||
Private,
|
||||
/// <summary>
|
||||
/// In the context of restricted access areas, like circle members views.
|
||||
/// </summary>
|
||||
Restricted,
|
||||
/// <summary>
|
||||
/// Publishing a content in a public access area.
|
||||
/// </summary>
|
||||
Public
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class RedirectViewModel
|
||||
{
|
||||
public string RedirectUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public abstract class Rule<TResource,TRequirement>
|
||||
{
|
||||
public Rule()
|
||||
{
|
||||
|
||||
}
|
||||
// Abstract method to compute any authorization on a resource
|
||||
public abstract bool Allow(string userId, TResource resource, TRequirement requirement);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public abstract class RuleSet <TResource,TRequirement>:List<Rule<TResource,TRequirement>> {
|
||||
|
||||
public abstract bool Allow(string userId, TResource resource, TRequirement requirement);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
public class ScopeViewModel
|
||||
{
|
||||
public string Value { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public bool Emphasize { get; set; }
|
||||
public bool Required { get; set; }
|
||||
public bool Checked { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
namespace Yavsc.Models.Access
|
||||
{
|
||||
|
||||
public class WhiteCard {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,294 +0,0 @@
|
|||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Yavsc.Abstract.Models.Messaging;
|
||||
using Yavsc.Server.Models.EMailing;
|
||||
using Yavsc.Server.Models.IT.SourceCode;
|
||||
using Yavsc.Server.Models.IT;
|
||||
using Yavsc.Abstract.Identity;
|
||||
using Yavsc.Server.Models.Calendar;
|
||||
|
||||
namespace Yavsc.Models
|
||||
{
|
||||
using Haircut;
|
||||
using IT.Evolution;
|
||||
using IT.Fixing;
|
||||
using Streaming;
|
||||
using Relationship;
|
||||
using Forms;
|
||||
using Auth;
|
||||
using Billing;
|
||||
using Musical;
|
||||
using Workflow;
|
||||
using Identity;
|
||||
using Market;
|
||||
using Chat;
|
||||
using Messaging;
|
||||
using Access;
|
||||
using Musical.Profiles;
|
||||
using Workflow.Profiles;
|
||||
using Drawing;
|
||||
using Attributes;
|
||||
using Bank;
|
||||
using Payment;
|
||||
using Blog;
|
||||
using IdentityServer8.Models;
|
||||
using IdentityServer8.EntityFramework.Entities;
|
||||
|
||||
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>, IdentityServer8.EntityFramework.Interfaces.IConfigurationDbContext
|
||||
{
|
||||
public ApplicationDbContext()
|
||||
{
|
||||
|
||||
}
|
||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
// Customize the ASP.NET Identity model and override the defaults if needed.
|
||||
// For example, you can rename the ASP.NET Identity table names and more.
|
||||
// Add your customizations after calling base.OnModelCreating(builder);
|
||||
builder.Entity<Contact>().HasKey(x => new { x.OwnerId, x.UserId });
|
||||
builder.Entity<DeviceDeclaration>().Property(x => x.DeclarationDate).HasDefaultValueSql("LOCALTIMESTAMP");
|
||||
builder.Entity<BlogTag>().HasKey(x => new { x.PostId, x.TagId });
|
||||
|
||||
builder.Entity<ApplicationUser>().Property(u => u.FullName).IsRequired(false);
|
||||
builder.Entity<ApplicationUser>().Property(u => u.DedicatedGoogleCalendar).IsRequired(false);
|
||||
builder.Entity<ApplicationUser>().HasMany<ChatConnection>(c => c.Connections);
|
||||
builder.Entity<ApplicationUser>().Property(u => u.Avatar).HasDefaultValue(Constants.DefaultAvatar);
|
||||
builder.Entity<ApplicationUser>().Property(u => u.DiskQuota).HasDefaultValue(Constants.DefaultFSQ);
|
||||
builder.Entity<ApplicationUser>().HasAlternateKey(u => u.Email);
|
||||
builder.Entity<BlackListed>().HasOne<ApplicationUser>(bl => bl.User);
|
||||
builder.Entity<BlackListed>().HasOne<ApplicationUser>(bl => bl.Owner);
|
||||
builder.Entity<UserActivity>().HasKey(u => new { u.DoesCode, u.UserId });
|
||||
builder.Entity<Instrumentation>().HasKey(u => new { u.InstrumentId, u.UserId });
|
||||
builder.Entity<CircleAuthorizationToBlogPost>().HasKey(a => new { a.CircleId, a.BlogPostId });
|
||||
builder.Entity<CircleMember>().HasKey(c => new { c.MemberId, c.CircleId });
|
||||
builder.Entity<DismissClicked>().HasKey(c => new { uid = c.UserId, notid = c.NotificationId });
|
||||
builder.Entity<HairTaintInstance>().HasKey(ti => new { ti.TaintId, ti.PrestationId });
|
||||
builder.Entity<HyperLink>().HasKey(l => new { l.HRef, l.Method });
|
||||
builder.Entity<Period>().HasKey(l => new { l.Start, l.End });
|
||||
builder.Entity<Cratie.Option>().HasKey(o => new { o.Code, o.CodeScrutin });
|
||||
builder.Entity<Notification>().Property(n => n.icon).HasDefaultValue("exclam");
|
||||
builder.Entity<ChatRoomAccess>().HasKey(p => new { room = p.ChannelName, user = p.UserId });
|
||||
builder.Entity<InstrumentRating>().HasAlternateKey(i => new { Instrument = i.InstrumentId, owner = i.OwnerId });
|
||||
|
||||
foreach (var et in builder.Model.GetEntityTypes())
|
||||
{
|
||||
if (et.ClrType.GetInterface("IBaseTrackedEntity") != null)
|
||||
et.FindProperty("DateCreated").SetAfterSaveBehavior(Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Ignore);
|
||||
}
|
||||
|
||||
builder.Entity<Activity>().Property(a => a.ParentCode).IsRequired(false);
|
||||
// builder.Entity<IdentityUserLogin<String>>().HasKey(i=> new { i.LoginProvider, i.UserId, i.ProviderKey });
|
||||
}
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
string? envCxStr = Environment.GetEnvironmentVariable(Constants.YavscConnectionStringEnvName);
|
||||
if (envCxStr != null)
|
||||
optionsBuilder.UseNpgsql(envCxStr);
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activities referenced on this site
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DbSet<Activity> Activities { get; set; }
|
||||
|
||||
public DbSet<UserActivity> UserActivities { get; set; }
|
||||
/// <summary>
|
||||
/// Users posts
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DbSet<BlogPost> BlogSpot { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Skills powered by this site
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DbSet<Skill> SiteSkills { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Circle members
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DbSet<CircleMember> CircleMembers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Special commands, talking about
|
||||
/// a given place and date.
|
||||
/// </summary>
|
||||
public DbSet<RdvQuery> RdvQueries { get; set; }
|
||||
|
||||
public DbSet<HairCutQuery> HairCutQueries { get; set; }
|
||||
public DbSet<HairPrestation> HairPrestation { get; set; }
|
||||
|
||||
public DbSet<HairMultiCutQuery> HairMultiCutQueries { get; set; }
|
||||
public DbSet<PerformerProfile> Performers { get; set; }
|
||||
|
||||
public DbSet<Estimate> Estimates { get; set; }
|
||||
public DbSet<AccountBalance> BankStatus { get; set; }
|
||||
public DbSet<BalanceImpact> BalanceImpact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// References all declared external NativeConfidential devices
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DbSet<DeviceDeclaration> DeviceDeclaration { get; set; }
|
||||
|
||||
public DbSet<Service> Services { get; set; }
|
||||
public DbSet<Product> Products { get; set; }
|
||||
|
||||
public DbSet<ExceptionSIREN> ExceptionsSIREN { get; set; }
|
||||
|
||||
public DbSet<Location> Locations { get; set; }
|
||||
|
||||
public DbSet<Tag> Tags { get; set; }
|
||||
|
||||
public DbSet<BlogTag> TagsDomain { get; set; }
|
||||
|
||||
public DbSet<EstimateTemplate> EstimateTemplates { get; set; }
|
||||
|
||||
public DbSet<Contact> Contact { get; set; }
|
||||
|
||||
public DbSet<ClientProviderInfo> ClientProviderInfo { get; set; }
|
||||
|
||||
public DbSet<BlackListed> BlackListed { get; set; }
|
||||
|
||||
public DbSet<MusicalPreference> MusicalPreference { get; set; }
|
||||
|
||||
public DbSet<MusicalTendency> MusicalTendency { get; set; }
|
||||
|
||||
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<GeneralSettings> GeneralSettings { get; set; }
|
||||
public DbSet<CoWorking> CoWorking { get; set; }
|
||||
|
||||
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));
|
||||
|
||||
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
if (entity.State == EntityState.Added)
|
||||
{
|
||||
((ITrackedEntity)entity.Entity).DateCreated = DateTime.Now;
|
||||
((ITrackedEntity)entity.Entity).UserCreated = userId;
|
||||
}
|
||||
|
||||
((ITrackedEntity)entity.Entity).DateModified = DateTime.Now;
|
||||
((ITrackedEntity)entity.Entity).UserModified = userId;
|
||||
}
|
||||
}
|
||||
|
||||
public int SaveChanges(string userId)
|
||||
{
|
||||
AddTimestamps(userId);
|
||||
return base.SaveChanges();
|
||||
}
|
||||
|
||||
public async Task<int> SaveChangesAsync(string userId, CancellationToken ctoken = default(CancellationToken))
|
||||
{
|
||||
AddTimestamps(userId);
|
||||
return await base.SaveChangesAsync(ctoken);
|
||||
}
|
||||
|
||||
public DbSet<Circle> Circle { get; set; }
|
||||
|
||||
public DbSet<CircleAuthorizationToBlogPost> CircleAuthorizationToBlogPost { get; set; }
|
||||
|
||||
public DbSet<CommandForm> CommandForm { get; set; }
|
||||
|
||||
public DbSet<Form> Form { get; set; }
|
||||
|
||||
public DbSet<Ban> Ban { get; set; }
|
||||
|
||||
public DbSet<HairTaint> HairTaint { get; set; }
|
||||
|
||||
public DbSet<Color> Color { get; set; }
|
||||
|
||||
public DbSet<Notification> Notification { get; set; }
|
||||
|
||||
public DbSet<DismissClicked> DismissClicked { get; set; }
|
||||
|
||||
|
||||
[ActivitySettings]
|
||||
public DbSet<BrusherProfile> BrusherProfile { get; set; }
|
||||
|
||||
public DbSet<BankIdentity> BankIdentity { get; set; }
|
||||
|
||||
public DbSet<PayPalPayment> PayPalPayment { get; set; }
|
||||
|
||||
public DbSet<HyperLink> HyperLink { get; set; }
|
||||
|
||||
public DbSet<Period> Period { get; set; }
|
||||
|
||||
public DbSet<BlogTag> BlogTag { get; set; }
|
||||
|
||||
public DbSet<ApplicationUser> ApplicationUser { get; set; }
|
||||
|
||||
public DbSet<Feature> Feature { get; set; }
|
||||
|
||||
public DbSet<Bug> Bug { get; set; }
|
||||
|
||||
public DbSet<Comment> Comment { get; set; }
|
||||
|
||||
public DbSet<Announce> Announce { get; set; }
|
||||
|
||||
// TODO remove and opt for for memory only storing,
|
||||
// as long as it must be set empty each time the service is restarted,
|
||||
// and that chatting should be kept as must as possible independent from db context
|
||||
public DbSet<ChatConnection> ChatConnection { get; set; }
|
||||
|
||||
public DbSet<ChatRoom> ChatRoom { get; set; }
|
||||
|
||||
public DbSet<MailingTemplate> MailingTemplate { get; set; }
|
||||
|
||||
public DbSet<GitRepositoryReference> GitRepositoryReference { get; set; }
|
||||
|
||||
public DbSet<Project> Project { get; set; }
|
||||
|
||||
[Obsolete("use signaled flows")]
|
||||
public DbSet<LiveFlow> LiveFlow { get; set; }
|
||||
|
||||
public DbSet<ChatRoomAccess> ChatRoomAccess { get; set; }
|
||||
|
||||
public DbSet<InstrumentRating> InstrumentRating { get; set; }
|
||||
|
||||
public DbSet<Scope> Scopes { get; set; }
|
||||
|
||||
public DbSet<BlogSpotPublication> blogSpotPublications { get; set; }
|
||||
public DbSet<IdentityServer8.EntityFramework.Entities.Client> Clients { get; set; }
|
||||
public DbSet<ClientCorsOrigin> ClientCorsOrigins { get; set; }
|
||||
public DbSet<IdentityServer8.EntityFramework.Entities.IdentityResource> IdentityResources { get; set; }
|
||||
public DbSet<IdentityServer8.EntityFramework.Entities.ApiResource> ApiResources { get; set; }
|
||||
public DbSet<IdentityServer8.EntityFramework.Entities.ApiScope> ApiScopes { get; set; }
|
||||
public DbSet<IdentityResourceClaim> IdentityResourceClaims { get; set; }
|
||||
public DbSet<IdentityResourceProperty> IdentityResourceProperties { get; set; }
|
||||
public DbSet<ApiResourceSecret> ApiResourceSecrets { get; set; }
|
||||
public DbSet<ApiResourceScope> ApiResourceScopes { get; set; }
|
||||
public DbSet<ApiResourceClaim> ApiResourceClaims { get; set; }
|
||||
public DbSet<ApiResourceProperty> ApiResourceProperties { get; set; }
|
||||
public DbSet<ApiScopeClaim> ApiScopeClaims { get; set; }
|
||||
public DbSet<ApiScopeProperty> ApiScopeProperties { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Newtonsoft.Json;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Yavsc.Models.Relationship;
|
||||
using Yavsc.Models.Identity;
|
||||
using Yavsc.Models.Chat;
|
||||
using Yavsc.Models.Bank;
|
||||
using Yavsc.Models.Access;
|
||||
using Yavsc.Abstract.Identity;
|
||||
|
||||
namespace Yavsc.Models
|
||||
{
|
||||
[Table("AspNetUsers")]
|
||||
public class ApplicationUser : IdentityUser, IApplicationUser
|
||||
{
|
||||
/// <summary>
|
||||
/// Another me, as a byte array.TG7@Eu%80rufzkhbb
|
||||
/// This value points a picture that may be used
|
||||
/// to present the user
|
||||
/// </summary>
|
||||
/// <returns>the path to an user's image, relative to it's user dir<summary>
|
||||
/// <see>Startup.UserFilesOptions</see>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[MaxLength(512)]
|
||||
public string? Avatar { get; set; }
|
||||
|
||||
[MaxLength(512)]
|
||||
public string? FullName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WIP Paypal
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Display(Name = "Account balance")]
|
||||
public virtual AccountBalance? AccountBalance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's posts
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[InverseProperty("Author"), JsonIgnore]
|
||||
public virtual List<Blog.BlogPost>? Posts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's contact list
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[InverseProperty("Owner"), JsonIgnore]
|
||||
public virtual List<Contact>? Book { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// External devices using the API
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[InverseProperty("DeviceOwner"), JsonIgnore]
|
||||
public virtual List<DeviceDeclaration>? DeviceDeclaration { get; set; }
|
||||
|
||||
[InverseProperty("Owner"), JsonIgnore]
|
||||
public virtual List<ChatConnection>? Connections { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's circles
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[InverseProperty("Owner"), JsonIgnore]
|
||||
|
||||
public virtual List<Circle>? Circles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Billing postal address
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[ForeignKey("PostalAddressId")]
|
||||
public virtual Location? PostalAddress { get; set; }
|
||||
public long? PostalAddressId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User's Google calendar
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[MaxLength(512)]
|
||||
public string? DedicatedGoogleCalendar { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Id + " " + this.AccountBalance?.Credits.ToString() + this.Email + " " + this.UserName + " $" + this.AccountBalance?.Credits.ToString();
|
||||
}
|
||||
|
||||
public virtual List<BankIdentity>? BankInfo { get; set; }
|
||||
|
||||
public long DiskQuota { get; set; } = 512 * 1024 * 1024;
|
||||
public long DiskUsage { get; set; } = 0;
|
||||
|
||||
public long MaxFileSize { get; set; } = 512 * 1024 * 1024;
|
||||
|
||||
[JsonIgnore]
|
||||
[InverseProperty("Owner")]
|
||||
public virtual List<BlackListed>? BlackList { get; set; }
|
||||
|
||||
public bool AllowMonthlyEmail { get; set; } = false;
|
||||
|
||||
[JsonIgnore]
|
||||
[InverseProperty("Owner")]
|
||||
public virtual List<ChatRoom>? Rooms { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[InverseProperty("User")]
|
||||
public virtual List<ChatRoomAccess>? RoomAccess { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[InverseProperty("Member")]
|
||||
public virtual List<CircleMember>? Membership { get; set; }
|
||||
|
||||
IAccountBalance? IApplicationUser.AccountBalance => AccountBalance;
|
||||
|
||||
ILocation? IApplicationUser.PostalAddress { get => PostalAddress; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
|
||||
namespace Yavsc.Models.Auth
|
||||
{
|
||||
public enum ApplicationTypes: int
|
||||
{
|
||||
JavaScript = 0,
|
||||
NativeConfidential = 1
|
||||
};
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Yavsc.Models.Identity
|
||||
{
|
||||
[JsonObject]
|
||||
|
||||
public class DeviceDeclaration : IMobileDeviceDeclaration {
|
||||
|
||||
|
||||
[Key,Required]
|
||||
public string DeviceId { get; set; }
|
||||
|
||||
public string Model { get; set; }
|
||||
public string Platform { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string DeviceOwnerId { get; set; }
|
||||
public DateTime DeclarationDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Latest Activity Update
|
||||
///
|
||||
/// Let's says,
|
||||
/// the latest time this device downloaded functional info from server
|
||||
/// activity list, let's say, promoted ones, those thar are at index, and
|
||||
/// all others, that are not listed as unsupported ones (not any more, after
|
||||
/// has been annonced as obsolete a decent laps of time).
|
||||
///
|
||||
/// In order to say, is any activity has changed here.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DateTime ? LatestActivityUpdate { get; set; }
|
||||
|
||||
[JsonIgnore,ForeignKey("DeviceOwnerId")]
|
||||
public virtual ApplicationUser DeviceOwner { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Auth {
|
||||
|
||||
public class ExternalLoginViewModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Url { get; set; }
|
||||
|
||||
public string State { get; set; }
|
||||
}
|
||||
|
||||
public class RegisterExternalBindingModel
|
||||
{
|
||||
[Required]
|
||||
public string UserName { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Provider { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ExternalAccessToken { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ParsedExternalAccessToken
|
||||
{
|
||||
public string user_id { get; set; }
|
||||
public string app_id { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Auth
|
||||
{
|
||||
/// <summary>
|
||||
/// OffLine OAuth2 Token
|
||||
/// To use against a third party Api
|
||||
/// </summary>
|
||||
public partial class OAuth2Tokens
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique identifier, equals the user email from OAuth provider
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Key]
|
||||
public string UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Expiration date & time
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DateTime Expiration { get; set; }
|
||||
/// <summary>
|
||||
/// Expiration time span in seconds
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string ExpiresIn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Should always be <c>Bearer</c> ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string TokenType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Access Token!
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string AccessToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The refresh token
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string RefreshToken { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Auth
|
||||
{
|
||||
|
||||
|
||||
public class RefreshToken
|
||||
{
|
||||
[Key]
|
||||
public string Id { get; set; }
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string Subject { get; set; }
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string ClientId { get; set; }
|
||||
public DateTime IssuedUtc { get; set; }
|
||||
public DateTime ExpiresUtc { get; set; }
|
||||
[Required]
|
||||
public string ProtectedTicket { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
|
||||
namespace Yavsc.Models.Auth {
|
||||
|
||||
public class UserCredential {
|
||||
public string UserId { get; set; }
|
||||
|
||||
public OAuth2Tokens Tokens { get; set; }
|
||||
public UserCredential(string userId, OAuth2Tokens tokens)
|
||||
{
|
||||
UserId = userId;
|
||||
Tokens = tokens;
|
||||
}
|
||||
|
||||
public string GetHeader()
|
||||
{
|
||||
return Tokens.TokenType+" "+Tokens.AccessToken;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models
|
||||
{
|
||||
using Yavsc;
|
||||
|
||||
public partial class AccountBalance: IAccountBalance {
|
||||
|
||||
[Key]
|
||||
public string UserId { get; set; }
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
public virtual ApplicationUser Owner { get; set; }
|
||||
|
||||
[Required,Display(Name="Credits en €")]
|
||||
public decimal Credits { get; set; }
|
||||
|
||||
public long ContactCredits { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models
|
||||
{
|
||||
public partial class BalanceImpact {
|
||||
[Required,Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
[Required,Display(Name="Impact")]
|
||||
public decimal Impact { get; set; }
|
||||
|
||||
[Required,Display(Name="Execution date")]
|
||||
public DateTime ExecDate { get; set; }
|
||||
|
||||
[Required,Display(Name="Reason")]
|
||||
public string Reason { get; set; }
|
||||
[Required]
|
||||
public string BalanceId { get; set; }
|
||||
|
||||
[ForeignKey("BalanceId")]
|
||||
public virtual AccountBalance Balance { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Yavsc.Attributes.Validation;
|
||||
|
||||
namespace Yavsc.Models.Bank
|
||||
{
|
||||
public class BankIdentity
|
||||
{
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the BI.
|
||||
/// </summary>
|
||||
/// <value>The BI.</value>
|
||||
[DisplayName("Code BIC")]
|
||||
[YaStringLength(15)]
|
||||
public string BIC { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IBA.
|
||||
/// </summary>
|
||||
/// <value>The IBA.</value>
|
||||
[DisplayName("Code IBAN")]
|
||||
[YaStringLength(33)]
|
||||
public string IBAN { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the bank code.
|
||||
/// </summary>
|
||||
/// <value>The bank code.</value>
|
||||
[DisplayName("Code Banque")]
|
||||
[YaStringLength(5)]
|
||||
public string BankCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the wicket code.
|
||||
/// </summary>
|
||||
/// <value>The wicket code.</value>
|
||||
[DisplayName("Code Guichet")]
|
||||
[YaStringLength(5)]
|
||||
public string WicketCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the account number.
|
||||
/// </summary>
|
||||
/// <value>The account number.</value>
|
||||
[DisplayName("Numéro de compte")]
|
||||
[YaStringLength(15)]
|
||||
public string AccountNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the banked key.
|
||||
/// </summary>
|
||||
/// <value>The banked key.</value>
|
||||
[DisplayName("Clé RIB")]
|
||||
public int BankedKey { get; set; }
|
||||
|
||||
public virtual ApplicationUser User { get; set; }
|
||||
|
||||
public string UserId { get; set; }
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj==null) return false;
|
||||
if (! typeof(BankIdentity).IsAssignableFrom(obj.GetType())) return false;
|
||||
BankIdentity tobj = (BankIdentity)obj;
|
||||
return tobj.IBAN == IBAN &&
|
||||
tobj.BIC == BIC &&
|
||||
tobj.AccountNumber == AccountNumber &&
|
||||
tobj.BankedKey == BankedKey;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Yavsc.Models.Billing
|
||||
{
|
||||
using Yavsc.Billing;
|
||||
|
||||
public class CommandLine : ICommandLine {
|
||||
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
[Required,MaxLength(256)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required,MaxLength(512)]
|
||||
public string Description { get; set; }
|
||||
|
||||
[Display(Name="Nombre")]
|
||||
public int Count { get; set; } = 1;
|
||||
|
||||
[DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal UnitaryCost { get; set; }
|
||||
|
||||
public long EstimateId { get; set; }
|
||||
|
||||
[JsonIgnore,NotMapped,ForeignKey("EstimateId")]
|
||||
virtual public Estimate Estimate { get; set; }
|
||||
|
||||
public string Currency
|
||||
{
|
||||
get;
|
||||
|
||||
set;
|
||||
} = "EUR";
|
||||
|
||||
[NotMapped]
|
||||
public string Reference {
|
||||
get {
|
||||
return "CL/"+this.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
using Yavsc.Models.Market;
|
||||
|
||||
namespace Yavsc.Models.Billing
|
||||
{
|
||||
public class ServiceContract<P> where P : Service
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
|
||||
namespace Yavsc.Models.Billing
|
||||
{
|
||||
using Models.Workflow;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public partial class Estimate : IEstimate
|
||||
{
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
public long? CommandId { get; set; }
|
||||
/// <summary>
|
||||
/// A command is not required to create
|
||||
/// an estimate,
|
||||
/// it will result in a new estimate template
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[ForeignKey("CommandId"),JsonIgnore]
|
||||
public RdvQuery Query { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
[InverseProperty("Estimate")]
|
||||
public virtual List<CommandLine> Bill { get; set; }
|
||||
/// <summary>
|
||||
/// List of attached graphic files
|
||||
/// to this estimate, as relative pathes to
|
||||
/// the command performer's root path.
|
||||
/// In db, they are separated by <c>:</c>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[NotMapped]
|
||||
public List<string> AttachedGraphics { get; set; }
|
||||
|
||||
public string AttachedGraphicsString
|
||||
{
|
||||
get { return string.Join(":", AttachedGraphics); }
|
||||
set { AttachedGraphics = value.Split(':').ToList(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// List of attached files
|
||||
/// to this estimate, as relative pathes to
|
||||
/// the command performer's root path.
|
||||
/// In db, they are separated by <c>:</c>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[NotMapped]
|
||||
public List<string> AttachedFiles { get; set; }
|
||||
public string AttachedFilesString
|
||||
{
|
||||
get { return string.Join(":", AttachedFiles); }
|
||||
set { AttachedFiles = value.Split(':').ToList(); }
|
||||
}
|
||||
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
[ForeignKey("OwnerId"),JsonIgnore]
|
||||
public virtual PerformerProfile Owner { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ClientId { get; set; }
|
||||
[ForeignKey("ClientId"),JsonIgnore]
|
||||
public virtual ApplicationUser Client { get; set; }
|
||||
|
||||
[Required]
|
||||
public string CommandType
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public DateTime ProviderValidationDate { get; set; }
|
||||
public DateTime ClientValidationDate { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models.Billing
|
||||
{
|
||||
public partial class EstimateTemplate
|
||||
{
|
||||
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Title { get; set; }
|
||||
public List<CommandLine> Bill { get; set; }
|
||||
|
||||
[Required]
|
||||
public string OwnerId { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using Yavsc.Attributes.Validation;
|
||||
|
||||
namespace Yavsc.Models.Billing
|
||||
{
|
||||
public class ExceptionSIREN {
|
||||
|
||||
[Key, YaStringLength(9, 9)]
|
||||
public string SIREN { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
using Yavsc.Billing;
|
||||
|
||||
namespace Yavsc.Models.Billing {
|
||||
public class FixedImpacter : IBillingImpacter
|
||||
{
|
||||
public decimal ImpactedValue { get; set; }
|
||||
public FixedImpacter (decimal impact)
|
||||
{
|
||||
ImpactedValue = impact;
|
||||
}
|
||||
public decimal Impact(decimal orgValue)
|
||||
{
|
||||
return orgValue + ImpactedValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models.Billing
|
||||
{
|
||||
using Newtonsoft.Json;
|
||||
using Workflow;
|
||||
using Yavsc.Models.Payment;
|
||||
using Yavsc;
|
||||
using Yavsc.Billing;
|
||||
using Yavsc.Abstract.Workflow;
|
||||
using Yavsc.Services;
|
||||
|
||||
public abstract class NominativeServiceCommand : IDecidableQuery, IIdentified<long>, IBillable
|
||||
{
|
||||
public string GetInvoiceId() { return GetType().Name + "/" + Id; }
|
||||
|
||||
public abstract long Id { get; set; }
|
||||
public abstract string Description { get; set; }
|
||||
|
||||
[Required()]
|
||||
public bool Consent { get; set; }
|
||||
public DateTime DateCreated
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public DateTime DateModified
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string UserCreated
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string UserModified
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[DisplayAttribute(Name="Status de la requête")]
|
||||
public QueryStatus Status { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ClientId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The client
|
||||
/// </summary>
|
||||
[ForeignKey("ClientId"),Display(Name="Client")]
|
||||
public ApplicationUser Client { get; set; }
|
||||
|
||||
[Required]
|
||||
public string PerformerId { get; set; }
|
||||
/// <summary>
|
||||
/// The performer identifier
|
||||
/// </summary>
|
||||
[ForeignKey("PerformerId"),Display(Name="Préstataire")]
|
||||
public PerformerProfile PerformerProfile { get; set; }
|
||||
|
||||
public DateTime? ValidationDate {get; set;}
|
||||
|
||||
|
||||
[Display(Name="Previsional")]
|
||||
public decimal? Previsional { get; set; }
|
||||
/// <summary>
|
||||
/// The bill
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
[Required]
|
||||
public string ActivityCode { get; set; }
|
||||
|
||||
[ForeignKey("ActivityCode"),JsonIgnore,Display(Name="Domaine d'activité")]
|
||||
public virtual Activity Context { get; set ; }
|
||||
|
||||
public bool Decided { get; set; }
|
||||
|
||||
|
||||
public abstract System.Collections.Generic.List<IBillItem> GetBillItems();
|
||||
|
||||
public bool GetIsAcquitted()
|
||||
{
|
||||
return Regularisation?.IsOk() ?? false;
|
||||
}
|
||||
|
||||
public string GetFileBaseName(IBillingService billingService)
|
||||
{
|
||||
string type = GetType().Name;
|
||||
string ack = GetIsAcquitted() ? "-ack" : null;
|
||||
var bcode = billingService.BillingMap[type];
|
||||
return $"facture-{bcode}-{Id}{ack}";
|
||||
}
|
||||
|
||||
[ForeignKey("Regularisation")]
|
||||
|
||||
public string? PaymentId { get; set; }
|
||||
|
||||
[Display(Name = "Acquittement de la facture")]
|
||||
public virtual PayPalPayment Regularisation { get; set; }
|
||||
public bool Accepted { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
using Yavsc.Billing;
|
||||
|
||||
namespace Yavsc.Models.Billing {
|
||||
public class ProportionalImpacter : IBillingImpacter
|
||||
{
|
||||
public decimal K { get; set; }
|
||||
public decimal Impact(decimal orgValue)
|
||||
{
|
||||
return orgValue * K;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Yavsc.Billing;
|
||||
|
||||
namespace Yavsc.Models.Billing {
|
||||
|
||||
public class ReductionCode : IBillingClause
|
||||
{
|
||||
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
public ReductionCode(string descr, decimal impact) {
|
||||
Description = descr;
|
||||
impacter = new FixedImpacter(impact);
|
||||
}
|
||||
public string Description
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
IBillingImpacter impacter;
|
||||
public IBillingImpacter Impacter
|
||||
{
|
||||
get
|
||||
{
|
||||
return impacter ;
|
||||
}
|
||||
private set {
|
||||
impacter = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
|
||||
|
||||
class ChatBilling {
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Yavsc.Models.Billing
|
||||
{
|
||||
public partial class histoestim
|
||||
{
|
||||
public long _id { get; set; }
|
||||
public string applicationname { get; set; }
|
||||
public DateTime datechange { get; set; }
|
||||
public long estid { get; set; }
|
||||
public int? status { get; set; }
|
||||
public string username { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Yavsc;
|
||||
using Yavsc.Abstract.Identity;
|
||||
using Yavsc.Abstract.Identity.Security;
|
||||
using Yavsc.Attributes.Validation;
|
||||
using Yavsc.Interfaces;
|
||||
using Yavsc.Models.Access;
|
||||
using Yavsc.Models.Relationship;
|
||||
using Yavsc.ViewModels.Blog;
|
||||
|
||||
namespace Yavsc.Models.Blog
|
||||
{
|
||||
public class BlogPost : BlogPostBase,
|
||||
IBlogPost, ICircleAuthorized, ITaggable<long>
|
||||
{
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Display(Name="Identifiant du post")]
|
||||
public long Id { get; set; }
|
||||
|
||||
[Display(Name="Identifiant de l'auteur")]
|
||||
[ForeignKey("Author")]
|
||||
public string? AuthorId { get; set; }
|
||||
|
||||
[Display(Name="Auteur")]
|
||||
public virtual ApplicationUser? Author { set; get; }
|
||||
|
||||
|
||||
[Display(Name="Date de création")]
|
||||
public DateTime DateCreated
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[Display(Name="Créateur")]
|
||||
public string? UserCreated
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[Display(Name="Dernière modification")]
|
||||
public DateTime DateModified
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[Display(Name="Utilisateur ayant modifé le dernier")]
|
||||
public string? UserModified
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public bool AuthorizeCircle(long circleId)
|
||||
{
|
||||
return ACL?.Any( i=>i.CircleId == circleId) ?? true;
|
||||
}
|
||||
|
||||
public ICircleAuthorization[] GetACL()
|
||||
{
|
||||
return ACL.ToArray();
|
||||
}
|
||||
|
||||
public void Tag(Tag tag)
|
||||
{
|
||||
var existent = Tags.SingleOrDefault(t => t.PostId == Id && t.TagId == tag.Id);
|
||||
if (existent==null) Tags.Add(new BlogTag { PostId = Id, Tag = tag } );
|
||||
}
|
||||
|
||||
public void DeTag(Tag tag)
|
||||
{
|
||||
var existent = Tags.SingleOrDefault(t => (( t.TagId == tag.Id) && t.PostId == Id));
|
||||
if (existent!=null) Tags.Remove(existent);
|
||||
}
|
||||
|
||||
public string[] GetTags()
|
||||
{
|
||||
return Tags.Select(t=>t.Tag.Name).ToArray();
|
||||
}
|
||||
|
||||
[InverseProperty("Post")]
|
||||
public virtual List<BlogTag> Tags { get; set; }
|
||||
|
||||
[InverseProperty("Post")]
|
||||
public virtual List<Comment> Comments { get; set; }
|
||||
|
||||
IApplicationUser IBlogPost.Author { get => this.Author; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Yavsc.Models.Relationship;
|
||||
|
||||
namespace Yavsc.Models.Blog
|
||||
{
|
||||
public partial class BlogTag
|
||||
{
|
||||
[ForeignKey("PostId")]
|
||||
public virtual BlogPost Post { get; set; }
|
||||
public long PostId { get; set; }
|
||||
|
||||
[ForeignKey("TagId")]
|
||||
public virtual Tag Tag{ get; set; }
|
||||
public long TagId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Yavsc.Models.Blog;
|
||||
|
||||
namespace Yavsc.Models
|
||||
{
|
||||
public class BlogSpotPublication
|
||||
{
|
||||
[Key]
|
||||
public long BlogpostId { get; set; }
|
||||
|
||||
[ForeignKey("BlogpostId")]
|
||||
public virtual BlogPost BlogPost{ get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Newtonsoft.Json;
|
||||
using Yavsc.Attributes.Validation;
|
||||
using Yavsc.Interfaces;
|
||||
|
||||
namespace Yavsc.Models.Blog
|
||||
{
|
||||
public class Comment : IComment<long>, ITrackedEntity
|
||||
{
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
[YaStringLength(1024)]
|
||||
public string Content { get; set; }
|
||||
|
||||
[ForeignKeyAttribute(nameof(ReceiverId))][JsonIgnore]
|
||||
public virtual BlogPost Post { get; set; }
|
||||
|
||||
[Required]
|
||||
public long ReceiverId { get; set; }
|
||||
public bool Visible { get; set; }
|
||||
|
||||
[ForeignKeyAttribute("AuthorId")][JsonIgnore]
|
||||
public virtual ApplicationUser Author {
|
||||
get; set;
|
||||
}
|
||||
|
||||
[Required]
|
||||
public string AuthorId
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string UserCreated { get => AuthorId; set => AuthorId=value; }
|
||||
|
||||
public DateTime DateModified
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string UserModified
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public DateTime DateCreated
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public long? ParentId { get; set; }
|
||||
|
||||
[ForeignKeyAttribute("ParentId")]
|
||||
public virtual Comment? Parent { get; set; }
|
||||
|
||||
[InversePropertyAttribute("Parent")]
|
||||
|
||||
public virtual List<Comment> Children { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
using Yavsc.Models.Calendar;
|
||||
|
||||
namespace Yavsc.Server.Models.Calendar
|
||||
{
|
||||
public class Availability : List<Period>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
//
|
||||
// Period.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;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Server.Models.Calendar
|
||||
{
|
||||
/// <summary>
|
||||
/// Hollydays.
|
||||
/// </summary>
|
||||
public class Period {
|
||||
/// <summary>
|
||||
/// Gets or sets the start.
|
||||
/// </summary>
|
||||
/// <value>The start.</value>
|
||||
[Required,Display(Name="Début")]
|
||||
public DateTime Start { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the end.
|
||||
/// </summary>
|
||||
/// <value>The end.</value>
|
||||
[Required,Display(Name="Fin")]
|
||||
public DateTime End { get; set; }
|
||||
|
||||
public static Period operator ^ (Period foo, Period bar) {
|
||||
var min = ( DateTime.Compare(foo.Start, bar.Start) > 0 ) ? foo.Start : bar.Start;
|
||||
var max = ( DateTime.Compare(bar.End, foo.End) > 0 ) ? foo.End : bar.End;
|
||||
if (DateTime.Compare(max, min)>0) return new Period { Start = min, End = max };
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
//
|
||||
// Periodicity.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/>.
|
||||
|
||||
namespace Yavsc.Server.Models.Calendar
|
||||
{
|
||||
/// <summary>
|
||||
/// Periodicity.
|
||||
/// </summary>
|
||||
public enum Periodicity {
|
||||
|
||||
/// <summary>
|
||||
/// On Demand.
|
||||
/// </summary>
|
||||
OnDemand=-1,
|
||||
/// <summary>
|
||||
/// The daily.
|
||||
/// </summary>
|
||||
Daily,
|
||||
/// <summary>
|
||||
/// The weekly.
|
||||
/// </summary>
|
||||
Weekly,
|
||||
/// <summary>
|
||||
/// The monthly.
|
||||
/// </summary>
|
||||
Monthly,
|
||||
/// <summary>
|
||||
/// The three m.
|
||||
/// </summary>
|
||||
ThreeM,
|
||||
/// <summary>
|
||||
/// The six m.
|
||||
/// </summary>
|
||||
SixM,
|
||||
/// <summary>
|
||||
/// The yearly.
|
||||
/// </summary>
|
||||
Yearly
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
//
|
||||
// PositionAndKeyphrase.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 Yavsc.Models.Relationship;
|
||||
|
||||
namespace Yavsc.Server.Models.Calendar
|
||||
{
|
||||
/// <summary>
|
||||
/// Position and keyphrase.
|
||||
/// </summary>
|
||||
public class PositionAndKeyphrase {
|
||||
/// <summary>
|
||||
/// The phrase.
|
||||
/// </summary>
|
||||
public string phrase;
|
||||
/// <summary>
|
||||
/// The position.
|
||||
/// </summary>
|
||||
public Position pos;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
//
|
||||
// ProvidedEvent.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;
|
||||
using Yavsc.Models.Messaging;
|
||||
using Yavsc.Models.Access;
|
||||
|
||||
namespace Yavsc.Models.Calendar
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Provided event.
|
||||
/// </summary>
|
||||
public class ProvidedEvent : BaseEvent {
|
||||
/// <summary>
|
||||
/// The privacy.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Publishing Privacy;
|
||||
|
||||
public override string CreateBody()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
//
|
||||
// Schedule.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/>.
|
||||
|
||||
//
|
||||
// Calendar.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;
|
||||
|
||||
namespace Yavsc.Models.Calendar
|
||||
{
|
||||
/// <summary>
|
||||
/// Le calendrier, l'emploi du temps.
|
||||
/// </summary>
|
||||
public class Schedule {
|
||||
|
||||
[Key,Required]
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
[ForeignKey("OwnerId")]
|
||||
[Display(Name="Professionnel")]
|
||||
public virtual ApplicationUser Owner { get ; set; }
|
||||
|
||||
public ScheduledEvent [] Events { get ; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
//
|
||||
// ScheduledEvent.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 Yavsc.Server.Models.Calendar;
|
||||
|
||||
namespace Yavsc.Models.Calendar
|
||||
{
|
||||
public class ScheduledEvent : IScheduledEvent
|
||||
{
|
||||
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
public Period Period
|
||||
{
|
||||
get;
|
||||
|
||||
set;
|
||||
}
|
||||
|
||||
public Periodicity Reccurence
|
||||
{
|
||||
get;
|
||||
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
//
|
||||
// WeekDay.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/>.
|
||||
|
||||
namespace Yavsc.Models.Calendar
|
||||
{
|
||||
/// <summary>
|
||||
/// Week day.
|
||||
/// </summary>
|
||||
public enum WeekDay:int {
|
||||
/// <summary>
|
||||
/// The monday (0).
|
||||
/// </summary>
|
||||
Monday=0,
|
||||
/// <summary>
|
||||
/// The tuesday.
|
||||
/// </summary>
|
||||
Tuesday,
|
||||
/// <summary>
|
||||
/// The wednesday.
|
||||
/// </summary>
|
||||
Wednesday,
|
||||
/// <summary>
|
||||
/// The thursday.
|
||||
/// </summary>
|
||||
Thursday,
|
||||
/// <summary>
|
||||
/// The friday.
|
||||
/// </summary>
|
||||
Friday,
|
||||
/// <summary>
|
||||
/// The saturday.
|
||||
/// </summary>
|
||||
Saturday,
|
||||
/// <summary>
|
||||
/// The sunday.
|
||||
/// </summary>
|
||||
Sunday
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
//
|
||||
// Connection.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 Newtonsoft.Json;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models.Chat
|
||||
{
|
||||
public class ChatConnection
|
||||
{
|
||||
[Required]
|
||||
public string ApplicationUserId { get; set; }
|
||||
|
||||
[ForeignKey("ApplicationUserId"),JsonIgnore]
|
||||
public virtual ApplicationUser Owner { get; set; }
|
||||
|
||||
[Key]
|
||||
public string ConnectionId { get; set; }
|
||||
|
||||
public string UserAgent { get; set; }
|
||||
|
||||
public bool Connected { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Newtonsoft.Json;
|
||||
using Yavsc.Abstract.Chat;
|
||||
using Yavsc.Attributes.Validation;
|
||||
|
||||
namespace Yavsc.Models.Chat
|
||||
{
|
||||
public class ChatRoom: IChatRoom<ChatRoomAccess>, ITrackedEntity
|
||||
{
|
||||
public string Topic { get; set; }
|
||||
|
||||
[Key]
|
||||
[YaStringLength(ChatHubConstants.MaxChanelName, MinimumLength=3)]
|
||||
public string Name { get; set;}
|
||||
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
[ForeignKey("OwnerId")][JsonIgnore]
|
||||
public virtual ApplicationUser Owner { get; set; }
|
||||
|
||||
[InverseProperty("Room")][JsonIgnore]
|
||||
public virtual List<ChatRoomAccess> Moderation { get; set; }
|
||||
public DateTime LatestJoinPart { get; set;}
|
||||
|
||||
public DateTime DateCreated { get; set; }
|
||||
|
||||
public string UserCreated { get; set; }
|
||||
public DateTime DateModified { get; set;}
|
||||
public string UserModified { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Yavsc.Abstract.Chat;
|
||||
|
||||
namespace Yavsc.Models.Chat
|
||||
{
|
||||
public class ChatRoomAccess: IChatRoomAccess
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string ChannelName { get; set; }
|
||||
[ForeignKey("ChannelName")]
|
||||
public virtual ChatRoom Room { get; set; }
|
||||
|
||||
[Required]
|
||||
public string UserId { get; set; }
|
||||
|
||||
public ChatRoomAccessLevel Level
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
public virtual ApplicationUser User { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
namespace Yavsc
|
||||
{
|
||||
public class ConsentOptions
|
||||
{
|
||||
public static bool EnableOfflineAccess = true;
|
||||
public static string OfflineAccessDisplayName = "Offline Access";
|
||||
public static string OfflineAccessDescription = "Access to your applications and resources, even when you are offline";
|
||||
|
||||
public static readonly string MustChooseOneErrorMessage = "You must pick at least one permission";
|
||||
public static readonly string InvalidSelectionErrorMessage = "Invalid selection";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Cratie.AName
|
||||
{
|
||||
public class NameSubmission : Submission
|
||||
{
|
||||
[RegularExpression(@"[a-zA-Z]+", ErrorMessage = "Nom invalide (seules les lettres de l'alphabet sont autorisées).", ErrorMessageResourceName = "EInvalidName")]
|
||||
|
||||
public string FirstChoice {get; set;}
|
||||
[RegularExpression(@"[a-zA-Z]+", ErrorMessage = "Nom invalide (seules les lettres de l'alphabet sont autorisées).", ErrorMessageResourceName = "EInvalidName")]
|
||||
public string SecondChoice {get; set;}
|
||||
[RegularExpression(@"[a-zA-Z]+", ErrorMessage = "Nom invalide (seules les lettres de l'alphabet sont autorisées).", ErrorMessageResourceName = "EInvalidName")]
|
||||
public string ThirdChoice {get; set;}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Yavsc.Models.Cratie
|
||||
{
|
||||
public class Option: ITrackedEntity
|
||||
{
|
||||
public string CodeScrutin { get; set; }
|
||||
public string Code { get; set ; }
|
||||
public string Description { get; set; }
|
||||
public DateTime DateCreated { get ; set ; }
|
||||
public string UserCreated { get ; set ; }
|
||||
public DateTime DateModified { get ; set ; }
|
||||
public string UserModified { get ; set ; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Cratie
|
||||
{
|
||||
public class Scrutin : ITrackedEntity
|
||||
{
|
||||
[Key]
|
||||
public string Code { get; set ; }
|
||||
public string Description { get ; set ; }
|
||||
public DateTime DateCreated { get; set; }
|
||||
public string UserCreated { get; set; }
|
||||
public DateTime DateModified { get; set; }
|
||||
public string UserModified { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models.Cratie
|
||||
{
|
||||
public class Submission
|
||||
{
|
||||
[ForeignKey("CodeScrutin")]
|
||||
public virtual Scrutin Context { get; set; }
|
||||
public string CodeScrutin { get; set ; }
|
||||
|
||||
[ForeignKey("CodeOption")]
|
||||
public virtual Option Choice { get; set; }
|
||||
public string CodeOption { get; set; }
|
||||
|
||||
[ForeignKey("AuthorId")]
|
||||
public virtual ApplicationUser Author { get; set; }
|
||||
public string AuthorId { get ; set ;}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
//
|
||||
// Color.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;
|
||||
|
||||
namespace Yavsc.Models.Drawing
|
||||
{
|
||||
public class Color
|
||||
{
|
||||
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
public Color(){
|
||||
|
||||
}
|
||||
public Color(Color c)
|
||||
{
|
||||
Red=c.Red;
|
||||
Green=c.Green;
|
||||
Blue=c.Blue;
|
||||
Name=c.Name;
|
||||
}
|
||||
public byte Red {get;set;}
|
||||
public byte Green {get;set;}
|
||||
public byte Blue {get;set;}
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using RazorEngine.Templating;
|
||||
using Yavsc.Attributes.Validation;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Calendar;
|
||||
using Yavsc.Server.Models.Calendar;
|
||||
|
||||
namespace Yavsc.Server.Models.EMailing
|
||||
{
|
||||
public class MailingTemplate : ITrackedEntity, ITemplateSource
|
||||
{
|
||||
/// <summary>
|
||||
/// Date Created
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DateTime DateCreated
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public DateTime DateModified
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Key][YaStringLength(3, 256)]
|
||||
public string Id { get; set; }
|
||||
|
||||
[YaStringLength(3, 256)]
|
||||
public string Topic { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Markdown template to process
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[MaxLength(64*1024)]
|
||||
public string Body { get; set; }
|
||||
|
||||
[EmailAddress()]
|
||||
public string ReplyToAddress { get; set; }
|
||||
|
||||
public Periodicity ToSend { get; set; }
|
||||
|
||||
public string UserCreated
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string UserModified
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string Template => Body;
|
||||
public string TemplateFile { get => Id; }
|
||||
|
||||
public TextReader GetTemplateReader()
|
||||
{
|
||||
return new StringReader(Body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
|
||||
//
|
||||
// IDocument.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;
|
||||
|
||||
namespace Yavsc.Models {
|
||||
|
||||
public class Parameter {
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
[Obsolete("Templates are ala Razor")]
|
||||
public interface IDocument {
|
||||
string Template { get; set; }
|
||||
Parameter [] Parameters { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
namespace Yavsc.Models;
|
||||
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
//
|
||||
// FileRecievedInfo.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 Yavsc.Abstract.FileSystem;
|
||||
|
||||
namespace Yavsc.Models.FileSystem
|
||||
{
|
||||
public class FileReceivedInfo : IFileReceivedInfo
|
||||
{
|
||||
public FileReceivedInfo(string destDir, string fileName, bool quotaOffense=false)
|
||||
{
|
||||
this.DestDir = destDir;
|
||||
this.FileName = fileName;
|
||||
this.QuotaOffense = quotaOffense;
|
||||
}
|
||||
public static FileReceivedInfo FromPath(string filePath)
|
||||
{
|
||||
FileInfo fi = new FileInfo(filePath);
|
||||
return new FileReceivedInfo(
|
||||
fi.Directory.FullName,
|
||||
fi.Name
|
||||
);
|
||||
}
|
||||
|
||||
public string DestDir { get; set; }
|
||||
|
||||
public string FileName { get; set; }
|
||||
public bool Overridden { get; set; }
|
||||
|
||||
public bool QuotaOffense { get; set; }
|
||||
public string FullName { get => Path.Combine(DestDir, FileName); }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
|
||||
using System.IO;
|
||||
using System.Net.Mime;
|
||||
|
||||
namespace Yavsc.Server.Model
|
||||
{
|
||||
public class FormFile
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
string contentDispositionString;
|
||||
public string ContentDisposition { get {
|
||||
return contentDispositionString;
|
||||
} set {
|
||||
ContentDisposition contentDisposition = new ContentDisposition(value);
|
||||
Name = contentDisposition.FileName;
|
||||
contentDispositionString = value;
|
||||
} }
|
||||
|
||||
public string ContentType { get; set; }
|
||||
|
||||
public string FilePath { get; set; }
|
||||
|
||||
public Stream Stream { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Forms
|
||||
{
|
||||
|
||||
public class Form
|
||||
{
|
||||
[Key]
|
||||
public string Id {get; set;}
|
||||
public string Summary { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Forms.Validation
|
||||
{
|
||||
public class Method
|
||||
{
|
||||
[Key]
|
||||
public string Name {get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// TODO localisation ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Required]
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
namespace Yavsc.Models.Forms.Validation
|
||||
{
|
||||
public class Required : Method
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,175 +0,0 @@
|
|||
|
||||
//
|
||||
// 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 : IUserSettings
|
||||
{
|
||||
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; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public enum HairCutGenders : int
|
||||
{
|
||||
[Display(Name="Femme")]
|
||||
Women,
|
||||
|
||||
[Display(Name="Homme")]
|
||||
Man,
|
||||
|
||||
[Display(Name="Enfant")]
|
||||
Kid
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
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; }
|
||||
|
||||
readonly HairCutQuery query;
|
||||
|
||||
private readonly string invoiceId;
|
||||
private readonly string payerName;
|
||||
private readonly string phone;
|
||||
private readonly string payerEmail;
|
||||
private readonly string amount;
|
||||
private readonly HairCutGenders gender;
|
||||
private readonly string date;
|
||||
private readonly string lieu;
|
||||
private readonly string clientFinal;
|
||||
private readonly string token;
|
||||
private readonly 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,419 +0,0 @@
|
|||
|
||||
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 System.Linq;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Yavsc.ViewModels.PayPal;
|
||||
using Yavsc.Models.HairCut;
|
||||
using Yavsc.Abstract.Identity;
|
||||
using Yavsc.Attributes.Validation;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public class HairCutQuery : NominativeServiceCommand
|
||||
{
|
||||
|
||||
// Bill description
|
||||
string _description = null;
|
||||
public override string Description
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
|
||||
[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"), YaStringLength(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.GlobalLocalizer[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 + 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 = Description;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
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.GlobalLocalizer["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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public enum HairDressings {
|
||||
|
||||
Coiffage,
|
||||
|
||||
Brushing,
|
||||
|
||||
[Display(Name="Mise en plis")]
|
||||
Folding
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public enum HairLength : int
|
||||
{
|
||||
HalfLong=0,
|
||||
Short=1,
|
||||
|
||||
Long=2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
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
|
||||
string _customDescription = null;
|
||||
public override string Description
|
||||
{
|
||||
get {
|
||||
return _customDescription ?? "Prestation en coiffure à domicile [commande groupée]" ;
|
||||
}
|
||||
set {
|
||||
_customDescription = value;
|
||||
}
|
||||
}
|
||||
|
||||
[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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
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;}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
|
||||
//
|
||||
// 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.Abstract.Identity;
|
||||
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.Email, 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.Email, 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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using Yavsc.Abstract.IT;
|
||||
using Yavsc.Attributes.Validation;
|
||||
using Yavsc.Billing;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Server.Models.IT.SourceCode;
|
||||
|
||||
namespace Yavsc.Server.Models.IT
|
||||
{
|
||||
public class Project : NominativeServiceCommand, IProject
|
||||
{
|
||||
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public override long Id { get; set; }
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This field is something like a key,
|
||||
/// since it is required non null,
|
||||
/// and is the key of the foreign GitRepositoryReference entity.
|
||||
///
|
||||
/// As a side effect, there's no project without valid git reference in db.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[YaRequired]
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Version { get; set; }
|
||||
|
||||
[InverseProperty("TargetProject")]
|
||||
public virtual List<ProjectBuildConfiguration> Configurations { get; set; }
|
||||
|
||||
|
||||
[YaRequired]
|
||||
public long GitId { get; set; }
|
||||
|
||||
[ForeignKey("GitId")]
|
||||
public virtual GitRepositoryReference Repository { get; set; }
|
||||
|
||||
readonly List<IBillItem> bill = new List<IBillItem>();
|
||||
public void AddBillItem(IBillItem item)
|
||||
{
|
||||
bill.Add(item);
|
||||
|
||||
}
|
||||
public override List<IBillItem> GetBillItems()
|
||||
{
|
||||
return bill;
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetConfigurations()
|
||||
{
|
||||
return Configurations.Select(c => c.Name);
|
||||
}
|
||||
|
||||
string description;
|
||||
public override string Description
|
||||
{
|
||||
get { return description; }
|
||||
set { description = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Yavsc.Attributes.Validation;
|
||||
|
||||
namespace Yavsc.Server.Models.IT
|
||||
{
|
||||
public class ProjectBuildConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// A Numerical Id
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
[YaRequired]
|
||||
public string Name { get; set; }
|
||||
|
||||
public long ProjectId { get; set; }
|
||||
|
||||
[ForeignKey("ProjectId")]
|
||||
public virtual Project TargetProject { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using System;
|
||||
using Yavsc.Abstract.Interfaces;
|
||||
|
||||
namespace Yavsc.Server.Models.IT.SourceCode
|
||||
{
|
||||
public abstract class Batch<TInput> : IBatch<TInput, bool>
|
||||
{
|
||||
public string WorkingDir { get; set; }
|
||||
public string LogPath { get; set; }
|
||||
public Action<bool> ResultHandler { get; private set; }
|
||||
public string []Args { get; set; }
|
||||
public abstract void Launch(TInput Input);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
// // GitClone.cs
|
||||
// /*
|
||||
// paul 21/06/2018 11:27 20182018 6 21
|
||||
// */
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
namespace Yavsc.Server.Models.IT.SourceCode
|
||||
{
|
||||
public class GitClone : SingleCmdProjectBatch
|
||||
{
|
||||
|
||||
public GitClone(string repo) : base(repo,"git")
|
||||
{
|
||||
|
||||
}
|
||||
public override void Launch(Project input)
|
||||
{
|
||||
if (input==null) throw new ArgumentNullException("input");
|
||||
LogPath = $"{input.Name}.git-clone.ansi.log";
|
||||
// TODO honor Args property
|
||||
// Model annotations => input.Repository!=null => input.Name == input.Repository.Path
|
||||
var prjPath = Path.Combine(WorkingDir, input.Name);
|
||||
var repoInfo = new DirectoryInfo(prjPath);
|
||||
var gitCmd = repoInfo.Exists ? "pull" : "clone --depth=1";
|
||||
|
||||
var cloneStart = new ProcessStartInfo
|
||||
( _cmdPath, $"{gitCmd} {input.Repository.Url} {input.Repository.Path}" )
|
||||
{
|
||||
WorkingDirectory = WorkingDir,
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false
|
||||
};
|
||||
// TODO make `.ansi.log` a defined constant.
|
||||
var logFile = new FileInfo
|
||||
( Path.Combine
|
||||
( _repositoryRootPath, $"{input.Name}.ansi.log" ));
|
||||
using (var stream = logFile.Create())
|
||||
using (var writer = new StreamWriter(stream))
|
||||
{
|
||||
var process = Process.Start(cloneStart);
|
||||
// TODO publish the starting log url ...
|
||||
while (!process.HasExited)
|
||||
{
|
||||
if (process.StandardOutput.Peek() > -1)
|
||||
writer.WriteLine(process.StandardOutput.ReadLine());
|
||||
}
|
||||
}
|
||||
ResultHandler?.Invoke(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Yavsc.Attributes.Validation;
|
||||
using Yavsc.Models;
|
||||
|
||||
namespace Yavsc.Server.Models.IT.SourceCode
|
||||
{
|
||||
public class GitRepositoryReference
|
||||
{
|
||||
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
[YaRequired]
|
||||
public string Path { get; set; }
|
||||
|
||||
[YaStringLength(2048)]
|
||||
public string Url { get; set; }
|
||||
|
||||
[YaStringLength(512)]
|
||||
public string Branch { get; set; }
|
||||
|
||||
[YaStringLength(1024)]
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
[ForeignKey("OwnerId")]
|
||||
public virtual ApplicationUser Owner { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[Git ref {Path} {Branch} {Url}]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace Yavsc.Server.Models.IT.SourceCode
|
||||
{
|
||||
public class ProjectBuild : SingleCmdProjectBatch
|
||||
{
|
||||
public ProjectBuild(string repoRoot): base(repoRoot, "make")
|
||||
{
|
||||
}
|
||||
|
||||
public override void Launch(Project input)
|
||||
{
|
||||
if (input==null) throw new ArgumentNullException("input");
|
||||
LogPath = $"{input.Name}.{_cmdPath}.ansi.log";
|
||||
|
||||
// TODO honor Args property
|
||||
// Model annotations => input.Repository!=null => input.Name == input.Repository.Path
|
||||
var prjPath = Path.Combine(WorkingDir, input.Name);
|
||||
var repoInfo = new DirectoryInfo(prjPath);
|
||||
var makeStart = CreateStartInfo(prjPath);
|
||||
|
||||
var args = string.Join(" ", Args);
|
||||
|
||||
// TODO make `.ansi.log` a defined constant.
|
||||
var logFile = new FileInfo(Path.Combine(_repositoryRootPath, LogPath));
|
||||
using (var stream = logFile.Create())
|
||||
using (var writer = new StreamWriter(stream))
|
||||
{
|
||||
var process = Process.Start(makeStart);
|
||||
// TODO announce ...
|
||||
while (!process.HasExited)
|
||||
{
|
||||
if (process.StandardOutput.Peek() > -1)
|
||||
writer.WriteLine(process.StandardOutput.ReadLine());
|
||||
}
|
||||
}
|
||||
ResultHandler?.Invoke(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace Yavsc.Server.Models.IT.SourceCode
|
||||
{
|
||||
public abstract class SingleCmdProjectBatch : Batch<Project>
|
||||
{
|
||||
protected string _repositoryRootPath;
|
||||
protected string _cmdPath ;
|
||||
public SingleCmdProjectBatch (string repoRoot, string cmdPath)
|
||||
{
|
||||
_cmdPath = cmdPath;
|
||||
_repositoryRootPath = repoRoot;
|
||||
WorkingDir = _repositoryRootPath;
|
||||
var fie = new DirectoryInfo(WorkingDir);
|
||||
if (!fie.Exists)
|
||||
throw new Exception ($"This directory doesn't exist: {WorkingDir},\nand cannot be used as a repository.");
|
||||
}
|
||||
|
||||
public ProcessStartInfo CreateStartInfo(string workingDir)
|
||||
{
|
||||
var args = string.Join(" ", Args);
|
||||
var info = new ProcessStartInfo
|
||||
( _cmdPath, args )
|
||||
{
|
||||
WorkingDirectory = workingDir ?? WorkingDir,
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false
|
||||
};
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
namespace Yavsc.Models {
|
||||
public interface IUnit<VType> {
|
||||
string Name { get; }
|
||||
bool CanConvertFrom(IUnit<VType> other);
|
||||
VType ConvertFrom (IUnit<VType> other, VType orgValue) ;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
namespace Yavsc.Models.Auth
|
||||
{
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
public class YaIdentityUserLogin
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the login provider for the login (e.g. facebook, google)
|
||||
/// </summary>
|
||||
public virtual string LoginProvider { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique provider identifier for this login.
|
||||
/// </summary>
|
||||
public virtual string ProviderKey { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the friendly name used in a UI for this login.
|
||||
/// </summary>
|
||||
public virtual string? ProviderDisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the primary key of the user associated with this login.
|
||||
/// </summary>
|
||||
public String UserId { get; set; } = default!;
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
public virtual ApplicationUser User { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
|
||||
|
||||
namespace Yavsc.Models.Market
|
||||
{
|
||||
public class BaseProduct
|
||||
{
|
||||
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// A contractual description for this product.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Controls wether this product or service
|
||||
/// may be offered to clients, or simply
|
||||
/// are internal workflow entry point.
|
||||
/// </summary>
|
||||
/// <returns>true when this product belongs to the public catalog.</returns>
|
||||
public bool Public { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Models.Market {
|
||||
|
||||
public class Catalog {
|
||||
public List<Product> Products { get; set; }
|
||||
public List<Service> Services { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Yavsc.Models.Market {
|
||||
/// <summary>
|
||||
/// Not yet used!
|
||||
/// </summary>
|
||||
public class Money : IUnit<decimal>
|
||||
{
|
||||
public Money(string name, decimal euroExchangeRate)
|
||||
{
|
||||
Name = name;
|
||||
EuroExchangeRate = euroExchangeRate;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get; private set ;
|
||||
}
|
||||
|
||||
public decimal EuroExchangeRate
|
||||
{
|
||||
get; private set ;
|
||||
}
|
||||
public bool CanConvertFrom(IUnit<decimal> other)
|
||||
{
|
||||
if (other is Money)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public decimal ConvertFrom(IUnit<decimal> other, decimal orgValue)
|
||||
{
|
||||
if (other is Money) {
|
||||
var om = other as Money;
|
||||
return orgValue * om.EuroExchangeRate / EuroExchangeRate;
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models.Market
|
||||
{
|
||||
public class Product : BaseProduct
|
||||
{
|
||||
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Weight in gram
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public decimal Weight { get; set; }
|
||||
/// <summary>
|
||||
/// Height in meter
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public decimal Height { get; set; }
|
||||
/// <summary>
|
||||
/// Width in meter
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public decimal Width { get; set; }
|
||||
public decimal Depth { get; set; }
|
||||
/// <summary>
|
||||
/// In euro
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public decimal? Price { get; set; }
|
||||
|
||||
// TODO make use of public Money Money { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models.Market {
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Workflow;
|
||||
using Yavsc.Models.Billing;
|
||||
|
||||
public class Service : BaseProduct
|
||||
{
|
||||
/// <summary>
|
||||
/// An unique product identifier.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Key(),DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
public string ContextId { get; set; }
|
||||
[ForeignKey("ContextId")]
|
||||
public virtual Activity Context { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of billing clause,
|
||||
/// associated to this service,
|
||||
/// that defines the transformation rules
|
||||
/// to take in account during the transformation
|
||||
/// of a corresponding prestation to an amount to pay.
|
||||
/// This property is built at constructing a new instance
|
||||
/// and is not mapped in database.
|
||||
/// For the moment, it's hard coded only.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
[NotMapped]
|
||||
public List<IBillingClause> Billing { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Yavsc.Interfaces;
|
||||
|
||||
namespace Yavsc.Models.Messaging
|
||||
{
|
||||
|
||||
public class Announce : BaseEvent, IAnnounce, IOwned
|
||||
{
|
||||
public Reason For { get; set; }
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
[ForeignKey("OwnerId")]
|
||||
public virtual ApplicationUser Owner { get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
public override string CreateBody()
|
||||
{
|
||||
return $"Annonce de {Owner.UserName}: {For}\n\n{Message}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue