refabrique des commandes

This commit is contained in:
2016-06-14 03:37:57 +02:00
parent a0531fbc39
commit b0b22ea494
38 changed files with 2484 additions and 262 deletions

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Rendering; using Microsoft.AspNet.Mvc.Rendering;

View File

@ -30,7 +30,7 @@ namespace Yavsc.Controllers
SmtpSettings _smtpSettings; SmtpSettings _smtpSettings;
private readonly ILogger _logger; private readonly ILogger _logger;
public CommandController(ApplicationDbContext context,IOptions<GoogleAuthSettings> googleSettings, public CommandController(ApplicationDbContext context, IOptions<GoogleAuthSettings> googleSettings,
IGoogleCloudMessageSender GCMSender, IGoogleCloudMessageSender GCMSender,
UserManager<ApplicationUser> userManager, UserManager<ApplicationUser> userManager,
IStringLocalizer<Yavsc.Resources.YavscLocalisation> localizer, IStringLocalizer<Yavsc.Resources.YavscLocalisation> localizer,
@ -54,11 +54,11 @@ namespace Yavsc.Controllers
public IActionResult Index() public IActionResult Index()
{ {
return View(_context.BookQueries return View(_context.BookQueries
.Include(x=>x.Client) .Include(x => x.Client)
.Include(x=>x.PerformerProfile) .Include(x => x.PerformerProfile)
.Include(x=>x.PerformerProfile.Performer) .Include(x => x.PerformerProfile.Performer)
.Include(x=>x.Location) .Include(x => x.Location)
.Include(x=>x.Bill).ToList()); .Include(x => x.Bill).ToList());
} }
// GET: Command/Details/5 // GET: Command/Details/5
@ -70,8 +70,8 @@ namespace Yavsc.Controllers
} }
BookQuery command = _context.BookQueries BookQuery command = _context.BookQueries
.Include(x=>x.Location) .Include(x => x.Location)
.Include(x=>x.PerformerProfile) .Include(x => x.PerformerProfile)
.Single(m => m.Id == id); .Single(m => m.Id == id);
if (command == null) if (command == null)
{ {
@ -90,66 +90,79 @@ namespace Yavsc.Controllers
/// <returns></returns> /// <returns></returns>
public IActionResult Create(string id) public IActionResult Create(string id)
{ {
if (string.IsNullOrWhiteSpace(id))
throw new InvalidOperationException(
"This method needs a performer id"
);
var pro = _context.Performers.Include( var pro = _context.Performers.Include(
x=>x.Performer).FirstOrDefault( x => x.Performer).FirstOrDefault(
x=>x.PerfomerId == id x => x.PerfomerId == id
); );
if (pro==null) if (pro == null)
return HttpNotFound(); return HttpNotFound();
ViewBag.GoogleSettings = _googleSettings; ViewBag.GoogleSettings = _googleSettings;
var userid = User.GetUserId(); var userid = User.GetUserId();
var user = _userManager.FindByIdAsync(userid).Result; var user = _userManager.FindByIdAsync(userid).Result;
return View(new BookQuery{ return View(new BookQuery(new Location(),DateTime.Now.AddHours(4))
{
PerformerProfile = pro, PerformerProfile = pro,
PerformerId = pro.PerfomerId, PerformerId = pro.PerfomerId,
ClientId = userid, ClientId = userid,
Client = user, Client = user
Location = new Location(),
EventDate = DateTime.Now.AddHours(4)
}); });
} }
// POST: Command/Create // POST: Command/Create
[HttpPost] [HttpPost, Authorize]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public async Task<IActionResult> Create(BookQuery command) public async Task<IActionResult> Create(BookQuery command)
{ {
var pro = _context.Performers.FirstOrDefault( var uid = User.GetUserId();
x=>x.PerfomerId == command.PerformerId 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; command.PerformerProfile = pro;
var user = _userManager.FindByIdAsync( var user = await _userManager.FindByIdAsync(
User.GetUserId() User.GetUserId()
).Result; );
command.Client = user; command.Client = user;
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
var yaev = command.CreateEvent(_localizer); var yaev = command.CreateEvent(_localizer);
MessageWithPayloadResponse grep=null; MessageWithPayloadResponse grep = null;
_context.Attach<Location>(command.Location); _context.Attach<Location>(command.Location);
_context.BookQueries.Add(command,GraphBehavior.IncludeDependents); _context.BookQueries.Add(command, GraphBehavior.IncludeDependents);
_context.SaveChanges(); _context.SaveChanges();
if (command.PerformerProfile.AcceptNotifications
&& command.PerformerProfile.AcceptPublicContact if (pro.AcceptNotifications
&& command.PerformerProfile.Performer.Devices.Select(d=>d.RegistrationId)!=null) { && pro.AcceptPublicContact)
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.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( await _emailSender.SendEmailAsync(
_siteSettings, _smtpSettings, _siteSettings, _smtpSettings,
command.PerformerProfile.Performer.Email, command.PerformerProfile.Performer.Email,
yaev.Title, yaev.Title,
$"{yaev.Description}\r\n-- \r\n{yaev.Comment}\r\n" $"{yaev.Description}\r\n-- \r\n{yaev.Comment}\r\n"
); );
} }
return RedirectToAction("Index"); return RedirectToAction("Index");
} }

View File

@ -8,6 +8,7 @@ using Microsoft.Data.Entity;
using Microsoft.Extensions.OptionsModel; using Microsoft.Extensions.OptionsModel;
using Yavsc.Helpers; using Yavsc.Helpers;
using Yavsc.Models; using Yavsc.Models;
using Yavsc.Models.Billing;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
@ -36,10 +37,10 @@ namespace Yavsc.Controllers
return HttpNotFound(); return HttpNotFound();
} }
Estimate estimate = _context.Estimates RDVEstimate estimate = _context.Estimates
.Include(e => e.Command) .Include(e => e.Query)
.Include(e => e.Command.PerformerProfile) .Include(e => e.Query.PerformerProfile)
.Include(e => e.Command.PerformerProfile.Performer) .Include(e => e.Query.PerformerProfile.Performer)
.Single(m => m.Id == id); .Single(m => m.Id == id);
if (estimate == null) if (estimate == null)
{ {
@ -60,7 +61,7 @@ namespace Yavsc.Controllers
// POST: Estimate/Create // POST: Estimate/Create
[HttpPost] [HttpPost]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public IActionResult Create(Estimate estimate, public IActionResult Create(RDVEstimate estimate,
ICollection<IFormFile> newGraphics, ICollection<IFormFile> newGraphics,
ICollection<IFormFile> newFiles ICollection<IFormFile> newFiles
) )
@ -74,9 +75,9 @@ namespace Yavsc.Controllers
var perfomerProfile = _context.Performers var perfomerProfile = _context.Performers
.Include( .Include(
perpr => perpr.Performer).FirstOrDefault( 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 cmd => cmd.Id == estimate.CommandId
); );
@ -114,7 +115,7 @@ namespace Yavsc.Controllers
return HttpNotFound(); return HttpNotFound();
} }
Estimate estimate = _context.Estimates.Single(m => m.Id == id); RDVEstimate estimate = _context.Estimates.Single(m => m.Id == id);
if (estimate == null) if (estimate == null)
{ {
return HttpNotFound(); return HttpNotFound();
@ -126,7 +127,7 @@ namespace Yavsc.Controllers
// POST: Estimate/Edit/5 // POST: Estimate/Edit/5
[HttpPost] [HttpPost]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public IActionResult Edit(Estimate estimate) public IActionResult Edit(RDVEstimate estimate)
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
@ -146,7 +147,7 @@ namespace Yavsc.Controllers
return HttpNotFound(); return HttpNotFound();
} }
Estimate estimate = _context.Estimates.Single(m => m.Id == id); RDVEstimate estimate = _context.Estimates.Single(m => m.Id == id);
if (estimate == null) if (estimate == null)
{ {
return HttpNotFound(); return HttpNotFound();
@ -160,7 +161,7 @@ namespace Yavsc.Controllers
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(long id) 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.Estimates.Remove(estimate);
_context.SaveChanges(); _context.SaveChanges();
return RedirectToAction("Index"); return RedirectToAction("Index");

View File

@ -7,6 +7,7 @@ using Microsoft.Data.Entity;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Yavsc.Models.Booking; using Yavsc.Models.Booking;
using Yavsc.Helpers; using Yavsc.Helpers;
using Yavsc.Models.Billing;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
@ -94,11 +95,11 @@ namespace Yavsc.Controllers
[Produces("text/x-tex"), Authorize, [Produces("text/x-tex"), Authorize,
Route("Release/Estimate-{id}.tex")] Route("Release/Estimate-{id}.tex")]
public Estimate Estimate(long id) public RDVEstimate Estimate(long id)
{ {
var estimate = _context.Estimates.Include(x=>x.Command). var estimate = _context.Estimates.Include(x=>x.Query).
Include(x=>x.Command.Client).FirstOrDefault(x=>x.Id==id); Include(x=>x.Query.Client).FirstOrDefault(x=>x.Id==id);
var adc = estimate.Command.Client.UserName; var adc = estimate.Query.Client.UserName;
return estimate; return estimate;
} }
} }

