refactoring

This commit is contained in:
2017-02-27 19:28:32 +01:00
parent 78e5ec16ce
commit 9973f0dcc7
57 changed files with 3371 additions and 251 deletions

View File

@ -34,7 +34,7 @@ namespace Yavsc.Controllers
/// <param name="maxId">returned Ids must be lower than this value</param> /// <param name="maxId">returned Ids must be lower than this value</param>
/// <returns>book queries</returns> /// <returns>book queries</returns>
[HttpGet] [HttpGet]
public IEnumerable<BookQueryProviderInfo> GetCommands(long maxId=long.MaxValue) public IEnumerable<RdvQueryProviderInfo> GetCommands(long maxId=long.MaxValue)
{ {
var uid = User.GetUserId(); var uid = User.GetUserId();
var now = DateTime.Now; var now = DateTime.Now;
@ -42,7 +42,7 @@ namespace Yavsc.Controllers
var result = _context.Commands.Include(c => c.Location). var result = _context.Commands.Include(c => c.Location).
Include(c => c.Client).Where(c => c.PerformerId == uid && c.Id < maxId && c.EventDate > now Include(c => c.Client).Where(c => c.PerformerId == uid && c.Id < maxId && c.EventDate > now
&& c.ValidationDate == null). && c.ValidationDate == null).
Select(c => new BookQueryProviderInfo Select(c => new RdvQueryProviderInfo
{ {
Client = new ClientProviderInfo { Client = new ClientProviderInfo {
UserName = c.Client.UserName, UserName = c.Client.UserName,
@ -71,7 +71,7 @@ namespace Yavsc.Controllers
} }
var uid = User.GetUserId(); var uid = User.GetUserId();
BookQuery bookQuery = _context.Commands.Where(c => c.ClientId == uid || c.PerformerId == uid).Single(m => m.Id == id); RdvQuery bookQuery = _context.Commands.Where(c => c.ClientId == uid || c.PerformerId == uid).Single(m => m.Id == id);
if (bookQuery == null) if (bookQuery == null)
{ {
@ -83,7 +83,7 @@ namespace Yavsc.Controllers
// PUT: api/BookQueryApi/5 // PUT: api/BookQueryApi/5
[HttpPut("{id}")] [HttpPut("{id}")]
public IActionResult PutBookQuery(long id, [FromBody] BookQuery bookQuery) public IActionResult PutBookQuery(long id, [FromBody] RdvQuery bookQuery)
{ {
if (!ModelState.IsValid) if (!ModelState.IsValid)
{ {
@ -121,7 +121,7 @@ namespace Yavsc.Controllers
// POST: api/BookQueryApi // POST: api/BookQueryApi
[HttpPost] [HttpPost]
public IActionResult PostBookQuery([FromBody] BookQuery bookQuery) public IActionResult PostBookQuery([FromBody] RdvQuery bookQuery)
{ {
if (!ModelState.IsValid) if (!ModelState.IsValid)
{ {
@ -162,7 +162,7 @@ namespace Yavsc.Controllers
return HttpBadRequest(ModelState); return HttpBadRequest(ModelState);
} }
var uid = User.GetUserId(); var uid = User.GetUserId();
BookQuery bookQuery = _context.Commands.Single(m => m.Id == id); RdvQuery bookQuery = _context.Commands.Single(m => m.Id == id);
if (bookQuery == null) if (bookQuery == null)
{ {

View File

@ -126,7 +126,7 @@ namespace Yavsc.Controllers
} }
} }
if (estimate.CommandId!=null) { if (estimate.CommandId!=null) {
var query = _context.BookQueries.FirstOrDefault(q => q.Id == estimate.CommandId); var query = _context.RdvQueries.FirstOrDefault(q => q.Id == estimate.CommandId);
if (query == null || query.PerformerId!= uid) if (query == null || query.PerformerId!= uid)
throw new InvalidOperationException(); throw new InvalidOperationException();
query.ValidationDate = DateTime.Now; query.ValidationDate = DateTime.Now;

View File

@ -51,4 +51,4 @@ namespace Yavsc.Controllers
return new BadRequestObjectResult(ModelState); return new BadRequestObjectResult(ModelState);
} }
} }
} }

View File

@ -3,6 +3,10 @@ using Microsoft.AspNet.Mvc;
namespace Yavsc.ApiControllers namespace Yavsc.ApiControllers
{ {
using Models; using Models;
/// <summary>
/// Base class for managing performers profiles
/// </summary>
[Produces("application/json"),Route("api/profile")] [Produces("application/json"),Route("api/profile")]
public abstract class ProfileApiController<T> : Controller public abstract class ProfileApiController<T> : Controller
{ {

View File

@ -22,16 +22,16 @@ namespace Yavsc.Controllers
[ServiceFilter(typeof(LanguageActionFilter))] [ServiceFilter(typeof(LanguageActionFilter))]
public class CommandController : Controller public class CommandController : Controller
{ {
private UserManager<ApplicationUser> _userManager; protected UserManager<ApplicationUser> _userManager;
private ApplicationDbContext _context; protected ApplicationDbContext _context;
private GoogleAuthSettings _googleSettings; protected GoogleAuthSettings _googleSettings;
private IGoogleCloudMessageSender _GCMSender; protected IGoogleCloudMessageSender _GCMSender;
private IEmailSender _emailSender; protected IEmailSender _emailSender;
private IStringLocalizer _localizer; protected IStringLocalizer _localizer;
SiteSettings _siteSettings; protected SiteSettings _siteSettings;
SmtpSettings _smtpSettings; protected SmtpSettings _smtpSettings;
private readonly ILogger _logger; protected 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,
@ -57,7 +57,7 @@ namespace Yavsc.Controllers
public IActionResult Index() public IActionResult Index()
{ {
var uid = User.GetUserId(); var uid = User.GetUserId();
return View(_context.BookQueries return View(_context.RdvQueries
.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)
@ -74,7 +74,7 @@ namespace Yavsc.Controllers
return HttpNotFound(); return HttpNotFound();
} }
BookQuery command = _context.BookQueries RdvQuery command = _context.RdvQueries
.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);
@ -113,7 +113,7 @@ namespace Yavsc.Controllers
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(activityCode,new Location(),DateTime.Now.AddHours(4)) return View(new RdvQuery(activityCode,new Location(),DateTime.Now.AddHours(4))
{ {
PerformerProfile = pro, PerformerProfile = pro,
PerformerId = pro.PerformerId, PerformerId = pro.PerformerId,
@ -126,7 +126,7 @@ namespace Yavsc.Controllers
// POST: Command/Create // POST: Command/Create
[HttpPost, Authorize] [HttpPost, Authorize]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public async Task<IActionResult> Create(BookQuery command) public async Task<IActionResult> Create(RdvQuery command)
{ {
var uid = User.GetUserId(); var uid = User.GetUserId();
@ -161,7 +161,7 @@ namespace Yavsc.Controllers
command.Location=existingLocation; command.Location=existingLocation;
} }
else _context.Attach<Location>(command.Location); else _context.Attach<Location>(command.Location);
_context.BookQueries.Add(command, GraphBehavior.IncludeDependents); _context.RdvQueries.Add(command, GraphBehavior.IncludeDependents);
_context.SaveChanges(User.GetUserId()); _context.SaveChanges(User.GetUserId());
var yaev = command.CreateEvent(_localizer); var yaev = command.CreateEvent(_localizer);
@ -206,7 +206,7 @@ namespace Yavsc.Controllers
return HttpNotFound(); return HttpNotFound();
} }
BookQuery command = _context.BookQueries.Single(m => m.Id == id); RdvQuery command = _context.RdvQueries.Single(m => m.Id == id);
if (command == null) if (command == null)
{ {
return HttpNotFound(); return HttpNotFound();
@ -217,7 +217,7 @@ namespace Yavsc.Controllers
// POST: Command/Edit/5 // POST: Command/Edit/5
[HttpPost] [HttpPost]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public IActionResult Edit(BookQuery command) public IActionResult Edit(RdvQuery command)
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
@ -237,7 +237,7 @@ namespace Yavsc.Controllers
return HttpNotFound(); return HttpNotFound();
} }
BookQuery command = _context.BookQueries.Single(m => m.Id == id); RdvQuery command = _context.RdvQueries.Single(m => m.Id == id);
if (command == null) if (command == null)
{ {
return HttpNotFound(); return HttpNotFound();
@ -251,8 +251,8 @@ namespace Yavsc.Controllers
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(long id) public IActionResult DeleteConfirmed(long id)
{ {
BookQuery command = _context.BookQueries.Single(m => m.Id == id); RdvQuery command = _context.RdvQueries.Single(m => m.Id == id);
_context.BookQueries.Remove(command); _context.RdvQueries.Remove(command);
_context.SaveChanges(User.GetUserId()); _context.SaveChanges(User.GetUserId());
return RedirectToAction("Index"); return RedirectToAction("Index");
} }

View File

@ -81,7 +81,7 @@ namespace Yavsc.Controllers
public IActionResult Create() public IActionResult Create()
{ {
var uid = User.GetUserId(); var uid = User.GetUserId();
IQueryable<BookQuery> queries = _context.BookQueries.Include(q=>q.Location).Where(bq=>bq.PerformerId == uid); IQueryable<RdvQuery> queries = _context.RdvQueries.Include(q=>q.Location).Where(bq=>bq.PerformerId == uid);
//.Select(bq=>new SelectListItem{ Text = bq.Client.UserName, Value = bq.Client.Id }); //.Select(bq=>new SelectListItem{ Text = bq.Client.UserName, Value = bq.Client.Id });
ViewBag.Clients = queries.Select(q=>q.Client).Distinct(); ViewBag.Clients = queries.Select(q=>q.Client).Distinct();
ViewBag.Queries = queries; ViewBag.Queries = queries;
@ -103,7 +103,7 @@ namespace Yavsc.Controllers
_context.Estimates _context.Estimates
.Add(estimate); .Add(estimate);
_context.SaveChanges(User.GetUserId()); _context.SaveChanges(User.GetUserId());
var query = _context.BookQueries.FirstOrDefault( var query = _context.RdvQueries.FirstOrDefault(
q=>q.Id == estimate.CommandId q=>q.Id == estimate.CommandId
); );
var perfomerProfile = _context.Performers var perfomerProfile = _context.Performers
@ -111,7 +111,7 @@ namespace Yavsc.Controllers
perpr => perpr.Performer).FirstOrDefault( perpr => perpr.Performer).FirstOrDefault(
x=>x.PerformerId == query.PerformerId x=>x.PerformerId == query.PerformerId
); );
var command = _context.BookQueries.FirstOrDefault( var command = _context.RdvQueries.FirstOrDefault(
cmd => cmd.Id == estimate.CommandId cmd => cmd.Id == estimate.CommandId
); );

View File

@ -10,9 +10,13 @@ using System.Security.Claims;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
using Helpers; using Helpers;
using Microsoft.AspNet.Http;
using Models; using Models;
using Models.Workflow; using Newtonsoft.Json;
using ViewModels.FrontOffice; using ViewModels.FrontOffice;
using Yavsc.Models.Haircut;
using Yavsc.ViewModels.Haircut;
public class FrontOfficeController : Controller public class FrontOfficeController : Controller
{ {
ApplicationDbContext _context; ApplicationDbContext _context;
@ -46,7 +50,7 @@ namespace Yavsc.Controllers
return View(model); return View(model);
} }
[Route("Profiles/{id?}"), HttpGet, AllowAnonymous] [AllowAnonymous]
public ActionResult Profiles(string id) public ActionResult Profiles(string id)
{ {
if (id == null) if (id == null)
@ -57,40 +61,28 @@ namespace Yavsc.Controllers
var result = _context.ListPerformers(id); var result = _context.ListPerformers(id);
return View(result); return View(result);
} }
[Route("Profiles/{id}"), HttpPost, AllowAnonymous] [AllowAnonymous]
public ActionResult Profiles(BookQuery bookQuery) public ActionResult HairCut(string id)
{ {
if (ModelState.IsValid) HairPrestation pPrestation=null;
{ var prestaJson = HttpContext.Session.GetString("HairCutPresta") ;
var pro = _context.Performers.Include( if (prestaJson!=null) {
pr => pr.Performer pPrestation = JsonConvert.DeserializeObject<HairPrestation>(prestaJson);
).FirstOrDefault(
x => x.PerformerId == bookQuery.PerformerId
);
if (pro == null)
return HttpNotFound();
// Let's create a command
if (bookQuery.Id == 0)
{
_context.BookQueries.Add(bookQuery);
}
else
{
_context.BookQueries.Update(bookQuery);
}
_context.SaveChanges(User.GetUserId());
// TODO Send sys notifications &
// notify the user (make him a basket badge)
return View("Index");
} }
ViewBag.Activities = _context.ActivityItems(null); else pPrestation = new HairPrestation {
return View("Profiles", _context.Performers.Include(p => p.Performer).Where
(p => p.Active).OrderBy( };
x => x.MinDailyCost
)); ViewBag.Activity = _context.Activities.First(a => a.Code == id);
var result = new HairCutView {
HairBrushers = _context.ListPerformers(id),
Topic = pPrestation
} ;
return View(result);
} }
[Produces("text/x-tex"), Authorize, Route("estimate-{id}.tex")] [Produces("text/x-tex"), Authorize, Route("estimate-{id}.tex")]
public ViewResult EstimateTex(long id) public ViewResult EstimateTex(long id)
{ {

View File

@ -0,0 +1,189 @@
using System;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.OptionsModel;
using Yavsc.Helpers;
using Yavsc.Models;
using Yavsc.Models.Google.Messaging;
using Yavsc.Models.Haircut;
using Yavsc.Models.Relationship;
using Yavsc.Services;
namespace Yavsc.Controllers
{
public class HairCutCommandController : CommandController
{
public HairCutCommandController(ApplicationDbContext context,
IOptions<GoogleAuthSettings> googleSettings,
IGoogleCloudMessageSender GCMSender,
UserManager<ApplicationUser> userManager,
IStringLocalizer<Yavsc.Resources.YavscLocalisation> localizer,
IEmailSender emailSender,
IOptions<SmtpSettings> smtpSettings,
IOptions<SiteSettings> siteSettings,
ILoggerFactory loggerFactory) : base(context,googleSettings,GCMSender,userManager,
localizer,emailSender,smtpSettings,siteSettings,loggerFactory)
{
}
[HttpPost, Authorize]
[ValidateAntiForgeryToken]
public async Task<IActionResult> CreateHairCutQuery(HairCutQuery command)
{
var uid = User.GetUserId();
var prid = command.PerformerId;
if (string.IsNullOrWhiteSpace(uid)
|| string.IsNullOrWhiteSpace(prid))
throw new InvalidOperationException(
"This method needs a PerformerId"
);
var pro = _context.Performers.Include(
u => u.Performer
).Include(u => u.Performer.Devices)
.FirstOrDefault(
x => x.PerformerId == command.PerformerId
);
var user = await _userManager.FindByIdAsync(uid);
command.Client = user;
command.ClientId = uid;
command.PerformerProfile = pro;
// FIXME Why!!
// ModelState.ClearValidationState("PerformerProfile.Avatar");
// ModelState.ClearValidationState("Client.Avatar");
// ModelState.ClearValidationState("ClientId");
ModelState.MarkFieldSkipped("ClientId");
if (ModelState.IsValid)
{
var existingLocation = _context.Locations.FirstOrDefault( x=>x.Address == command.Location.Address
&& x.Longitude == command.Location.Longitude && x.Latitude == command.Location.Latitude );
if (existingLocation!=null) {
command.Location=existingLocation;
}
else _context.Attach<Location>(command.Location);
_context.HairCutQueries.Add(command, GraphBehavior.IncludeDependents);
_context.SaveChanges(User.GetUserId());
var yaev = command.CreateEvent(_localizer);
MessageWithPayloadResponse grep = null;
if (pro.AcceptNotifications
&& pro.AcceptPublicContact)
{
if (pro.Performer.Devices.Count > 0) {
var regids = command.PerformerProfile.Performer
.Devices.Select(d => d.GCMRegistrationId);
grep = await _GCMSender.NotifyHairCutQueryAsync(_googleSettings,regids,yaev);
}
// TODO setup a profile choice to allow notifications
// both on mailbox and mobile
// if (grep==null || grep.success<=0 || grep.failure>0)
ViewBag.GooglePayload=grep;
if (grep!=null)
_logger.LogWarning($"Performer: {command.PerformerProfile.Performer.UserName} success: {grep.success} failure: {grep.failure}");
await _emailSender.SendEmailAsync(
_siteSettings, _smtpSettings,
command.PerformerProfile.Performer.Email,
yaev.Topic+" "+yaev.Sender,
$"{yaev.Message}\r\n-- \r\n{yaev.Previsional}\r\n{yaev.EventDate}\r\n"
);
}
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
ViewBag.GoogleSettings = _googleSettings;
return View("CommandConfirmation",command);
}
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
ViewBag.GoogleSettings = _googleSettings;
return View(command);
}
[HttpPost, Authorize]
[ValidateAntiForgeryToken]
public async Task<IActionResult> CreateHairMultiCutQuery(HairMultiCutQuery command)
{
var uid = User.GetUserId();
var prid = command.PerformerId;
if (string.IsNullOrWhiteSpace(uid)
|| string.IsNullOrWhiteSpace(prid))
throw new InvalidOperationException(
"This method needs a PerformerId"
);
var pro = _context.Performers.Include(
u => u.Performer
).Include(u => u.Performer.Devices)
.FirstOrDefault(
x => x.PerformerId == command.PerformerId
);
var user = await _userManager.FindByIdAsync(uid);
command.Client = user;
command.ClientId = uid;
command.PerformerProfile = pro;
// FIXME Why!!
// ModelState.ClearValidationState("PerformerProfile.Avatar");
// ModelState.ClearValidationState("Client.Avatar");
// ModelState.ClearValidationState("ClientId");
ModelState.MarkFieldSkipped("ClientId");
if (ModelState.IsValid)
{
var existingLocation = _context.Locations.FirstOrDefault( x=>x.Address == command.Location.Address
&& x.Longitude == command.Location.Longitude && x.Latitude == command.Location.Latitude );
if (existingLocation!=null) {
command.Location=existingLocation;
}
else _context.Attach<Location>(command.Location);
_context.HairMultiCutQueries.Add(command, GraphBehavior.IncludeDependents);
_context.SaveChanges(User.GetUserId());
var yaev = command.CreateEvent(_localizer);
MessageWithPayloadResponse grep = null;
if (pro.AcceptNotifications
&& pro.AcceptPublicContact)
{
if (pro.Performer.Devices.Count > 0) {
var regids = command.PerformerProfile.Performer
.Devices.Select(d => d.GCMRegistrationId);
grep = await _GCMSender.NotifyHairCutQueryAsync(_googleSettings,regids,yaev);
}
// TODO setup a profile choice to allow notifications
// both on mailbox and mobile
// if (grep==null || grep.success<=0 || grep.failure>0)
ViewBag.GooglePayload=grep;
if (grep!=null)
_logger.LogWarning($"Performer: {command.PerformerProfile.Performer.UserName} success: {grep.success} failure: {grep.failure}");
await _emailSender.SendEmailAsync(
_siteSettings, _smtpSettings,
command.PerformerProfile.Performer.Email,
yaev.Topic+" "+yaev.Sender,
$"{yaev.Message}\r\n-- \r\n{yaev.Previsional}\r\n{yaev.EventDate}\r\n"
);
}
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
ViewBag.GoogleSettings = _googleSettings;
return View("CommandConfirmation",command);
}
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
ViewBag.GoogleSettings = _googleSettings;
return View(command);
}
}
}

View File

@ -0,0 +1,122 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.Data.Entity;
using Yavsc.Models;
using Yavsc.Models.Haircut;
namespace Yavsc.Controllers
{
public class HairPrestationsController : Controller
{
private ApplicationDbContext _context;
public HairPrestationsController(ApplicationDbContext context)
{
_context = context;
}
// GET: HairPrestations
public async Task<IActionResult> Index()
{
return View(await _context.HairPrestation.ToListAsync());
}
// GET: HairPrestations/Details/5
public async Task<IActionResult> Details(long? id)
{
if (id == null)
{
return HttpNotFound();
}
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
if (hairPrestation == null)
{
return HttpNotFound();
}
return View(hairPrestation);
}
// GET: HairPrestations/Create
public IActionResult Create()
{
return View();
}
// POST: HairPrestations/Create
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(HairPrestation hairPrestation)
{
if (ModelState.IsValid)
{
_context.HairPrestation.Add(hairPrestation);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(hairPrestation);
}
// GET: HairPrestations/Edit/5
public async Task<IActionResult> Edit(long? id)
{
if (id == null)
{
return HttpNotFound();
}
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
if (hairPrestation == null)
{
return HttpNotFound();
}
return View(hairPrestation);
}
// POST: HairPrestations/Edit/5
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(HairPrestation hairPrestation)
{
if (ModelState.IsValid)
{
_context.Update(hairPrestation);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(hairPrestation);
}
// GET: HairPrestations/Delete/5
[ActionName("Delete")]
public async Task<IActionResult> Delete(long? id)
{
if (id == null)
{
return HttpNotFound();
}
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
if (hairPrestation == null)
{
return HttpNotFound();
}
return View(hairPrestation);
}
// POST: HairPrestations/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(long id)
{
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
_context.HairPrestation.Remove(hairPrestation);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
}
}

View File

@ -103,7 +103,7 @@ namespace Yavsc.Controllers
UserName = user.UserName, UserName = user.UserName,
PostsCounter = pc, PostsCounter = pc,
Balance = user.AccountBalance, Balance = user.AccountBalance,
ActiveCommandCount = _dbContext.BookQueries.Count(x => (x.ClientId == user.Id) && (x.EventDate > DateTime.Now)), ActiveCommandCount = _dbContext.RdvQueries.Count(x => (x.ClientId == user.Id) && (x.EventDate > DateTime.Now)),
HasDedicatedCalendar = !string.IsNullOrEmpty(user.DedicatedGoogleCalendar), HasDedicatedCalendar = !string.IsNullOrEmpty(user.DedicatedGoogleCalendar),
Roles = await _userManager.GetRolesAsync(user), Roles = await _userManager.GetRolesAsync(user),
PostalAddress = user.PostalAddress?.Address, PostalAddress = user.PostalAddress?.Address,

View File

@ -4,13 +4,22 @@ namespace Yavsc.Helpers
{ {
using Models.Workflow; using Models.Workflow;
using Models.Messaging; using Models.Messaging;
using Yavsc.Models.Haircut;
public static class EventHelpers public static class EventHelpers
{ {
public static BookQueryEvent CreateEvent(this BookQuery query, public static RdvQueryEvent CreateEvent(this RdvQuery query,
IStringLocalizer SR) IStringLocalizer SR)
{ {
var yaev = new BookQueryEvent var yaev = new RdvQueryEvent
{ {
Sender = query.ClientId,
Message = string.Format(SR["RdvToPerf"],
query.Client.UserName,
query.EventDate.ToString("dddd dd/MM/yyyy à HH:mm"),
query.Location.Address,
query.ActivityCode)+
"\n"+query.Reason,
Client = new ClientProviderInfo {  Client = new ClientProviderInfo { 
UserName = query.Client.UserName , UserName = query.Client.UserName ,
UserId = query.ClientId, UserId = query.ClientId,
@ -24,6 +33,54 @@ namespace Yavsc.Helpers
}; };
return yaev; return yaev;
} }
public static HairCutQueryEvent CreateEvent(this HairCutQuery query,
IStringLocalizer SR)
{
var yaev = new HairCutQueryEvent
{
Sender = query.ClientId,
Message = string.Format(SR["RdvToPerf"],
query.Client.UserName,
query.EventDate.ToString("dddd dd/MM/yyyy à HH:mm"),
query.Location.Address,
query.ActivityCode),
Client = new ClientProviderInfo { 
UserName = query.Client.UserName ,
UserId = query.ClientId,
Avatar = query.Client.Avatar } ,
Previsional = query.Previsional,
EventDate = query.EventDate,
Location = query.Location,
Id = query.Id,
Reason = "Coupe particulier",
ActivityCode = query.ActivityCode
};
return yaev;
}
public static HairCutQueryEvent CreateEvent(this HairMultiCutQuery query,
IStringLocalizer SR)
{
var yaev = new HairCutQueryEvent
{
Sender = query.ClientId,
Message = string.Format(SR["RdvToPerf"],
query.Client.UserName,
query.EventDate.ToString("dddd dd/MM/yyyy à HH:mm"),
query.Location.Address,
query.ActivityCode),
Client = new ClientProviderInfo { 
UserName = query.Client.UserName ,
UserId = query.ClientId,
Avatar = query.Client.Avatar } ,
Previsional = query.Previsional,
EventDate = query.EventDate,
Location = query.Location,
Id = query.Id,
Reason = "Commande groupée!",
ActivityCode = query.ActivityCode
};
return yaev;
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,745 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class hairPrestations : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_BaseProduct_ArticleId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_Estimate_BookQuery_CommandId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_Estimate_PerformerProfile_OwnerId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint");
migrationBuilder.DropForeignKey(name: "FK_DimissClicked_Notification_NotificationId", table: "DimissClicked");
migrationBuilder.DropForeignKey(name: "FK_DimissClicked_ApplicationUser_UserId", table: "DimissClicked");
migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_CommandForm_Activity_ActivityCode", table: "CommandForm");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_Activity_DoesCode", table: "UserActivity");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity");
migrationBuilder.DropColumn(name: "ArticleId", table: "CommandLine");
migrationBuilder.DropTable("BaseProduct");
migrationBuilder.DropTable("BookQuery");
// les id de requete existant venaient d'une table nomée "BookQuery"
// qui n'existe plus.
migrationBuilder.Sql("DELETE FROM \"Estimate\"");
migrationBuilder.Sql("DELETE FROM \"CommandLine\"");
migrationBuilder.CreateTable(
name: "HairMultiCutQuery",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ActivityCode = table.Column<string>(nullable: false),
ClientId = table.Column<string>(nullable: false),
DateCreated = table.Column<DateTime>(nullable: false),
DateModified = table.Column<DateTime>(nullable: false),
EventDate = table.Column<DateTime>(nullable: false),
LocationId = table.Column<long>(nullable: true),
PerformerId = table.Column<string>(nullable: false),
Previsional = table.Column<decimal>(nullable: true),
Status = table.Column<int>(nullable: false),
UserCreated = table.Column<string>(nullable: true),
UserModified = table.Column<string>(nullable: true),
ValidationDate = table.Column<DateTime>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_HairMultiCutQuery", x => x.Id);
table.ForeignKey(
name: "FK_HairMultiCutQuery_Activity_ActivityCode",
column: x => x.ActivityCode,
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_HairMultiCutQuery_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_HairMultiCutQuery_Location_LocationId",
column: x => x.LocationId,
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId",
column: x => x.PerformerId,
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Product",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Depth = table.Column<decimal>(nullable: false),
Description = table.Column<string>(nullable: true),
Height = table.Column<decimal>(nullable: false),
Name = table.Column<string>(nullable: true),
Price = table.Column<decimal>(nullable: true),
Public = table.Column<bool>(nullable: false),
Weight = table.Column<decimal>(nullable: false),
Width = table.Column<decimal>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Product", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RdvQuery",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ActivityCode = table.Column<string>(nullable: false),
ClientId = table.Column<string>(nullable: false),
DateCreated = table.Column<DateTime>(nullable: false),
DateModified = table.Column<DateTime>(nullable: false),
EventDate = table.Column<DateTime>(nullable: false),
LocationId = table.Column<long>(nullable: true),
LocationTypeId = table.Column<long>(nullable: true),
PerformerId = table.Column<string>(nullable: false),
Previsional = table.Column<decimal>(nullable: true),
Reason = table.Column<string>(nullable: true),
Status = table.Column<int>(nullable: false),
UserCreated = table.Column<string>(nullable: true),
UserModified = table.Column<string>(nullable: true),
ValidationDate = table.Column<DateTime>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RdvQuery", x => x.Id);
table.ForeignKey(
name: "FK_RdvQuery_Activity_ActivityCode",
column: x => x.ActivityCode,
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RdvQuery_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RdvQuery_Location_LocationId",
column: x => x.LocationId,
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_RdvQuery_LocationType_LocationTypeId",
column: x => x.LocationTypeId,
principalTable: "LocationType",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_RdvQuery_PerformerProfile_PerformerId",
column: x => x.PerformerId,
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "HairPrestation",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Cares = table.Column<bool>(nullable: false),
Cut = table.Column<bool>(nullable: false),
Dressing = table.Column<int>(nullable: false),
Gender = table.Column<int>(nullable: false),
HairMultiCutQueryId = table.Column<long>(nullable: true),
Length = table.Column<int>(nullable: false),
Shampoo = table.Column<bool>(nullable: false),
Tech = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_HairPrestation", x => x.Id);
table.ForeignKey(
name: "FK_HairPrestation_HairMultiCutQuery_HairMultiCutQueryId",
column: x => x.HairMultiCutQueryId,
principalTable: "HairMultiCutQuery",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "HairCutQuery",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ActivityCode = table.Column<string>(nullable: false),
ClientId = table.Column<string>(nullable: false),
DateCreated = table.Column<DateTime>(nullable: false),
DateModified = table.Column<DateTime>(nullable: false),
EventDate = table.Column<DateTime>(nullable: false),
LocationId = table.Column<long>(nullable: true),
PerformerId = table.Column<string>(nullable: false),
PrestationId = table.Column<long>(nullable: true),
Previsional = table.Column<decimal>(nullable: true),
Status = table.Column<int>(nullable: false),
UserCreated = table.Column<string>(nullable: true),
UserModified = table.Column<string>(nullable: true),
ValidationDate = table.Column<DateTime>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_HairCutQuery", x => x.Id);
table.ForeignKey(
name: "FK_HairCutQuery_Activity_ActivityCode",
column: x => x.ActivityCode,
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_HairCutQuery_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_HairCutQuery_Location_LocationId",
column: x => x.LocationId,
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_HairCutQuery_PerformerProfile_PerformerId",
column: x => x.PerformerId,
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_HairCutQuery_HairPrestation_PrestationId",
column: x => x.PrestationId,
principalTable: "HairPrestation",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.AddColumn<long>(
name: "HairPrestationId",
table: "HairTaint",
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_BlackListed_ApplicationUser_OwnerId",
table: "BlackListed",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId",
table: "CircleAuthorizationToBlogPost",
column: "BlogPostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId",
table: "CircleAuthorizationToBlogPost",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_Estimate_EstimateId",
table: "CommandLine",
column: "EstimateId",
principalTable: "Estimate",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_ApplicationUser_ClientId",
table: "Estimate",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_RdvQuery_CommandId",
table: "Estimate",
column: "CommandId",
principalTable: "RdvQuery",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_PerformerProfile_OwnerId",
table: "Estimate",
column: "OwnerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairTaint_Color_ColorId",
table: "HairTaint",
column: "ColorId",
principalTable: "Color",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairTaint_HairPrestation_HairPrestationId",
table: "HairTaint",
column: "HairPrestationId",
principalTable: "HairPrestation",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_DimissClicked_Notification_NotificationId",
table: "DimissClicked",
column: "NotificationId",
principalTable: "Notification",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_DimissClicked_ApplicationUser_UserId",
table: "DimissClicked",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Instrumentation_Instrument_InstrumentId",
table: "Instrumentation",
column: "InstrumentId",
principalTable: "Instrument",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandForm_Activity_ActivityCode",
table: "CommandForm",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_Activity_DoesCode",
table: "UserActivity",
column: "DoesCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_PerformerProfile_UserId",
table: "UserActivity",
column: "UserId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_Estimate_RdvQuery_CommandId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_Estimate_PerformerProfile_OwnerId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint");
migrationBuilder.DropForeignKey(name: "FK_HairTaint_HairPrestation_HairPrestationId", table: "HairTaint");
migrationBuilder.DropForeignKey(name: "FK_DimissClicked_Notification_NotificationId", table: "DimissClicked");
migrationBuilder.DropForeignKey(name: "FK_DimissClicked_ApplicationUser_UserId", table: "DimissClicked");
migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_CommandForm_Activity_ActivityCode", table: "CommandForm");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_Activity_DoesCode", table: "UserActivity");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity");
migrationBuilder.DropColumn(name: "HairPrestationId", table: "HairTaint");
migrationBuilder.DropTable("HairCutQuery");
migrationBuilder.DropTable("Product");
migrationBuilder.DropTable("RdvQuery");
migrationBuilder.DropTable("HairPrestation");
migrationBuilder.DropTable("HairMultiCutQuery");
migrationBuilder.CreateTable(
name: "BaseProduct",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Description = table.Column<string>(nullable: true),
Discriminator = table.Column<string>(nullable: false),
Name = table.Column<string>(nullable: true),
Public = table.Column<bool>(nullable: false),
Depth = table.Column<decimal>(nullable: true),
Height = table.Column<decimal>(nullable: true),
Price = table.Column<decimal>(nullable: true),
Weight = table.Column<decimal>(nullable: true),
Width = table.Column<decimal>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BaseProduct", x => x.Id);
});
migrationBuilder.CreateTable(
name: "BookQuery",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
ActivityCode = table.Column<string>(nullable: false),
ClientId = table.Column<string>(nullable: false),
DateCreated = table.Column<DateTime>(nullable: false),
DateModified = table.Column<DateTime>(nullable: false),
EventDate = table.Column<DateTime>(nullable: false),
LocationId = table.Column<long>(nullable: true),
LocationTypeId = table.Column<long>(nullable: true),
PerformerId = table.Column<string>(nullable: false),
Previsional = table.Column<decimal>(nullable: true),
Reason = table.Column<string>(nullable: true),
Status = table.Column<int>(nullable: false),
UserCreated = table.Column<string>(nullable: true),
UserModified = table.Column<string>(nullable: true),
ValidationDate = table.Column<DateTime>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BookQuery", x => x.Id);
table.ForeignKey(
name: "FK_BookQuery_Activity_ActivityCode",
column: x => x.ActivityCode,
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
column: x => x.ClientId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_BookQuery_Location_LocationId",
column: x => x.LocationId,
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_BookQuery_LocationType_LocationTypeId",
column: x => x.LocationTypeId,
principalTable: "LocationType",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
column: x => x.PerformerId,
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.AddColumn<long>(
name: "ArticleId",
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_BlackListed_ApplicationUser_OwnerId",
table: "BlackListed",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId",
table: "CircleAuthorizationToBlogPost",
column: "BlogPostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId",
table: "CircleAuthorizationToBlogPost",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_BaseProduct_ArticleId",
table: "CommandLine",
column: "ArticleId",
principalTable: "BaseProduct",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_Estimate_EstimateId",
table: "CommandLine",
column: "EstimateId",
principalTable: "Estimate",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_ApplicationUser_ClientId",
table: "Estimate",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_BookQuery_CommandId",
table: "Estimate",
column: "CommandId",
principalTable: "BookQuery",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_PerformerProfile_OwnerId",
table: "Estimate",
column: "OwnerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairTaint_Color_ColorId",
table: "HairTaint",
column: "ColorId",
principalTable: "Color",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_DimissClicked_Notification_NotificationId",
table: "DimissClicked",
column: "NotificationId",
principalTable: "Notification",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_DimissClicked_ApplicationUser_UserId",
table: "DimissClicked",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Instrumentation_Instrument_InstrumentId",
table: "Instrumentation",
column: "InstrumentId",
principalTable: "Instrument",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CommandForm_Activity_ActivityCode",
table: "CommandForm",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_Activity_DoesCode",
table: "UserActivity",
column: "DoesCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_PerformerProfile_UserId",
table: "UserActivity",
column: "UserId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
}
}
}

View File

@ -1,6 +1,8 @@
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 Yavsc.Models; using Yavsc.Models;
namespace Yavsc.Migrations namespace Yavsc.Migrations
@ -306,8 +308,6 @@ namespace Yavsc.Migrations
b.Property<long>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<int>("Count"); b.Property<int>("Count");
b.Property<string>("Description") b.Property<string>("Description")
@ -441,6 +441,102 @@ namespace Yavsc.Migrations
b.HasKey("Id"); b.HasKey("Id");
}); });
modelBuilder.Entity("Yavsc.Models.Haircut.HairCutQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("DateCreated");
b.Property<DateTime>("DateModified");
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<long?>("PrestationId");
b.Property<decimal?>("Previsional");
b.Property<int>("Status");
b.Property<string>("UserCreated");
b.Property<string>("UserModified");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Haircut.HairMultiCutQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("DateCreated");
b.Property<DateTime>("DateModified");
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<int>("Status");
b.Property<string>("UserCreated");
b.Property<string>("UserModified");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestation", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("Cares");
b.Property<bool>("Cut");
b.Property<int>("Dressing");
b.Property<int>("Gender");
b.Property<long?>("HairMultiCutQueryId");
b.Property<int>("Length");
b.Property<bool>("Shampoo");
b.Property<int>("Tech");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Haircut.HairTaint", b => modelBuilder.Entity("Yavsc.Models.Haircut.HairTaint", b =>
{ {
b.Property<long>("Id") b.Property<long>("Id")
@ -450,6 +546,8 @@ namespace Yavsc.Migrations
b.Property<long>("ColorId"); b.Property<long>("ColorId");
b.Property<long?>("HairPrestationId");
b.HasKey("Id"); b.HasKey("Id");
}); });
@ -475,25 +573,28 @@ namespace Yavsc.Migrations
b.HasKey("DeviceId"); b.HasKey("DeviceId");
}); });
modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b => modelBuilder.Entity("Yavsc.Models.Market.Product", b =>
{ {
b.Property<long>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd(); .ValueGeneratedOnAdd();
b.Property<decimal>("Depth");
b.Property<string>("Description"); b.Property<string>("Description");
b.Property<string>("Discriminator") b.Property<decimal>("Height");
.IsRequired();
b.Property<string>("Name"); b.Property<string>("Name");
b.Property<decimal?>("Price");
b.Property<bool>("Public"); b.Property<bool>("Public");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasKey("Id"); b.HasKey("Id");
b.HasAnnotation("Relational:DiscriminatorProperty", "Discriminator");
b.HasAnnotation("Relational:DiscriminatorValue", "BaseProduct");
}); });
modelBuilder.Entity("Yavsc.Models.Market.Service", b => modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
@ -773,45 +874,6 @@ namespace Yavsc.Migrations
b.HasKey("Code"); b.HasKey("Code");
}); });
modelBuilder.Entity("Yavsc.Models.Workflow.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("DateCreated");
b.Property<DateTime>("DateModified");
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId");
b.Property<long?>("LocationTypeId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<string>("Reason");
b.Property<int>("Status");
b.Property<string>("UserCreated");
b.Property<string>("UserModified");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Workflow.CommandForm", b => modelBuilder.Entity("Yavsc.Models.Workflow.CommandForm", b =>
{ {
b.Property<long>("Id") b.Property<long>("Id")
@ -877,6 +939,45 @@ namespace Yavsc.Migrations
b.HasKey("UserId"); b.HasKey("UserId");
}); });
modelBuilder.Entity("Yavsc.Models.Workflow.RdvQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("DateCreated");
b.Property<DateTime>("DateModified");
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId");
b.Property<long?>("LocationTypeId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<string>("Reason");
b.Property<int>("Status");
b.Property<string>("UserCreated");
b.Property<string>("UserModified");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b => modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b =>
{ {
b.Property<string>("DoesCode"); b.Property<string>("DoesCode");
@ -888,23 +989,6 @@ namespace Yavsc.Migrations
b.HasKey("DoesCode", "UserId"); b.HasKey("DoesCode", "UserId");
}); });
modelBuilder.Entity("Yavsc.Models.Market.Product", b =>
{
b.HasBaseType("Yavsc.Models.Market.BaseProduct");
b.Property<decimal>("Depth");
b.Property<decimal>("Height");
b.Property<decimal?>("Price");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasAnnotation("Relational:DiscriminatorValue", "Product");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{ {
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole") b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
@ -982,10 +1066,6 @@ namespace Yavsc.Migrations
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b => modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{ {
b.HasOne("Yavsc.Models.Market.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("Yavsc.Models.Billing.Estimate") b.HasOne("Yavsc.Models.Billing.Estimate")
.WithMany() .WithMany()
.HasForeignKey("EstimateId"); .HasForeignKey("EstimateId");
@ -1001,7 +1081,7 @@ namespace Yavsc.Migrations
.WithMany() .WithMany()
.HasForeignKey("ClientId"); .HasForeignKey("ClientId");
b.HasOne("Yavsc.Models.Workflow.BookQuery") b.HasOne("Yavsc.Models.Workflow.RdvQuery")
.WithMany() .WithMany()
.HasForeignKey("CommandId"); .HasForeignKey("CommandId");
@ -1024,11 +1104,64 @@ namespace Yavsc.Migrations
.HasForeignKey("ApplicationUserId"); .HasForeignKey("ApplicationUserId");
}); });
modelBuilder.Entity("Yavsc.Models.Haircut.HairCutQuery", b =>
{
b.HasOne("Yavsc.Models.Workflow.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("Yavsc.Models.Relationship.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
b.HasOne("Yavsc.Models.Haircut.HairPrestation")
.WithMany()
.HasForeignKey("PrestationId");
});
modelBuilder.Entity("Yavsc.Models.Haircut.HairMultiCutQuery", b =>
{
b.HasOne("Yavsc.Models.Workflow.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("Yavsc.Models.Relationship.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestation", b =>
{
b.HasOne("Yavsc.Models.Haircut.HairMultiCutQuery")
.WithMany()
.HasForeignKey("HairMultiCutQueryId");
});
modelBuilder.Entity("Yavsc.Models.Haircut.HairTaint", b => modelBuilder.Entity("Yavsc.Models.Haircut.HairTaint", b =>
{ {
b.HasOne("Yavsc.Models.Drawing.Color") b.HasOne("Yavsc.Models.Drawing.Color")
.WithMany() .WithMany()
.HasForeignKey("ColorId"); .HasForeignKey("ColorId");
b.HasOne("Yavsc.Models.Haircut.HairPrestation")
.WithMany()
.HasForeignKey("HairPrestationId");
}); });
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b => modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
@ -1124,29 +1257,6 @@ namespace Yavsc.Migrations
.HasForeignKey("ParentCode"); .HasForeignKey("ParentCode");
}); });
modelBuilder.Entity("Yavsc.Models.Workflow.BookQuery", b =>
{
b.HasOne("Yavsc.Models.Workflow.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("Yavsc.Models.Relationship.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("Yavsc.Models.Relationship.LocationType")
.WithMany()
.HasForeignKey("LocationTypeId");
b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Workflow.CommandForm", b => modelBuilder.Entity("Yavsc.Models.Workflow.CommandForm", b =>
{ {
b.HasOne("Yavsc.Models.Workflow.Activity") b.HasOne("Yavsc.Models.Workflow.Activity")
@ -1180,6 +1290,29 @@ namespace Yavsc.Migrations
.HasForeignKey("PerformerId"); .HasForeignKey("PerformerId");
}); });
modelBuilder.Entity("Yavsc.Models.Workflow.RdvQuery", b =>
{
b.HasOne("Yavsc.Models.Workflow.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("Yavsc.Models.Relationship.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("Yavsc.Models.Relationship.LocationType")
.WithMany()
.HasForeignKey("LocationTypeId");
b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b => modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b =>
{ {
b.HasOne("Yavsc.Models.Workflow.Activity") b.HasOne("Yavsc.Models.Workflow.Activity")

View File

@ -91,13 +91,15 @@ namespace Yavsc.Models
/// on his profile). /// on his profile).
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public DbSet<BookQuery> Commands { get; set; } public DbSet<RdvQuery> 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<BookQuery> BookQueries { get; set; } public DbSet<RdvQuery> RdvQueries { get; set; }
public DbSet<HairCutQuery> HairCutQueries { get; set; }
public DbSet<HairMultiCutQuery> HairMultiCutQueries { get; set; }
public DbSet<PerformerProfile> Performers { get; set; } public DbSet<PerformerProfile> Performers { get; set; }
public DbSet<Estimate> Estimates { get; set; } public DbSet<Estimate> Estimates { get; set; }
public DbSet<AccountBalance> BankStatus { get; set; } public DbSet<AccountBalance> BankStatus { get; set; }
@ -269,6 +271,8 @@ namespace Yavsc.Models
public DbSet<Notification> Notification { get; set; } public DbSet<Notification> Notification { get; set; }
public DbSet<DimissClicked> DimissClicked { get; set; } public DbSet<DimissClicked> DimissClicked { get; set; }
public DbSet<HairPrestation> HairPrestation { get; set; }
} }

View File

@ -2,7 +2,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json; using Newtonsoft.Json;
using Yavsc.Models.Market;
namespace Yavsc.Models.Billing namespace Yavsc.Models.Billing
{ {
@ -14,7 +13,7 @@ namespace Yavsc.Models.Billing
[Required,MaxLength(512)] [Required,MaxLength(512)]
public string Description { get; set; } public string Description { get; set; }
public BaseProduct Article { get; set; }
public int Count { get; set; } public int Count { get; set; }
[DisplayFormat(DataFormatString="{0:C}")] [DisplayFormat(DataFormatString="{0:C}")]

View File

@ -24,7 +24,7 @@ namespace Yavsc.Models.Billing
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[ForeignKey("CommandId"),JsonIgnore] [ForeignKey("CommandId"),JsonIgnore]
public BookQuery Query { get; set; } public RdvQuery Query { get; set; }
public string Description { get; set; } public string Description { get; set; }
public string Title { get; set; } public string Title { get; set; }

View File

@ -5,11 +5,12 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Billing namespace Yavsc.Models.Billing
{ {
using Interfaces.Workflow; using Interfaces.Workflow;
using Workflow; using Newtonsoft.Json;
using YavscLib; using Workflow;
using YavscLib;
public abstract class NominativeServiceCommand : IBaseTrackedEntity, IQuery public abstract class NominativeServiceCommand : IBaseTrackedEntity, IQuery
{ {
public DateTime DateCreated public DateTime DateCreated
{ {
@ -60,6 +61,10 @@ using YavscLib;
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[Required]
public string ActivityCode { get; set; }
[ForeignKey("ActivityCode"),JsonIgnore]
public virtual Activity Context  { get; set ; }
} }
} }

View File

@ -35,7 +35,7 @@ namespace Yavsc.Models.Calendar
/// <returns>The free dates.</returns> /// <returns>The free dates.</returns>
/// <param name="username">Username.</param> /// <param name="username">Username.</param>
/// <param name="req">Req.</param> /// <param name="req">Req.</param>
IFreeDateSet GetFreeDates(string username, BookQuery req); IFreeDateSet GetFreeDates(string username, RdvQuery req);
/// <summary> /// <summary>
/// Book the specified username and ev. /// Book the specified username and ev.
/// </summary> /// </summary>

View File

@ -1,7 +1,9 @@
using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Billing; using Yavsc.Models.Billing;
using Yavsc.Models.Relationship;
namespace Yavsc.Models.Haircut namespace Yavsc.Models.Haircut
{ {
@ -9,6 +11,14 @@ namespace Yavsc.Models.Haircut
{ {
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; } public long Id { get; set; }
HairPrestation [] Prestations { get; set; } HairPrestation Prestation { get; set; }
public Location Location { get; set; }
public DateTime EventDate
{
get;
set;
}
} }
} }

View File

@ -2,7 +2,7 @@ using Yavsc.Interfaces.Workflow;
namespace Yavsc.Models.Haircut namespace Yavsc.Models.Haircut
{ {
public class HairCutQueryEvent : BookQueryProviderInfo, IEvent public class HairCutQueryEvent : RdvQueryProviderInfo, IEvent
{ {
public HairCutQueryEvent() public HairCutQueryEvent()
{ {

View File

@ -1,7 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Haircut namespace Yavsc.Models.Haircut
{ {
public enum HairDressings { public enum HairDressings {
Coiffage,
Brushing, Brushing,
[Display(Name="Mise en plis")]
Folding Folding
} }
} }

View File

@ -0,0 +1,23 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Billing;
using Yavsc.Models.Relationship;
namespace Yavsc.Models.Haircut
{
public class HairMultiCutQuery : NominativeServiceCommand
{
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
HairPrestation [] Prestations { get; set; }
public Location Location { get; set; }
public DateTime EventDate
{
get;
set;
}
}
}

View File

@ -1,18 +1,39 @@
using Yavsc.Models.Market; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Haircut namespace Yavsc.Models.Haircut
{ {
public class HairPrestation : Service public class HairPrestation
{ {
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
[Display(Name="Longueur de cheveux")]
public HairLength Length { get; set; } public HairLength Length { get; set; }
[Display(Name="Pour qui")]
public HairCutGenders Gender { get; set; } public HairCutGenders Gender { get; set; }
[Display(Name="Coupe")]
public bool Cut { get; set; } public bool Cut { get; set; }
[Display(Name="Coiffage")]
public HairDressings Dressing { get; set; } public HairDressings Dressing { get; set; }
[Display(Name="Technique")]
public HairTechnos Tech { get; set; } public HairTechnos Tech { get; set; }
[Display(Name="Shampoing")]
public bool Shampoo { get; set; } public bool Shampoo { get; set; }
public HairTaint[] Taints { get; set; }
[Display(Name="Couleurs")]
public virtual List<HairTaint> Taints { get; set; }
[Display(Name="Soins")]
public bool Cares { get; set; } public bool Cares { get; set; }
} }

View File

@ -1,13 +1,18 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Haircut namespace Yavsc.Models.Haircut
{ {
public enum HairTechnos public enum HairTechnos
{ {
Color, Color,
[Display(Name="Permantante")]
Permanent, Permanent,
[Display(Name="Défrisage")]
Defris, Defris,
[Display(Name="Mêches")]
Mech, Mech,
Balayage, Balayage
TyAndDie
} }
} }

View File

@ -1,16 +1,10 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Market namespace Yavsc.Models.Market
{ {
public partial class BaseProduct public class BaseProduct
{ {
/// <summary>
/// An unique product identifier.
/// </summary>
/// <returns></returns>
[Key(),DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// A contractual description for this product. /// A contractual description for this product.

View File

@ -1,9 +1,15 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Market namespace Yavsc.Models.Market
{ {
public partial class Product : BaseProduct public class Product : BaseProduct
{ {
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
/// <summary> /// <summary>
/// Weight in gram /// Weight in gram
/// </summary> /// </summary>

View File

@ -2,11 +2,19 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Market { namespace Yavsc.Models.Market {
using System.ComponentModel.DataAnnotations;
using Billing; using Billing;
using Workflow; using Workflow;
public partial class Service : BaseProduct public class Service : BaseProduct
{ {
/// <summary>
/// An unique product identifier.
/// </summary>
/// <returns></returns>
[Key(),DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
public string ContextId { get; set; } public string ContextId { get; set; }
[ForeignKey("ContextId")] [ForeignKey("ContextId")]
public virtual Activity Context { get; set; } public virtual Activity Context { get; set; }

View File

@ -25,9 +25,9 @@ using Interfaces.Workflow;
public class BookQueryEvent: BookQueryProviderInfo, IEvent public class RdvQueryEvent: RdvQueryProviderInfo, IEvent
{ {
public BookQueryEvent() public RdvQueryEvent()
{ {
Topic = "BookQuery"; Topic = "BookQuery";
} }

View File

@ -5,7 +5,7 @@ namespace Yavsc.Models
using Models.Messaging; using Models.Messaging;
using Models.Relationship; using Models.Relationship;
public class BookQueryProviderInfo public class RdvQueryProviderInfo
{ {
public ClientProviderInfo Client { get; set; } public ClientProviderInfo Client { get; set; }
public Location Location { get; set; } public Location Location { get; set; }

View File

@ -1,7 +1,6 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace Yavsc.Models.Workflow namespace Yavsc.Models.Workflow
{ {
@ -11,7 +10,7 @@ namespace Yavsc.Models.Workflow
/// 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 : NominativeServiceCommand public class RdvQuery : NominativeServiceCommand
{ {
/// <summary> /// <summary>
/// The command identifier /// The command identifier
@ -38,22 +37,18 @@ namespace Yavsc.Models.Workflow
} }
public string Reason { get; set; } public string Reason { get; set; }
public BookQuery() public RdvQuery()
{ {
} }
public BookQuery(string activityCode, Location eventLocation, DateTime eventDate) public RdvQuery(string activityCode, Location eventLocation, DateTime eventDate)
{ {
Location = eventLocation; Location = eventLocation;
EventDate = eventDate; EventDate = eventDate;
ActivityCode = activityCode; ActivityCode = activityCode;
} }
[Required]
public string ActivityCode { get; set; }
[ForeignKey("ActivityCode"),JsonIgnore]
public virtual Activity Context  { get; set ; }
} }
} }

View File

@ -338,5 +338,5 @@ contact a performer</value></data>
<data name="YourPosts"><value>You posts</value></data> <data name="YourPosts"><value>You posts</value></data>
<data name="YourProfile"><value>Your profile</value></data> <data name="YourProfile"><value>Your profile</value></data>
<data name="YourMessageHasBeenSent"><value>Your message has been sent</value></data> <data name="YourMessageHasBeenSent"><value>Your message has been sent</value></data>
<data name="Longueur de cheveux"><value>Hair Length</value></data>
</root> </root>

View File

@ -325,6 +325,7 @@
<data name="ProviderId"><value>Identifiant du fournisseur</value></data> <data name="ProviderId"><value>Identifiant du fournisseur</value></data>
<data name="ProviderName"><value>Nom du fournisseur</value></data> <data name="ProviderName"><value>Nom du fournisseur</value></data>
<data name="Rate"><value>Cote</value></data> <data name="Rate"><value>Cote</value></data>
<data name="RdvToPerf"><value>{0} vous demande une intervention le {1} à {2} ({3})</value></data>
<data name="ReadMore"><value>Lire la suite ...</value></data> <data name="ReadMore"><value>Lire la suite ...</value></data>
<data name="reason"><value>raison</value></data> <data name="reason"><value>raison</value></data>
<data name="Register"><value>S'inscrire</value></data> <data name="Register"><value>S'inscrire</value></data>

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Yavsc.Models.Google.Messaging; using Yavsc.Models.Google.Messaging;
using Yavsc.Models.Haircut;
using Yavsc.Models.Messaging; using Yavsc.Models.Messaging;
namespace Yavsc.Services namespace Yavsc.Services
@ -11,12 +12,18 @@ namespace Yavsc.Services
Task<MessageWithPayloadResponse> NotifyBookQueryAsync( Task<MessageWithPayloadResponse> NotifyBookQueryAsync(
GoogleAuthSettings googlesettings, GoogleAuthSettings googlesettings,
IEnumerable<string> registrationId, IEnumerable<string> registrationId,
BookQueryEvent ev); RdvQueryEvent ev);
Task<MessageWithPayloadResponse> NotifyEstimateAsync( Task<MessageWithPayloadResponse> NotifyEstimateAsync(
GoogleAuthSettings googlesettings, GoogleAuthSettings googlesettings,
IEnumerable<string> registrationId, IEnumerable<string> registrationId,
EstimationEvent ev); EstimationEvent ev);
Task<MessageWithPayloadResponse> NotifyHairCutQueryAsync(
GoogleAuthSettings googlesettings,
IEnumerable<string> registrationId,
HairCutQueryEvent ev);
} }
} }

View File

@ -10,6 +10,7 @@ using Microsoft.AspNet.Identity;
using Yavsc.Models; using Yavsc.Models;
using Yavsc.Models.Google.Messaging; using Yavsc.Models.Google.Messaging;
using System.Collections.Generic; using System.Collections.Generic;
using Yavsc.Models.Haircut;
namespace Yavsc.Services namespace Yavsc.Services
{ {
@ -27,11 +28,11 @@ namespace Yavsc.Services
/// <returns>a MessageWithPayloadResponse, /// <returns>a MessageWithPayloadResponse,
/// <c>bool somethingsent = (response.failure == 0 &amp;&amp; response.success > 0)</c> /// <c>bool somethingsent = (response.failure == 0 &amp;&amp; response.success > 0)</c>
/// </returns> /// </returns>
public async Task<MessageWithPayloadResponse> NotifyBookQueryAsync(GoogleAuthSettings googleSettings, IEnumerable<string> registrationIds, BookQueryEvent ev) public async Task<MessageWithPayloadResponse> NotifyBookQueryAsync(GoogleAuthSettings googleSettings, IEnumerable<string> registrationIds, RdvQueryEvent ev)
{ {
MessageWithPayloadResponse response = null; MessageWithPayloadResponse response = null;
await Task.Run(()=>{ await Task.Run(()=>{
response = googleSettings.NotifyEvent<BookQueryEvent>(registrationIds, ev); response = googleSettings.NotifyEvent<RdvQueryEvent>(registrationIds, ev);
}); });
return response; return response;
} }
@ -45,6 +46,16 @@ namespace Yavsc.Services
return response; return response;
} }
public async Task<MessageWithPayloadResponse> NotifyHairCutQueryAsync(GoogleAuthSettings googleSettings,
IEnumerable<string> registrationIds, HairCutQueryEvent ev)
{
MessageWithPayloadResponse response = null;
await Task.Run(()=>{
response = googleSettings.NotifyEvent<HairCutQueryEvent>(registrationIds, ev);
});
return response;
}
public Task<bool> SendEmailAsync(SiteSettings siteSettings, SmtpSettings smtpSettings, string email, string subject, string message) public Task<bool> SendEmailAsync(SiteSettings siteSettings, SmtpSettings smtpSettings, string email, string subject, string message)
{ {
try try

View File

@ -7,10 +7,16 @@ namespace Yavsc
public partial class Startup public partial class Startup
{ {
/// <summary> /// <summary>
/// Lists Available user profile classes. /// Lists Available user profile classes,
/// populated at startup, using reflexion.
/// </summary> /// </summary>
public static Dictionary<string,Type> ProfileTypes = new Dictionary<string,Type>() ; public static Dictionary<string,Type> ProfileTypes = new Dictionary<string,Type>() ;
public static readonly string [] Forms = new string [] { "Profiles" };
/// <summary>
/// Lists available command forms.
/// This is hard coded.
/// </summary>
public static readonly string [] Forms = new string [] { "Profiles" , "HairCut" };
private void ConfigureWorkflow(IApplicationBuilder app, SiteSettings settings) private void ConfigureWorkflow(IApplicationBuilder app, SiteSettings settings)
{ {
@ -30,6 +36,5 @@ namespace Yavsc
return AppDomain.CurrentDomain.GetAssemblies()[0]; return AppDomain.CurrentDomain.GetAssemblies()[0];
} }
} }
} }

View File

@ -4,9 +4,9 @@ using Microsoft.AspNet.Authorization;
namespace Yavsc.ViewModels.Auth.Handlers namespace Yavsc.ViewModels.Auth.Handlers
{ {
using Models.Workflow; using Models.Workflow;
public class CommandEditHandler : AuthorizationHandler<EditRequirement, BookQuery> public class CommandEditHandler : AuthorizationHandler<EditRequirement, RdvQuery>
{ {
protected override void Handle(AuthorizationContext context, EditRequirement requirement, BookQuery resource) protected override void Handle(AuthorizationContext context, EditRequirement requirement, RdvQuery resource)
{ {
if (context.User.IsInRole("FrontOffice")) if (context.User.IsInRole("FrontOffice"))
context.Succeed(requirement); context.Succeed(requirement);

View File

@ -4,9 +4,9 @@ using Microsoft.AspNet.Authorization;
namespace Yavsc.ViewModels.Auth.Handlers namespace Yavsc.ViewModels.Auth.Handlers
{ {
using Models.Workflow; using Models.Workflow;
public class CommandViewHandler : AuthorizationHandler<ViewRequirement, BookQuery> public class CommandViewHandler : AuthorizationHandler<ViewRequirement, RdvQuery>
{ {
protected override void Handle(AuthorizationContext context, ViewRequirement requirement, BookQuery resource) protected override void Handle(AuthorizationContext context, ViewRequirement requirement, RdvQuery resource)
{ {
if (context.User.IsInRole("FrontOffice")) if (context.User.IsInRole("FrontOffice"))
context.Succeed(requirement); context.Succeed(requirement);

View File

@ -0,0 +1,13 @@
using System.Collections.Generic;
using Yavsc.Models.Haircut;
using Yavsc.Models.Workflow;
namespace Yavsc.ViewModels.Haircut
{
public class HairCutView
{
public List<PerformerProfile> HairBrushers { get; set; }
public HairPrestation Topic { get; set; }
}
}

View File

@ -1,4 +1,4 @@
@model BookQuery @model RdvQuery
@using Yavsc.Models.Google.Messaging @using Yavsc.Models.Google.Messaging
@{ @{
ViewData["Title"] = SR["Command confirmation"]+" "+ViewBag.Activity.Name; ViewData["Title"] = SR["Command confirmation"]+" "+ViewBag.Activity.Name;

View File

@ -1,4 +1,4 @@
@model BookQuery @model RdvQuery
@{ ViewData["Title"] = "Proposition de rendez-vous "+ @{ ViewData["Title"] = "Proposition de rendez-vous "+
@SR["to"]+" "+ Model.PerformerProfile.Performer.UserName @SR["to"]+" "+ Model.PerformerProfile.Performer.UserName
+" ["+SR[ViewBag.Activity.Code]+"]"; } +" ["+SR[ViewBag.Activity.Code]+"]"; }
@ -21,10 +21,16 @@
} }
</style> </style>
} }
@section scripts{ @section scripts {
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('#datetimepicker2').datetimepicker({
locale: 'fr',
format: "YYYY/MM/DD HH:mm"
});
var config = { var config = {
mapId: 'map', mapId: 'map',
addrId: 'Location_Address', addrId: 'Location_Address',
@ -75,7 +81,6 @@
return true; return true;
} }
$('#EventDate').datepicker({ language: 'fr' });
$('#' + config.addrId).rules("add", $('#' + config.addrId).rules("add",
{ {
@ -112,6 +117,7 @@
} }
}); });
}); });
</script> </script>
} }
<h2>@ViewData["Title"]</h2> <h2>@ViewData["Title"]</h2>
@ -137,14 +143,7 @@
</span> </span>
</div> </div>
</div> </div>
<script type="text/javascript">
$(function () {
$('#datetimepicker2').datetimepicker({
locale: 'fr',
format: "YYYY/MM/DD hh:mm"
});
});
</script>
<span asp-validation-for="EventDate" class="text-danger"> <span asp-validation-for="EventDate" class="text-danger">
</span> </span>
</div> </div>

View File

@ -1,4 +1,4 @@
@model BookQuery @model RdvQuery
@{ @{
ViewData["Title"] = "Delete"; ViewData["Title"] = "Delete";

View File

@ -1,4 +1,4 @@
@model BookQuery @model RdvQuery
@{ @{
ViewData["Title"] = @SR["Details"]; ViewData["Title"] = @SR["Details"];

View File

@ -1,4 +1,4 @@
@model BookQuery @model RdvQuery
@{ @{
ViewData["Title"] = "Edit"; ViewData["Title"] = "Edit";

View File

@ -1,4 +1,4 @@
@model IEnumerable<BookQuery> @model IEnumerable<RdvQuery>
@{ @{
ViewData["Title"] = "Index"; ViewData["Title"] = "Index";

View File

@ -1,16 +0,0 @@
@model IEnumerable<PerformerProfile>
@{
ViewData["Title"] = "Book - " + (ViewBag.Activity?.Name ?? SR["Any"]);
}
<em>@ViewBag.Activity.Description</em>
@foreach (var profile in Model) {
<hr/>
@Html.DisplayFor(m=>m)
<form action="~/Command/HArts" >
<input type="hidden" name="id" value="@profile.PerformerId" />
<input type="hidden" name="activityCode" value="@ViewBag.Activity.Code" />
<input type="submit" value="@SR["Prennez un rendez-vous avec"] @profile.Performer.UserName"/>
</form>
}

View File

@ -0,0 +1,73 @@
@model HairCutView
@{
ViewData["Title"] = "Book - " + (ViewBag.Activity?.Name ?? SR["Any"]);
}
<em>@ViewBag.Activity.Description</em>
@Html.DisplayFor(m=>m)
<form asp-controller="HairCutCommand" asp-action="CreateHairCutQuery" >
<div class="form-horizontal">
<h4>HairPrestation</h4>
<hr />
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Topic.Cares" />
<label asp-for="Topic.Cares"></label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Topic.Cut" />
<label asp-for="Topic.Cut"></label>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Topic.Dressing" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Topic.Dressing" class="form-control"></select>
<span asp-validation-for="Topic.Dressing" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Topic.Gender" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Topic.Gender" class="form-control"></select>
<span asp-validation-for="Topic.Gender" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Topic.Length" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Topic.Length" class="form-control"></select>
<span asp-validation-for="Topic.Length" class="text-danger" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Topic.Shampoo" />
<label asp-for="Topic.Shampoo"></label>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Topic.Tech" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Topic.Tech" class="form-control"></select>
<span asp-validation-for="Topic.Tech" class="text-danger" />
</div>
</div>
<input type="hidden" name="activityCode" value="@ViewBag.Activity.Code" />
<input type="submit" value="@SR["Selectionnez maintenant votre prestataire"]"/>
</form>

View File

@ -0,0 +1,77 @@
@model Yavsc.Models.Haircut.HairPrestation
@{
ViewData["Title"] = "Create";
}
<h2>Create</h2>
<form asp-action="Create">
<div class="form-horizontal">
<h4>HairPrestation</h4>
<hr />
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Cares" />
<label asp-for="Cares"></label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Cut" />
<label asp-for="Cut"></label>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Dressing" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Dressing" class="form-control"></select>
<span asp-validation-for="Dressing" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Gender" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Gender" class="form-control"></select>
<span asp-validation-for="Gender" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Length" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Length" class="form-control"></select>
<span asp-validation-for="Length" class="text-danger" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Shampoo" />
<label asp-for="Shampoo"></label>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Tech" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Tech" class="form-control"></select>
<span asp-validation-for="Tech" class="text-danger" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
</form>
<div>
<a asp-action="Index">Back to List</a>
</div>

View File

@ -0,0 +1,64 @@
@model Yavsc.Models.Haircut.HairPrestation
@{
ViewData["Title"] = "Delete";
}
<h2>Delete</h2>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>HairPrestation</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Cares)
</dt>
<dd>
@Html.DisplayFor(model => model.Cares)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Cut)
</dt>
<dd>
@Html.DisplayFor(model => model.Cut)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Dressing)
</dt>
<dd>
@Html.DisplayFor(model => model.Dressing)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Gender)
</dt>
<dd>
@Html.DisplayFor(model => model.Gender)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Length)
</dt>
<dd>
@Html.DisplayFor(model => model.Length)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Shampoo)
</dt>
<dd>
@Html.DisplayFor(model => model.Shampoo)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Tech)
</dt>
<dd>
@Html.DisplayFor(model => model.Tech)
</dd>
</dl>
<form asp-action="Delete">
<div class="form-actions no-color">
<input type="submit" value="Delete" class="btn btn-default" /> |
<a asp-action="Index">Back to List</a>
</div>
</form>
</div>

View File

@ -0,0 +1,60 @@
@model Yavsc.Models.Haircut.HairPrestation
@{
ViewData["Title"] = "Details";
}
<h2>Details</h2>
<div>
<h4>HairPrestation</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Cares)
</dt>
<dd>
@Html.DisplayFor(model => model.Cares)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Cut)
</dt>
<dd>
@Html.DisplayFor(model => model.Cut)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Dressing)
</dt>
<dd>
@Html.DisplayFor(model => model.Dressing)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Gender)
</dt>
<dd>
@Html.DisplayFor(model => model.Gender)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Length)
</dt>
<dd>
@Html.DisplayFor(model => model.Length)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Shampoo)
</dt>
<dd>
@Html.DisplayFor(model => model.Shampoo)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Tech)
</dt>
<dd>
@Html.DisplayFor(model => model.Tech)
</dd>
</dl>
</div>
<p>
<a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> |
<a asp-action="Index">Back to List</a>
</p>

View File

@ -0,0 +1,78 @@
@model Yavsc.Models.Haircut.HairPrestation
@{
ViewData["Title"] = "Edit";
}
<h2>Edit</h2>
<form asp-action="Edit">
<div class="form-horizontal">
<h4>HairPrestation</h4>
<hr />
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="Id" />
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Cares" />
<label asp-for="Cares"></label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Cut" />
<label asp-for="Cut"></label>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Dressing" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Dressing" class="form-control"></select>
<span asp-validation-for="Dressing" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Gender" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Gender" class="form-control"></select>
<span asp-validation-for="Gender" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Length" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Length" class="form-control"></select>
<span asp-validation-for="Length" class="text-danger" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Shampoo" />
<label asp-for="Shampoo"></label>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Tech" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="Tech" class="form-control"></select>
<span asp-validation-for="Tech" class="text-danger" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
</div>
</form>
<div>
<a asp-action="Index">Back to List</a>
</div>

View File

@ -0,0 +1,68 @@
@model IEnumerable<Yavsc.Models.Haircut.HairPrestation>
@{
ViewData["Title"] = "Index";
}
<h2>Index</h2>
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Cares)
</th>
<th>
@Html.DisplayNameFor(model => model.Cut)
</th>
<th>
@Html.DisplayNameFor(model => model.Dressing)
</th>
<th>
@Html.DisplayNameFor(model => model.Gender)
</th>
<th>
@Html.DisplayNameFor(model => model.Length)
</th>
<th>
@Html.DisplayNameFor(model => model.Shampoo)
</th>
<th>
@Html.DisplayNameFor(model => model.Tech)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Cares)
</td>
<td>
@Html.DisplayFor(modelItem => item.Cut)
</td>
<td>
@Html.DisplayFor(modelItem => item.Dressing)
</td>
<td>
@Html.DisplayFor(modelItem => item.Gender)
</td>
<td>
@Html.DisplayFor(modelItem => item.Length)
</td>
<td>
@Html.DisplayFor(modelItem => item.Shampoo)
</td>
<td>
@Html.DisplayFor(modelItem => item.Tech)
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
</td>
</tr>
}
</table>

View File

@ -2,8 +2,7 @@
ViewData["Title"] = @SR["About"]+" "+@SiteSettings.Value.Title; ViewData["Title"] = @SR["About"]+" "+@SiteSettings.Value.Title;
} }
<h1>@ViewData["Title"]</h1> <h1>@ViewData["Title"]</h1>
<em>@SiteSettings.Value.Slogan</em> <environment names="ZicMoove">
<markdown> <markdown>
@ -90,3 +89,33 @@ et programme la suppression complète de ces dites informations dans les quinze
L'opération est annulable, jusqu'à deux semaines après sa programmation. L'opération est annulable, jusqu'à deux semaines après sa programmation.
</markdown> </markdown>
</environment>
<environment names="Lua">
<markdown>
C'est mon site pérso.
--
Paul,
publiant lua.p schneider.fr
</markdown>
</environment>
<environment names="Yavsc">
<markdown>
Yet Another Very Small Company ...
</markdown>
</environment>
<environment names="YavscPre">
<markdown>
Yet Another Very Small Company : La pré-production
</markdown>
</environment>
<environment names="Dev">
<markdown>
Site du développeur
</markdown>
</environment>

View File

@ -1,3 +1,5 @@
@model IEnumerable<Activity>
@{ @{
ViewData["Title"] = "Home Page"; ViewData["Title"] = "Home Page";
} }
@ -41,9 +43,9 @@
} }
@foreach (var form in act.Forms) { @foreach (var frm in act.Forms) {
<a class="btn btn-default" asp-controller="FrontOffice" asp-action="@form.Action" asp-route-id="@act.Code"> <a class="btn btn-success" asp-controller="FrontOffice" asp-action="@frm.Action" asp-route-id="@act.Code">
@form.Title @frm.Title
</a> </a>
} }
</div> </div>

View File

@ -1,4 +1,4 @@
@model BookQuery @model RdvQuery
<dl class="dl-horizontal"> <dl class="dl-horizontal">

View File

@ -28,7 +28,8 @@
@using Yavsc.ViewModels.Auth; @using Yavsc.ViewModels.Auth;
@using Yavsc.ViewModels.Administration; @using Yavsc.ViewModels.Administration;
@using Yavsc.ViewModels.Relationship; @using Yavsc.ViewModels.Relationship;
@using Yavsc.ViewModels.Haircut;
@inject IViewLocalizer LocString @inject IViewLocalizer LocString
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers" @addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
@addTagHelper "*, Yavsc" @addTagHelper "*, Yavsc"