vnext
Paul Schneider 7 years ago
parent a8437733ae
commit db02e965dc
44 changed files with 2798 additions and 350 deletions

@ -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<ApplicationUser> _userManager;
PayPalSettings _paymentSettings;
public HairCutController(ApplicationDbContext context,
IOptions<GoogleAuthSettings> googleSettings,
IGoogleCloudMessageSender GCMSender,
@ -36,6 +40,7 @@ namespace Yavsc.ApiControllers
IEmailSender emailSender,
IOptions<SmtpSettings> smtpSettings,
IOptions<SiteSettings> siteSettings,
IOptions<PayPalSettings> 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<HairCutController>();
}
@ -76,5 +82,14 @@ namespace Yavsc.ApiControllers
return Ok();
}
[HttpPost("createpayment/{id}")]
public async Task<IActionResult> 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);
}
}
}

@ -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<PaymentApiController>();
}
public async Task<IActionResult> 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<IActionResult> Execute(string paymentId, string payerId)
@ -47,59 +59,8 @@ namespace Yavsc.ApiControllers
return Ok(result);
}
[HttpPost("create")]
public async Task<IActionResult> 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<Transaction>
{
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<Item>
{
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);
}
}
}

@ -192,7 +192,7 @@ namespace Yavsc.Controllers
}
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == model.ActivityCode);
ViewBag.GoogleSettings = _googleSettings;
var addition = model.Prestation.Addition(brusherProfile);
var addition = model.Addition(brusherProfile);
ViewBag.Addition = addition.ToString("C",CultureInfo.CurrentUICulture);
return View("CommandConfirmation",model);
}
@ -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";

@ -27,7 +27,7 @@ namespace Yavsc.Extensions
}
return items;
}
public static List<SelectListItem> GetSelectList (Type type, IStringLocalizer SR)
public static List<SelectListItem> GetSelectList (Type type, IStringLocalizer SR, string selectedValue = null)
{
var typeInfo = type.GetTypeInfo();
var values = Enum.GetValues(type).Cast<Enum>();
@ -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()
Value = strval,
Selected = strval == selectedValue
});
}
return items;

@ -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

@ -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;
}
}
}

@ -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}"
};
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<Item> { };
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> { 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

@ -1,3 +1,5 @@
using YavscLib.Billing;
namespace Yavsc.Models.Billing {
public interface IBillingClause { 
string Description {get; set;}

@ -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;

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations

File diff suppressed because it is too large Load Diff

@ -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<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_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<string>(
name: "PaymentId",
table: "HairCutQuery",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Name",
table: "CommandLine",
nullable: false,
defaultValue: "");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_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<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_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<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_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");
}
}
}

@ -319,6 +319,10 @@ namespace Yavsc.Migrations
b.Property<long?>("EstimateTemplateId");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 256);
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
@ -547,6 +551,8 @@ namespace Yavsc.Migrations
b.Property<long?>("LocationId");
b.Property<string>("PaymentId");
b.Property<string>("PerformerId")
.IsRequired();
@ -853,7 +859,7 @@ namespace Yavsc.Migrations
modelBuilder.Entity("Yavsc.Models.Payment.PaypalPayment", b =>
{
b.Property<string>("PaypalPayerId");
b.Property<string>("PaypalPaymentId");
b.Property<DateTime>("DateCreated");
@ -862,16 +868,16 @@ namespace Yavsc.Migrations
b.Property<string>("ExecutorId")
.IsRequired();
b.Property<string>("PaypalPaymentId")
b.Property<string>("OrderReference");
b.Property<string>("PaypalPayerId")
.IsRequired();
b.Property<string>("UserCreated");
b.Property<string>("UserModified");
b.Property<string>("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");

@ -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;
}
}
}
}