View File

@ -18,6 +18,7 @@ using Yavsc.Helpers;
using Yavsc.ViewModels.Calendar; using Yavsc.ViewModels.Calendar;
using System.Net; using System.Net;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using Yavsc.Models.Workflow;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {

View File

@ -19,7 +19,6 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using Yavsc.Helpers; using Yavsc.Helpers;
using Yavsc.Model;
using Yavsc.Models.Google; using Yavsc.Models.Google;
namespace Yavsc.GoogleApis namespace Yavsc.GoogleApis

View File

@ -1,18 +1,18 @@
using System.IO; using System.IO;
using Microsoft.AspNet.FileProviders; using Microsoft.AspNet.FileProviders;
using Yavsc.Models; using Yavsc.Models.Billing;
namespace Yavsc.Helpers namespace Yavsc.Helpers
{ {
public static class FileSystemHelpers { 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; return null;
var fsp = new PhysicalFileProvider( var fsp = new PhysicalFileProvider(
Path.Combine( Path.Combine(
userFileDir, userFileDir,
estimate.Command.PerformerProfile.Performer.UserName estimate.Query.PerformerProfile.Performer.UserName
)); ));
return fsp.GetDirectoryContents( return fsp.GetDirectoryContents(
Path.Combine(Constants.UserBillsFilesDir, estimate.Id.ToString()) Path.Combine(Constants.UserBillsFilesDir, estimate.Id.ToString())

View File

@ -1,7 +1,6 @@
using System; using System;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure; using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations; using Microsoft.Data.Entity.Migrations;
using Yavsc.Models; using Yavsc.Models;

View File

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

View File

@ -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<string>("RegistrationId");
b.Property<string>("DeviceOwnerId");
b.Property<string>("Name");
b.HasKey("RegistrationId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("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<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("Yavsc.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("ActorDenomination");
b.Property<string>("Description");
b.Property<string>("ModeratorGroupName");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("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<string>("Id");
b.Property<bool>("Active");
b.Property<string>("DisplayName");
b.Property<string>("LogoutRedirectUri")
.HasAnnotation("MaxLength", 100);
b.Property<string>("RedirectUri");
b.Property<int>("RefreshTokenLifeTime");
b.Property<string>("Secret");
b.Property<int>("Type");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b =>
{
b.Property<string>("Id");
b.Property<string>("ClientId")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.Property<DateTime>("ExpiresUtc");
b.Property<DateTime>("IssuedUtc");
b.Property<string>("ProtectedTicket")
.IsRequired();
b.Property<string>("Subject")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<long?>("NominativeCommandId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.NominativeCommand", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate");
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Market.CommandSpecification", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ModelType");
b.Property<string>("QueryViewName");
b.Property<long?>("ServiceId");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("Billing");
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<decimal?>("Pricing");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("ExpiresIn");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long?>("OfferId");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIREN")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("GoogleCloudMobileDeclaration", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("DeviceOwnerId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", 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");
});
}
}
}

View File

@ -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<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_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<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClientId = table.Column<string>(nullable: false),
CreationDate = table.Column<DateTime>(nullable: false),
Lag = table.Column<int>(nullable: false),
PerformerId = table.Column<string>(nullable: false),
Previsional = table.Column<decimal>(nullable: true),
ValidationDate = table.Column<DateTime>(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<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ModelType = table.Column<string>(nullable: true),
QueryViewName = table.Column<string>(nullable: true),
ServiceId = table.Column<long>(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<long>(
name: "NominativeCommandId",
table: "CommandLine",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_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<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_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<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClientId = table.Column<string>(nullable: false),
CreationDate = table.Column<DateTime>(nullable: false),
Lag = table.Column<int>(nullable: false),
PerformerId = table.Column<string>(nullable: false),
Previsional = table.Column<decimal>(nullable: true),
ValidationDate = table.Column<DateTime>(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<string>(
name: "AllowedOrigin",
table: "Client",
nullable: true);
migrationBuilder.AddColumn<long>(
name: "CommandId",
table: "CommandLine",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_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);
}
}
}

View File

@ -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<string>("RegistrationId");
b.Property<string>("DeviceOwnerId");
b.Property<string>("Name");
b.HasKey("RegistrationId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("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<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("Yavsc.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("ActorDenomination");
b.Property<string>("Description");
b.Property<string>("ModeratorGroupName");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("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<string>("Id");
b.Property<bool>("Active");
b.Property<string>("DisplayName");
b.Property<string>("LogoutRedirectUri")
.HasAnnotation("MaxLength", 100);
b.Property<string>("RedirectUri");
b.Property<int>("RefreshTokenLifeTime");
b.Property<string>("Secret");
b.Property<int>("Type");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b =>
{
b.Property<string>("Id");
b.Property<string>("ClientId")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.Property<DateTime>("ExpiresUtc");
b.Property<DateTime>("IssuedUtc");
b.Property<string>("ProtectedTicket")
.IsRequired();
b.Property<string>("Subject")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("RDVEstimateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.RDVEstimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId")
.IsRequired();
b.Property<string>("bcontent");
b.Property<DateTime>("modified");
b.Property<string>("photo");
b.Property<DateTime>("posted");
b.Property<int>("rate");
b.Property<string>("title");
b.Property<bool>("visible");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long?>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("CircleId")
.IsRequired();
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("Billing");
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<decimal?>("Pricing");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("ExpiresIn");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.Property<string>("PerfomerId");
b.Property<bool>("AcceptGeoLocalisation");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long?>("OfferId");
b.Property<long>("OrganisationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIREN")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerfomerId");
});
modelBuilder.Entity("GoogleCloudMobileDeclaration", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("DeviceOwnerId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", 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");
});
}
}
}

View File

@ -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<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_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<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
AttachedFilesString = table.Column<string>(nullable: true),
AttachedGraphicsString = table.Column<string>(nullable: true),
CommandId = table.Column<long>(nullable: true),
Description = table.Column<string>(nullable: true),
Status = table.Column<int>(nullable: true),
Title = table.Column<string>(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<long>(
name: "LocationId",
table: "BookQuery",
nullable: true);
migrationBuilder.AddColumn<long>(
name: "RDVEstimateId",
table: "CommandLine",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_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<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_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<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ClientId = table.Column<string>(nullable: false),
CreationDate = table.Column<DateTime>(nullable: false),
Lag = table.Column<int>(nullable: false),
PerformerId = table.Column<string>(nullable: false),
Previsional = table.Column<decimal>(nullable: true),
ValidationDate = table.Column<DateTime>(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<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ModelType = table.Column<string>(nullable: true),
QueryViewName = table.Column<string>(nullable: true),
ServiceId = table.Column<long>(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<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
AttachedFilesString = table.Column<string>(nullable: true),
AttachedGraphicsString = table.Column<string>(nullable: true),
CommandId = table.Column<long>(nullable: true),
Description = table.Column<string>(nullable: true),
Status = table.Column<int>(nullable: true),
Title = table.Column<string>(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<long>(
name: "LocationId",
table: "BookQuery",
nullable: false);
migrationBuilder.AddColumn<long>(
name: "EstimateId",
table: "CommandLine",
nullable: true);
migrationBuilder.AddColumn<long>(
name: "NominativeCommandId",
table: "CommandLine",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_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);
}
}
}

View File

@ -212,12 +212,10 @@ namespace Yavsc.Migrations
b.Property<bool>("Active"); b.Property<bool>("Active");
b.Property<string>("AllowedOrigin")
.HasAnnotation("MaxLength", 100);
b.Property<string>("DisplayName"); b.Property<string>("DisplayName");
b.Property<string>("LogoutRedirectUri"); b.Property<string>("LogoutRedirectUri")
.HasAnnotation("MaxLength", 100);
b.Property<string>("RedirectUri"); b.Property<string>("RedirectUri");
@ -270,16 +268,42 @@ namespace Yavsc.Migrations
b.HasKey("Id"); b.HasKey("Id");
}); });
modelBuilder.Entity("Yavsc.Models.BaseProduct", b => modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{ {
b.Property<long>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("RDVEstimateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.RDVEstimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<long?>("CommandId");
b.Property<string>("Description"); b.Property<string>("Description");
b.Property<string>("Name"); b.Property<int?>("Status");
b.Property<bool>("Public"); b.Property<string>("Title");
b.HasKey("Id"); b.HasKey("Id");
}); });
@ -325,7 +349,7 @@ namespace Yavsc.Migrations
b.Property<int>("Lag"); b.Property<int>("Lag");
b.Property<long>("LocationId"); b.Property<long?>("LocationId");
b.Property<string>("PerformerId") b.Property<string>("PerformerId")
.IsRequired(); .IsRequired();
@ -363,50 +387,6 @@ namespace Yavsc.Migrations
b.HasKey("Id"); b.HasKey("Id");
}); });
modelBuilder.Entity("Yavsc.Models.Command", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate");
b.Property<int>("Lag");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<long?>("CommandId");
b.Property<string>("Comment");
b.Property<int>("Count");
b.Property<long?>("EstimateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Contact", b => modelBuilder.Entity("Yavsc.Models.Contact", b =>
{ {
b.Property<string>("OwnerId"); b.Property<string>("OwnerId");
@ -416,22 +396,36 @@ namespace Yavsc.Migrations
b.HasKey("OwnerId", "UserId"); b.HasKey("OwnerId", "UserId");
}); });
modelBuilder.Entity("Yavsc.Models.Estimate", b => modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b =>
{ {
b.Property<long>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString"); b.Property<string>("Description");
b.Property<string>("AttachedGraphicsString"); b.Property<string>("Name");
b.Property<long?>("CommandId"); b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("Billing");
b.Property<string>("ContextId");
b.Property<string>("Description"); b.Property<string>("Description");
b.Property<int?>("Status"); b.Property<string>("Name");
b.Property<string>("Title"); b.Property<decimal?>("Pricing");
b.Property<bool>("Public");
b.HasKey("Id"); b.HasKey("Id");
}); });
@ -453,7 +447,19 @@ namespace Yavsc.Migrations
b.HasKey("UserId"); b.HasKey("UserId");
}); });
modelBuilder.Entity("Yavsc.Models.PerformerProfile", b => modelBuilder.Entity("Yavsc.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{ {
b.Property<string>("PerfomerId"); b.Property<string>("PerfomerId");
@ -487,38 +493,6 @@ namespace Yavsc.Migrations
b.HasKey("PerfomerId"); b.HasKey("PerfomerId");
}); });
modelBuilder.Entity("Yavsc.Models.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("Billing");
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<decimal?>("Pricing");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("GoogleCloudMobileDeclaration", b => modelBuilder.Entity("GoogleCloudMobileDeclaration", b =>
{ {
b.HasOne("Yavsc.Models.ApplicationUser") b.HasOne("Yavsc.Models.ApplicationUser")
@ -579,6 +553,28 @@ namespace Yavsc.Migrations
.HasForeignKey("BalanceId"); .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 => modelBuilder.Entity("Yavsc.Models.Blog", b =>
{ {
b.HasOne("Yavsc.Models.ApplicationUser") b.HasOne("Yavsc.Models.ApplicationUser")
@ -596,7 +592,7 @@ namespace Yavsc.Migrations
.WithMany() .WithMany()
.HasForeignKey("LocationId"); .HasForeignKey("LocationId");
b.HasOne("Yavsc.Models.PerformerProfile") b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany() .WithMany()
.HasForeignKey("PerformerId"); .HasForeignKey("PerformerId");
}); });
@ -619,36 +615,6 @@ namespace Yavsc.Migrations
.HasForeignKey("MemberId"); .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 => modelBuilder.Entity("Yavsc.Models.Contact", b =>
{ {
b.HasOne("Yavsc.Models.ApplicationUser") b.HasOne("Yavsc.Models.ApplicationUser")
@ -656,20 +622,20 @@ namespace Yavsc.Migrations
.HasForeignKey("OwnerId"); .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() .WithMany()
.HasForeignKey("CommandId"); .HasForeignKey("ContextId");
}); });
modelBuilder.Entity("Yavsc.Models.PerformerProfile", b => modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{ {
b.HasOne("Yavsc.Models.Activity") b.HasOne("Yavsc.Models.Activity")
.WithMany() .WithMany()
.HasForeignKey("ActivityCode"); .HasForeignKey("ActivityCode");
b.HasOne("Yavsc.Models.Service") b.HasOne("Yavsc.Models.Market.Service")
.WithMany() .WithMany()
.HasForeignKey("OfferId"); .HasForeignKey("OfferId");
@ -681,13 +647,6 @@ namespace Yavsc.Migrations
.WithMany() .WithMany()
.HasForeignKey("PerfomerId"); .HasForeignKey("PerfomerId");
}); });
modelBuilder.Entity("Yavsc.Models.Service", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
} }
} }
} }

