refactoring

This commit is contained in:
Paul Schneider 2017-05-02 13:10:23 +02:00
commit 8b5e50626e
40 changed files with 161 additions and 103 deletions

View file

@ -1,10 +0,0 @@
using System;
namespace Yavsc.Interfaces
{
public interface ILifeTime
{
DateTime Modified { get; set; }
DateTime Posted { get; set; }
}
}

View file

@ -1,28 +0,0 @@
//
// ITitle.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Yavsc.Interfaces
{
public interface ITitle
{
string Title { get; set; }
}
}

View file

@ -2,10 +2,9 @@ using Yavsc.Models.Market;
namespace Yavsc.Models.Billing
{
public class ServiceContract<P> where P : Service
{
}
}
}

View file

@ -1,6 +0,0 @@
public interface IBillingImpacter { 
decimal Impact(decimal orgValue);
}

View file

@ -8,6 +8,7 @@ namespace Yavsc.Models.Billing
using Newtonsoft.Json;
using Workflow;
using YavscLib;
using YavscLib.Models.Workflow;
public abstract class NominativeServiceCommand : IBaseTrackedEntity, IQuery
{

View file

@ -8,6 +8,10 @@ namespace Yavsc.Models.Haircut
{
public class BrusherProfile : ISpecializationSettings
{
public BrusherProfile()
{
}
[Key]
public string UserId
{

View file

@ -0,0 +1,65 @@
using System;
namespace YavscLib.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;
}
}
}

View file

@ -0,0 +1,19 @@
namespace YavscLib
{
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; }
}
}

View file

@ -9,7 +9,7 @@ namespace Yavsc.Models.Haircut.Views
public class HaircutQueryProviderInfo : HaircutQueryComonInfo {
public HaircutQueryProviderInfo(HairCutQuery query) : base (query)
{
ClientInfo = new UserInfo(query.Client);
ClientInfo = new UserInfo(query.Client.Id, query.Client.UserName, query.Client.Avatar);
}
public UserInfo ClientInfo { get; set; }
@ -17,9 +17,10 @@ namespace Yavsc.Models.Haircut.Views
public class HaircutQueryClientInfo : HaircutQueryComonInfo {
public HaircutQueryClientInfo(HairCutQuery query) : base (query)
{
ProviderInfo = new UserInfo(query.PerformerProfile.Performer);
var user = query.PerformerProfile.Performer;
ProviderInfo = new UserInfo(user.Id, user.UserName, user.Avatar);
}
public UserInfo ProviderInfo { get; set; }
public UserInfo ProviderInfo { get; set; }
}
public class HaircutQueryComonInfo

View file

@ -2,9 +2,8 @@ using System.Collections.Generic;
namespace Yavsc.Models.Market {
public class Catalog {
public List<Product> Products { get; set; }
public List<Service> Services { get; set; }
}
}
}

View file

@ -3,8 +3,8 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Market {
using System.ComponentModel.DataAnnotations;
using Billing;
using Workflow;
using Yavsc.Models.Billing;
public class Service : BaseProduct
{
@ -14,27 +14,27 @@ namespace Yavsc.Models.Market {
/// <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,
/// 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.
/// and is not mapped in database.
/// For the moment, it's hard coded only.
/// </summary>
/// <returns></returns>
[NotMapped]
public List<IBillingClause> Billing { get; set; }
}
}
}

View file

@ -23,8 +23,8 @@ using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Messaging
{
using Interfaces;
using Interfaces.Workflow;
using YavscLib;
/// <summary>
/// Base event.

View file

@ -1,15 +1,16 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using YavscLib;
namespace Yavsc.Models.Relationship
{
public partial class CircleMember
{
[Required]
public long CircleId { get; set; }
public long CircleId { get; set; }
[ForeignKey("CircleId")]
public virtual Circle Circle { get; set; }

View file

@ -7,7 +7,7 @@ using Newtonsoft.Json;
namespace Yavsc.Models.Workflow
{
using Market;
using Yavsc.Models.Market;
using YavscLib;
public class Activity : IBaseTrackedEntity, IActivity

View file

@ -1,10 +0,0 @@
namespace Yavsc.Models.Workflow
{
using YavscLib;
public interface IQuery: IBaseTrackedEntity
{
QueryStatus Status { get; set; }
}
}

View file

@ -1,8 +0,0 @@
namespace Yavsc.Models
{
public interface IRequisition
{
bool Eval();
}
}

View file

@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Workflow
namespace Yavsc.Models.Workflow
{
using System;
using Models.Relationship;
@ -42,7 +42,7 @@ namespace Yavsc.Models.Workflow
[Display(Name="Active")]
public bool Active { get; set; }
[Obsolete("Implement and use a new specialization setting")]
[Display(Name="Maximal Daily Cost (euro/day)"),DisplayFormat(DataFormatString="{0:C}")]
public int? MaxDailyCost { get; set; }
@ -58,6 +58,6 @@ namespace Yavsc.Models.Workflow
public bool DoesBlog { get {
return Performer?.Posts?.Count > 0 ;
} }
}
}
}

View file

@ -6,6 +6,7 @@ using Yavsc.Models.Market;
namespace Yavsc.Models.Workflow
{
using Models.Relationship;
/// <summary>
/// A date, between two persons
/// </summary>
@ -35,4 +36,4 @@ namespace Yavsc.Models.Workflow
}
}
}