@ -1,3 +1,5 @@
using YavscLib.Billing;
namespace Yavsc.Models.Billing   {
public class FixedImpacter : IBillingImpacter
{

@ -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<long>
{
@ -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<IBillItem> GetBillItems()
{
throw new NotImplementedException();
}
public abstract System.Collections.Generic.List<IBillItem> GetBillItems();
}
}

@ -1,3 +1,5 @@
using YavscLib.Billing;
namespace Yavsc.Models.Billing   {
public class ProportionalImpacter : IBillingImpacter
{

@ -1,6 +1,8 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using YavscLib.Billing;
namespace Yavsc.Models.Billing {
public class ReductionCode : IBillingClause

@ -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; }
@ -24,12 +30,12 @@ namespace Yavsc.Models.Haircut
public long PrestationId { get; set; }
[ForeignKey("PrestationId"), Required, Display(Name = "Préstation")]
public virtual HairPrestation Prestation { get; set; }
public virtual HairPrestation Prestation { get; set; }
[ForeignKey("LocationId")]
[Display(Name = "Lieu du rendez-vous")]
[DisplayFormat(ConvertEmptyStringToNull = true, NullDisplayText = "[Pas de lieu spécifié]")]
public virtual Location Location { get; set; }
public virtual Location Location { get; set; }
[Display(Name = "Date et heure")]
[DisplayFormat(NullDisplayText = "[Pas de date ni heure]", ApplyFormatInEditMode = true, DataFormatString = "{0:d}")]
@ -50,5 +56,289 @@ namespace Yavsc.Models.Haircut
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<IBillItem> GetBillItems()
{
string longhairsuffix = " (cheveux longs)";
string halflonghairsuffix = " (cheveux mi-longs)";
string shorthairsuffix = " (cheveux courts)";
List<IBillItem> bill = new List<IBillItem>();
// 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<IBillItem, decimal>(0m, (t, l) => t + l.Count * l.UnitaryCost);
}
}

@ -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<IBillItem> GetBillItems()
{
throw new NotImplementedException();
}
}
}

@ -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; }
[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
{

@ -4,8 +4,11 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Workflow
{
using System.Collections.Generic;
using Yavsc.Models.Billing;
using Yavsc.Models.Relationship;
using YavscLib.Billing;
/// <summary>
/// Query, for a date, with a given perfomer, at this given place.
/// </summary>
@ -57,7 +60,9 @@ namespace Yavsc.Models.Workflow
ActivityCode = activityCode;
}
public override List<IBillItem> GetBillItems()
{
throw new NotImplementedException();
}
}
}

@ -234,7 +234,7 @@
<data name="Forgot Password Confirmation."><value>Confirmation mot de passe perdu.</value></data>
<data name="from"><value>provenant de</value></data>
<data name="Full name"><value>Nom complet</value></data>
<data name="GCM Notification sending failed"><value>L'envoi du message push a échoué</value></data>
<data name="EGCMBUTEMAIL"><value>L'envoi du message push a échoué, mais un e-mail a été envoyé</value></data>
<data name="GCM Notifications sent"><value>Message push envoyé</value></data>
<data name="GiveAnExplicitReason"><value>Dites en plus, ci àprès, à propos de cet évennement</value></data>
<data name="GoogleDidntGeoLocalized"><value>Google n'a pas pu identifier ce lieu</value></data>

@ -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; }
}
}
}

@ -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";
}
}

@ -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; }
}
}

@ -32,11 +32,12 @@
</dd>
<dt>Addition minimale
(Compter des frais supplémentaires
en cas de longs déplacements,
ou des majorations en cas de weekend et jour férie)
</dt>
<dd> <span class="price"> @ViewBag.Addition </span>
<dd> <span class="price"> @ViewBag.Addition </span> <br/>
(Compter des frais supplémentaires <br/>
en cas de longs déplacements,<br/>
ou des majorations en cas de weekend et jour férie)
</dd>
<dt>Date de la prestation</dt>
<dd>@if (Model.EventDate == null) {
@ -65,7 +66,7 @@
else {
if (ViewBag.GooglePayload.failure>0)
{
<div class="error">@SR["GCM Notification sending failed"]</div>
<div class="error">@SR["EGCMBUTEMAIL"]</div>
}
else {
<div>@SR["E-mail sent"]</div>
@ -73,6 +74,18 @@
}
} else {<div>@SR["E-mail sent"]</div>}
</dd>
<dt>Numéro identifiant votre commande</dt>
<dd>@Model.Id</dd>
<environment names="Development">
<dt>Facture</dt>
<dd>TODO</dd>
</environment>
<dt>@Html.DisplayNameFor(m=>m.Regularisation)</dt>
<dd>@Html.DisplayFor(m=>m.Regularisation,new { PaymentUrl = "/api/haircut/createpayment/"+Model.Id.ToString() })</dd>
</dl>

@ -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();
});
</script>