View File

@ -6,8 +6,10 @@ using Microsoft.AspNet.Authentication.OAuth;
using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Yavsc.Models.Auth; using Yavsc.Models.Auth;
using Yavsc.Models.Billing;
using Yavsc.Models.Booking; using Yavsc.Models.Booking;
using Yavsc.Models.OAuth; using Yavsc.Models.OAuth;
using Yavsc.Models.Workflow;
namespace Yavsc.Models namespace Yavsc.Models
{ {
@ -61,15 +63,15 @@ namespace Yavsc.Models
/// on his profile). /// on his profile).
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public DbSet<Command> Commands { get; set; } public DbSet<BookQuery> Commands { get; set; }
/// <summary> /// <summary>
/// Special commands, talking about /// Special commands, talking about
/// a given place and date. /// a given place and date.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public DbSet<Booking.BookQuery> BookQueries { get; set; } public DbSet<BookQuery> BookQueries { get; set; }
public DbSet<PerformerProfile> Performers { get; set; } public DbSet<PerformerProfile> Performers { get; set; }
public DbSet<Estimate> Estimates { get; set; } public DbSet<RDVEstimate> Estimates { get; set; }
public DbSet<AccountBalance> BankStatus { get; set; } public DbSet<AccountBalance> BankStatus { get; set; }
public DbSet<BalanceImpact> BankBook { get; set; } public DbSet<BalanceImpact> BankBook { get; set; }
public DbSet<Location> Map { get; set; } public DbSet<Location> Map { get; set; }

View File

@ -0,0 +1,9 @@
using Yavsc.Models.Market;
namespace Yavsc.Models.Billing
{
public class Command<P> where P:BaseProduct {
}
}

View File

@ -1,9 +1,9 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Market;
namespace Yavsc.Models namespace Yavsc.Models.Billing
{ {
public class CommandLine { public class CommandLine {

View File

@ -3,10 +3,11 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; 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)] [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; } public long Id { get; set; }
@ -19,7 +20,7 @@ namespace Yavsc.Models
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[ForeignKey("CommandId")] [ForeignKey("CommandId")]
public virtual Command Command { get; set; } public BookQuery Query { get; set; }
public string Description { get; set; } public string Description { get; set; }
public int? Status { get; set; } public int? Status { get; set; }
public string Title { get; set; } public string Title { get; set; }

View File

@ -1,9 +1,9 @@
using System; using System;
namespace Yavsc.Models namespace Yavsc.Models.Billing
{ {
public partial class EstimateAgreement : Estimate public partial class EstimateAgreement : RDVEstimate
{ {
public DateTime ClientValidationDate { get; set; } public DateTime ClientValidationDate { get; set; }
} }

View File

@ -3,17 +3,13 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Market;
using Yavsc.Models.Workflow;
namespace Yavsc.Models namespace Yavsc.Models.Billing
{ {
public class Command { public class NominativeServiceCommand : Command<Service> {
/// <summary>
/// The command identifier
/// </summary>
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id {get; set; }
public string ClientId { get; set; } public string ClientId { get; set; }
@ -40,6 +36,10 @@ namespace Yavsc.Models
public DateTime CreationDate {get; set;} public DateTime CreationDate {get; set;}
public decimal? Previsional { get; set; } public decimal? Previsional { get; set; }
/// <summary>
/// The bill
/// </summary>
/// <returns></returns>
public List<CommandLine> Bill { get; set; } public List<CommandLine> Bill { get; set; }
///<summary> ///<summary>

View File

@ -1,6 +1,6 @@
using System; using System;
namespace Yavsc.Models namespace Yavsc.Models.Billing
{ {
public partial class histoestim public partial class histoestim
{ {

View File

@ -2,7 +2,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models namespace Yavsc.Models.Billing
{ {
public partial class satisfaction public partial class satisfaction
{ {

View File

@ -1,5 +1,5 @@
namespace Yavsc.Models namespace Yavsc.Models.Billing
{ {
public partial class writtings public partial class writtings
{ {

View File

@ -1,5 +1,5 @@
namespace Yavsc.Models namespace Yavsc.Models.Billing
{ {
public partial class wrtags public partial class wrtags
{ {

View File

@ -1,6 +1,7 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Billing;
namespace Yavsc.Models.Booking namespace Yavsc.Models.Booking
{ {
@ -8,28 +9,24 @@ namespace Yavsc.Models.Booking
/// Query, for a date, with a given perfomer, at this given place. /// Query, for a date, with a given perfomer, at this given place.
/// </summary> /// </summary>
public class BookQuery : Command { public class BookQuery : NominativeServiceCommand {
/// <summary>
/// <summary> /// The command identifier
/// Event date /// </summary>
/// </summary> [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
/// <returns></returns> public long Id {get; set; }
[Required(),Display(Name="EventDate")] public DateTime EventDate{get; set; }
public DateTime EventDate { get; set; }
/// <summary>
/// Location identifier
/// </summary>
/// <returns></returns>
[Required]
public long LocationId { get; set; }
/// <summary>
/// A Location for this event
/// </summary>
/// <returns></returns>
[Required(ErrorMessage="SpecifyPlace"),Display(Name="Location"),ForeignKey("LocationId")]
public Location Location { get; set; } public Location Location { get; set; }
public BookQuery()
{
}
public BookQuery(Location eventLocation, DateTime eventDate)
{
Location = eventLocation;
EventDate = eventDate;
}
} }
} }

View File

@ -0,0 +1,38 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Market;
namespace Yavsc.Models.Booking
{
/// <summary>
/// A date, between two persons
/// </summary>
public class RendezVous: Service {
// Haut les mains.
/// <summary>
/// Event date
/// </summary>
/// <returns></returns>
[Required(),Display(Name="EventDate")]
public DateTime EventDate { get; set; }
/// <summary>
/// Location identifier
/// </summary>
/// <returns></returns>
[Required]
public long LocationId { get; set; }
/// <summary>
/// A Location for this event
/// </summary>
/// <returns></returns>
[Required(ErrorMessage="SpecifyPlace"),Display(Name="Location"),ForeignKey("LocationId")]
public Location Location { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models namespace Yavsc.Models.Market
{ {
public partial class BaseProduct public partial class BaseProduct
{ {

View File

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Yavsc.Models { namespace Yavsc.Models.Market {
public class Catalog { public class Catalog {

View File

@ -1,6 +1,6 @@
namespace Yavsc.Models namespace Yavsc.Models.Market
{ {
public partial class Product : BaseProduct public partial class Product : BaseProduct
{ {

View File

@ -1,5 +1,5 @@
namespace Yavsc.Models { namespace Yavsc.Models.Market {
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
public enum BillingMode {  public enum BillingMode { 

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Market;
namespace Yavsc.Models namespace Yavsc.Models
{ {
@ -35,5 +36,7 @@ namespace Yavsc.Models
/// <returns></returns> /// <returns></returns>
string ModeratorGroupName { get; set; } string ModeratorGroupName { get; set; }
} }
} }

View File

@ -1,7 +1,9 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Market;
namespace Yavsc.Models { namespace Yavsc.Models.Workflow
{
public class PerformerProfile { public class PerformerProfile {

View File

@ -294,9 +294,7 @@ namespace Yavsc
name: "default", name: "default",
template: "{controller=Home}/{action=Index}/{id?}"); template: "{controller=Home}/{action=Index}/{id?}");
}); });
#if OWIN
app.UseSignalR(); app.UseSignalR();
#endif
} }
// Entry point for the application. // Entry point for the application.

View File

@ -3,6 +3,8 @@ using System.IO;
using System.Security.Claims; using System.Security.Claims;
using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Authorization;
using Yavsc.Models; using Yavsc.Models;
using Yavsc.Models.Billing;
using Yavsc.Models.Booking;
namespace Yavsc { namespace Yavsc {
public class PrivateChatEntryRequirement : IAuthorizationRequirement public class PrivateChatEntryRequirement : IAuthorizationRequirement
@ -77,9 +79,9 @@ public class BlogViewHandler : AuthorizationHandler<ViewRequirement, Blog>
} }
} }
public class CommandViewHandler : AuthorizationHandler<ViewRequirement, Command> public class CommandViewHandler : AuthorizationHandler<ViewRequirement, BookQuery>
{ {
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")) if (context.User.IsInRole("FrontOffice"))
context.Succeed(requirement); context.Succeed(requirement);
@ -91,9 +93,9 @@ public class BlogViewHandler : AuthorizationHandler<ViewRequirement, Blog>
} }
} }
public class CommandEditHandler : AuthorizationHandler<EditRequirement, Command> public class CommandEditHandler : AuthorizationHandler<EditRequirement, BookQuery>
{ {
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")) if (context.User.IsInRole("FrontOffice"))
context.Succeed(requirement); context.Succeed(requirement);

View File

@ -102,7 +102,9 @@ $(document).ready(function(){
<div class="form-horizontal"> <div class="form-horizontal">
<h4>@SR["Fill in your book query"]</h4> <h4>@SR["Fill in your book query"]</h4>
<hr /> <hr />
<div class="form-group" has-feedback> <div class="form-group" has-feedback>
@Html.ValidationSummary()
<fieldset> <fieldset>
<legend><label for="EventDate" class="col-md-2 control-label" > <legend><label for="EventDate" class="col-md-2 control-label" >
@SR["EventDate"] @SR["EventDate"]
@ -142,6 +144,7 @@ $(document).ready(function(){
</div> </div>
@Html.HiddenFor(model=>model.Client.Id) @Html.HiddenFor(model=>model.Client.Id)
@Html.HiddenFor(model=>model.PerformerId) @Html.HiddenFor(model=>model.PerformerId)
</div> </div>
</form> </form>

View File

@ -1,7 +0,0 @@
<form enctype="application/x-www-form-urlencoded" method="post" class="navbar-right">
@Html.AntiForgeryToken()
<label for="username">username:</label><input name="username" placeholder="(Votre Nom d'utilisateur)"/>
<label for="password">password:</label><input name="password" placeholder="(Votre mot de passe)" type="password"/>
<input formaction="/api/token/post" class="btn btn-lg btn-success" name="Getatoken" type="submit" value="Getatoken" />
</form>

View File

@ -1,4 +1,4 @@
@model Yavsc.Models.PerformerProfile @model PerformerProfile
<div class="performer @(Model.Active?"active":"inactive")"> <div class="performer @(Model.Active?"active":"inactive")">
@Model.Performer?.UserName (rating: @Model.Rate%) @Model.Performer?.UserName (rating: @Model.Rate%)

View File

@ -1,11 +1,14 @@
@using Yavsc @using Yavsc;
@using Yavsc.Models @using Yavsc.Models;
@using Yavsc.Models.Google @using Yavsc.Models.Google;
@using Yavsc.Models.Booking @using Yavsc.Models.Booking;
@using Yavsc.ViewModels.Account @using Yavsc.Models.Market;
@using Yavsc.ViewModels.Manage @using Yavsc.Models.Billing;
@using Yavsc.Models.Workflow;
@using Yavsc.ViewModels.Account;
@using Yavsc.ViewModels.Manage;
@using Yavsc.ViewModels.Calendar; @using Yavsc.ViewModels.Calendar;
@using Microsoft.AspNet.Identity @using Microsoft.AspNet.Identity;
@using Microsoft.AspNet.Mvc; @using Microsoft.AspNet.Mvc;
@using Microsoft.Extensions.Localization; @using Microsoft.Extensions.Localization;
@using Microsoft.AspNet.Mvc.Localization; @using Microsoft.AspNet.Mvc.Localization;