diff --git a/Yavsc/ApiControllers/HairCut/HairCutController.cs b/Yavsc/ApiControllers/HairCut/HairCutController.cs index 0e7b3ea8..64544a8c 100644 --- a/Yavsc/ApiControllers/HairCut/HairCutController.cs +++ b/Yavsc/ApiControllers/HairCut/HairCutController.cs @@ -14,6 +14,9 @@ namespace Yavsc.ApiControllers using Services; using Yavsc.Models.Haircut; using Yavsc.Resources; + using System.Threading.Tasks; + using Yavsc.Helpers; + using Microsoft.Data.Entity; [Route("api/haircut")] public class HairCutController : Controller @@ -28,6 +31,7 @@ namespace Yavsc.ApiControllers private SmtpSettings _smtpSettings; private UserManager _userManager; + PayPalSettings _paymentSettings; public HairCutController(ApplicationDbContext context, IOptions googleSettings, IGoogleCloudMessageSender GCMSender, @@ -36,6 +40,7 @@ namespace Yavsc.ApiControllers IEmailSender emailSender, IOptions smtpSettings, IOptions siteSettings, + IOptions payPalSettings, ILoggerFactory loggerFactory) { _context = context; @@ -45,6 +50,7 @@ namespace Yavsc.ApiControllers _userManager = userManager; _smtpSettings = smtpSettings.Value; _siteSettings = siteSettings.Value; + _paymentSettings = payPalSettings.Value; _localizer = localizer; _logger = loggerFactory.CreateLogger(); } @@ -76,5 +82,14 @@ namespace Yavsc.ApiControllers return Ok(); } + [HttpPost("createpayment/{id}")] + public async Task CreatePayment(long id) + { + var apiContext = _paymentSettings.CreateAPIContext(); + var query = await _context.HairCutQueries.Include(q=>q.Client). + Include(q=>q.Client.PostalAddress).SingleAsync(q=>q.Id == id); + var payment = apiContext.CreatePaiment(query,"sale",_logger); + return Json(payment); + } } } diff --git a/Yavsc/ApiControllers/PaymentApiController.cs b/Yavsc/ApiControllers/PaymentApiController.cs index 44f4a9ba..ac5e9022 100644 --- a/Yavsc/ApiControllers/PaymentApiController.cs +++ b/Yavsc/ApiControllers/PaymentApiController.cs @@ -1,12 +1,12 @@ - -using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; +using Microsoft.Data.Entity; using Microsoft.Extensions.Logging; using Microsoft.Extensions.OptionsModel; using PayPal.Api; using Yavsc.Helpers; using Yavsc.Models; +using Yavsc.ViewModels.PayPal; namespace Yavsc.ApiControllers { @@ -29,7 +29,19 @@ namespace Yavsc.ApiControllers _logger = loggerFactory.CreateLogger(); } + public async Task Info(string paymentId) + { + var result = new PaymentInfo { + DbContent = await dbContext.PaypalPayments.SingleAsync( + p=>p.PaypalPaymentId==paymentId) + }; + await Task.Run( () => { + var apiContext = paymentSettings.CreateAPIContext(); + result.FromPaypal = Payment.Get(apiContext,paymentId); + }); + return Ok(result); + } [HttpPost("execute")] public async Task Execute(string paymentId, string payerId) @@ -43,63 +55,12 @@ namespace Yavsc.ApiControllers execution.transactions = payment.transactions; result = payment.Execute(apiContext,execution); }); - + return Ok(result); } - [HttpPost("create")] - public async Task Create() - { - var apiContext = paymentSettings.CreateAPIContext(); - var payment = Payment.Create(apiContext, - new Payment - { - intent = "authorize", // "sale", "order", "authorize" - payer = new Payer - { - payment_method = "paypal" - }, - transactions = new List - { - new Transaction - { - description = "Transaction description.", - invoice_number = "001", - amount = new Amount - { - currency = "EUR", - total = "0.11", - details = new Details - { - tax = "0.01", - shipping = "0.02", - subtotal = "0.08" - } - }, - item_list = new ItemList - { - items = new List - { - new Item - { - name = "nah", - currency = "EUR", - price = "0.02", - quantity = "4", - sku = "sku" - } - } - } - } - }, - redirect_urls = new RedirectUrls - { - return_url = siteSettings.Audience+ "/Manage/Credit/Return", - cancel_url = siteSettings.Audience+ "/Manage/Credit/Cancel" - } - }); - return Json(payment); - } + + } } diff --git a/Yavsc/Controllers/HairCutCommandController.cs b/Yavsc/Controllers/HairCutCommandController.cs index 6f2c055c..1700cb28 100644 --- a/Yavsc/Controllers/HairCutCommandController.cs +++ b/Yavsc/Controllers/HairCutCommandController.cs @@ -192,8 +192,8 @@ namespace Yavsc.Controllers } ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == model.ActivityCode); ViewBag.GoogleSettings = _googleSettings; - var addition = model.Prestation.Addition(brusherProfile); - ViewBag.Addition = addition.ToString("C",CultureInfo.CurrentUICulture); + var addition = model.Addition(brusherProfile); + ViewBag.Addition = addition.ToString("C",CultureInfo.CurrentUICulture); return View("CommandConfirmation",model); } ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == model.ActivityCode); @@ -244,7 +244,7 @@ namespace Yavsc.Controllers ViewBag.HairTechnos = EnumExtensions.GetSelectList(typeof(HairTechnos),_localizer); ViewBag.HairLength = EnumExtensions.GetSelectList(typeof(HairLength),_localizer); ViewBag.Activity = _context.Activities.First(a => a.Code == activityCode); - ViewBag.Gender = EnumExtensions.GetSelectList(typeof(HairCutGenders),_localizer); + ViewBag.Gender = EnumExtensions.GetSelectList(typeof(HairCutGenders),_localizer,HairCutGenders.Women); ViewBag.HairDressings = EnumExtensions.GetSelectList(typeof(HairDressings),_localizer); ViewBag.ColorsClass = ( pPrestation.Tech == HairTechnos.Color || pPrestation.Tech == HairTechnos.Mech ) ? "":"hidden"; diff --git a/Yavsc/Extensions/EnumExtensions.cs b/Yavsc/Extensions/EnumExtensions.cs index c34be6ff..851000e8 100644 --- a/Yavsc/Extensions/EnumExtensions.cs +++ b/Yavsc/Extensions/EnumExtensions.cs @@ -19,15 +19,15 @@ namespace Yavsc.Extensions foreach (var value in values) { - items.Add(new SelectListItem { - Text = SR[GetDescription(value, typeInfo)], - Value = value.ToString(), + items.Add(new SelectListItem { + Text = SR[GetDescription(value, typeInfo)], + Value = value.ToString(), Selected = value == valueSelected }); } return items; } - public static List GetSelectList (Type type, IStringLocalizer SR) + public static List GetSelectList (Type type, IStringLocalizer SR, string selectedValue = null) { var typeInfo = type.GetTypeInfo(); var values = Enum.GetValues(type).Cast(); @@ -35,9 +35,12 @@ namespace Yavsc.Extensions foreach (var value in values) { + var strval = value.ToString(); + items.Add(new SelectListItem { - Text = SR[GetDescription(value, typeInfo)], - Value = value.ToString() + Text = SR[GetDescription(value, typeInfo)], + Value = strval, + Selected = strval == selectedValue }); } return items; diff --git a/Yavsc/Helpers/EventHelpers.cs b/Yavsc/Helpers/EventHelpers.cs index cbb7927c..d73d397f 100644 --- a/Yavsc/Helpers/EventHelpers.cs +++ b/Yavsc/Helpers/EventHelpers.cs @@ -40,7 +40,7 @@ namespace Yavsc.Helpers string evdate = query.EventDate?.ToString("dddd dd/MM/yyyy à HH:mm")??"[pas de date spécifiée]"; string address = query.Location?.Address??"[pas de lieu spécifié]"; var p = query.Prestation; - decimal total = query.Prestation.Addition(bpr); + decimal total = query.Addition(bpr); string strprestation = $@"Coupe: {p.Cut}, Total: {total}"; var yaev = new HairCutQueryEvent diff --git a/Yavsc/Helpers/HaircutHelpers.cs b/Yavsc/Helpers/HaircutHelpers.cs deleted file mode 100644 index dea34203..00000000 --- a/Yavsc/Helpers/HaircutHelpers.cs +++ /dev/null @@ -1,130 +0,0 @@ -using Yavsc.Models.Haircut; - -namespace Yavsc.Helpers -{ - public static class HaircutHelpers - { - public static decimal Addition (this HairPrestation p, BrusherProfile profile) - { - decimal sub=0; - // Le shampoing - sub += p.Shampoo ? profile.ShampooPrice:0; - - // la coupe - sub += p.Cut ? p.Gender == HairCutGenders.Women ? - p.Length == HairLength.Long ? profile.WomenLongCutPrice : - p.Length == HairLength.HalfLong ? profile.WomenHalfCutPrice : - profile.WomenShortCutPrice : p.Gender == HairCutGenders.Man ? - profile.ManCutPrice : profile.KidCutPrice : 0; - - // Les techniques - switch (p.Tech) { - case HairTechnos.Color: - bool multicolor = p.Taints.Count>1; - switch (p.Length) { - case HairLength.Long: - sub += sub += multicolor? profile.LongMultiColorPrice : profile.LongColorPrice; - break; - case HairLength.HalfLong: sub += multicolor? profile.HalfMultiColorPrice : profile.HalfColorPrice; - break; - default: - sub += multicolor? profile.ShortMultiColorPrice : profile.ShortColorPrice; - break; - } - break; - case HairTechnos.Balayage: - switch (p.Length) { - case HairLength.Long: - sub += profile.LongBalayagePrice; - break; - case HairLength.HalfLong: sub += profile.HalfBalayagePrice; - break; - default: - sub += profile.ShortBalayagePrice; - break; - } - break; - case HairTechnos.Defris: - switch (p.Length) { - case HairLength.Long: - sub += profile.LongDefrisPrice; - break; - case HairLength.HalfLong: sub += profile.HalfDefrisPrice; - break; - default: - sub += profile.ShortDefrisPrice; - break; - } - break; - case HairTechnos.Mech: - switch (p.Length) { - case HairLength.Long: - sub += profile.LongMechPrice; - break; - case HairLength.HalfLong: sub += profile.HalfMechPrice; - break; - default: - sub += profile.ShortMechPrice; - break; - } - break; - case HairTechnos.Permanent: - switch (p.Length) { - case HairLength.Long: - sub += profile.LongPermanentPrice; - break; - case HairLength.HalfLong: sub += profile.HalfPermanentPrice; - break; - default: - sub += profile.ShortPermanentPrice; - break; - } - break; - - } - - // Les coiffages - switch (p.Dressing) { - case HairDressings.Brushing: - switch (p.Gender) { - case HairCutGenders.Women: - switch (p.Length) { - case HairLength.Long: - sub += profile.LongBrushingPrice; - break; - case HairLength.HalfLong: sub += profile.HalfBrushingPrice; - break; - default: - sub += profile.ShortBrushingPrice; - break; - } - break; - case HairCutGenders.Man: - sub += profile.ManBrushPrice; - break; - } - break; - case HairDressings.Coiffage: - // est offert - break; - case HairDressings.Folding: - switch (p.Length) { - case HairLength.Long: - sub += profile.LongFoldingPrice; - break; - case HairLength.HalfLong: sub += profile.HalfFoldingPrice; - break; - default: - sub += profile.ShortFoldingPrice; - break; - } - break; - } - - // les soins - sub += p.Cares ? profile.CarePrice:0; - return sub; - - } - } -} diff --git a/Yavsc/Helpers/PayPalHelpers.cs b/Yavsc/Helpers/PayPalHelpers.cs index 32bbcee8..99b2b7dd 100644 --- a/Yavsc/Helpers/PayPalHelpers.cs +++ b/Yavsc/Helpers/PayPalHelpers.cs @@ -1,7 +1,8 @@ using System.Collections.Generic; +using System.Linq; +using Microsoft.Extensions.Logging; using PayPal.Api; using Yavsc.Models.Billing; -using Yavsc.Models.Haircut; namespace Yavsc.Helpers { @@ -18,20 +19,40 @@ namespace Yavsc.Helpers return apiContext; } - public static Payment CreatePaiement(this APIContext apiContext, NominativeServiceCommand query, string intent = "sale") + public static Payment CreatePaiment(this APIContext apiContext, NominativeServiceCommand query, string intent = "sale", ILogger logger=null) { var queryType = query.GetType().Name; var transaction = new Transaction { - description = query.Description+"\nVotre commande du "+query.DateCreated.ToLongDateString(), + description ="Votre commande du "+query.DateCreated.ToLongDateString()+ + "\n"+query.Description, invoice_number = $"{query.ActivityCode}/{queryType}/{query.Id}" }; - transaction.item_list.shipping_address.line1 = query.Client.PostalAddress.Address; + logger?.LogInformation("transaction: "+transaction.invoice_number); + // transaction.item_list.shipping_address.city + // country_code default_address id + // line1 line2 preferred_address recipient_name state status type + transaction.item_list = new ItemList(); + if (query.Client.PostalAddress!=null) { + transaction.item_list.shipping_address = new ShippingAddress(); + transaction.item_list.shipping_address.line1 = query.Client.PostalAddress.Address; + } transaction.item_list.shipping_phone_number = query.Client.PhoneNumber; - transaction.item_list.items = new List { }; - var item = new Item(); + logger?.LogInformation("client address: "+transaction.item_list.shipping_address.line1); + transaction.item_list.items = query.GetBillItems().Select(i => new Item { + name = i.Name, + description = i.Description, + price = i.UnitaryCost.ToString("F2"), + currency = "EUR", + quantity = i.Count.ToString(), + sku = query.ActivityCode + /* postback_data= + sku= + supplementary_data= */ + }).ToList(); + - return new Payment + return Payment.Create(apiContext, new Payment { intent = intent, // "sale", "order", "authorize" payer = new Payer @@ -39,10 +60,10 @@ namespace Yavsc.Helpers payment_method = "paypal" }, transactions = new List { transaction } - }; + }); } - public static Payment CreatePaiement(this APIContext apiContext, Estimate estimation) + public static Payment CreatePaiment(this APIContext apiContext, Estimate estimation) { var payment = Payment.Create(apiContext, new Payment diff --git a/Yavsc/Interfaces/Workflow/IBillingClause.cs b/Yavsc/Interfaces/Workflow/IBillingClause.cs index 149b8d47..db5bb927 100644 --- a/Yavsc/Interfaces/Workflow/IBillingClause.cs +++ b/Yavsc/Interfaces/Workflow/IBillingClause.cs @@ -1,7 +1,9 @@ +using YavscLib.Billing; + namespace Yavsc.Models.Billing { -public interface IBillingClause {  - string Description {get; set;} - IBillingImpacter Impacter { get; } -} + public interface IBillingClause {  + string Description {get; set;} + IBillingImpacter Impacter { get; } + } -} \ No newline at end of file +} diff --git a/Yavsc/Migrations/20170507200834_paypal.Designer.cs b/Yavsc/Migrations/20170507200834_paypal.Designer.cs index 53f5d041..635e25ac 100644 --- a/Yavsc/Migrations/20170507200834_paypal.Designer.cs +++ b/Yavsc/Migrations/20170507200834_paypal.Designer.cs @@ -1,7 +1,6 @@ using System; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Infrastructure; -using Microsoft.Data.Entity.Metadata; using Microsoft.Data.Entity.Migrations; using Yavsc.Models; diff --git a/Yavsc/Migrations/20170507200834_paypal.cs b/Yavsc/Migrations/20170507200834_paypal.cs index 6ca8748c..1e9f35cd 100644 --- a/Yavsc/Migrations/20170507200834_paypal.cs +++ b/Yavsc/Migrations/20170507200834_paypal.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using Microsoft.Data.Entity.Migrations; namespace Yavsc.Migrations diff --git a/Yavsc/Migrations/20170510121057_hairCutPaypalPayment.Designer.cs b/Yavsc/Migrations/20170510121057_hairCutPaypalPayment.Designer.cs new file mode 100644 index 00000000..5f8d64d1 --- /dev/null +++ b/Yavsc/Migrations/20170510121057_hairCutPaypalPayment.Designer.cs @@ -0,0 +1,1493 @@ +using System; +using Microsoft.Data.Entity; +using Microsoft.Data.Entity.Infrastructure; +using Microsoft.Data.Entity.Metadata; +using Microsoft.Data.Entity.Migrations; +using Yavsc.Models; + +namespace Yavsc.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20170510121057_hairCutPaypalPayment")] + partial class hairCutPaypalPayment + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { + modelBuilder + .HasAnnotation("ProductVersion", "7.0.0-rc1-16348"); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b => + { + b.Property("Id"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("Name") + .HasAnnotation("MaxLength", 256); + + b.Property("NormalizedName") + .HasAnnotation("MaxLength", 256); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .HasAnnotation("Relational:Name", "RoleNameIndex"); + + b.HasAnnotation("Relational:TableName", "AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("RoleId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasAnnotation("Relational:TableName", "AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasAnnotation("Relational:TableName", "AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin", b => + { + b.Property("LoginProvider"); + + b.Property("ProviderKey"); + + b.Property("ProviderDisplayName"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasAnnotation("Relational:TableName", "AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole", b => + { + b.Property("UserId"); + + b.Property("RoleId"); + + b.HasKey("UserId", "RoleId"); + + b.HasAnnotation("Relational:TableName", "AspNetUserRoles"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.Ban", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.BlackListed", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.CircleAuthorizationToBlogPost", b => + { + b.Property("CircleId"); + + b.Property("BlogPostId"); + + b.HasKey("CircleId", "BlogPostId"); + }); + + modelBuilder.Entity("Yavsc.Models.AccountBalance", b => + { + b.Property("UserId"); + + b.Property("ContactCredits"); + + b.Property("Credits"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.Property("Id"); + + b.Property("AccessFailedCount"); + + b.Property("Avatar") + .HasAnnotation("MaxLength", 512) + .HasAnnotation("Relational:DefaultValue", "/images/Users/icon_user.png") + .HasAnnotation("Relational:DefaultValueType", "System.String"); + + b.Property("BankInfoId"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("DedicatedGoogleCalendar"); + + b.Property("DiskQuota") + .HasAnnotation("Relational:DefaultValue", "524288000") + .HasAnnotation("Relational:DefaultValueType", "System.Int64"); + + b.Property("DiskUsage"); + + b.Property("Email") + .HasAnnotation("MaxLength", 256); + + b.Property("EmailConfirmed"); + + b.Property("FullName") + .HasAnnotation("MaxLength", 512); + + b.Property("LockoutEnabled"); + + b.Property("LockoutEnd"); + + b.Property("NormalizedEmail") + .HasAnnotation("MaxLength", 256); + + b.Property("NormalizedUserName") + .HasAnnotation("MaxLength", 256); + + b.Property("PasswordHash"); + + b.Property("PhoneNumber"); + + b.Property("PhoneNumberConfirmed"); + + b.Property("PostalAddressId"); + + b.Property("SecurityStamp"); + + b.Property("TwoFactorEnabled"); + + b.Property("UserName") + .HasAnnotation("MaxLength", 256); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasAnnotation("Relational:Name", "EmailIndex"); + + b.HasIndex("NormalizedUserName") + .HasAnnotation("Relational:Name", "UserNameIndex"); + + b.HasAnnotation("Relational:TableName", "AspNetUsers"); + }); + + modelBuilder.Entity("Yavsc.Models.Auth.Client", b => + { + b.Property("Id"); + + b.Property("Active"); + + b.Property("DisplayName"); + + b.Property("LogoutRedirectUri") + .HasAnnotation("MaxLength", 100); + + b.Property("RedirectUri"); + + b.Property("RefreshTokenLifeTime"); + + b.Property("Secret"); + + b.Property("Type"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b => + { + b.Property("Id"); + + b.Property("ClientId") + .IsRequired() + .HasAnnotation("MaxLength", 50); + + b.Property("ExpiresUtc"); + + b.Property("IssuedUtc"); + + b.Property("ProtectedTicket") + .IsRequired(); + + b.Property("Subject") + .IsRequired() + .HasAnnotation("MaxLength", 50); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.BalanceImpact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BalanceId") + .IsRequired(); + + b.Property("ExecDate"); + + b.Property("Impact"); + + b.Property("Reason") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Bank.BankIdentity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AccountNumber") + .HasAnnotation("MaxLength", 15); + + b.Property("BIC") + .HasAnnotation("MaxLength", 15); + + b.Property("BankCode") + .HasAnnotation("MaxLength", 5); + + b.Property("BankedKey"); + + b.Property("IBAN") + .HasAnnotation("MaxLength", 33); + + b.Property("WicketCode") + .HasAnnotation("MaxLength", 5); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Count"); + + b.Property("Currency"); + + b.Property("Description") + .IsRequired() + .HasAnnotation("MaxLength", 512); + + b.Property("EstimateId"); + + b.Property("EstimateTemplateId"); + + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 256); + + b.Property("UnitaryCost"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AttachedFilesString"); + + b.Property("AttachedGraphicsString"); + + b.Property("ClientId") + .IsRequired(); + + b.Property("ClientValidationDate"); + + b.Property("CommandId"); + + b.Property("CommandType") + .IsRequired(); + + b.Property("Description"); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("ProviderValidationDate"); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b => + { + b.Property("SIREN"); + + b.HasKey("SIREN"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuthorId"); + + b.Property("Content"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Photo"); + + b.Property("Rate"); + + b.Property("Title"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.Property("Visible"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.Connection", b => + { + b.Property("ConnectionId"); + + b.Property("ApplicationUserId") + .IsRequired(); + + b.Property("Connected"); + + b.Property("UserAgent"); + + b.HasKey("ConnectionId"); + }); + + modelBuilder.Entity("Yavsc.Models.Drawing.Color", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Blue"); + + b.Property("Green"); + + b.Property("Name"); + + b.Property("Red"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Forms.Form", b => + { + b.Property("Id"); + + b.Property("Summary"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.BrusherProfile", b => + { + b.Property("UserId"); + + b.Property("ActionDistance"); + + b.Property("CarePrice"); + + b.Property("EndOfTheDay"); + + b.Property("FlatFeeDiscount"); + + b.Property("HalfBalayagePrice"); + + b.Property("HalfBrushingPrice"); + + b.Property("HalfColorPrice"); + + b.Property("HalfDefrisPrice"); + + b.Property("HalfFoldingPrice"); + + b.Property("HalfMechPrice"); + + b.Property("HalfMultiColorPrice"); + + b.Property("HalfPermanentPrice"); + + b.Property("KidCutPrice"); + + b.Property("LongBalayagePrice"); + + b.Property("LongBrushingPrice"); + + b.Property("LongColorPrice"); + + b.Property("LongDefrisPrice"); + + b.Property("LongFoldingPrice"); + + b.Property("LongMechPrice"); + + b.Property("LongMultiColorPrice"); + + b.Property("LongPermanentPrice"); + + b.Property("ManBrushPrice"); + + b.Property("ManCutPrice"); + + b.Property("ShampooPrice"); + + b.Property("ShortBalayagePrice"); + + b.Property("ShortBrushingPrice"); + + b.Property("ShortColorPrice"); + + b.Property("ShortDefrisPrice"); + + b.Property("ShortFoldingPrice"); + + b.Property("ShortMechPrice"); + + b.Property("ShortMultiColorPrice"); + + b.Property("ShortPermanentPrice"); + + b.Property("StartOfTheDay"); + + b.Property("WomenHalfCutPrice"); + + b.Property("WomenLongCutPrice"); + + b.Property("WomenShortCutPrice"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairCutQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("AdditionalInfo") + .HasAnnotation("MaxLength", 512); + + b.Property("ClientId") + .IsRequired(); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Description"); + + b.Property("EventDate"); + + b.Property("LocationId"); + + b.Property("PaymentId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("PrestationId"); + + b.Property("Previsional"); + + b.Property("Status"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairMultiCutQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("ClientId") + .IsRequired(); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Description"); + + b.Property("EventDate"); + + b.Property("LocationId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("Previsional"); + + b.Property("Status"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Cares"); + + b.Property("Cut"); + + b.Property("Dressing"); + + b.Property("Gender"); + + b.Property("Length"); + + b.Property("Shampoo"); + + b.Property("Tech"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestationCollectionItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("PrestationId"); + + b.Property("QueryId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Brand"); + + b.Property("ColorId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaintInstance", b => + { + b.Property("TaintId"); + + b.Property("PrestationId"); + + b.HasKey("TaintId", "PrestationId"); + }); + + modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b => + { + b.Property("DeviceId"); + + b.Property("DeclarationDate") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("DeviceOwnerId"); + + b.Property("GCMRegistrationId") + .IsRequired(); + + b.Property("Model"); + + b.Property("Platform"); + + b.Property("Version"); + + b.HasKey("DeviceId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Depth"); + + b.Property("Description"); + + b.Property("Height"); + + b.Property("Name"); + + b.Property("Price"); + + b.Property("Public"); + + b.Property("Weight"); + + b.Property("Width"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ContextId"); + + b.Property("Description"); + + b.Property("Name"); + + b.Property("Public"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.ClientProviderInfo", b => + { + b.Property("UserId"); + + b.Property("Avatar"); + + b.Property("BillingAddressId"); + + b.Property("EMail"); + + b.Property("Phone"); + + b.Property("UserName"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.DimissClicked", b => + { + b.Property("UserId"); + + b.Property("NotificationId"); + + b.HasKey("UserId", "NotificationId"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("body") + .IsRequired(); + + b.Property("click_action") + .IsRequired(); + + b.Property("color"); + + b.Property("icon"); + + b.Property("sound"); + + b.Property("tag"); + + b.Property("title") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Instrument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 255); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.MusicalPreference", b => + { + b.Property("OwnerProfileId"); + + b.Property("DjSettingsUserId"); + + b.Property("GeneralSettingsUserId"); + + b.Property("Rate"); + + b.Property("TendencyId"); + + b.HasKey("OwnerProfileId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.MusicalTendency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 255); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.DjSettings", b => + { + b.Property("UserId"); + + b.Property("SoundCloudId"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.GeneralSettings", b => + { + b.Property("UserId"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.Instrumentation", b => + { + b.Property("InstrumentId"); + + b.Property("UserId"); + + b.HasKey("InstrumentId", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b => + { + b.Property("UserId"); + + b.Property("AccessToken"); + + b.Property("Expiration"); + + b.Property("ExpiresIn"); + + b.Property("RefreshToken"); + + b.Property("TokenType"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Payment.PaypalPayment", b => + { + b.Property("PaypalPaymentId"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("ExecutorId") + .IsRequired(); + + b.Property("OrderReference"); + + b.Property("PaypalPayerId") + .IsRequired(); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.HasKey("PaypalPaymentId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Circle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ApplicationUserId"); + + b.Property("Name"); + + b.Property("OwnerId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.CircleMember", b => + { + b.Property("MemberId"); + + b.Property("CircleId"); + + b.HasKey("MemberId", "CircleId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Contact", b => + { + b.Property("OwnerId"); + + b.Property("UserId"); + + b.Property("ApplicationUserId"); + + b.HasKey("OwnerId", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Address") + .IsRequired() + .HasAnnotation("MaxLength", 512); + + b.Property("Latitude"); + + b.Property("Longitude"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.LocationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.PostTag", b => + { + b.Property("PostId"); + + b.Property("TagId"); + + b.HasKey("PostId", "TagId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Rate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Activity", b => + { + b.Property("Code") + .HasAnnotation("MaxLength", 512); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Description"); + + b.Property("Hidden"); + + b.Property("ModeratorGroupName"); + + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 512); + + b.Property("ParentCode") + .HasAnnotation("MaxLength", 512); + + b.Property("Photo"); + + b.Property("Rate"); + + b.Property("SettingsClassName"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.HasKey("Code"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CommandForm", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ActionName"); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CoWorking", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("FormationSettingsUserId"); + + b.Property("PerformerId"); + + b.Property("WorkingForId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.Property("PerformerId"); + + b.Property("AcceptNotifications"); + + b.Property("AcceptPublicContact"); + + b.Property("Active"); + + b.Property("MaxDailyCost"); + + b.Property("MinDailyCost"); + + b.Property("OrganizationAddressId"); + + b.Property("Rate"); + + b.Property("SIREN") + .IsRequired() + .HasAnnotation("MaxLength", 14); + + b.Property("UseGeoLocalizationToReduceDistanceWithClients"); + + b.Property("WebSite"); + + b.HasKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Profiles.FormationSettings", b => + { + b.Property("UserId"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.RdvQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("ClientId") + .IsRequired(); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Description"); + + b.Property("EventDate"); + + b.Property("LocationId"); + + b.Property("LocationTypeId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("Previsional"); + + b.Property("Reason"); + + b.Property("Status"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b => + { + b.Property("DoesCode"); + + b.Property("UserId"); + + b.Property("Weight"); + + b.HasKey("DoesCode", "UserId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole") + .WithMany() + .HasForeignKey("RoleId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.BlackListed", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.CircleAuthorizationToBlogPost", b => + { + b.HasOne("Yavsc.Models.Blog") + .WithMany() + .HasForeignKey("BlogPostId"); + + b.HasOne("Yavsc.Models.Relationship.Circle") + .WithMany() + .HasForeignKey("CircleId"); + }); + + modelBuilder.Entity("Yavsc.Models.AccountBalance", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithOne() + .HasForeignKey("Yavsc.Models.AccountBalance", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.HasOne("Yavsc.Models.Bank.BankIdentity") + .WithMany() + .HasForeignKey("BankInfoId"); + + b.HasOne("Yavsc.Models.Relationship.Location") + .WithMany() + .HasForeignKey("PostalAddressId"); + }); + + modelBuilder.Entity("Yavsc.Models.BalanceImpact", b => + { + b.HasOne("Yavsc.Models.AccountBalance") + .WithMany() + .HasForeignKey("BalanceId"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b => + { + b.HasOne("Yavsc.Models.Billing.Estimate") + .WithMany() + .HasForeignKey("EstimateId"); + + b.HasOne("Yavsc.Models.Billing.EstimateTemplate") + .WithMany() + .HasForeignKey("EstimateTemplateId"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Models.Workflow.RdvQuery") + .WithMany() + .HasForeignKey("CommandId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("AuthorId"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.Connection", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.BrusherProfile", b => + { + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairCutQuery", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ActivityCode"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Models.Relationship.Location") + .WithMany() + .HasForeignKey("LocationId"); + + b.HasOne("Yavsc.Models.Payment.PaypalPayment") + .WithMany() + .HasForeignKey("PaymentId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + + b.HasOne("Yavsc.Models.Haircut.HairPrestation") + .WithMany() + .HasForeignKey("PrestationId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairMultiCutQuery", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ActivityCode"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Models.Relationship.Location") + .WithMany() + .HasForeignKey("LocationId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestationCollectionItem", b => + { + b.HasOne("Yavsc.Models.Haircut.HairPrestation") + .WithMany() + .HasForeignKey("PrestationId"); + + b.HasOne("Yavsc.Models.Haircut.HairMultiCutQuery") + .WithMany() + .HasForeignKey("QueryId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaint", b => + { + b.HasOne("Yavsc.Models.Drawing.Color") + .WithMany() + .HasForeignKey("ColorId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaintInstance", b => + { + b.HasOne("Yavsc.Models.Haircut.HairPrestation") + .WithMany() + .HasForeignKey("PrestationId"); + + b.HasOne("Yavsc.Models.Haircut.HairTaint") + .WithMany() + .HasForeignKey("TaintId"); + }); + + modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("DeviceOwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ContextId"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.ClientProviderInfo", b => + { + b.HasOne("Yavsc.Models.Relationship.Location") + .WithMany() + .HasForeignKey("BillingAddressId"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.DimissClicked", b => + { + b.HasOne("Yavsc.Models.Messaging.Notification") + .WithMany() + .HasForeignKey("NotificationId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.MusicalPreference", b => + { + b.HasOne("Yavsc.Models.Musical.Profiles.DjSettings") + .WithMany() + .HasForeignKey("DjSettingsUserId"); + + b.HasOne("Yavsc.Models.Musical.Profiles.GeneralSettings") + .WithMany() + .HasForeignKey("GeneralSettingsUserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.Instrumentation", b => + { + b.HasOne("Yavsc.Models.Musical.Instrument") + .WithMany() + .HasForeignKey("InstrumentId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Payment.PaypalPayment", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ExecutorId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Circle", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.CircleMember", b => + { + b.HasOne("Yavsc.Models.Relationship.Circle") + .WithMany() + .HasForeignKey("CircleId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("MemberId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Contact", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.PostTag", b => + { + b.HasOne("Yavsc.Models.Blog") + .WithMany() + .HasForeignKey("PostId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Activity", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ParentCode"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CommandForm", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ActivityCode"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CoWorking", b => + { + b.HasOne("Yavsc.Models.Workflow.Profiles.FormationSettings") + .WithMany() + .HasForeignKey("FormationSettingsUserId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("WorkingForId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.HasOne("Yavsc.Models.Relationship.Location") + .WithMany() + .HasForeignKey("OrganizationAddressId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.RdvQuery", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ActivityCode"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Models.Relationship.Location") + .WithMany() + .HasForeignKey("LocationId"); + + b.HasOne("Yavsc.Models.Relationship.LocationType") + .WithMany() + .HasForeignKey("LocationTypeId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("DoesCode"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("UserId"); + }); + } + } +} diff --git a/Yavsc/Migrations/20170510121057_hairCutPaypalPayment.cs b/Yavsc/Migrations/20170510121057_hairCutPaypalPayment.cs new file mode 100644 index 00000000..226969bf --- /dev/null +++ b/Yavsc/Migrations/20170510121057_hairCutPaypalPayment.cs @@ -0,0 +1,726 @@ +using System; +using System.Collections.Generic; +using Microsoft.Data.Entity.Migrations; + +namespace Yavsc.Migrations +{ + public partial class hairCutPaypalPayment : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim_IdentityRole_RoleId", table: "AspNetRoleClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_ApplicationUser_UserId", table: "AspNetUserRoles"); + migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed"); + migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId", table: "CircleAuthorizationToBlogPost"); + migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost"); + migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance"); + migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact"); + migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine"); + migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate"); + migrationBuilder.DropForeignKey(name: "FK_Estimate_PerformerProfile_OwnerId", table: "Estimate"); + migrationBuilder.DropForeignKey(name: "FK_Connection_ApplicationUser_ApplicationUserId", table: "Connection"); + migrationBuilder.DropForeignKey(name: "FK_BrusherProfile_PerformerProfile_UserId", table: "BrusherProfile"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_PerformerProfile_PerformerId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_HairPrestation_PrestationId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_Activity_ActivityCode", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId", table: "HairPrestationCollectionItem"); + migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", table: "HairPrestationCollectionItem"); + migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint"); + migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairPrestation_PrestationId", table: "HairTaintInstance"); + migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairTaint_TaintId", table: "HairTaintInstance"); + migrationBuilder.DropForeignKey(name: "FK_DimissClicked_Notification_NotificationId", table: "DimissClicked"); + migrationBuilder.DropForeignKey(name: "FK_DimissClicked_ApplicationUser_UserId", table: "DimissClicked"); + migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation"); + migrationBuilder.DropForeignKey(name: "FK_PaypalPayment_ApplicationUser_ExecutorId", table: "PaypalPayment"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag"); + migrationBuilder.DropForeignKey(name: "FK_CommandForm_Activity_ActivityCode", table: "CommandForm"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_Activity_ActivityCode", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_ApplicationUser_ClientId", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_PerformerProfile_PerformerId", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_UserActivity_Activity_DoesCode", table: "UserActivity"); + migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity"); + migrationBuilder.DropPrimaryKey(name: "PK_PaypalPayment", table: "PaypalPayment"); + migrationBuilder.AddPrimaryKey( + name: "PK_PaypalPayment", + table: "PaypalPayment", + column: "PaypalPaymentId"); + migrationBuilder.AddColumn( + name: "PaymentId", + table: "HairCutQuery", + nullable: true); + migrationBuilder.AddColumn( + name: "Name", + table: "CommandLine", + nullable: false, + defaultValue: ""); + migrationBuilder.AddForeignKey( + name: "FK_IdentityRoleClaim_IdentityRole_RoleId", + table: "AspNetRoleClaims", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserClaim_ApplicationUser_UserId", + table: "AspNetUserClaims", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserLogin_ApplicationUser_UserId", + table: "AspNetUserLogins", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_IdentityRole_RoleId", + table: "AspNetUserRoles", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_ApplicationUser_UserId", + table: "AspNetUserRoles", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BlackListed_ApplicationUser_OwnerId", + table: "BlackListed", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId", + table: "CircleAuthorizationToBlogPost", + column: "BlogPostId", + principalTable: "Blog", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", + table: "CircleAuthorizationToBlogPost", + column: "CircleId", + principalTable: "Circle", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_AccountBalance_ApplicationUser_UserId", + table: "AccountBalance", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BalanceImpact_AccountBalance_BalanceId", + table: "BalanceImpact", + column: "BalanceId", + principalTable: "AccountBalance", + principalColumn: "UserId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_CommandLine_Estimate_EstimateId", + table: "CommandLine", + column: "EstimateId", + principalTable: "Estimate", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Estimate_ApplicationUser_ClientId", + table: "Estimate", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Estimate_PerformerProfile_OwnerId", + table: "Estimate", + column: "OwnerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Connection_ApplicationUser_ApplicationUserId", + table: "Connection", + column: "ApplicationUserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BrusherProfile_PerformerProfile_UserId", + table: "BrusherProfile", + column: "UserId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_Activity_ActivityCode", + table: "HairCutQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_ApplicationUser_ClientId", + table: "HairCutQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_PaypalPayment_PaymentId", + table: "HairCutQuery", + column: "PaymentId", + principalTable: "PaypalPayment", + principalColumn: "PaypalPaymentId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_PerformerProfile_PerformerId", + table: "HairCutQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_HairPrestation_PrestationId", + table: "HairCutQuery", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_Activity_ActivityCode", + table: "HairMultiCutQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", + table: "HairMultiCutQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", + table: "HairMultiCutQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId", + table: "HairPrestationCollectionItem", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", + table: "HairPrestationCollectionItem", + column: "QueryId", + principalTable: "HairMultiCutQuery", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairTaint_Color_ColorId", + table: "HairTaint", + column: "ColorId", + principalTable: "Color", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairTaintInstance_HairPrestation_PrestationId", + table: "HairTaintInstance", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairTaintInstance_HairTaint_TaintId", + table: "HairTaintInstance", + column: "TaintId", + principalTable: "HairTaint", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_DimissClicked_Notification_NotificationId", + table: "DimissClicked", + column: "NotificationId", + principalTable: "Notification", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_DimissClicked_ApplicationUser_UserId", + table: "DimissClicked", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Instrumentation_Instrument_InstrumentId", + table: "Instrumentation", + column: "InstrumentId", + principalTable: "Instrument", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PaypalPayment_ApplicationUser_ExecutorId", + table: "PaypalPayment", + column: "ExecutorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_CircleMember_Circle_CircleId", + table: "CircleMember", + column: "CircleId", + principalTable: "Circle", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_CircleMember_ApplicationUser_MemberId", + table: "CircleMember", + column: "MemberId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PostTag_Blog_PostId", + table: "PostTag", + column: "PostId", + principalTable: "Blog", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_CommandForm_Activity_ActivityCode", + table: "CommandForm", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Location_OrganizationAddressId", + table: "PerformerProfile", + column: "OrganizationAddressId", + principalTable: "Location", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_ApplicationUser_PerformerId", + table: "PerformerProfile", + column: "PerformerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_Activity_ActivityCode", + table: "RdvQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_ApplicationUser_ClientId", + table: "RdvQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_PerformerProfile_PerformerId", + table: "RdvQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_UserActivity_Activity_DoesCode", + table: "UserActivity", + column: "DoesCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_UserActivity_PerformerProfile_UserId", + table: "UserActivity", + column: "UserId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.RenameColumn( + name: "orderReference", + table: "PaypalPayment", + newName: "OrderReference"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim_IdentityRole_RoleId", table: "AspNetRoleClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_ApplicationUser_UserId", table: "AspNetUserRoles"); + migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed"); + migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId", table: "CircleAuthorizationToBlogPost"); + migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost"); + migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance"); + migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact"); + migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine"); + migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate"); + migrationBuilder.DropForeignKey(name: "FK_Estimate_PerformerProfile_OwnerId", table: "Estimate"); + migrationBuilder.DropForeignKey(name: "FK_Connection_ApplicationUser_ApplicationUserId", table: "Connection"); + migrationBuilder.DropForeignKey(name: "FK_BrusherProfile_PerformerProfile_UserId", table: "BrusherProfile"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_PaypalPayment_PaymentId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_PerformerProfile_PerformerId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_HairPrestation_PrestationId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_Activity_ActivityCode", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId", table: "HairPrestationCollectionItem"); + migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", table: "HairPrestationCollectionItem"); + migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint"); + migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairPrestation_PrestationId", table: "HairTaintInstance"); + migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairTaint_TaintId", table: "HairTaintInstance"); + migrationBuilder.DropForeignKey(name: "FK_DimissClicked_Notification_NotificationId", table: "DimissClicked"); + migrationBuilder.DropForeignKey(name: "FK_DimissClicked_ApplicationUser_UserId", table: "DimissClicked"); + migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation"); + migrationBuilder.DropForeignKey(name: "FK_PaypalPayment_ApplicationUser_ExecutorId", table: "PaypalPayment"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag"); + migrationBuilder.DropForeignKey(name: "FK_CommandForm_Activity_ActivityCode", table: "CommandForm"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_Activity_ActivityCode", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_ApplicationUser_ClientId", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_PerformerProfile_PerformerId", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_UserActivity_Activity_DoesCode", table: "UserActivity"); + migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity"); + migrationBuilder.DropPrimaryKey(name: "PK_PaypalPayment", table: "PaypalPayment"); + migrationBuilder.DropColumn(name: "PaymentId", table: "HairCutQuery"); + migrationBuilder.DropColumn(name: "Name", table: "CommandLine"); + migrationBuilder.AddPrimaryKey( + name: "PK_PaypalPayment", + table: "PaypalPayment", + column: "PaypalPayerId"); + migrationBuilder.AddForeignKey( + name: "FK_IdentityRoleClaim_IdentityRole_RoleId", + table: "AspNetRoleClaims", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserClaim_ApplicationUser_UserId", + table: "AspNetUserClaims", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserLogin_ApplicationUser_UserId", + table: "AspNetUserLogins", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_IdentityRole_RoleId", + table: "AspNetUserRoles", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_ApplicationUser_UserId", + table: "AspNetUserRoles", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BlackListed_ApplicationUser_OwnerId", + table: "BlackListed", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId", + table: "CircleAuthorizationToBlogPost", + column: "BlogPostId", + principalTable: "Blog", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", + table: "CircleAuthorizationToBlogPost", + column: "CircleId", + principalTable: "Circle", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_AccountBalance_ApplicationUser_UserId", + table: "AccountBalance", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BalanceImpact_AccountBalance_BalanceId", + table: "BalanceImpact", + column: "BalanceId", + principalTable: "AccountBalance", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_CommandLine_Estimate_EstimateId", + table: "CommandLine", + column: "EstimateId", + principalTable: "Estimate", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Estimate_ApplicationUser_ClientId", + table: "Estimate", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Estimate_PerformerProfile_OwnerId", + table: "Estimate", + column: "OwnerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Connection_ApplicationUser_ApplicationUserId", + table: "Connection", + column: "ApplicationUserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BrusherProfile_PerformerProfile_UserId", + table: "BrusherProfile", + column: "UserId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_Activity_ActivityCode", + table: "HairCutQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_ApplicationUser_ClientId", + table: "HairCutQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_PerformerProfile_PerformerId", + table: "HairCutQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_HairPrestation_PrestationId", + table: "HairCutQuery", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_Activity_ActivityCode", + table: "HairMultiCutQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", + table: "HairMultiCutQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", + table: "HairMultiCutQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId", + table: "HairPrestationCollectionItem", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", + table: "HairPrestationCollectionItem", + column: "QueryId", + principalTable: "HairMultiCutQuery", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairTaint_Color_ColorId", + table: "HairTaint", + column: "ColorId", + principalTable: "Color", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairTaintInstance_HairPrestation_PrestationId", + table: "HairTaintInstance", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairTaintInstance_HairTaint_TaintId", + table: "HairTaintInstance", + column: "TaintId", + principalTable: "HairTaint", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_DimissClicked_Notification_NotificationId", + table: "DimissClicked", + column: "NotificationId", + principalTable: "Notification", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_DimissClicked_ApplicationUser_UserId", + table: "DimissClicked", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Instrumentation_Instrument_InstrumentId", + table: "Instrumentation", + column: "InstrumentId", + principalTable: "Instrument", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PaypalPayment_ApplicationUser_ExecutorId", + table: "PaypalPayment", + column: "ExecutorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_CircleMember_Circle_CircleId", + table: "CircleMember", + column: "CircleId", + principalTable: "Circle", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_CircleMember_ApplicationUser_MemberId", + table: "CircleMember", + column: "MemberId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PostTag_Blog_PostId", + table: "PostTag", + column: "PostId", + principalTable: "Blog", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_CommandForm_Activity_ActivityCode", + table: "CommandForm", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Location_OrganizationAddressId", + table: "PerformerProfile", + column: "OrganizationAddressId", + principalTable: "Location", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_ApplicationUser_PerformerId", + table: "PerformerProfile", + column: "PerformerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_Activity_ActivityCode", + table: "RdvQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_ApplicationUser_ClientId", + table: "RdvQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_PerformerProfile_PerformerId", + table: "RdvQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_UserActivity_Activity_DoesCode", + table: "UserActivity", + column: "DoesCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_UserActivity_PerformerProfile_UserId", + table: "UserActivity", + column: "UserId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.RenameColumn( + name: "OrderReference", + table: "PaypalPayment", + newName: "orderReference"); + } + } +} diff --git a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs index a6055d6d..1fb01bf7 100644 --- a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs @@ -319,6 +319,10 @@ namespace Yavsc.Migrations b.Property("EstimateTemplateId"); + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 256); + b.Property("UnitaryCost"); b.HasKey("Id"); @@ -547,6 +551,8 @@ namespace Yavsc.Migrations b.Property("LocationId"); + b.Property("PaymentId"); + b.Property("PerformerId") .IsRequired(); @@ -853,7 +859,7 @@ namespace Yavsc.Migrations modelBuilder.Entity("Yavsc.Models.Payment.PaypalPayment", b => { - b.Property("PaypalPayerId"); + b.Property("PaypalPaymentId"); b.Property("DateCreated"); @@ -862,16 +868,16 @@ namespace Yavsc.Migrations b.Property("ExecutorId") .IsRequired(); - b.Property("PaypalPaymentId") + b.Property("OrderReference"); + + b.Property("PaypalPayerId") .IsRequired(); b.Property("UserCreated"); b.Property("UserModified"); - b.Property("orderReference"); - - b.HasKey("PaypalPayerId"); + b.HasKey("PaypalPaymentId"); }); modelBuilder.Entity("Yavsc.Models.Relationship.Circle", b => @@ -1254,6 +1260,10 @@ namespace Yavsc.Migrations .WithMany() .HasForeignKey("LocationId"); + b.HasOne("Yavsc.Models.Payment.PaypalPayment") + .WithMany() + .HasForeignKey("PaymentId"); + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") .WithMany() .HasForeignKey("PerformerId"); diff --git a/Yavsc/Models/Billing/CommandLine.cs b/Yavsc/Models/Billing/CommandLine.cs index 39be6d41..e2556e22 100644 --- a/Yavsc/Models/Billing/CommandLine.cs +++ b/Yavsc/Models/Billing/CommandLine.cs @@ -5,7 +5,6 @@ using Newtonsoft.Json; namespace Yavsc.Models.Billing { - using System; using YavscLib.Billing; public class CommandLine : ICommandLine { @@ -13,10 +12,14 @@ namespace Yavsc.Models.Billing [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; } - public int Count { get; set; } + [Display(Name="Nombre")] + public int Count { get; set; } = 1; [DisplayFormat(DataFormatString="{0:C}")] public decimal UnitaryCost { get; set; } @@ -31,7 +34,15 @@ namespace Yavsc.Models.Billing get; set; + } = "EUR"; + + [NotMapped] + public string Reference { + get { + return "CL/"+this.Id; + } } } + } diff --git a/Yavsc/Models/Billing/FixedImpacter.cs b/Yavsc/Models/Billing/FixedImpacter.cs index a6a72595..50121342 100644 --- a/Yavsc/Models/Billing/FixedImpacter.cs +++ b/Yavsc/Models/Billing/FixedImpacter.cs @@ -1,3 +1,5 @@ +using YavscLib.Billing; + namespace Yavsc.Models.Billing   { public class FixedImpacter : IBillingImpacter { diff --git a/Yavsc/Models/Billing/NominativeServiceCommand.cs b/Yavsc/Models/Billing/NominativeServiceCommand.cs index aeb03698..a5b9bf3f 100644 --- a/Yavsc/Models/Billing/NominativeServiceCommand.cs +++ b/Yavsc/Models/Billing/NominativeServiceCommand.cs @@ -9,7 +9,7 @@ namespace Yavsc.Models.Billing using Workflow; using YavscLib; using YavscLib.Billing; - using YavscLib.Models.Workflow; + using YavscLib.Workflow; public abstract class NominativeServiceCommand : IBaseTrackedEntity, IQuery, IIdentified { @@ -71,9 +71,6 @@ namespace Yavsc.Models.Billing [ForeignKey("ActivityCode"),JsonIgnore,Display(Name="Domaine d'activité")] public virtual Activity Context  { get; set ; } - public System.Collections.Generic.List GetBillItems() - { - throw new NotImplementedException(); - } + public abstract System.Collections.Generic.List GetBillItems(); } } diff --git a/Yavsc/Models/Billing/ProportionalImpacter.cs b/Yavsc/Models/Billing/ProportionalImpacter.cs index 892aa855..9173cd93 100644 --- a/Yavsc/Models/Billing/ProportionalImpacter.cs +++ b/Yavsc/Models/Billing/ProportionalImpacter.cs @@ -1,5 +1,7 @@ +using YavscLib.Billing; + namespace Yavsc.Models.Billing   { - public class ProportionalImpacter : IBillingImpacter + public class ProportionalImpacter : IBillingImpacter { public decimal K { get; set; } public decimal Impact(decimal orgValue) @@ -8,4 +10,4 @@ namespace Yavsc.Models.Billing   { } } -} \ No newline at end of file +} diff --git a/Yavsc/Models/Billing/ReductionCode.cs b/Yavsc/Models/Billing/ReductionCode.cs index c1b89880..d58a9eed 100644 --- a/Yavsc/Models/Billing/ReductionCode.cs +++ b/Yavsc/Models/Billing/ReductionCode.cs @@ -1,6 +1,8 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using YavscLib.Billing; + namespace Yavsc.Models.Billing { public class ReductionCode : IBillingClause @@ -28,4 +30,4 @@ public class ReductionCode : IBillingClause } } } -} \ No newline at end of file +} diff --git a/Yavsc/Models/HairCut/HairCutQuery.cs b/Yavsc/Models/HairCut/HairCutQuery.cs index 769b38a0..a7695f99 100644 --- a/Yavsc/Models/HairCut/HairCutQuery.cs +++ b/Yavsc/Models/HairCut/HairCutQuery.cs @@ -1,21 +1,27 @@ using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; using Yavsc.Models.Billing; +using Yavsc.Models.Payment; using Yavsc.Models.Relationship; +using YavscLib.Billing; namespace Yavsc.Models.Haircut { public class HairCutQuery : NominativeServiceCommand { + // Bill description public override string Description { get; set; - } = "Prestation en coiffure à domicile"; + } + = "Prestation en coiffure à domicile"; [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] override public long Id { get; set; } @@ -23,17 +29,17 @@ namespace Yavsc.Models.Haircut [Required] public long PrestationId { get; set; } - [ForeignKey("PrestationId"),Required,Display(Name="Préstation")] - public virtual HairPrestation Prestation { get; set; } + [ForeignKey("PrestationId"), Required, Display(Name = "Préstation")] + public virtual HairPrestation Prestation { get; set; } [ForeignKey("LocationId")] - [Display(Name="Lieu du rendez-vous")] + [Display(Name = "Lieu du rendez-vous")] [DisplayFormat(ConvertEmptyStringToNull = true, NullDisplayText = "[Pas de lieu spécifié]")] - public virtual Location Location { get; set; } + 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 + [Display(Name = "Date et heure")] + [DisplayFormat(NullDisplayText = "[Pas de date ni heure]", ApplyFormatInEditMode = true, DataFormatString = "{0:d}")] + public DateTime? EventDate { get; set; @@ -46,9 +52,293 @@ namespace Yavsc.Models.Haircut set; } - [Display(Name="Informations complémentaires"), + [Display(Name = "Informations complémentaires"), StringLengthAttribute(512)] [DisplayFormat(ConvertEmptyStringToNull = true, NullDisplayText = "[pas d'informations complémentaires]")] public string AdditionalInfo { get; set; } + + public string PaymentId { get; set; } + + [ForeignKey("PaymentId"), Display(Name = "Acquittement de la facture")] + public virtual PaypalPayment Regularisation { get; set; } + + public override List GetBillItems() + { + string longhairsuffix = " (cheveux longs)"; + string halflonghairsuffix = " (cheveux mi-longs)"; + string shorthairsuffix = " (cheveux courts)"; + + List bill = new List(); + + // Le shampoing + if (this.Prestation.Shampoo) + bill.Add(new CommandLine { Name = "Shampoing", UnitaryCost = SelectedProfile.ShampooPrice }); + + // la coupe + if (Prestation.Cut) + bill.Add(new CommandLine + { + Name = "Coupe", + 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 + longhairsuffix, + UnitaryCost = multicolor ? SelectedProfile.LongMultiColorPrice : + SelectedProfile.LongColorPrice + }); + break; + case HairLength.HalfLong: + bill.Add(new CommandLine + { + Name = name + halflonghairsuffix, + UnitaryCost = multicolor ? SelectedProfile.HalfMultiColorPrice : SelectedProfile.HalfColorPrice + }); + break; + default: + + bill.Add(new CommandLine + { + Name = name + shorthairsuffix, + UnitaryCost = multicolor ? SelectedProfile.ShortMultiColorPrice : SelectedProfile.ShortColorPrice + }); + + break; + } + } + break; + case HairTechnos.Balayage: + { + string name = "Balayage"; + switch (Prestation.Length) + { + case HairLength.Long: + bill.Add(new CommandLine + { + Name = name + longhairsuffix, + UnitaryCost = SelectedProfile.LongBalayagePrice + }); + break; + case HairLength.HalfLong: + bill.Add(new CommandLine + { + Name = name + halflonghairsuffix, + UnitaryCost = SelectedProfile.HalfBalayagePrice + }); + break; + default: + bill.Add(new CommandLine + { + Name = 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 + longhairsuffix, + UnitaryCost = SelectedProfile.LongDefrisPrice + }); + break; + case HairLength.HalfLong: + bill.Add(new CommandLine + { + Name = name + halflonghairsuffix, + UnitaryCost = SelectedProfile.HalfDefrisPrice + }); + break; + default: + bill.Add(new CommandLine + { + Name = 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 + longhairsuffix, + UnitaryCost = SelectedProfile.LongMechPrice + }); + break; + case HairLength.HalfLong: + bill.Add(new CommandLine + { + Name = name + halflonghairsuffix, + UnitaryCost = SelectedProfile.HalfMechPrice + }); + break; + default: + bill.Add(new CommandLine + { + Name = 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 + longhairsuffix, + UnitaryCost = SelectedProfile.LongPermanentPrice + }); + break; + case HairLength.HalfLong: + bill.Add(new CommandLine + { + Name = name + halflonghairsuffix, + UnitaryCost = SelectedProfile.HalfPermanentPrice + }); + break; + default: + bill.Add(new CommandLine + { + Name = 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 + longhairsuffix, + UnitaryCost = SelectedProfile.LongBrushingPrice + }); + break; + case HairLength.HalfLong: + bill.Add(new CommandLine + { + Name = name + halflonghairsuffix, + UnitaryCost = SelectedProfile.HalfBrushingPrice + }); + break; + default: + bill.Add(new CommandLine + { + Name = name + shorthairsuffix, + UnitaryCost = SelectedProfile.ShortBrushingPrice + }); + break; + } + break; + case HairCutGenders.Man: + bill.Add(new CommandLine + { + Name = 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 + longhairsuffix, + UnitaryCost = SelectedProfile.LongFoldingPrice + }); + break; + case HairLength.HalfLong: + bill.Add(new CommandLine + { + Name = name + halflonghairsuffix, + UnitaryCost = SelectedProfile.HalfFoldingPrice + }); + break; + default: + bill.Add(new CommandLine + { + Name = name + shorthairsuffix, + UnitaryCost = SelectedProfile.ShortFoldingPrice + }); + break; + } + } + break; + } + + // les soins + if (Prestation.Cares) { + bill.Add(new CommandLine { Name = "Soins", + UnitaryCost = SelectedProfile.CarePrice }); + + } + return bill; + } + + [ForeignKeyAttribute("PerformerId")] + public virtual BrusherProfile SelectedProfile { get; set; } + public decimal Addition() => GetBillItems().Aggregate(0m, (t, l) => t + l.Count * l.UnitaryCost); + } } diff --git a/Yavsc/Models/HairCut/HairMultiCutQuery.cs b/Yavsc/Models/HairCut/HairMultiCutQuery.cs index 3bed9fb0..eea5f75c 100644 --- a/Yavsc/Models/HairCut/HairMultiCutQuery.cs +++ b/Yavsc/Models/HairCut/HairMultiCutQuery.cs @@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Billing; using Yavsc.Models.Relationship; +using YavscLib.Billing; namespace Yavsc.Models.Haircut { @@ -44,5 +45,10 @@ namespace Yavsc.Models.Haircut get; set; } + + public override List GetBillItems() + { + throw new NotImplementedException(); + } } } diff --git a/Yavsc/Models/Payment/PaypalPayment.cs b/Yavsc/Models/Payment/PaypalPayment.cs index eaf751f2..32c8e113 100644 --- a/Yavsc/Models/Payment/PaypalPayment.cs +++ b/Yavsc/Models/Payment/PaypalPayment.cs @@ -7,15 +7,18 @@ namespace Yavsc.Models.Payment { public class PaypalPayment : IBaseTrackedEntity { + [Required,Key] + public string PaypalPaymentId { get; set; } + [Required] - public string ExecutorId { get; set; } + public string ExecutorId { get; set; } [ForeignKey("ExecutorId")] public virtual ApplicationUser Executor { get; set; } - [Key,Required] - string PaypalPayerId { get; set; } + [Required] - string PaypalPaymentId { get; set; } - string orderReference { get; set; } + public string PaypalPayerId { get; set; } + + public string OrderReference { get; set; } [Display(Name="Date de création")] public DateTime DateCreated { diff --git a/Yavsc/Models/Workflow/RdvQuery.cs b/Yavsc/Models/Workflow/RdvQuery.cs index 15ccd05f..fde3e5ae 100644 --- a/Yavsc/Models/Workflow/RdvQuery.cs +++ b/Yavsc/Models/Workflow/RdvQuery.cs @@ -4,8 +4,11 @@ using System.ComponentModel.DataAnnotations.Schema; namespace Yavsc.Models.Workflow { - using Yavsc.Models.Billing; - using Yavsc.Models.Relationship; + using System.Collections.Generic; + using Yavsc.Models.Billing; + using Yavsc.Models.Relationship; + using YavscLib.Billing; + /// /// Query, for a date, with a given perfomer, at this given place. /// @@ -57,7 +60,9 @@ namespace Yavsc.Models.Workflow ActivityCode = activityCode; } - - + public override List GetBillItems() + { + throw new NotImplementedException(); + } } } diff --git a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx index d7790349..ee875c1d 100644 --- a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx +++ b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx @@ -234,7 +234,7 @@ Confirmation mot de passe perdu. provenant de Nom complet - L'envoi du message push a échoué + L'envoi du message push a échoué, mais un e-mail a été envoyé Message push envoyé Dites en plus, ci àprès, à propos de cet évennement Google n'a pas pu identifier ce lieu diff --git a/Yavsc/ViewModels/PayPal/Amount.cs b/Yavsc/ViewModels/PayPal/Amount.cs deleted file mode 100644 index 041c4753..00000000 --- a/Yavsc/ViewModels/PayPal/Amount.cs +++ /dev/null @@ -1,26 +0,0 @@ - -namespace Yavsc.ViewModels.PayPal -{ - public class Amount - { - public string total { get; set; } - public string currency { get; set; } = "EUR"; - public class Details - { - public string subtotal { get; set; } - public string shipping { get; set; } - public string tax { get; set; } - public string shipping_discount { get; set; } - - } - public Details details; - public class ItemList - { - public Item[] items; - public string description { get; set; } - public string invoice_number { get; set; } - public string custom { get; set; } - } - - } -} diff --git a/Yavsc/ViewModels/PayPal/PayPalItem.cs b/Yavsc/ViewModels/PayPal/PayPalItem.cs deleted file mode 100644 index 6e949ea1..00000000 --- a/Yavsc/ViewModels/PayPal/PayPalItem.cs +++ /dev/null @@ -1,14 +0,0 @@ - -namespace Yavsc.ViewModels.PayPal -{ - public class Item - { - public string quantity { get; set; } - public string name { get; set; } - public string price { get; set; } - public string currency { get; set; } = "EUR"; - public string description { get; set; } - public string tax { get; set; } = "1"; - - } -} diff --git a/Yavsc/ViewModels/PayPal/PaymentInfo.cs b/Yavsc/ViewModels/PayPal/PaymentInfo.cs new file mode 100644 index 00000000..b5146024 --- /dev/null +++ b/Yavsc/ViewModels/PayPal/PaymentInfo.cs @@ -0,0 +1,11 @@ +using PayPal.Api; +using Yavsc.Models.Payment; + +namespace Yavsc.ViewModels.PayPal +{ + public class PaymentInfo + { + public PaypalPayment DbContent { get; set; } + public Payment FromPaypal { get; set; } + } +} diff --git a/Yavsc/Views/HairCutCommand/CommandConfirmation.cshtml b/Yavsc/Views/HairCutCommand/CommandConfirmation.cshtml index 8759748a..3fc840e9 100644 --- a/Yavsc/Views/HairCutCommand/CommandConfirmation.cshtml +++ b/Yavsc/Views/HairCutCommand/CommandConfirmation.cshtml @@ -31,12 +31,13 @@ @Html.DisplayFor(m=>m.AdditionalInfo) -
Addition minimale - (Compter des frais supplémentaires - en cas de longs déplacements, - ou des majorations en cas de weekend et jour férie) +
Addition minimale
-
@ViewBag.Addition +
@ViewBag.Addition
+ + (Compter des frais supplémentaires
+ en cas de longs déplacements,
+ ou des majorations en cas de weekend et jour férie)
Date de la prestation
@if (Model.EventDate == null) { @@ -65,7 +66,7 @@ else { if (ViewBag.GooglePayload.failure>0) { -
@SR["GCM Notification sending failed"]
+
@SR["EGCMBUTEMAIL"]
} else {
@SR["E-mail sent"]
@@ -73,6 +74,18 @@ } } else {
@SR["E-mail sent"]
}
+
Numéro identifiant votre commande
+
@Model.Id
+ + + +
Facture
+
TODO
+ +
+ +
@Html.DisplayNameFor(m=>m.Regularisation)
+
@Html.DisplayFor(m=>m.Regularisation,new { PaymentUrl = "/api/haircut/createpayment/"+Model.Id.ToString() })
diff --git a/Yavsc/Views/HairCutCommand/HairCut.cshtml b/Yavsc/Views/HairCutCommand/HairCut.cshtml index ce4fa745..ecd0d3a9 100644 --- a/Yavsc/Views/HairCutCommand/HairCut.cshtml +++ b/Yavsc/Views/HairCutCommand/HairCut.cshtml @@ -16,7 +16,6 @@ function updateTarif () { var len = $('#Prestation_Length').prop('selectedIndex'); - var gen = $("#Prestation_Gender").prop('selectedIndex'); var tech = $("#Prestation_Tech").prop('selectedIndex'); var dress = $("#Prestation_Dressing").prop('selectedIndex'); @@ -28,7 +27,6 @@ havecut = true; total += cutprice; displayTarif('CutPrice', cutprice); - } else displayTarif('CutPrice',0); if (gen==0) { if (tech>0) {  @@ -129,8 +127,6 @@ } else gtarif=tarifs[2]; } onTarif(tarifs[0]); - updateTarif(); - }); diff --git a/Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml b/Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml index 3fdb7680..1bfa5ca1 100644 --- a/Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml +++ b/Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml @@ -1,7 +1,7 @@ @model ApplicationUser - +@if (Model!=null) { @Model.UserName @if (Model.Posts!=null) { @SR["index de ses articles"] -} \ No newline at end of file +}} else { néant } \ No newline at end of file diff --git a/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml b/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml index 169e950f..f59206d4 100644 --- a/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml +++ b/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml @@ -1,5 +1,4 @@ @model HairCutQuery -
@Html.DisplayNameFor(m=>m.Prestation)
@@ -21,7 +20,8 @@
@Html.DisplayFor(m=>m.AdditionalInfo)
- +
@Html.DisplayNameFor(m=>m.Regularisation)
+
@Html.DisplayFor(m=>m.Regularisation,new { PaymentUrl = "/api/haircut/createpayment/"+Model.Id.ToString() })
diff --git a/Yavsc/Views/Shared/DisplayTemplates/PaypalPayment.cshtml b/Yavsc/Views/Shared/DisplayTemplates/PaypalPayment.cshtml new file mode 100644 index 00000000..afa3dc9f --- /dev/null +++ b/Yavsc/Views/Shared/DisplayTemplates/PaypalPayment.cshtml @@ -0,0 +1,50 @@ +@model PaypalPayment + +@if (Model!=null && Model.Executor!=null) { + @Html.DisplayFor(m=>m.Executor) +} else { + +
+ + + + + + + + + + +} \ No newline at end of file diff --git a/Yavsc/Views/_ViewImports.cshtml b/Yavsc/Views/_ViewImports.cshtml index e0b6bbcc..ae3fc8b8 100755 --- a/Yavsc/Views/_ViewImports.cshtml +++ b/Yavsc/Views/_ViewImports.cshtml @@ -22,6 +22,7 @@ @using Yavsc.Models.Relationship @using Yavsc.Models.Drawing; @using Yavsc.Models.Haircut; +@using Yavsc.Models.Payment; @using Yavsc.ViewModels.Account; @using Yavsc.ViewModels.Manage; diff --git a/Yavsc/contrib/rsync-to-pre.sh b/Yavsc/contrib/rsync-to-pre.sh index 40503b5e..b1d5af4e 100755 --- a/Yavsc/contrib/rsync-to-pre.sh +++ b/Yavsc/contrib/rsync-to-pre.sh @@ -8,15 +8,11 @@ ssh root@localhost rm -rf $FSPATH/approot/src set -e cd bin/output/ rsync -ravu wwwroot approot root@localhost:$FSPATH - -sleep 5 +ssh root@localhost sync ssh root@localhost service kestrel restart ) -sleep 15 echo "Now, go and try " -# wait a little, for the processes to become stable -sleep 15 echo "Then, feel free to launch contrib/rsync-to-prod.sh" diff --git a/Yavsc/contrib/rsync-to-prod.sh b/Yavsc/contrib/rsync-to-prod.sh index 5ed232bd..89a54f54 100755 --- a/Yavsc/contrib/rsync-to-prod.sh +++ b/Yavsc/contrib/rsync-to-prod.sh @@ -2,16 +2,12 @@ FSPATH=/srv/www/yavsc - - ( set -e ssh root@localhost rm -rf $FSPATH/approot/src cd bin/output/ - rsync -ravu wwwroot approot root@localhost:$FSPATH - ssh root@localhost service kestrel stop - sleep 1 - ssh root@localhost service kestrel start + ssh root@localhost sync + ssh root@localhost service kestrel restart ) diff --git a/Yavsc/tasks.todo b/Yavsc/tasks.todo index e96666f6..1c2b295d 100644 --- a/Yavsc/tasks.todo +++ b/Yavsc/tasks.todo @@ -63,7 +63,9 @@ Ceci est une grosse liste de fonctionnalités, existantes, ou à implémenter, o * La sélection d'une formation musicale: idem chanteur + (rechercher/afficher) la taille de la formation ☐ depuis le mobile ☐ depuis le Web - ☐ Des spécifications détaillées du coeur de l'application + ☐ Des spécifications détaillées du coeur de l'application + ☐ Géocodeur adresse postale + ☐ Evaluation des trajets ## Jalon 2 diff --git a/Yavsc/wwwroot/css/main/site.css b/Yavsc/wwwroot/css/main/site.css index 172d709d..14548a41 100644 --- a/Yavsc/wwwroot/css/main/site.css +++ b/Yavsc/wwwroot/css/main/site.css @@ -18,7 +18,7 @@ .smalltofhol { max-height: 3em; max-width: 3em; float:left; margin:.5em; } .price { font-weight: bold; - font-size: x-large; + font-size: large; padding: .2em; margin: .2em; } @@ -119,21 +119,17 @@ select, padding: .5em; } -.carousel .item .btn { - -webkit-transition: -webkit-transform 2s; - transition: transform 2s background-color 1s color 1s; +.carousel .item .btn { + -webkit-transition: -webkit-transform 2s background-color 1s color 1s; + -moz-transition: transform 2s background-color 2s color 2s; + transition: transform 2s ; transform: scale3d(0,0,0); -webkit-transform: scale3d(0,0,0); } -.carousel .active .btn { +.carousel .active .btn { -webkit-transform: inherit; - transform: inherit; -} -.container { - -webkit-transition: background-color 2s color 1s; - -moz-transition: background-color 2s color 1s; - transition: background-color 2s color 1s; + transform: inherit; } .disabled { color: #999; @@ -147,14 +143,14 @@ select, .carousel-caption-s p { -webkit-text-shadow: 3px 3px 7px rgb(0, 0, 0); - margin:0.5em; - padding:.5em; animation: mymove 4s infinite; font-family: "Arial"; font-weight: 800; font-size: x-large; - text-shadow: 3px 3px 7px rgb(0, 0, 0); - color: white; + text-shadow: 3px 3px 7px rgb(0, 0, 60); + color: #fff; + background-color: rgba(94, 24, 194, .15); + border-radius: .5em; } .carousel-caption-s { diff --git a/YavscLib/Billing/IBillItem.cs b/YavscLib/Billing/IBillItem.cs new file mode 100644 index 00000000..045ff9a8 --- /dev/null +++ b/YavscLib/Billing/IBillItem.cs @@ -0,0 +1,13 @@ +namespace YavscLib.Billing +{ + public interface IBillItem { + string Name { get; set; } + string Description { get; set; } + int Count { get; set; } + decimal UnitaryCost { get; set; } + string Currency { get; set; } + + string Reference { get; } + + } +} diff --git a/YavscLib/Billing/IBillable.cs b/YavscLib/Billing/IBillable.cs new file mode 100644 index 00000000..516ad9df --- /dev/null +++ b/YavscLib/Billing/IBillable.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace YavscLib.Billing +{ + public interface IBillable { + string Description { get; set; } + List GetBillItems(); + + } +} diff --git a/YavscLib/Billing/IBillingImpacter.cs b/YavscLib/Billing/IBillingImpacter.cs new file mode 100644 index 00000000..6aaf5d55 --- /dev/null +++ b/YavscLib/Billing/IBillingImpacter.cs @@ -0,0 +1,8 @@ + +namespace YavscLib.Billing +{ + public interface IBillingImpacter {  + decimal Impact(decimal orgValue); + + } +} diff --git a/YavscLib/IBillingImpacter.cs b/YavscLib/IBillingImpacter.cs deleted file mode 100644 index 0dc72329..00000000 --- a/YavscLib/IBillingImpacter.cs +++ /dev/null @@ -1,6 +0,0 @@ - - -public interface IBillingImpacter {  - decimal Impact(decimal orgValue); - -} diff --git a/YavscLib/IcommandLine.cs b/YavscLib/ICommandLine.cs similarity index 59% rename from YavscLib/IcommandLine.cs rename to YavscLib/ICommandLine.cs index db39a562..311a0506 100644 --- a/YavscLib/IcommandLine.cs +++ b/YavscLib/ICommandLine.cs @@ -1,12 +1,6 @@ namespace YavscLib.Billing { - public interface IBillItem { - string Description { get; set; } - int Count { get; set; } - decimal UnitaryCost { get; set; } - string Currency { get; set; } - } public interface ICommandLine : IBillItem { // FIXME too hard: no such generic name in any interface @@ -14,6 +8,5 @@ namespace YavscLib.Billing // FIXME too far: perhaps no existing estimate long EstimateId { get; set; } - } } diff --git a/YavscLib/IAccountBalance.cs b/YavscLib/Workflow/IAccountBalance.cs similarity index 100% rename from YavscLib/IAccountBalance.cs rename to YavscLib/Workflow/IAccountBalance.cs diff --git a/YavscLib/Workflow/IQuery.cs b/YavscLib/Workflow/IQuery.cs index 007e8499..43ce6a8a 100644 --- a/YavscLib/Workflow/IQuery.cs +++ b/YavscLib/Workflow/IQuery.cs @@ -1,6 +1,5 @@ -namespace YavscLib.Models.Workflow +namespace YavscLib.Workflow { - using System.Collections.Generic; using YavscLib; using YavscLib.Billing; @@ -8,9 +7,4 @@ namespace YavscLib.Models.Workflow { QueryStatus Status { get; set; } } - public interface IBillable { - string Description { get; set; } - List GetBillItems(); - - } } diff --git a/global.json b/global.json index 19201b63..a3aebcec 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,7 @@ { "projects": [ "Yavsc", - "Yavsc.Api", - "Yavsc.Client", - "wrap" + "YavscLib" ], "sdk": { "version": "1.0.0-rc1-update2",