View file

@ -1,21 +0,0 @@
namespace Yavsc.Models.Auth
{
public class UserInfo {
public UserInfo()
{
}
public UserInfo(ApplicationUser user)
{
UserId = user.Id;
UserName = user.UserName;
Avatar = user.Avatar;
}
public string UserId { get; set; }
public string UserName { get; set; }
public string Avatar { get; set; }
}
}

View file

@ -61,7 +61,7 @@
"Google.Apis.Core": "1.11.1",
"Google.Apis": "1.11.1",
"MailKit": "1.12.0",
"MarkdownDeep-av.NET": "1.5.5",
"MarkdownDeep-av.NET": "1.5.6",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-rc1-final",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-rc1-final",

View file

@ -289,7 +289,7 @@
"lib/net451/MailKit.dll": {}
}
},
"MarkdownDeep-av.NET/1.5.5": {
"MarkdownDeep-av.NET/1.5.6": {
"type": "package",
"compile": {
"lib/net451/MarkdownDeep.dll": {}
@ -2514,7 +2514,7 @@
"lib/net451/MimeKit.dll": {}
}
},
"Newtonsoft.Json/7.0.1": {
"Newtonsoft.Json/10.0.2": {
"type": "package",
"compile": {
"lib/net45/Newtonsoft.Json.dll": {}
@ -2853,7 +2853,13 @@
},
"YavscLib/1.0.0": {
"type": "project",
"framework": ".NETFramework,Version=v4.5.1"
"framework": ".NETFramework,Version=v4.5.1",
"dependencies": {
"Newtonsoft.Json": "10.0.2"
},
"frameworkAssemblies": [
"System.ComponentModel.DataAnnotations"
]
},
"Zlib.Portable.Signed/1.11.0": {
"type": "package",
@ -3152,7 +3158,7 @@
"lib/net451/MailKit.dll": {}
}
},
"MarkdownDeep-av.NET/1.5.5": {
"MarkdownDeep-av.NET/1.5.6": {
"type": "package",
"compile": {
"lib/net451/MarkdownDeep.dll": {}
@ -5377,7 +5383,7 @@
"lib/net451/MimeKit.dll": {}
}
},
"Newtonsoft.Json/7.0.1": {
"Newtonsoft.Json/10.0.2": {
"type": "package",
"compile": {
"lib/net45/Newtonsoft.Json.dll": {}
@ -5716,7 +5722,13 @@
},
"YavscLib/1.0.0": {
"type": "project",
"framework": ".NETFramework,Version=v4.5.1"
"framework": ".NETFramework,Version=v4.5.1",
"dependencies": {
"Newtonsoft.Json": "10.0.2"
},
"frameworkAssemblies": [
"System.ComponentModel.DataAnnotations"
]
},
"Zlib.Portable.Signed/1.11.0": {
"type": "package",
@ -6015,7 +6027,7 @@
"lib/net451/MailKit.dll": {}
}
},
"MarkdownDeep-av.NET/1.5.5": {
"MarkdownDeep-av.NET/1.5.6": {
"type": "package",
"compile": {
"lib/net451/MarkdownDeep.dll": {}
@ -8240,7 +8252,7 @@
"lib/net451/MimeKit.dll": {}
}
},
"Newtonsoft.Json/7.0.1": {
"Newtonsoft.Json/10.0.2": {
"type": "package",
"compile": {
"lib/net45/Newtonsoft.Json.dll": {}
@ -8579,7 +8591,13 @@
},
"YavscLib/1.0.0": {
"type": "project",
"framework": ".NETFramework,Version=v4.5.1"
"framework": ".NETFramework,Version=v4.5.1",
"dependencies": {
"Newtonsoft.Json": "10.0.2"
},
"frameworkAssemblies": [
"System.ComponentModel.DataAnnotations"
]
},
"Zlib.Portable.Signed/1.11.0": {
"type": "package",
@ -8884,15 +8902,15 @@
"MailKit.nuspec"
]
},
"MarkdownDeep-av.NET/1.5.5": {
"MarkdownDeep-av.NET/1.5.6": {
"type": "package",
"sha512": "RVNumZoZCPDq3H83vrudwptPgR0YFb3MsxIAuGZccUIPiwVUyixGanymHOy0H9QPubkYWo8t00iXqVvIjiu2gg==",
"sha512": "/nK/Hzru+vAmNGX5tZtEkKxCqjUS8a/u1vZaQ4pEmlvm6C9IIJ5rWIJephDWVwbzi6eKdEeduU+xmPfLNXrQwQ==",
"files": [
"lib/dnxcore50/MarkdownDeep.dll",
"lib/MonoAndroid10/MarkdownDeep.dll",
"lib/net451/MarkdownDeep.dll",
"MarkdownDeep-av.NET.1.5.5.nupkg",
"MarkdownDeep-av.NET.1.5.5.nupkg.sha512",
"MarkdownDeep-av.NET.1.5.6.nupkg",
"MarkdownDeep-av.NET.1.5.6.nupkg.sha512",
"MarkdownDeep-av.NET.nuspec"
]
},
@ -10614,9 +10632,9 @@
"MimeKit.nuspec"
]
},
"Newtonsoft.Json/7.0.1": {
"Newtonsoft.Json/10.0.2": {
"type": "package",
"sha512": "q3V4KLetMLnt1gpAVWgtXnHjKs0UG/RalBc29u2ZKxd5t5Ze4JBL5WiiYIklJyK/5CRiIiNwigVQUo0FgbsuWA==",
"sha512": "iwElSU2IXmwGvytJsezyDML2ZWDkG2JzTYzlU/BNlmzMdlmRvbnwITsGGY74gwVEpDli1UdOLkMT7/3jxWvXzA==",
"files": [
"lib/net20/Newtonsoft.Json.dll",
"lib/net20/Newtonsoft.Json.xml",
@ -10626,12 +10644,17 @@
"lib/net40/Newtonsoft.Json.xml",
"lib/net45/Newtonsoft.Json.dll",
"lib/net45/Newtonsoft.Json.xml",
"lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll",
"lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.xml",
"lib/portable-net45+wp80+win8+wpa81+dnxcore50/Newtonsoft.Json.dll",
"lib/portable-net45+wp80+win8+wpa81+dnxcore50/Newtonsoft.Json.xml",
"Newtonsoft.Json.7.0.1.nupkg",
"Newtonsoft.Json.7.0.1.nupkg.sha512",
"lib/netstandard1.0/Newtonsoft.Json.dll",
"lib/netstandard1.0/Newtonsoft.Json.xml",
"lib/netstandard1.3/Newtonsoft.Json.dll",
"lib/netstandard1.3/Newtonsoft.Json.xml",
"lib/portable-net40+sl5+win8+wpa81+wp8/Newtonsoft.Json.dll",
"lib/portable-net40+sl5+win8+wpa81+wp8/Newtonsoft.Json.xml",
"lib/portable-net45+win8+wpa81+wp8/Newtonsoft.Json.dll",
"lib/portable-net45+win8+wpa81+wp8/Newtonsoft.Json.xml",
"LICENSE.md",
"Newtonsoft.Json.10.0.2.nupkg",
"Newtonsoft.Json.10.0.2.nupkg.sha512",
"Newtonsoft.Json.nuspec",
"tools/install.ps1"
]
@ -11550,7 +11573,7 @@
"Google.Apis.Core >= 1.11.1",
"Google.Apis >= 1.11.1",
"MailKit >= 1.12.0",
"MarkdownDeep-av.NET >= 1.5.5",
"MarkdownDeep-av.NET >= 1.5.6",
"Microsoft.AspNet.Authentication.Cookies >= 1.0.0-rc1-final",
"Microsoft.AspNet.Authentication.Facebook >= 1.0.0-rc1-final",
"Microsoft.AspNet.Authentication.Twitter >= 1.0.0-rc1-final",