@ -1,7 +1,7 @@
@model ApplicationUser
@if (Model!=null) {
<img src="~/Avatars/@(Model.UserName).s.png" alt="" class="smalltofhol">
@Model.UserName
@if (Model.Posts!=null) { <a asp-controller="Blogspot" asp-action="UserPosts"
asp-route-id="@Model.UserName" class="btn btn-link">@SR["index de ses articles"]</a>
}
}} else { <text>néant</text> }

@ -1,5 +1,4 @@
@model HairCutQuery
<dl class="dl-horizontal">
<dt>@Html.DisplayNameFor(m=>m.Prestation)
</dt>
@ -21,7 +20,8 @@
</dt>
<dd>@Html.DisplayFor(m=>m.AdditionalInfo)
</dd>
<dt>@Html.DisplayNameFor(m=>m.Regularisation)</dt>
<dd>@Html.DisplayFor(m=>m.Regularisation,new { PaymentUrl = "/api/haircut/createpayment/"+Model.Id.ToString() })</dd>
</dl>

@ -0,0 +1,50 @@
@model PaypalPayment
@if (Model!=null && Model.Executor!=null) {
@Html.DisplayFor(m=>m.Executor)
} else {
<div id="paypal-button"></div>
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<environement names="lua,coiffure,zicmoove,yavsc,yavscpre">
<script>
var CREATE_PAYMENT_URL = '@(ViewData["PaymentUrl"])';
var EXECUTE_PAYMENT_URL = 'https://lua.pschneider.fr/api/payment/execute';
var PAYPAL_ENV = 'sandbox';
</script>
</environement>
<environement names="Development">
<script>
var CREATE_PAYMENT_URL = '@(ViewData["PaymentUrl"])';
var EXECUTE_PAYMENT_URL = 'https://dev.pschneider.fr/api/payment/execute';
var PAYPAL_ENV = 'sandbox';
</script>
</environement>
<script>
paypal.Button.render({
env: PAYPAL_ENV, // 'production', Optional: specify 'sandbox' environment
payment: function(resolve, reject) {
return paypal.request.post(CREATE_PAYMENT_URL)
.then(function(data) { resolve(data.id); })
.catch(function(err) { reject(err); });
},
onAuthorize: function(data) {
// Note: you can display a confirmation page before executing
return paypal.request.post(EXECUTE_PAYMENT_URL,
{ paymentID: data.paymentID, payerID: data.payerID })
.then(function(data) { /* Go to a success page */ })
.catch(function(err) { /* Go to an error page */ });
}
}, '#paypal-button');
</script>
}

@ -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;

@ -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 <https://yavscpre.pschneider.fr>"
# wait a little, for the processes to become stable
sleep 15
echo "Then, feel free to launch 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
)

@ -64,6 +64,8 @@ Ceci est une grosse liste de fonctionnalités, existantes, ou à implémenter, o
☐ depuis le mobile
☐ depuis le Web
☐ Des spécifications détaillées du coeur de l'application
☐ Géocodeur adresse postale
☐ Evaluation des trajets
## Jalon 2

@ -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;
}
@ -120,8 +120,9 @@ select,
}
.carousel .item .btn {
-webkit-transition: -webkit-transform 2s;
transition: transform 2s background-color 1s color 1s;
-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);
}
@ -130,11 +131,6 @@ select,
-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;
}
.disabled {
color: #999;
background-color: #555;
@ -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 {

@ -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; }
}
}

@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace YavscLib.Billing
{
public interface IBillable {
string Description { get; set; }
List<IBillItem> GetBillItems();
}
}

@ -0,0 +1,8 @@
namespace YavscLib.Billing
{
public interface IBillingImpacter { 
decimal Impact(decimal orgValue);
}
}

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

@ -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; }
}
}

@ -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<IBillItem> GetBillItems();
}
}

@ -1,9 +1,7 @@
{
"projects": [
"Yavsc",
"Yavsc.Api",
"Yavsc.Client",
"wrap"
"YavscLib"
],
"sdk": {
"version": "1.0.0-rc1-update2",

Loading…