From b0b22ea494cb27385ef7642b551c8bc728022b5f Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Tue, 14 Jun 2016 03:37:57 +0200 Subject: [PATCH] refabrique des commandes --- Yavsc/Controllers/ClientController.cs | 1 - Yavsc/Controllers/CommandController.cs | 85 ++- Yavsc/Controllers/EstimateController.cs | 23 +- Yavsc/Controllers/FrontOfficeController.cs | 9 +- Yavsc/Controllers/ManageController.cs | 1 + Yavsc/GoogleApis/MapTracks.cs | 1 - Yavsc/Helpers/FileSystemHelpers.cs | 8 +- .../20160610153353_client.Designer.cs | 1 - Yavsc/Migrations/20160610153353_client.cs | 1 - .../20160613142037_devices.Designer.cs | 712 ++++++++++++++++++ Yavsc/Migrations/20160613142037_devices.cs | 416 ++++++++++ .../20160614010545_bookquery.Designer.cs | 653 ++++++++++++++++ Yavsc/Migrations/20160614010545_bookquery.cs | 419 +++++++++++ .../ApplicationDbContextModelSnapshot.cs | 227 +++--- Yavsc/Model/ApplicationDbContext.cs | 8 +- Yavsc/Model/Billing/Command.cs | 9 + Yavsc/Model/Billing/CommandLine.cs | 4 +- Yavsc/Model/Billing/Estimate.cs | 7 +- Yavsc/Model/Billing/EstimateAgreement.cs | 4 +- .../{Commande.cs => NominatvieCommande.cs} | 16 +- Yavsc/Model/Billing/histoestim.cs | 2 +- Yavsc/Model/Billing/satisfaction.cs | 2 +- Yavsc/Model/Billing/writtings.cs | 2 +- Yavsc/Model/Billing/wrtags.cs | 2 +- Yavsc/Model/Booking/BookQuery.cs | 39 +- Yavsc/Model/Booking/RendezVous.cs | 38 + Yavsc/Model/Market/BaseProduct.cs | 2 +- Yavsc/Model/Market/Catalog.cs | 2 +- Yavsc/Model/Market/Product.cs | 2 +- Yavsc/Model/Market/Service.cs | 2 +- Yavsc/Model/Workflow/Activity.cs | 3 + Yavsc/Model/Workflow/PerformerProfile.cs | 4 +- Yavsc/Startup/Startup.cs | 2 - .../ViewModels/Auth/AuthorisationHandlers.cs | 10 +- Yavsc/Views/Command/Create.cshtml | 3 + Yavsc/Views/Shared/_GetAToken.cshtml | 7 - Yavsc/Views/Shared/_PerformerPartial.cshtml | 2 +- Yavsc/Views/_ViewImports.cshtml | 17 +- 38 files changed, 2484 insertions(+), 262 deletions(-) create mode 100644 Yavsc/Migrations/20160613142037_devices.Designer.cs create mode 100644 Yavsc/Migrations/20160613142037_devices.cs create mode 100644 Yavsc/Migrations/20160614010545_bookquery.Designer.cs create mode 100644 Yavsc/Migrations/20160614010545_bookquery.cs create mode 100644 Yavsc/Model/Billing/Command.cs rename Yavsc/Model/Billing/{Commande.cs => NominatvieCommande.cs} (84%) create mode 100644 Yavsc/Model/Booking/RendezVous.cs delete mode 100644 Yavsc/Views/Shared/_GetAToken.cshtml diff --git a/Yavsc/Controllers/ClientController.cs b/Yavsc/Controllers/ClientController.cs index eaf5edfb..a1243e82 100644 --- a/Yavsc/Controllers/ClientController.cs +++ b/Yavsc/Controllers/ClientController.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Rendering; diff --git a/Yavsc/Controllers/CommandController.cs b/Yavsc/Controllers/CommandController.cs index 8bac6f85..0da5d76a 100644 --- a/Yavsc/Controllers/CommandController.cs +++ b/Yavsc/Controllers/CommandController.cs @@ -30,7 +30,7 @@ namespace Yavsc.Controllers SmtpSettings _smtpSettings; private readonly ILogger _logger; - public CommandController(ApplicationDbContext context,IOptions googleSettings, + public CommandController(ApplicationDbContext context, IOptions googleSettings, IGoogleCloudMessageSender GCMSender, UserManager userManager, IStringLocalizer localizer, @@ -54,11 +54,11 @@ namespace Yavsc.Controllers public IActionResult Index() { return View(_context.BookQueries - .Include(x=>x.Client) - .Include(x=>x.PerformerProfile) - .Include(x=>x.PerformerProfile.Performer) - .Include(x=>x.Location) - .Include(x=>x.Bill).ToList()); + .Include(x => x.Client) + .Include(x => x.PerformerProfile) + .Include(x => x.PerformerProfile.Performer) + .Include(x => x.Location) + .Include(x => x.Bill).ToList()); } // GET: Command/Details/5 @@ -70,8 +70,8 @@ namespace Yavsc.Controllers } BookQuery command = _context.BookQueries - .Include(x=>x.Location) - .Include(x=>x.PerformerProfile) + .Include(x => x.Location) + .Include(x => x.PerformerProfile) .Single(m => m.Id == id); if (command == null) { @@ -90,66 +90,79 @@ namespace Yavsc.Controllers /// public IActionResult Create(string id) { + if (string.IsNullOrWhiteSpace(id)) + throw new InvalidOperationException( + "This method needs a performer id" + ); var pro = _context.Performers.Include( - x=>x.Performer).FirstOrDefault( - x=>x.PerfomerId == id + x => x.Performer).FirstOrDefault( + x => x.PerfomerId == id ); - if (pro==null) + if (pro == null) return HttpNotFound(); ViewBag.GoogleSettings = _googleSettings; var userid = User.GetUserId(); - var user = _userManager.FindByIdAsync(userid).Result; - return View(new BookQuery{ + var user = _userManager.FindByIdAsync(userid).Result; + return View(new BookQuery(new Location(),DateTime.Now.AddHours(4)) + { PerformerProfile = pro, PerformerId = pro.PerfomerId, ClientId = userid, - Client = user, - Location = new Location(), - EventDate = DateTime.Now.AddHours(4) + Client = user }); } // POST: Command/Create - [HttpPost] + [HttpPost, Authorize] [ValidateAntiForgeryToken] public async Task Create(BookQuery command) { - var pro = _context.Performers.FirstOrDefault( - x=>x.PerfomerId == command.PerformerId + var uid = User.GetUserId(); + var prid = command.PerformerId; + if (string.IsNullOrWhiteSpace(uid) + || string.IsNullOrWhiteSpace(prid)) + throw new InvalidOperationException( + "This method needs a prid and uid" + ); + var pro = _context.Performers.Include( + u => u.Performer + ).Include( u => u.Performer.Devices) + .FirstOrDefault( + x => x.PerfomerId == command.PerformerId ); command.PerformerProfile = pro; - var user = _userManager.FindByIdAsync( - User.GetUserId() - ).Result; + var user = await _userManager.FindByIdAsync( + User.GetUserId() + ); command.Client = user; if (ModelState.IsValid) { var yaev = command.CreateEvent(_localizer); - MessageWithPayloadResponse grep=null; + MessageWithPayloadResponse grep = null; _context.Attach(command.Location); - _context.BookQueries.Add(command,GraphBehavior.IncludeDependents); + _context.BookQueries.Add(command, GraphBehavior.IncludeDependents); _context.SaveChanges(); - if (command.PerformerProfile.AcceptNotifications - && command.PerformerProfile.AcceptPublicContact - && command.PerformerProfile.Performer.Devices.Select(d=>d.RegistrationId)!=null) { - grep = await _GCMSender.NotifyAsync(_googleSettings, - command.PerformerProfile.Performer.Devices.Select(d=>d.RegistrationId), - yaev - ); - } - // TODO setup a profile choice to allow notifications - // both on mailbox and mobile - // if (grep==null || grep.success<=0 || grep.failure>0) + + if (pro.AcceptNotifications + && pro.AcceptPublicContact) { + if (pro.Performer.Devices.Count > 0) + grep = await _GCMSender.NotifyAsync(_googleSettings, + command.PerformerProfile.Performer.Devices.Select(d => d.RegistrationId), + yaev + ); + // TODO setup a profile choice to allow notifications + // both on mailbox and mobile + // if (grep==null || grep.success<=0 || grep.failure>0) + await _emailSender.SendEmailAsync( _siteSettings, _smtpSettings, command.PerformerProfile.Performer.Email, yaev.Title, $"{yaev.Description}\r\n-- \r\n{yaev.Comment}\r\n" ); - } return RedirectToAction("Index"); } diff --git a/Yavsc/Controllers/EstimateController.cs b/Yavsc/Controllers/EstimateController.cs index 5bdf0756..cd2c240c 100644 --- a/Yavsc/Controllers/EstimateController.cs +++ b/Yavsc/Controllers/EstimateController.cs @@ -8,6 +8,7 @@ using Microsoft.Data.Entity; using Microsoft.Extensions.OptionsModel; using Yavsc.Helpers; using Yavsc.Models; +using Yavsc.Models.Billing; namespace Yavsc.Controllers { @@ -36,10 +37,10 @@ namespace Yavsc.Controllers return HttpNotFound(); } - Estimate estimate = _context.Estimates - .Include(e => e.Command) - .Include(e => e.Command.PerformerProfile) - .Include(e => e.Command.PerformerProfile.Performer) + RDVEstimate estimate = _context.Estimates + .Include(e => e.Query) + .Include(e => e.Query.PerformerProfile) + .Include(e => e.Query.PerformerProfile.Performer) .Single(m => m.Id == id); if (estimate == null) { @@ -60,7 +61,7 @@ namespace Yavsc.Controllers // POST: Estimate/Create [HttpPost] [ValidateAntiForgeryToken] - public IActionResult Create(Estimate estimate, + public IActionResult Create(RDVEstimate estimate, ICollection newGraphics, ICollection newFiles ) @@ -74,9 +75,9 @@ namespace Yavsc.Controllers var perfomerProfile = _context.Performers .Include( perpr => perpr.Performer).FirstOrDefault( - x=>x.PerfomerId == estimate.Command.PerformerId + x=>x.PerfomerId == estimate.Query.PerformerId ); - var command = _context.Commands.FirstOrDefault( + var command = _context.BookQueries.FirstOrDefault( cmd => cmd.Id == estimate.CommandId ); @@ -114,7 +115,7 @@ namespace Yavsc.Controllers return HttpNotFound(); } - Estimate estimate = _context.Estimates.Single(m => m.Id == id); + RDVEstimate estimate = _context.Estimates.Single(m => m.Id == id); if (estimate == null) { return HttpNotFound(); @@ -126,7 +127,7 @@ namespace Yavsc.Controllers // POST: Estimate/Edit/5 [HttpPost] [ValidateAntiForgeryToken] - public IActionResult Edit(Estimate estimate) + public IActionResult Edit(RDVEstimate estimate) { if (ModelState.IsValid) { @@ -146,7 +147,7 @@ namespace Yavsc.Controllers return HttpNotFound(); } - Estimate estimate = _context.Estimates.Single(m => m.Id == id); + RDVEstimate estimate = _context.Estimates.Single(m => m.Id == id); if (estimate == null) { return HttpNotFound(); @@ -160,7 +161,7 @@ namespace Yavsc.Controllers [ValidateAntiForgeryToken] public IActionResult DeleteConfirmed(long id) { - Estimate estimate = _context.Estimates.Single(m => m.Id == id); + RDVEstimate estimate = _context.Estimates.Single(m => m.Id == id); _context.Estimates.Remove(estimate); _context.SaveChanges(); return RedirectToAction("Index"); diff --git a/Yavsc/Controllers/FrontOfficeController.cs b/Yavsc/Controllers/FrontOfficeController.cs index 3a4a7667..a7eb46f8 100644 --- a/Yavsc/Controllers/FrontOfficeController.cs +++ b/Yavsc/Controllers/FrontOfficeController.cs @@ -7,6 +7,7 @@ using Microsoft.Data.Entity; using Microsoft.Extensions.Logging; using Yavsc.Models.Booking; using Yavsc.Helpers; +using Yavsc.Models.Billing; namespace Yavsc.Controllers { @@ -94,11 +95,11 @@ namespace Yavsc.Controllers [Produces("text/x-tex"), Authorize, Route("Release/Estimate-{id}.tex")] - public Estimate Estimate(long id) + public RDVEstimate Estimate(long id) { - var estimate = _context.Estimates.Include(x=>x.Command). - Include(x=>x.Command.Client).FirstOrDefault(x=>x.Id==id); - var adc = estimate.Command.Client.UserName; + var estimate = _context.Estimates.Include(x=>x.Query). + Include(x=>x.Query.Client).FirstOrDefault(x=>x.Id==id); + var adc = estimate.Query.Client.UserName; return estimate; } } diff --git a/Yavsc/Controllers/ManageController.cs b/Yavsc/Controllers/ManageController.cs index a75fc674..1228758c 100644 --- a/Yavsc/Controllers/ManageController.cs +++ b/Yavsc/Controllers/ManageController.cs @@ -18,6 +18,7 @@ using Yavsc.Helpers; using Yavsc.ViewModels.Calendar; using System.Net; using Microsoft.Extensions.Localization; +using Yavsc.Models.Workflow; namespace Yavsc.Controllers { diff --git a/Yavsc/GoogleApis/MapTracks.cs b/Yavsc/GoogleApis/MapTracks.cs index a3f7c8d8..94132bf2 100644 --- a/Yavsc/GoogleApis/MapTracks.cs +++ b/Yavsc/GoogleApis/MapTracks.cs @@ -19,7 +19,6 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . using Yavsc.Helpers; -using Yavsc.Model; using Yavsc.Models.Google; namespace Yavsc.GoogleApis diff --git a/Yavsc/Helpers/FileSystemHelpers.cs b/Yavsc/Helpers/FileSystemHelpers.cs index 71d0cb6a..74984222 100644 --- a/Yavsc/Helpers/FileSystemHelpers.cs +++ b/Yavsc/Helpers/FileSystemHelpers.cs @@ -1,18 +1,18 @@ using System.IO; using Microsoft.AspNet.FileProviders; -using Yavsc.Models; +using Yavsc.Models.Billing; namespace Yavsc.Helpers { public static class FileSystemHelpers { - public static IDirectoryContents GetFileContent(this Estimate estimate, string userFileDir) + public static IDirectoryContents GetFileContent(this RDVEstimate estimate, string userFileDir) { - if (estimate?.Command?.PerformerProfile?.Performer == null) + if (estimate?.Query?.PerformerProfile?.Performer == null) return null; var fsp = new PhysicalFileProvider( Path.Combine( userFileDir, - estimate.Command.PerformerProfile.Performer.UserName + estimate.Query.PerformerProfile.Performer.UserName )); return fsp.GetDirectoryContents( Path.Combine(Constants.UserBillsFilesDir, estimate.Id.ToString()) diff --git a/Yavsc/Migrations/20160610153353_client.Designer.cs b/Yavsc/Migrations/20160610153353_client.Designer.cs index bb3526b2..971f52c8 100644 --- a/Yavsc/Migrations/20160610153353_client.Designer.cs +++ b/Yavsc/Migrations/20160610153353_client.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/20160610153353_client.cs b/Yavsc/Migrations/20160610153353_client.cs index a3f674d2..ea79a563 100644 --- a/Yavsc/Migrations/20160610153353_client.cs +++ b/Yavsc/Migrations/20160610153353_client.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using Microsoft.Data.Entity.Migrations; namespace Yavsc.Migrations diff --git a/Yavsc/Migrations/20160613142037_devices.Designer.cs b/Yavsc/Migrations/20160613142037_devices.Designer.cs new file mode 100644 index 00000000..dc57c4ac --- /dev/null +++ b/Yavsc/Migrations/20160613142037_devices.Designer.cs @@ -0,0 +1,712 @@ +using System; +using Microsoft.Data.Entity; +using Microsoft.Data.Entity.Infrastructure; +using Microsoft.Data.Entity.Migrations; +using Yavsc.Models; + +namespace Yavsc.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20160613142037_devices")] + partial class devices + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { + modelBuilder + .HasAnnotation("ProductVersion", "7.0.0-rc1-16348"); + + modelBuilder.Entity("GoogleCloudMobileDeclaration", b => + { + b.Property("RegistrationId"); + + b.Property("DeviceOwnerId"); + + b.Property("Name"); + + b.HasKey("RegistrationId"); + }); + + 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.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Address") + .IsRequired(); + + b.Property("Latitude"); + + b.Property("Longitude"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.AccountBalance", b => + { + b.Property("UserId"); + + b.Property("ContactCredits"); + + b.Property("Credits"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Activity", b => + { + b.Property("Code") + .HasAnnotation("MaxLength", 512); + + b.Property("ActorDenomination"); + + b.Property("Description"); + + b.Property("ModeratorGroupName"); + + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 512); + + b.Property("Photo"); + + b.HasKey("Code"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.Property("Id"); + + b.Property("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("DedicatedGoogleCalendar"); + + b.Property("Email") + .HasAnnotation("MaxLength", 256); + + b.Property("EmailConfirmed"); + + 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.Billing.CommandLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ArticleId"); + + b.Property("BookQueryId"); + + b.Property("Comment"); + + b.Property("Count"); + + b.Property("EstimateId"); + + b.Property("NominativeCommandId"); + + 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("CommandId"); + + b.Property("Description"); + + b.Property("Status"); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.NominativeCommand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClientId") + .IsRequired(); + + b.Property("CreationDate"); + + b.Property("Lag"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("Previsional"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuthorId") + .IsRequired(); + + b.Property("bcontent"); + + b.Property("modified"); + + b.Property("photo"); + + b.Property("posted"); + + b.Property("rate"); + + b.Property("title"); + + b.Property("visible"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClientId") + .IsRequired(); + + b.Property("CreationDate") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("EventDate"); + + b.Property("Lag"); + + b.Property("LocationId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("Previsional"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Circle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("OwnerId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.CircleMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CircleId") + .IsRequired(); + + b.Property("MemberId") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Contact", b => + { + b.Property("OwnerId"); + + b.Property("UserId"); + + b.HasKey("OwnerId", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("Name"); + + b.Property("Public"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.CommandSpecification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ModelType"); + + b.Property("QueryViewName"); + + b.Property("ServiceId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Billing"); + + b.Property("ContextId"); + + b.Property("Description"); + + b.Property("Name"); + + b.Property("Pricing"); + + b.Property("Public"); + + b.HasKey("Id"); + }); + + 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.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Rate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.Property("PerfomerId"); + + b.Property("AcceptGeoLocalisation"); + + b.Property("AcceptNotifications"); + + b.Property("AcceptPublicContact"); + + b.Property("Active"); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("MaxDailyCost"); + + b.Property("MinDailyCost"); + + b.Property("OfferId"); + + b.Property("OrganisationAddressId"); + + b.Property("Rate"); + + b.Property("SIREN") + .IsRequired() + .HasAnnotation("MaxLength", 14); + + b.Property("WebSite"); + + b.HasKey("PerfomerId"); + }); + + modelBuilder.Entity("GoogleCloudMobileDeclaration", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("DeviceOwnerId"); + }); + + 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.AccountBalance", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithOne() + .HasForeignKey("Yavsc.Models.AccountBalance", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.HasOne("Yavsc.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.Market.BaseProduct") + .WithMany() + .HasForeignKey("ArticleId"); + + b.HasOne("Yavsc.Models.Booking.BookQuery") + .WithMany() + .HasForeignKey("BookQueryId"); + + b.HasOne("Yavsc.Models.Billing.Estimate") + .WithMany() + .HasForeignKey("EstimateId"); + + b.HasOne("Yavsc.Models.Billing.NominativeCommand") + .WithMany() + .HasForeignKey("NominativeCommandId"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b => + { + b.HasOne("Yavsc.Models.Billing.NominativeCommand") + .WithMany() + .HasForeignKey("CommandId"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.NominativeCommand", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("AuthorId"); + }); + + modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Location") + .WithMany() + .HasForeignKey("LocationId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Circle", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.CircleMember", b => + { + b.HasOne("Yavsc.Models.Circle") + .WithMany() + .HasForeignKey("CircleId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("MemberId"); + }); + + modelBuilder.Entity("Yavsc.Models.Contact", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.CommandSpecification", b => + { + b.HasOne("Yavsc.Models.Market.Service") + .WithMany() + .HasForeignKey("ServiceId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.HasOne("Yavsc.Models.Activity") + .WithMany() + .HasForeignKey("ContextId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.HasOne("Yavsc.Models.Activity") + .WithMany() + .HasForeignKey("ActivityCode"); + + b.HasOne("Yavsc.Models.Market.Service") + .WithMany() + .HasForeignKey("OfferId"); + + b.HasOne("Yavsc.Location") + .WithMany() + .HasForeignKey("OrganisationAddressId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("PerfomerId"); + }); + } + } +} diff --git a/Yavsc/Migrations/20160613142037_devices.cs b/Yavsc/Migrations/20160613142037_devices.cs new file mode 100644 index 00000000..708a28eb --- /dev/null +++ b/Yavsc/Migrations/20160613142037_devices.cs @@ -0,0 +1,416 @@ +using System; +using Microsoft.Data.Entity.Migrations; + +namespace Yavsc.Migrations +{ + public partial class devices : 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_AccountBalance_ApplicationUser_UserId", table: "AccountBalance"); + migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact"); + migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog"); + migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery"); + migrationBuilder.DropForeignKey(name: "FK_BookQuery_Location_LocationId", table: "BookQuery"); + migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_CommandLine_Command_CommandId", table: "CommandLine"); + migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact"); + migrationBuilder.DropForeignKey(name: "FK_Estimate_Command_CommandId", table: "Estimate"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile"); + migrationBuilder.DropColumn(name: "AllowedOrigin", table: "Client"); + migrationBuilder.DropColumn(name: "CommandId", table: "CommandLine"); + migrationBuilder.DropTable("Command"); + migrationBuilder.CreateTable( + name: "NominativeCommand", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:Serial", true), + ClientId = table.Column(nullable: false), + CreationDate = table.Column(nullable: false), + Lag = table.Column(nullable: false), + PerformerId = table.Column(nullable: false), + Previsional = table.Column(nullable: true), + ValidationDate = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_NominativeCommand", x => x.Id); + table.ForeignKey( + name: "FK_NominativeCommand_ApplicationUser_ClientId", + column: x => x.ClientId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_NominativeCommand_PerformerProfile_PerformerId", + column: x => x.PerformerId, + principalTable: "PerformerProfile", + principalColumn: "PerfomerId", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( + name: "CommandSpecification", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:Serial", true), + ModelType = table.Column(nullable: true), + QueryViewName = table.Column(nullable: true), + ServiceId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CommandSpecification", x => x.Id); + table.ForeignKey( + name: "FK_CommandSpecification_Service_ServiceId", + column: x => x.ServiceId, + principalTable: "Service", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.AddColumn( + name: "NominativeCommandId", + table: "CommandLine", + nullable: true); + 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_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_NominativeCommand_NominativeCommandId", + table: "CommandLine", + column: "NominativeCommandId", + principalTable: "NominativeCommand", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Estimate_NominativeCommand_CommandId", + table: "Estimate", + column: "CommandId", + principalTable: "NominativeCommand", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Blog_ApplicationUser_AuthorId", + table: "Blog", + column: "AuthorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BookQuery_ApplicationUser_ClientId", + table: "BookQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BookQuery_Location_LocationId", + table: "BookQuery", + column: "LocationId", + principalTable: "Location", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BookQuery_PerformerProfile_PerformerId", + table: "BookQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerfomerId", + 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_Contact_ApplicationUser_OwnerId", + table: "Contact", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Activity_ActivityCode", + table: "PerformerProfile", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Location_OrganisationAddressId", + table: "PerformerProfile", + column: "OrganisationAddressId", + principalTable: "Location", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_ApplicationUser_PerfomerId", + table: "PerformerProfile", + column: "PerfomerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + 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_AccountBalance_ApplicationUser_UserId", table: "AccountBalance"); + migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact"); + migrationBuilder.DropForeignKey(name: "FK_CommandLine_NominativeCommand_NominativeCommandId", table: "CommandLine"); + migrationBuilder.DropForeignKey(name: "FK_Estimate_NominativeCommand_CommandId", table: "Estimate"); + migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog"); + migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery"); + migrationBuilder.DropForeignKey(name: "FK_BookQuery_Location_LocationId", table: "BookQuery"); + migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile"); + migrationBuilder.DropColumn(name: "NominativeCommandId", table: "CommandLine"); + migrationBuilder.DropTable("NominativeCommand"); + migrationBuilder.DropTable("CommandSpecification"); + migrationBuilder.CreateTable( + name: "Command", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:Serial", true), + ClientId = table.Column(nullable: false), + CreationDate = table.Column(nullable: false), + Lag = table.Column(nullable: false), + PerformerId = table.Column(nullable: false), + Previsional = table.Column(nullable: true), + ValidationDate = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Command", x => x.Id); + table.ForeignKey( + name: "FK_Command_ApplicationUser_ClientId", + column: x => x.ClientId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Command_PerformerProfile_PerformerId", + column: x => x.PerformerId, + principalTable: "PerformerProfile", + principalColumn: "PerfomerId", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.AddColumn( + name: "AllowedOrigin", + table: "Client", + nullable: true); + migrationBuilder.AddColumn( + name: "CommandId", + table: "CommandLine", + nullable: true); + 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_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_Blog_ApplicationUser_AuthorId", + table: "Blog", + column: "AuthorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BookQuery_ApplicationUser_ClientId", + table: "BookQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BookQuery_Location_LocationId", + table: "BookQuery", + column: "LocationId", + principalTable: "Location", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BookQuery_PerformerProfile_PerformerId", + table: "BookQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerfomerId", + 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_CommandLine_Command_CommandId", + table: "CommandLine", + column: "CommandId", + principalTable: "Command", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Contact_ApplicationUser_OwnerId", + table: "Contact", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Estimate_Command_CommandId", + table: "Estimate", + column: "CommandId", + principalTable: "Command", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Activity_ActivityCode", + table: "PerformerProfile", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Location_OrganisationAddressId", + table: "PerformerProfile", + column: "OrganisationAddressId", + principalTable: "Location", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_ApplicationUser_PerfomerId", + table: "PerformerProfile", + column: "PerfomerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/Yavsc/Migrations/20160614010545_bookquery.Designer.cs b/Yavsc/Migrations/20160614010545_bookquery.Designer.cs new file mode 100644 index 00000000..b000df2e --- /dev/null +++ b/Yavsc/Migrations/20160614010545_bookquery.Designer.cs @@ -0,0 +1,653 @@ +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("20160614010545_bookquery")] + partial class bookquery + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { + modelBuilder + .HasAnnotation("ProductVersion", "7.0.0-rc1-16348"); + + modelBuilder.Entity("GoogleCloudMobileDeclaration", b => + { + b.Property("RegistrationId"); + + b.Property("DeviceOwnerId"); + + b.Property("Name"); + + b.HasKey("RegistrationId"); + }); + + 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.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Address") + .IsRequired(); + + b.Property("Latitude"); + + b.Property("Longitude"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.AccountBalance", b => + { + b.Property("UserId"); + + b.Property("ContactCredits"); + + b.Property("Credits"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Activity", b => + { + b.Property("Code") + .HasAnnotation("MaxLength", 512); + + b.Property("ActorDenomination"); + + b.Property("Description"); + + b.Property("ModeratorGroupName"); + + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 512); + + b.Property("Photo"); + + b.HasKey("Code"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.Property("Id"); + + b.Property("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("DedicatedGoogleCalendar"); + + b.Property("Email") + .HasAnnotation("MaxLength", 256); + + b.Property("EmailConfirmed"); + + 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.Billing.CommandLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ArticleId"); + + b.Property("BookQueryId"); + + b.Property("Comment"); + + b.Property("Count"); + + b.Property("RDVEstimateId"); + + b.Property("UnitaryCost"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.RDVEstimate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AttachedFilesString"); + + b.Property("AttachedGraphicsString"); + + b.Property("CommandId"); + + b.Property("Description"); + + b.Property("Status"); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuthorId") + .IsRequired(); + + b.Property("bcontent"); + + b.Property("modified"); + + b.Property("photo"); + + b.Property("posted"); + + b.Property("rate"); + + b.Property("title"); + + b.Property("visible"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClientId") + .IsRequired(); + + b.Property("CreationDate") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("EventDate"); + + b.Property("Lag"); + + b.Property("LocationId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("Previsional"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Circle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("OwnerId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.CircleMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CircleId") + .IsRequired(); + + b.Property("MemberId") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Contact", b => + { + b.Property("OwnerId"); + + b.Property("UserId"); + + b.HasKey("OwnerId", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("Name"); + + b.Property("Public"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Billing"); + + b.Property("ContextId"); + + b.Property("Description"); + + b.Property("Name"); + + b.Property("Pricing"); + + b.Property("Public"); + + b.HasKey("Id"); + }); + + 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.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Rate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.Property("PerfomerId"); + + b.Property("AcceptGeoLocalisation"); + + b.Property("AcceptNotifications"); + + b.Property("AcceptPublicContact"); + + b.Property("Active"); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("MaxDailyCost"); + + b.Property("MinDailyCost"); + + b.Property("OfferId"); + + b.Property("OrganisationAddressId"); + + b.Property("Rate"); + + b.Property("SIREN") + .IsRequired() + .HasAnnotation("MaxLength", 14); + + b.Property("WebSite"); + + b.HasKey("PerfomerId"); + }); + + modelBuilder.Entity("GoogleCloudMobileDeclaration", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("DeviceOwnerId"); + }); + + 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.AccountBalance", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithOne() + .HasForeignKey("Yavsc.Models.AccountBalance", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.HasOne("Yavsc.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.Market.BaseProduct") + .WithMany() + .HasForeignKey("ArticleId"); + + b.HasOne("Yavsc.Models.Booking.BookQuery") + .WithMany() + .HasForeignKey("BookQueryId"); + + b.HasOne("Yavsc.Models.Billing.RDVEstimate") + .WithMany() + .HasForeignKey("RDVEstimateId"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.RDVEstimate", b => + { + b.HasOne("Yavsc.Models.Booking.BookQuery") + .WithMany() + .HasForeignKey("CommandId"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("AuthorId"); + }); + + modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Location") + .WithMany() + .HasForeignKey("LocationId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Circle", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.CircleMember", b => + { + b.HasOne("Yavsc.Models.Circle") + .WithMany() + .HasForeignKey("CircleId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("MemberId"); + }); + + modelBuilder.Entity("Yavsc.Models.Contact", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.HasOne("Yavsc.Models.Activity") + .WithMany() + .HasForeignKey("ContextId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.HasOne("Yavsc.Models.Activity") + .WithMany() + .HasForeignKey("ActivityCode"); + + b.HasOne("Yavsc.Models.Market.Service") + .WithMany() + .HasForeignKey("OfferId"); + + b.HasOne("Yavsc.Location") + .WithMany() + .HasForeignKey("OrganisationAddressId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("PerfomerId"); + }); + } + } +} diff --git a/Yavsc/Migrations/20160614010545_bookquery.cs b/Yavsc/Migrations/20160614010545_bookquery.cs new file mode 100644 index 00000000..4e33216b --- /dev/null +++ b/Yavsc/Migrations/20160614010545_bookquery.cs @@ -0,0 +1,419 @@ +using System; +using System.Collections.Generic; +using Microsoft.Data.Entity.Migrations; + +namespace Yavsc.Migrations +{ + public partial class bookquery : 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_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_CommandLine_NominativeCommand_NominativeCommandId", table: "CommandLine"); + migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog"); + migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery"); + migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile"); + migrationBuilder.DropColumn(name: "EstimateId", table: "CommandLine"); + migrationBuilder.DropColumn(name: "NominativeCommandId", table: "CommandLine"); + migrationBuilder.DropTable("Estimate"); + migrationBuilder.DropTable("CommandSpecification"); + migrationBuilder.DropTable("NominativeCommand"); + migrationBuilder.CreateTable( + name: "RDVEstimate", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:Serial", true), + AttachedFilesString = table.Column(nullable: true), + AttachedGraphicsString = table.Column(nullable: true), + CommandId = table.Column(nullable: true), + Description = table.Column(nullable: true), + Status = table.Column(nullable: true), + Title = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_RDVEstimate", x => x.Id); + table.ForeignKey( + name: "FK_RDVEstimate_BookQuery_CommandId", + column: x => x.CommandId, + principalTable: "BookQuery", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.AlterColumn( + name: "LocationId", + table: "BookQuery", + nullable: true); + migrationBuilder.AddColumn( + name: "RDVEstimateId", + table: "CommandLine", + nullable: true); + 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_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_RDVEstimate_RDVEstimateId", + table: "CommandLine", + column: "RDVEstimateId", + principalTable: "RDVEstimate", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Blog_ApplicationUser_AuthorId", + table: "Blog", + column: "AuthorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BookQuery_ApplicationUser_ClientId", + table: "BookQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BookQuery_PerformerProfile_PerformerId", + table: "BookQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerfomerId", + 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_Contact_ApplicationUser_OwnerId", + table: "Contact", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Activity_ActivityCode", + table: "PerformerProfile", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Location_OrganisationAddressId", + table: "PerformerProfile", + column: "OrganisationAddressId", + principalTable: "Location", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_ApplicationUser_PerfomerId", + table: "PerformerProfile", + column: "PerfomerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + 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_AccountBalance_ApplicationUser_UserId", table: "AccountBalance"); + migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact"); + migrationBuilder.DropForeignKey(name: "FK_CommandLine_RDVEstimate_RDVEstimateId", table: "CommandLine"); + migrationBuilder.DropForeignKey(name: "FK_Blog_ApplicationUser_AuthorId", table: "Blog"); + migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery"); + migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganisationAddressId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerfomerId", table: "PerformerProfile"); + migrationBuilder.DropColumn(name: "RDVEstimateId", table: "CommandLine"); + migrationBuilder.DropTable("RDVEstimate"); + migrationBuilder.CreateTable( + name: "NominativeCommand", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:Serial", true), + ClientId = table.Column(nullable: false), + CreationDate = table.Column(nullable: false), + Lag = table.Column(nullable: false), + PerformerId = table.Column(nullable: false), + Previsional = table.Column(nullable: true), + ValidationDate = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_NominativeCommand", x => x.Id); + table.ForeignKey( + name: "FK_NominativeCommand_ApplicationUser_ClientId", + column: x => x.ClientId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_NominativeCommand_PerformerProfile_PerformerId", + column: x => x.PerformerId, + principalTable: "PerformerProfile", + principalColumn: "PerfomerId", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( + name: "CommandSpecification", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:Serial", true), + ModelType = table.Column(nullable: true), + QueryViewName = table.Column(nullable: true), + ServiceId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CommandSpecification", x => x.Id); + table.ForeignKey( + name: "FK_CommandSpecification_Service_ServiceId", + column: x => x.ServiceId, + principalTable: "Service", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( + name: "Estimate", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:Serial", true), + AttachedFilesString = table.Column(nullable: true), + AttachedGraphicsString = table.Column(nullable: true), + CommandId = table.Column(nullable: true), + Description = table.Column(nullable: true), + Status = table.Column(nullable: true), + Title = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Estimate", x => x.Id); + table.ForeignKey( + name: "FK_Estimate_NominativeCommand_CommandId", + column: x => x.CommandId, + principalTable: "NominativeCommand", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.AlterColumn( + name: "LocationId", + table: "BookQuery", + nullable: false); + migrationBuilder.AddColumn( + name: "EstimateId", + table: "CommandLine", + nullable: true); + migrationBuilder.AddColumn( + name: "NominativeCommandId", + table: "CommandLine", + nullable: true); + 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_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_CommandLine_NominativeCommand_NominativeCommandId", + table: "CommandLine", + column: "NominativeCommandId", + principalTable: "NominativeCommand", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Blog_ApplicationUser_AuthorId", + table: "Blog", + column: "AuthorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BookQuery_ApplicationUser_ClientId", + table: "BookQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BookQuery_PerformerProfile_PerformerId", + table: "BookQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerfomerId", + 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_Contact_ApplicationUser_OwnerId", + table: "Contact", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Activity_ActivityCode", + table: "PerformerProfile", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Location_OrganisationAddressId", + table: "PerformerProfile", + column: "OrganisationAddressId", + principalTable: "Location", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_ApplicationUser_PerfomerId", + table: "PerformerProfile", + column: "PerfomerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs index 38510039..21362a2c 100644 --- a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs @@ -212,12 +212,10 @@ namespace Yavsc.Migrations b.Property("Active"); - b.Property("AllowedOrigin") - .HasAnnotation("MaxLength", 100); - b.Property("DisplayName"); - b.Property("LogoutRedirectUri"); + b.Property("LogoutRedirectUri") + .HasAnnotation("MaxLength", 100); b.Property("RedirectUri"); @@ -270,16 +268,42 @@ namespace Yavsc.Migrations b.HasKey("Id"); }); - modelBuilder.Entity("Yavsc.Models.BaseProduct", b => + modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b => { b.Property("Id") .ValueGeneratedOnAdd(); + b.Property("ArticleId"); + + b.Property("BookQueryId"); + + b.Property("Comment"); + + b.Property("Count"); + + b.Property("RDVEstimateId"); + + b.Property("UnitaryCost"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.RDVEstimate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AttachedFilesString"); + + b.Property("AttachedGraphicsString"); + + b.Property("CommandId"); + b.Property("Description"); - b.Property("Name"); + b.Property("Status"); - b.Property("Public"); + b.Property("Title"); b.HasKey("Id"); }); @@ -325,7 +349,7 @@ namespace Yavsc.Migrations b.Property("Lag"); - b.Property("LocationId"); + b.Property("LocationId"); b.Property("PerformerId") .IsRequired(); @@ -363,50 +387,6 @@ namespace Yavsc.Migrations b.HasKey("Id"); }); - modelBuilder.Entity("Yavsc.Models.Command", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ClientId") - .IsRequired(); - - b.Property("CreationDate"); - - b.Property("Lag"); - - b.Property("PerformerId") - .IsRequired(); - - b.Property("Previsional"); - - b.Property("ValidationDate"); - - b.HasKey("Id"); - }); - - modelBuilder.Entity("Yavsc.Models.CommandLine", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ArticleId"); - - b.Property("BookQueryId"); - - b.Property("CommandId"); - - b.Property("Comment"); - - b.Property("Count"); - - b.Property("EstimateId"); - - b.Property("UnitaryCost"); - - b.HasKey("Id"); - }); - modelBuilder.Entity("Yavsc.Models.Contact", b => { b.Property("OwnerId"); @@ -416,22 +396,36 @@ namespace Yavsc.Migrations b.HasKey("OwnerId", "UserId"); }); - modelBuilder.Entity("Yavsc.Models.Estimate", b => + modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b => { b.Property("Id") .ValueGeneratedOnAdd(); - b.Property("AttachedFilesString"); + b.Property("Description"); - b.Property("AttachedGraphicsString"); + b.Property("Name"); - b.Property("CommandId"); + b.Property("Public"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Billing"); + + b.Property("ContextId"); b.Property("Description"); - b.Property("Status"); + b.Property("Name"); - b.Property("Title"); + b.Property("Pricing"); + + b.Property("Public"); b.HasKey("Id"); }); @@ -453,7 +447,19 @@ namespace Yavsc.Migrations b.HasKey("UserId"); }); - modelBuilder.Entity("Yavsc.Models.PerformerProfile", b => + modelBuilder.Entity("Yavsc.Models.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Rate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => { b.Property("PerfomerId"); @@ -487,38 +493,6 @@ namespace Yavsc.Migrations b.HasKey("PerfomerId"); }); - modelBuilder.Entity("Yavsc.Models.Service", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Billing"); - - b.Property("ContextId"); - - b.Property("Description"); - - b.Property("Name"); - - b.Property("Pricing"); - - b.Property("Public"); - - b.HasKey("Id"); - }); - - modelBuilder.Entity("Yavsc.Models.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Name"); - - b.Property("Rate"); - - b.HasKey("Id"); - }); - modelBuilder.Entity("GoogleCloudMobileDeclaration", b => { b.HasOne("Yavsc.Models.ApplicationUser") @@ -579,6 +553,28 @@ namespace Yavsc.Migrations .HasForeignKey("BalanceId"); }); + modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b => + { + b.HasOne("Yavsc.Models.Market.BaseProduct") + .WithMany() + .HasForeignKey("ArticleId"); + + b.HasOne("Yavsc.Models.Booking.BookQuery") + .WithMany() + .HasForeignKey("BookQueryId"); + + b.HasOne("Yavsc.Models.Billing.RDVEstimate") + .WithMany() + .HasForeignKey("RDVEstimateId"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.RDVEstimate", b => + { + b.HasOne("Yavsc.Models.Booking.BookQuery") + .WithMany() + .HasForeignKey("CommandId"); + }); + modelBuilder.Entity("Yavsc.Models.Blog", b => { b.HasOne("Yavsc.Models.ApplicationUser") @@ -596,7 +592,7 @@ namespace Yavsc.Migrations .WithMany() .HasForeignKey("LocationId"); - b.HasOne("Yavsc.Models.PerformerProfile") + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") .WithMany() .HasForeignKey("PerformerId"); }); @@ -619,36 +615,6 @@ namespace Yavsc.Migrations .HasForeignKey("MemberId"); }); - modelBuilder.Entity("Yavsc.Models.Command", b => - { - b.HasOne("Yavsc.Models.ApplicationUser") - .WithMany() - .HasForeignKey("ClientId"); - - b.HasOne("Yavsc.Models.PerformerProfile") - .WithMany() - .HasForeignKey("PerformerId"); - }); - - modelBuilder.Entity("Yavsc.Models.CommandLine", b => - { - b.HasOne("Yavsc.Models.BaseProduct") - .WithMany() - .HasForeignKey("ArticleId"); - - b.HasOne("Yavsc.Models.Booking.BookQuery") - .WithMany() - .HasForeignKey("BookQueryId"); - - b.HasOne("Yavsc.Models.Command") - .WithMany() - .HasForeignKey("CommandId"); - - b.HasOne("Yavsc.Models.Estimate") - .WithMany() - .HasForeignKey("EstimateId"); - }); - modelBuilder.Entity("Yavsc.Models.Contact", b => { b.HasOne("Yavsc.Models.ApplicationUser") @@ -656,20 +622,20 @@ namespace Yavsc.Migrations .HasForeignKey("OwnerId"); }); - modelBuilder.Entity("Yavsc.Models.Estimate", b => + modelBuilder.Entity("Yavsc.Models.Market.Service", b => { - b.HasOne("Yavsc.Models.Command") + b.HasOne("Yavsc.Models.Activity") .WithMany() - .HasForeignKey("CommandId"); + .HasForeignKey("ContextId"); }); - modelBuilder.Entity("Yavsc.Models.PerformerProfile", b => + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => { b.HasOne("Yavsc.Models.Activity") .WithMany() .HasForeignKey("ActivityCode"); - b.HasOne("Yavsc.Models.Service") + b.HasOne("Yavsc.Models.Market.Service") .WithMany() .HasForeignKey("OfferId"); @@ -681,13 +647,6 @@ namespace Yavsc.Migrations .WithMany() .HasForeignKey("PerfomerId"); }); - - modelBuilder.Entity("Yavsc.Models.Service", b => - { - b.HasOne("Yavsc.Models.Activity") - .WithMany() - .HasForeignKey("ContextId"); - }); } } } diff --git a/Yavsc/Model/ApplicationDbContext.cs b/Yavsc/Model/ApplicationDbContext.cs index 07474859..c4c15b7d 100644 --- a/Yavsc/Model/ApplicationDbContext.cs +++ b/Yavsc/Model/ApplicationDbContext.cs @@ -6,8 +6,10 @@ using Microsoft.AspNet.Authentication.OAuth; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.Data.Entity; using Yavsc.Models.Auth; +using Yavsc.Models.Billing; using Yavsc.Models.Booking; using Yavsc.Models.OAuth; +using Yavsc.Models.Workflow; namespace Yavsc.Models { @@ -61,15 +63,15 @@ namespace Yavsc.Models /// on his profile). /// /// - public DbSet Commands { get; set; } + public DbSet Commands { get; set; } /// /// Special commands, talking about /// a given place and date. /// /// - public DbSet BookQueries { get; set; } + public DbSet BookQueries { get; set; } public DbSet Performers { get; set; } - public DbSet Estimates { get; set; } + public DbSet Estimates { get; set; } public DbSet BankStatus { get; set; } public DbSet BankBook { get; set; } public DbSet Map { get; set; } diff --git a/Yavsc/Model/Billing/Command.cs b/Yavsc/Model/Billing/Command.cs new file mode 100644 index 00000000..fa9ffb36 --- /dev/null +++ b/Yavsc/Model/Billing/Command.cs @@ -0,0 +1,9 @@ +using Yavsc.Models.Market; + +namespace Yavsc.Models.Billing +{ + + public class Command

where P:BaseProduct { + } + + } diff --git a/Yavsc/Model/Billing/CommandLine.cs b/Yavsc/Model/Billing/CommandLine.cs index 5829acc1..0e6d0b09 100644 --- a/Yavsc/Model/Billing/CommandLine.cs +++ b/Yavsc/Model/Billing/CommandLine.cs @@ -1,9 +1,9 @@ - using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Models.Market; -namespace Yavsc.Models +namespace Yavsc.Models.Billing { public class CommandLine { diff --git a/Yavsc/Model/Billing/Estimate.cs b/Yavsc/Model/Billing/Estimate.cs index 7f53089b..c4036975 100644 --- a/Yavsc/Model/Billing/Estimate.cs +++ b/Yavsc/Model/Billing/Estimate.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; +using Yavsc.Models.Booking; -namespace Yavsc.Models +namespace Yavsc.Models.Billing { - public partial class Estimate + public partial class RDVEstimate { [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long Id { get; set; } @@ -19,7 +20,7 @@ namespace Yavsc.Models /// /// [ForeignKey("CommandId")] - public virtual Command Command { get; set; } + public BookQuery Query { get; set; } public string Description { get; set; } public int? Status { get; set; } public string Title { get; set; } diff --git a/Yavsc/Model/Billing/EstimateAgreement.cs b/Yavsc/Model/Billing/EstimateAgreement.cs index fad861f6..e9d8573a 100644 --- a/Yavsc/Model/Billing/EstimateAgreement.cs +++ b/Yavsc/Model/Billing/EstimateAgreement.cs @@ -1,9 +1,9 @@ using System; -namespace Yavsc.Models +namespace Yavsc.Models.Billing { - public partial class EstimateAgreement : Estimate + public partial class EstimateAgreement : RDVEstimate { public DateTime ClientValidationDate { get; set; } } diff --git a/Yavsc/Model/Billing/Commande.cs b/Yavsc/Model/Billing/NominatvieCommande.cs similarity index 84% rename from Yavsc/Model/Billing/Commande.cs rename to Yavsc/Model/Billing/NominatvieCommande.cs index b1ad5879..116e2f51 100644 --- a/Yavsc/Model/Billing/Commande.cs +++ b/Yavsc/Model/Billing/NominatvieCommande.cs @@ -3,17 +3,13 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Models.Market; +using Yavsc.Models.Workflow; -namespace Yavsc.Models +namespace Yavsc.Models.Billing { - public class Command { - - ///

- /// The command identifier - /// - [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public long Id {get; set; } + public class NominativeServiceCommand : Command { public string ClientId { get; set; } @@ -40,6 +36,10 @@ namespace Yavsc.Models public DateTime CreationDate {get; set;} public decimal? Previsional { get; set; } + /// + /// The bill + /// + /// public List Bill { get; set; } /// diff --git a/Yavsc/Model/Billing/histoestim.cs b/Yavsc/Model/Billing/histoestim.cs index 0bea1df8..3821bf5f 100644 --- a/Yavsc/Model/Billing/histoestim.cs +++ b/Yavsc/Model/Billing/histoestim.cs @@ -1,6 +1,6 @@ using System; -namespace Yavsc.Models +namespace Yavsc.Models.Billing { public partial class histoestim { diff --git a/Yavsc/Model/Billing/satisfaction.cs b/Yavsc/Model/Billing/satisfaction.cs index dc3ce837..e579092a 100644 --- a/Yavsc/Model/Billing/satisfaction.cs +++ b/Yavsc/Model/Billing/satisfaction.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace Yavsc.Models +namespace Yavsc.Models.Billing { public partial class satisfaction { diff --git a/Yavsc/Model/Billing/writtings.cs b/Yavsc/Model/Billing/writtings.cs index a50c1ba4..73014945 100644 --- a/Yavsc/Model/Billing/writtings.cs +++ b/Yavsc/Model/Billing/writtings.cs @@ -1,5 +1,5 @@ -namespace Yavsc.Models +namespace Yavsc.Models.Billing { public partial class writtings { diff --git a/Yavsc/Model/Billing/wrtags.cs b/Yavsc/Model/Billing/wrtags.cs index 6388b6c2..40e9cb3b 100644 --- a/Yavsc/Model/Billing/wrtags.cs +++ b/Yavsc/Model/Billing/wrtags.cs @@ -1,5 +1,5 @@ -namespace Yavsc.Models +namespace Yavsc.Models.Billing { public partial class wrtags { diff --git a/Yavsc/Model/Booking/BookQuery.cs b/Yavsc/Model/Booking/BookQuery.cs index c1206202..87e31b68 100644 --- a/Yavsc/Model/Booking/BookQuery.cs +++ b/Yavsc/Model/Booking/BookQuery.cs @@ -1,6 +1,7 @@ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Models.Billing; namespace Yavsc.Models.Booking { @@ -8,28 +9,24 @@ namespace Yavsc.Models.Booking /// Query, for a date, with a given perfomer, at this given place. /// - public class BookQuery : Command { - - /// - /// Event date - /// - /// - [Required(),Display(Name="EventDate")] - public DateTime EventDate { get; set; } - - /// - /// Location identifier - /// - /// - [Required] - public long LocationId { get; set; } - - /// - /// A Location for this event - /// - /// - [Required(ErrorMessage="SpecifyPlace"),Display(Name="Location"),ForeignKey("LocationId")] + public class BookQuery : NominativeServiceCommand { + /// + /// The command identifier + /// + [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public long Id {get; set; } + public DateTime EventDate{get; set; } public Location Location { get; set; } + public BookQuery() + { + + } + + public BookQuery(Location eventLocation, DateTime eventDate) + { + Location = eventLocation; + EventDate = eventDate; + } } } \ No newline at end of file diff --git a/Yavsc/Model/Booking/RendezVous.cs b/Yavsc/Model/Booking/RendezVous.cs new file mode 100644 index 00000000..3a0dfe0f --- /dev/null +++ b/Yavsc/Model/Booking/RendezVous.cs @@ -0,0 +1,38 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Models.Market; + +namespace Yavsc.Models.Booking +{ + /// + /// A date, between two persons + /// + + public class RendezVous: Service { + // Haut les mains. + + /// + /// Event date + /// + /// + [Required(),Display(Name="EventDate")] + public DateTime EventDate { get; set; } + + /// + /// Location identifier + /// + /// + [Required] + public long LocationId { get; set; } + + /// + /// A Location for this event + /// + /// + [Required(ErrorMessage="SpecifyPlace"),Display(Name="Location"),ForeignKey("LocationId")] + public Location Location { get; set; } + + } + +} \ No newline at end of file diff --git a/Yavsc/Model/Market/BaseProduct.cs b/Yavsc/Model/Market/BaseProduct.cs index 5655fade..cd6b2525 100644 --- a/Yavsc/Model/Market/BaseProduct.cs +++ b/Yavsc/Model/Market/BaseProduct.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace Yavsc.Models +namespace Yavsc.Models.Market { public partial class BaseProduct { diff --git a/Yavsc/Model/Market/Catalog.cs b/Yavsc/Model/Market/Catalog.cs index beb2e697..8d68c624 100644 --- a/Yavsc/Model/Market/Catalog.cs +++ b/Yavsc/Model/Market/Catalog.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Yavsc.Models { +namespace Yavsc.Models.Market { public class Catalog { diff --git a/Yavsc/Model/Market/Product.cs b/Yavsc/Model/Market/Product.cs index f6b52a94..9c500f9f 100644 --- a/Yavsc/Model/Market/Product.cs +++ b/Yavsc/Model/Market/Product.cs @@ -1,6 +1,6 @@ -namespace Yavsc.Models +namespace Yavsc.Models.Market { public partial class Product : BaseProduct { diff --git a/Yavsc/Model/Market/Service.cs b/Yavsc/Model/Market/Service.cs index a29df2d3..ba5a09aa 100644 --- a/Yavsc/Model/Market/Service.cs +++ b/Yavsc/Model/Market/Service.cs @@ -1,5 +1,5 @@ -namespace Yavsc.Models { +namespace Yavsc.Models.Market { using System.ComponentModel.DataAnnotations.Schema; public enum BillingMode {  diff --git a/Yavsc/Model/Workflow/Activity.cs b/Yavsc/Model/Workflow/Activity.cs index 356c4736..dd474fbb 100644 --- a/Yavsc/Model/Workflow/Activity.cs +++ b/Yavsc/Model/Workflow/Activity.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Models.Market; namespace Yavsc.Models { @@ -35,5 +36,7 @@ namespace Yavsc.Models /// string ModeratorGroupName { get; set; } + + } } diff --git a/Yavsc/Model/Workflow/PerformerProfile.cs b/Yavsc/Model/Workflow/PerformerProfile.cs index ba92f089..2941b0f1 100644 --- a/Yavsc/Model/Workflow/PerformerProfile.cs +++ b/Yavsc/Model/Workflow/PerformerProfile.cs @@ -1,7 +1,9 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Yavsc.Models.Market; -namespace Yavsc.Models { +namespace Yavsc.Models.Workflow +{ public class PerformerProfile { diff --git a/Yavsc/Startup/Startup.cs b/Yavsc/Startup/Startup.cs index 8b77d04a..0663b9d8 100755 --- a/Yavsc/Startup/Startup.cs +++ b/Yavsc/Startup/Startup.cs @@ -294,9 +294,7 @@ namespace Yavsc name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); -#if OWIN app.UseSignalR(); -#endif } // Entry point for the application. diff --git a/Yavsc/ViewModels/Auth/AuthorisationHandlers.cs b/Yavsc/ViewModels/Auth/AuthorisationHandlers.cs index 07233b61..951f49ab 100644 --- a/Yavsc/ViewModels/Auth/AuthorisationHandlers.cs +++ b/Yavsc/ViewModels/Auth/AuthorisationHandlers.cs @@ -3,6 +3,8 @@ using System.IO; using System.Security.Claims; using Microsoft.AspNet.Authorization; using Yavsc.Models; +using Yavsc.Models.Billing; +using Yavsc.Models.Booking; namespace Yavsc { public class PrivateChatEntryRequirement : IAuthorizationRequirement @@ -77,9 +79,9 @@ public class BlogViewHandler : AuthorizationHandler } } - public class CommandViewHandler : AuthorizationHandler + public class CommandViewHandler : AuthorizationHandler { - protected override void Handle(AuthorizationContext context, ViewRequirement requirement, Command resource) + protected override void Handle(AuthorizationContext context, ViewRequirement requirement, BookQuery resource) { if (context.User.IsInRole("FrontOffice")) context.Succeed(requirement); @@ -91,9 +93,9 @@ public class BlogViewHandler : AuthorizationHandler } } - public class CommandEditHandler : AuthorizationHandler + public class CommandEditHandler : AuthorizationHandler { - protected override void Handle(AuthorizationContext context, EditRequirement requirement, Command resource) + protected override void Handle(AuthorizationContext context, EditRequirement requirement, BookQuery resource) { if (context.User.IsInRole("FrontOffice")) context.Succeed(requirement); diff --git a/Yavsc/Views/Command/Create.cshtml b/Yavsc/Views/Command/Create.cshtml index 196d9e29..29df65f8 100644 --- a/Yavsc/Views/Command/Create.cshtml +++ b/Yavsc/Views/Command/Create.cshtml @@ -102,7 +102,9 @@ $(document).ready(function(){

@SR["Fill in your book query"]


+
+ @Html.ValidationSummary()
@Html.HiddenFor(model=>model.Client.Id) @Html.HiddenFor(model=>model.PerformerId) +
diff --git a/Yavsc/Views/Shared/_GetAToken.cshtml b/Yavsc/Views/Shared/_GetAToken.cshtml deleted file mode 100644 index 8a217944..00000000 --- a/Yavsc/Views/Shared/_GetAToken.cshtml +++ /dev/null @@ -1,7 +0,0 @@ - - \ No newline at end of file diff --git a/Yavsc/Views/Shared/_PerformerPartial.cshtml b/Yavsc/Views/Shared/_PerformerPartial.cshtml index ee6a8620..243b696b 100644 --- a/Yavsc/Views/Shared/_PerformerPartial.cshtml +++ b/Yavsc/Views/Shared/_PerformerPartial.cshtml @@ -1,4 +1,4 @@ -@model Yavsc.Models.PerformerProfile +@model PerformerProfile
@Model.Performer?.UserName (rating: @Model.Rate%) diff --git a/Yavsc/Views/_ViewImports.cshtml b/Yavsc/Views/_ViewImports.cshtml index 9e8a6616..d29ca532 100755 --- a/Yavsc/Views/_ViewImports.cshtml +++ b/Yavsc/Views/_ViewImports.cshtml @@ -1,11 +1,14 @@ -@using Yavsc -@using Yavsc.Models -@using Yavsc.Models.Google -@using Yavsc.Models.Booking -@using Yavsc.ViewModels.Account -@using Yavsc.ViewModels.Manage +@using Yavsc; +@using Yavsc.Models; +@using Yavsc.Models.Google; +@using Yavsc.Models.Booking; +@using Yavsc.Models.Market; +@using Yavsc.Models.Billing; +@using Yavsc.Models.Workflow; +@using Yavsc.ViewModels.Account; +@using Yavsc.ViewModels.Manage; @using Yavsc.ViewModels.Calendar; -@using Microsoft.AspNet.Identity +@using Microsoft.AspNet.Identity; @using Microsoft.AspNet.Mvc; @using Microsoft.Extensions.Localization; @using Microsoft.AspNet.Mvc.Localization;