This commit is contained in:
2017-03-09 15:33:19 +01:00
55 changed files with 2987 additions and 202 deletions

View File

@ -6,6 +6,7 @@ using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Yavsc.Models; using Yavsc.Models;
using Yavsc.Models.Billing; using Yavsc.Models.Billing;
@ -65,13 +66,13 @@ namespace Yavsc.Controllers
} }
// PUT: api/Estimate/5 // PUT: api/Estimate/5
[HttpPut("{id}")] [HttpPut("{id}"),Produces("application/json")]
public IActionResult PutEstimate(long id, [FromBody] Estimate estimate) public IActionResult PutEstimate(long id, [FromBody] Estimate estimate)
{ {
if (!ModelState.IsValid) if (!ModelState.IsValid)
{ {
return HttpBadRequest(ModelState); return new BadRequestObjectResult(ModelState);
} }
if (id != estimate.Id) if (id != estimate.Id)
@ -109,13 +110,9 @@ namespace Yavsc.Controllers
} }
// POST: api/Estimate // POST: api/Estimate
[HttpPost] [HttpPost,Produces("application/json")]
public IActionResult PostEstimate([FromBody] Estimate estimate) public IActionResult PostEstimate([FromBody] Estimate estimate)
{ {
if (!ModelState.IsValid)
{
return HttpBadRequest(ModelState);
}
var uid = User.GetUserId(); var uid = User.GetUserId();
if (!User.IsInRole(Constants.AdminGroupName)) if (!User.IsInRole(Constants.AdminGroupName))
{ {
@ -127,9 +124,17 @@ namespace Yavsc.Controllers
} }
if (estimate.CommandId!=null) { if (estimate.CommandId!=null) {
var query = _context.RdvQueries.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) {
throw new InvalidOperationException(); return HttpBadRequest(ModelState);
}
query.ValidationDate = DateTime.Now; query.ValidationDate = DateTime.Now;
_context.SaveChanges(User.GetUserId());
_context.Entry(query).State = EntityState.Detached;
}
if (!ModelState.IsValid)
{
_logger.LogError(JsonConvert.SerializeObject(ModelState));
return Json(ModelState);
} }
_context.Estimates.Add(estimate); _context.Estimates.Add(estimate);

View File

@ -17,6 +17,7 @@ namespace Yavsc.ApiControllers
using Yavsc.Services; using Yavsc.Services;
using Yavsc.Models.Messaging; using Yavsc.Models.Messaging;
using Yavsc.ViewModels; using Yavsc.ViewModels;
using Microsoft.Extensions.OptionsModel;
[Route("api/pdfestimate"), Authorize] [Route("api/pdfestimate"), Authorize]
public class PdfEstimateController : Controller public class PdfEstimateController : Controller
@ -33,12 +34,17 @@ namespace Yavsc.ApiControllers
IAuthorizationService authorizationService, IAuthorizationService authorizationService,
ILoggerFactory loggerFactory, ILoggerFactory loggerFactory,
IStringLocalizer<Yavsc.Resources.YavscLocalisation> SR, IStringLocalizer<Yavsc.Resources.YavscLocalisation> SR,
ApplicationDbContext context) ApplicationDbContext context,
IOptions<GoogleAuthSettings> googleSettings,
IGoogleCloudMessageSender GCMSender
)
{ {
_googleSettings=googleSettings.Value;
this.authorizationService = authorizationService; this.authorizationService = authorizationService;
dbContext = context; dbContext = context;
logger = loggerFactory.CreateLogger<PdfEstimateController>(); logger = loggerFactory.CreateLogger<PdfEstimateController>();
this._localizer = SR; this._localizer = SR;
_GCMSender=GCMSender;
} }
[HttpGet("get/{id}", Name = "Get"), Authorize] [HttpGet("get/{id}", Name = "Get"), Authorize]
@ -111,10 +117,12 @@ namespace Yavsc.ApiControllers
var yaev = new EstimationEvent(dbContext,estimate,_localizer); var yaev = new EstimationEvent(dbContext,estimate,_localizer);
var regids = estimate.Client.Devices.Select(d => d.GCMRegistrationId).ToArray(); var regids = estimate.Client.Devices.Select(d => d.GCMRegistrationId).ToArray();
logger.LogWarning($"new regids: {regids}"); bool gcmSent = false;
var grep = await _GCMSender.NotifyEstimateAsync(_googleSettings,regids,yaev); if (regids.Length>0) {
logger.LogWarning($"grep: {grep}"); var grep = await _GCMSender.NotifyEstimateAsync(_googleSettings,regids,yaev);
return Ok (new { ProviderValidationDate = estimate.ProviderValidationDate, GCMSent = grep.success }); gcmSent = grep.success>0;
}
return Ok (new { ProviderValidationDate = estimate.ProviderValidationDate, GCMSent = gcmSent });
} }
[HttpGet("prosign/{id}")] [HttpGet("prosign/{id}")]

View File

@ -0,0 +1,9 @@
using System;
namespace Yavsc.Attributes
{
public class ActivitySettingsAttribute : Attribute
{
}
}

View File

@ -41,9 +41,9 @@ namespace Yavsc.Controllers
var items = Startup.ProfileTypes.Select( var items = Startup.ProfileTypes.Select(
pt => new SelectListItem pt => new SelectListItem
{ {
Text = SR[pt.Key], Text = SR[pt.FullName],
Value = pt.Key, Value = pt.FullName,
Selected = currentCode == pt.Key Selected = currentCode == pt.FullName
}).ToList(); }).ToList();
items.Add(new SelectListItem { Text = SR[Constants.NoneCode], Value = Constants.NoneCode, Selected = currentCode == null}); items.Add(new SelectListItem { Text = SR[Constants.NoneCode], Value = Constants.NoneCode, Selected = currentCode == null});
ViewBag.SettingsClassName = items; ViewBag.SettingsClassName = items;

View File

@ -1,121 +1,17 @@
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using System.Security.Claims;
using Microsoft.Data.Entity;
using Yavsc.Models; using Yavsc.Models;
using Yavsc.Models.Haircut; using Yavsc.Models.Haircut;
using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Authorization;
using Yavsc.Controllers.Generic;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
[Authorize(Roles="Performer")] [Authorize(Roles="Performer")]
public class BrusherProfileController : Controller public class BrusherProfileController : SettingsController<BrusherProfile>
{ {
private ApplicationDbContext _context;
public BrusherProfileController(ApplicationDbContext context) public BrusherProfileController(ApplicationDbContext context) : base(context)
{ {
_context = context;
} }
// GET: BrusherProfile
public async Task<IActionResult> Index()
{
var existing = await _context.BrusherProfile.SingleOrDefaultAsync(p=>p.UserId == User.GetUserId());
return View(existing);
}
// GET: BrusherProfile/Details/5
public async Task<IActionResult> Details(string id)
{
if (id == null)
{
id = User.GetUserId();
}
BrusherProfile brusherProfile = await _context.BrusherProfile.SingleAsync(m => m.UserId == id);
if (brusherProfile == null)
{
return HttpNotFound();
}
return View(brusherProfile);
}
// GET: BrusherProfile/Create
public IActionResult Create()
{
return View();
}
// GET: BrusherProfile/Edit/5
public async Task<IActionResult> Edit(string id)
{
if (id == null)
{
id = User.GetUserId();
}
BrusherProfile brusherProfile = await _context.BrusherProfile.SingleOrDefaultAsync(m => m.UserId == id);
if (brusherProfile == null)
{
brusherProfile = new BrusherProfile { };
}
return View(brusherProfile);
}
// POST: BrusherProfile/Edit/5
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(BrusherProfile brusherProfile)
{
if (string.IsNullOrEmpty(brusherProfile.UserId))
{
// a creation
brusherProfile.UserId = User.GetUserId();
if (ModelState.IsValid)
{
_context.BrusherProfile.Add(brusherProfile);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
}
else if (ModelState.IsValid)
{
_context.Update(brusherProfile);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(brusherProfile);
}
// GET: BrusherProfile/Delete/5
[ActionName("Delete")]
public async Task<IActionResult> Delete(string id)
{
if (id == null)
{
return HttpNotFound();
}
BrusherProfile brusherProfile = await _context.BrusherProfile.SingleAsync(m => m.UserId == id);
if (brusherProfile == null)
{
return HttpNotFound();
}
return View(brusherProfile);
}
// POST: BrusherProfile/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(string id)
{
BrusherProfile brusherProfile = await _context.BrusherProfile.SingleAsync(m => m.UserId == id);
_context.BrusherProfile.Remove(brusherProfile);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
} }
} }

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.Musical.Profiles;
namespace Yavsc.Controllers
{
public class DjSettingsController : Controller
{
private ApplicationDbContext _context;
public DjSettingsController(ApplicationDbContext context)
{
_context = context;
}
// GET: DjSettings
public async Task<IActionResult> Index()
{
return View(await _context.DjSettings.ToListAsync());
}
// GET: DjSettings/Details/5
public async Task<IActionResult> Details(string id)
{
if (id == null)
{
return HttpNotFound();
}
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
if (djSettings == null)
{
return HttpNotFound();
}
return View(djSettings);
}
// GET: DjSettings/Create
public IActionResult Create()
{
return View();
}
// POST: DjSettings/Create
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(DjSettings djSettings)
{
if (ModelState.IsValid)
{
_context.DjSettings.Add(djSettings);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(djSettings);
}
// GET: DjSettings/Edit/5
public async Task<IActionResult> Edit(string id)
{
if (id == null)
{
return HttpNotFound();
}
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
if (djSettings == null)
{
return HttpNotFound();
}
return View(djSettings);
}
// POST: DjSettings/Edit/5
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(DjSettings djSettings)
{
if (ModelState.IsValid)
{
_context.Update(djSettings);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(djSettings);
}
// GET: DjSettings/Delete/5
[ActionName("Delete")]
public async Task<IActionResult> Delete(string id)
{
if (id == null)
{
return HttpNotFound();
}
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
if (djSettings == null)
{
return HttpNotFound();
}
return View(djSettings);
}
// POST: DjSettings/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(string id)
{
DjSettings djSettings = await _context.DjSettings.SingleAsync(m => m.UserId == id);
_context.DjSettings.Remove(djSettings);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
}
}

View File

@ -7,16 +7,23 @@ using Microsoft.Data.Entity;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
using Microsoft.Extensions.Logging;
using Models; using Models;
using Models.Workflow; using Models.Workflow;
using Yavsc.Exceptions;
using Yavsc.ViewModels.Workflow;
using YavscLib;
[Authorize] [Authorize]
public class DoController : Controller public class DoController : Controller
{ {
private ApplicationDbContext _context; private ApplicationDbContext _context;
ILogger _logger;
public DoController(ApplicationDbContext context) public DoController(ApplicationDbContext context,ILogger<DoController> logger)
{ {
_context = context; _context = context;
_logger = logger;
} }
// GET: /Do/Index // GET: /Do/Index
@ -35,6 +42,7 @@ namespace Yavsc.Controllers
// GET: Do/Details/5 // GET: Do/Details/5
public IActionResult Details(string id, string activityCode) public IActionResult Details(string id, string activityCode)
{ {
if (id == null || activityCode == null) if (id == null || activityCode == null)
{ {
return HttpNotFound(); return HttpNotFound();
@ -46,10 +54,23 @@ namespace Yavsc.Controllers
{ {
return HttpNotFound(); return HttpNotFound();
} }
ViewBag.HasConfigurableSettings = (userActivity.Does.SettingsClassName != null);
if (ViewBag.HasConfigurableSettings) bool hasConfigurableSettings = (userActivity.Does.SettingsClassName != null);
ViewBag.SettingsControllerName = Startup.ProfileTypes[userActivity.Does.SettingsClassName].Name; if (hasConfigurableSettings) {
return View(userActivity); ViewBag.ProfileType = Startup.ProfileTypes.Single(t=>t.FullName==userActivity.Does.SettingsClassName);
var dbset = (IQueryable<ISpecializationSettings>) _context.GetDbSet(userActivity.Does.SettingsClassName);
if (dbset == null) throw new InvalidWorkflowModelException($"pas de db set pour {userActivity.Does.SettingsClassName}, vous avez peut-être besoin de décorer votre propriété avec l'attribut [ActivitySettings]");
return View(new UserActivityViewModel {
Declaration = userActivity,
HasSettings = dbset.Any(ua=>ua.UserId==id),
NeedsSettings = hasConfigurableSettings
} );
}
return View(new UserActivityViewModel {
Declaration = userActivity,
HasSettings = false,
NeedsSettings = hasConfigurableSettings
} );
} }
// GET: Do/Create // GET: Do/Create
@ -152,9 +173,10 @@ namespace Yavsc.Controllers
// POST: Do/Delete/5 // POST: Do/Delete/5
[HttpPost, ActionName("Delete"),Authorize] [HttpPost, ActionName("Delete"),Authorize]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(string id, string activityCode) public IActionResult DeleteConfirmed(UserActivity userActivity)
{ {
UserActivity userActivity = _context.UserActivities.Single(m => m.UserId == id && m.DoesCode == activityCode); if (!ModelState.IsValid)
return new BadRequestObjectResult(ModelState);
if (!User.IsInRole("Administrator")) if (!User.IsInRole("Administrator"))
if (User.GetUserId() != userActivity.UserId) { if (User.GetUserId() != userActivity.UserId) {
ModelState.AddModelError("User","You're not admin."); ModelState.AddModelError("User","You're not admin.");

View File

@ -0,0 +1,15 @@
using Yavsc.Controllers.Generic;
using Yavsc.Models;
using Yavsc.Models.Workflow.Profiles;
namespace Yavsc.Controllers
{
public class FormationSettingsController : SettingsController<FormationSettings>
{
public FormationSettingsController(ApplicationDbContext context) : base(context)
{
}
}
}

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.Musical.Profiles;
namespace Yavsc.Controllers
{
public class GeneralSettingsController : Controller
{
private ApplicationDbContext _context;
public GeneralSettingsController(ApplicationDbContext context)
{
_context = context;
}
// GET: GeneralSettings
public async Task<IActionResult> Index()
{
return View(await _context.GeneralSettings.ToListAsync());
}
// GET: GeneralSettings/Details/5
public async Task<IActionResult> Details(string id)
{
if (id == null)
{
return HttpNotFound();
}
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
if (generalSettings == null)
{
return HttpNotFound();
}
return View(generalSettings);
}
// GET: GeneralSettings/Create
public IActionResult Create()
{
return View();
}
// POST: GeneralSettings/Create
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(GeneralSettings generalSettings)
{
if (ModelState.IsValid)
{
_context.GeneralSettings.Add(generalSettings);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(generalSettings);
}
// GET: GeneralSettings/Edit/5
public async Task<IActionResult> Edit(string id)
{
if (id == null)
{
return HttpNotFound();
}
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
if (generalSettings == null)
{
return HttpNotFound();
}
return View(generalSettings);
}
// POST: GeneralSettings/Edit/5
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(GeneralSettings generalSettings)
{
if (ModelState.IsValid)
{
_context.Update(generalSettings);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(generalSettings);
}
// GET: GeneralSettings/Delete/5
[ActionName("Delete")]
public async Task<IActionResult> Delete(string id)
{
if (id == null)
{
return HttpNotFound();
}
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
if (generalSettings == null)
{
return HttpNotFound();
}
return View(generalSettings);
}
// POST: GeneralSettings/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(string id)
{
GeneralSettings generalSettings = await _context.GeneralSettings.SingleAsync(m => m.UserId == id);
_context.GeneralSettings.Remove(generalSettings);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
}
}

View File

@ -0,0 +1,140 @@
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;
using Yavsc.Exceptions;
using Yavsc.Models;
using YavscLib;
namespace Yavsc.Controllers.Generic
{
[Authorize]
public abstract class SettingsController<TSettings> : Controller where TSettings : class, ISpecializationSettings, new()
{
protected ApplicationDbContext _context;
private object dbSet;
protected DbSet<TSettings> Settings { get {
return (DbSet<TSettings>) dbSet;
} }
public SettingsController(ApplicationDbContext context)
{
_context = context;
dbSet=_context.GetDbSet<TSettings>();
if (dbSet==null) throw new InvalidWorkflowModelException(this.GetType().Name);
}
public async Task<IActionResult> Index()
{
var existing = await this.Settings.SingleOrDefaultAsync(p=>p.UserId == User.GetUserId());
return View(existing);
}
// GET: BrusherProfile/Details/5
public async Task<IActionResult> Details(string id)
{
if (id == null)
{
id = User.GetUserId();
}
var profile = await Settings.SingleAsync(m => m.UserId == id);
if (profile == null)
{
return HttpNotFound();
}
return View(profile);
}
// GET: BrusherProfile/Create
public IActionResult Create()
{
return View("Edit", new TSettings());
}
// GET: BrusherProfile/Edit/5
public async Task<IActionResult> Edit(string id)
{
if (id == null)
{
id = User.GetUserId();
}
TSettings setting = await Settings.SingleOrDefaultAsync(m => m.UserId == id);
if (setting == null)
{
setting = new TSettings { };
}
return View(setting);
}
// GET: BrusherProfile/Delete/5
[ActionName("Delete")]
public async Task<IActionResult> Delete(string id)
{
if (id == null)
{
return HttpNotFound();
}
var brusherProfile = await Settings.SingleAsync(m => m.UserId == id);
if (brusherProfile == null)
{
return HttpNotFound();
}
return View(brusherProfile);
}
// POST: FormationSettings/Create
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(TSettings settings)
{
if (settings.UserId == null) settings.UserId = User.GetUserId();
if (ModelState.IsValid)
{
Settings.Add(settings);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
return View("Edit",settings);
}
// POST: FormationSettings/Edit/5
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(TSettings settings)
{
if (settings.UserId == null) {
settings.UserId = User.GetUserId();
Settings.Add(settings);
} else
_context.Update(settings);
if (ModelState.IsValid)
{
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
return View(settings);
}
// POST: FormationSettings/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(string id)
{
TSettings formationSettings = await Settings.SingleAsync(m => m.UserId == id);
Settings.Remove(formationSettings);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
}
}

View File

@ -78,16 +78,16 @@ namespace Yavsc.Controllers
public async Task<IActionResult> Index(ManageMessageId? message = null) public async Task<IActionResult> Index(ManageMessageId? message = null)
{ {
ViewData["StatusMessage"] = ViewData["StatusMessage"] =
message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed." message == ManageMessageId.ChangePasswordSuccess ? _SR["Your password has been changed."]
: message == ManageMessageId.SetPasswordSuccess ? "Your password has been set." : message == ManageMessageId.SetPasswordSuccess ? _SR["Your password has been set."]
: message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set." : message == ManageMessageId.SetTwoFactorSuccess ? _SR["Your two-factor authentication provider has been set."]
: message == ManageMessageId.Error ? "An error has occurred." : message == ManageMessageId.Error ? _SR["An error has occurred."]
: message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added." : message == ManageMessageId.AddPhoneSuccess ? _SR["Your phone number was added."]
: message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed." : message == ManageMessageId.RemovePhoneSuccess ? _SR["Your phone number was removed."]
: message == ManageMessageId.ChangeNameSuccess ? "Your name was updated." : message == ManageMessageId.ChangeNameSuccess ? _SR["Your name was updated."]
: message == ManageMessageId.SetActivitySuccess ? "Your activity was set." : message == ManageMessageId.SetActivitySuccess ? _SR["Your activity was set."]
: message == ManageMessageId.AvatarUpdateSuccess ? "Your avatar was updated." : message == ManageMessageId.AvatarUpdateSuccess ? _SR["Your avatar was updated."]
: message == ManageMessageId.IdentityUpdateSuccess ? "Your identity was updated." : message == ManageMessageId.IdentityUpdateSuccess ? _SR["Your identity was updated."]
: ""; : "";
var user = await GetCurrentUserAsync(); var user = await GetCurrentUserAsync();
@ -114,8 +114,10 @@ namespace Yavsc.Controllers
DiskQuota = user.DiskQuota DiskQuota = user.DiskQuota
}; };
model.HaveProfessionalSettings = _dbContext.Performers.Any(x => x.PerformerId == user.Id); model.HaveProfessionalSettings = _dbContext.Performers.Any(x => x.PerformerId == user.Id);
model.Activity = _dbContext.UserActivities.Include(a=>a.Does).Where(u=>u.UserId == user.Id) var usrActs = _dbContext.UserActivities.Include(a=>a.Does).Where(a=> a.UserId == user.Id);
.ToList();
model.HaveActivityToConfigure = usrActs.Any( a=> a.Settings == null && a.Does.SettingsClassName!=null );
model.Activity = _dbContext.UserActivities.Include(a=>a.Does).Where(u=>u.UserId == user.Id).ToList();
return View(model); return View(model);
} }

View File

@ -0,0 +1,15 @@
using System;
namespace Yavsc.Exceptions
{
public class InvalidWorkflowModelException : Exception
{
public InvalidWorkflowModelException(string descr) : base(descr)
{
}
public InvalidWorkflowModelException(string descr, Exception inner) : base(descr,inner)
{
}
}
}

View File

@ -7,16 +7,8 @@ namespace Yavsc.Helpers
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Models.Workflow; using Models.Workflow;
using Yavsc.Models; using Yavsc.Models;
using YavscLib;
public static class WorkflowHelpers public static class WorkflowHelpers
{ {
public static ISpecializationSettings CreateSettings (this Activity activity) {
if (activity.SettingsClassName==null) return null;
var ctor = Startup.ProfileTypes[activity.SettingsClassName].GetConstructor(System.Type.EmptyTypes);
if (ctor==null) return null;
return (ISpecializationSettings) ctor.Invoke(null);
}
public static List<PerformerProfile> ListPerformers(this ApplicationDbContext context, string actCode) public static List<PerformerProfile> ListPerformers(this ApplicationDbContext context, string actCode)
{ {
return context.Performers return context.Performers

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,600 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class estimateRequireCommandType : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_Estimate_PerformerProfile_OwnerId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Location_LocationId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_PerformerProfile_PerformerId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_HairPrestation_PrestationId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_Activity_ActivityCode", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_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_RdvQuery_Activity_ActivityCode", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_ApplicationUser_ClientId", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_PerformerProfile_PerformerId", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_Activity_DoesCode", table: "UserActivity");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity");
migrationBuilder.Sql("update \"Estimate\" set \"CommandType\"='RdvQuery'");
migrationBuilder.AlterColumn<string>(
name: "CommandType",
table: "Estimate",
nullable: false);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BlackListed_ApplicationUser_OwnerId",
table: "BlackListed",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId",
table: "CircleAuthorizationToBlogPost",
column: "BlogPostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId",
table: "CircleAuthorizationToBlogPost",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_Estimate_EstimateId",
table: "CommandLine",
column: "EstimateId",
principalTable: "Estimate",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_ApplicationUser_ClientId",
table: "Estimate",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_PerformerProfile_OwnerId",
table: "Estimate",
column: "OwnerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_Activity_ActivityCode",
table: "HairCutQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_ApplicationUser_ClientId",
table: "HairCutQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_Location_LocationId",
table: "HairCutQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_PerformerProfile_PerformerId",
table: "HairCutQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_HairPrestation_PrestationId",
table: "HairCutQuery",
column: "PrestationId",
principalTable: "HairPrestation",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_Activity_ActivityCode",
table: "HairMultiCutQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_ApplicationUser_ClientId",
table: "HairMultiCutQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId",
table: "HairMultiCutQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairTaint_Color_ColorId",
table: "HairTaint",
column: "ColorId",
principalTable: "Color",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_DimissClicked_Notification_NotificationId",
table: "DimissClicked",
column: "NotificationId",
principalTable: "Notification",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_DimissClicked_ApplicationUser_UserId",
table: "DimissClicked",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Instrumentation_Instrument_InstrumentId",
table: "Instrumentation",
column: "InstrumentId",
principalTable: "Instrument",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandForm_Activity_ActivityCode",
table: "CommandForm",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RdvQuery_Activity_ActivityCode",
table: "RdvQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RdvQuery_ApplicationUser_ClientId",
table: "RdvQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RdvQuery_PerformerProfile_PerformerId",
table: "RdvQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_Activity_DoesCode",
table: "UserActivity",
column: "DoesCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_PerformerProfile_UserId",
table: "UserActivity",
column: "UserId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Blog_BlogPostId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_Estimate_PerformerProfile_OwnerId", table: "Estimate");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Location_LocationId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_PerformerProfile_PerformerId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_HairPrestation_PrestationId", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_Activity_ActivityCode", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", table: "HairMultiCutQuery");
migrationBuilder.DropForeignKey(name: "FK_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_RdvQuery_Activity_ActivityCode", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_ApplicationUser_ClientId", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_RdvQuery_PerformerProfile_PerformerId", table: "RdvQuery");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_Activity_DoesCode", table: "UserActivity");
migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity");
migrationBuilder.AlterColumn<string>(
name: "CommandType",
table: "Estimate",
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_Estimate_EstimateId",
table: "CommandLine",
column: "EstimateId",
principalTable: "Estimate",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_ApplicationUser_ClientId",
table: "Estimate",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Estimate_PerformerProfile_OwnerId",
table: "Estimate",
column: "OwnerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_Activity_ActivityCode",
table: "HairCutQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_ApplicationUser_ClientId",
table: "HairCutQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_Location_LocationId",
table: "HairCutQuery",
column: "LocationId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_PerformerProfile_PerformerId",
table: "HairCutQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairCutQuery_HairPrestation_PrestationId",
table: "HairCutQuery",
column: "PrestationId",
principalTable: "HairPrestation",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_Activity_ActivityCode",
table: "HairMultiCutQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_ApplicationUser_ClientId",
table: "HairMultiCutQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId",
table: "HairMultiCutQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_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_RdvQuery_Activity_ActivityCode",
table: "RdvQuery",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_RdvQuery_ApplicationUser_ClientId",
table: "RdvQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_RdvQuery_PerformerProfile_PerformerId",
table: "RdvQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_Activity_DoesCode",
table: "UserActivity",
column: "DoesCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_UserActivity_PerformerProfile_UserId",
table: "UserActivity",
column: "UserId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
}
}
}

View File

@ -337,7 +337,8 @@ namespace Yavsc.Migrations
b.Property<long?>("CommandId"); b.Property<long?>("CommandId");
b.Property<string>("CommandType"); b.Property<string>("CommandType")
.IsRequired();
b.Property<string>("Description"); b.Property<string>("Description");

View File

@ -26,6 +26,7 @@ namespace Yavsc.Models
using Musical.Profiles; using Musical.Profiles;
using Workflow.Profiles; using Workflow.Profiles;
using Drawing; using Drawing;
using Yavsc.Attributes;
public class ApplicationDbContext : IdentityDbContext<ApplicationUser> public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{ {
@ -51,8 +52,23 @@ namespace Yavsc.Models
if (et.ClrType.GetInterface("IBaseTrackedEntity")!=null) if (et.ClrType.GetInterface("IBaseTrackedEntity")!=null)
et.FindProperty("DateCreated").IsReadOnlyAfterSave = true; et.FindProperty("DateCreated").IsReadOnlyAfterSave = true;
} }
}
public DbSet<TSettings> GetDbSet<TSettings>() where TSettings : class, ISpecializationSettings
{
return (DbSet<TSettings>) GetDbSet(typeof(TSettings).FullName);
}
public IQueryable<ISpecializationSettings> GetDbSet(string settingsClassName)
{
var dbSetPropInfo = Startup.GetUserSettingPropertyInfo(settingsClassName);
if (dbSetPropInfo == null) return null;
// var settingType = dbSetPropInfo.PropertyType;
// var dbSetType = typeof(DbSet<>).MakeGenericType(new Type[] { settingType } );
// avec une info method Remove et Update, ça le ferait ...
return (IQueryable<ISpecializationSettings>) dbSetPropInfo.GetValue(this);
} }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
optionsBuilder.UseNpgsql(Startup.ConnectionString); optionsBuilder.UseNpgsql(Startup.ConnectionString);
@ -219,18 +235,28 @@ namespace Yavsc.Models
public DbSet<LocationType> LocationType { get; set; } public DbSet<LocationType> LocationType { get; set; }
public DbSet<Instrument> Instrument { get; set; } public DbSet<Instrument> Instrument { get; set; }
[ActivitySettings]
public DbSet<DjSettings> DjSettings { get; set; } public DbSet<DjSettings> DjSettings { get; set; }
[ActivitySettings]
public DbSet<Instrumentation> Instrumentation { get; set; } public DbSet<Instrumentation> Instrumentation { get; set; }
[ActivitySettings]
public DbSet<FormationSettings> FormationSettings { get; set; } public DbSet<FormationSettings> FormationSettings { get; set; }
[ActivitySettings]
public DbSet<GeneralSettings> GeneralSettings { get; set; } public DbSet<GeneralSettings> GeneralSettings { get; set; }
public DbSet<CoWorking> WorkflowProviders { get; set; } public DbSet<CoWorking> WorkflowProviders { get; set; }
private void AddTimestamps(string currentUsername) private void AddTimestamps(string currentUsername)
{ {
var entities = ChangeTracker.Entries().Where(x => x.Entity.GetType().GetInterface("IBaseTrackedEntity")!=null && (x.State == EntityState.Added || x.State == EntityState.Modified)); var entities =
ChangeTracker.Entries()
.Where(x => x.Entity.GetType().GetInterface("IBaseTrackedEntity")!=null
&& (x.State == EntityState.Added || x.State == EntityState.Modified));
// Microsoft.AspNet.Identity;
foreach (var entity in entities) foreach (var entity in entities)
{ {
@ -274,6 +300,7 @@ namespace Yavsc.Models
public DbSet<HairPrestation> HairPrestation { get; set; } public DbSet<HairPrestation> HairPrestation { get; set; }
[ActivitySettings]
public DbSet<BrusherProfile> BrusherProfile { get; set; } public DbSet<BrusherProfile> BrusherProfile { get; set; }

View File

@ -71,6 +71,7 @@ namespace Yavsc.Models.Billing
[ForeignKey("ClientId"),JsonIgnore] [ForeignKey("ClientId"),JsonIgnore]
public virtual ApplicationUser Client { get; set; } public virtual ApplicationUser Client { get; set; }
[Required]
public string CommandType public string CommandType
{ {
get; set; get; set;

View File

@ -135,5 +135,6 @@ namespace Yavsc.Models.Haircut
[Display(Name="Remise au forfait coupe+technique"),DisplayFormat(DataFormatString="{0:C}")] [Display(Name="Remise au forfait coupe+technique"),DisplayFormat(DataFormatString="{0:C}")]
public decimal FlatFeeDiscount { get; set; } public decimal FlatFeeDiscount { get; set; }
} }
} }

View File

@ -17,6 +17,5 @@ namespace Yavsc.Models.Musical.Profiles
[ForeignKeyAttribute("InstrumentId")] [ForeignKeyAttribute("InstrumentId")]
public virtual Instrument Tool { get; set; } public virtual Instrument Tool { get; set; }
} }
} }

View File

@ -14,5 +14,6 @@ namespace Yavsc.Models.Workflow.Profiles
{ {
get; set; get; set;
} }
} }
} }

View File

@ -1,5 +1,6 @@
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
{ {
@ -19,5 +20,8 @@ namespace Yavsc.Models.Workflow
[Range(0,100)] [Range(0,100)]
public int Weight { get; set; } public int Weight { get; set; }
[NotMapped,JsonIgnore]
public object Settings { get; internal set; }
} }
} }

View File

@ -398,8 +398,10 @@
{0} devrait être disponible pour ce rendez-vous</value></data> {0} devrait être disponible pour ce rendez-vous</value></data>
<data name="Yavsc.Models.Musical.Profiles.Instrumentation"><value>Paramètres musicien (l'instrument)</value></data> <data name="Yavsc.Models.Musical.Profiles.Instrumentation"><value>Paramètres musicien (l'instrument)</value></data>
<data name="Yavsc.Models.Musical.Profiles.DjSettings"><value>Paramètres Dj (le compte SoundCloud.com)</value></data> <data name="Yavsc.Models.Musical.Profiles.DjSettings"><value>Paramètres Dj (le compte SoundCloud.com)</value></data>
<data name="Yavsc.Models.Musical.Profiles.FormationSettings"><value>Paramètres formation (les partenaires)</value></data> <data name="Yavsc.Models.Workflow.Profiles.FormationSettings"><value>Paramètres formation (les partenaires)</value></data>
<data name="Yavsc.Models.Musical.Profiles.GeneralSettings"><value>Paramètres généraux (visibilité et présentation)</value></data> <data name="Yavsc.Models.Musical.Profiles.GeneralSettings"><value>Paramètres généraux (visibilité et présentation)</value></data>
<data name="Yavsc.Models.Haircut.BrusherProfile"><value>Paramètres coiffeur: tarifs, disponibilité</value></data>
<data name="Yes"><value>Oui</value></data> <data name="Yes"><value>Oui</value></data>
<data name="YouNeedToBeAuthenticatedIOToContact"><value>Vous devez vous authentifier pour pouvoir demander un devis <data name="YouNeedToBeAuthenticatedIOToContact"><value>Vous devez vous authentifier pour pouvoir demander un devis
à un préstataire.</value></data> à un préstataire.</value></data>

View File

@ -18,8 +18,10 @@ namespace Yavsc
{ {
private Client GetApplication(string clientId) private Client GetApplication(string clientId)
{ {
var dbContext = new ApplicationDbContext(); Client app=null;
var app = dbContext.Applications.FirstOrDefault(x => x.Id == clientId); using (var dbContext = new ApplicationDbContext()) {
app = dbContext.Applications.FirstOrDefault(x => x.Id == clientId);
}
return app; return app;
} }
private readonly ConcurrentDictionary<string, string> _authenticationCodes = new ConcurrentDictionary<string, string>(StringComparer.Ordinal); private readonly ConcurrentDictionary<string, string> _authenticationCodes = new ConcurrentDictionary<string, string>(StringComparer.Ordinal);

View File

@ -1,6 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Builder;
using Microsoft.Extensions.Logging;
using Yavsc.Exceptions;
using Yavsc.Models;
using YavscLib;
namespace Yavsc namespace Yavsc
{ {
@ -10,15 +16,21 @@ namespace Yavsc
/// Lists Available user profile classes, /// Lists Available user profile classes,
/// populated at startup, using reflexion. /// populated at startup, using reflexion.
/// </summary> /// </summary>
public static Dictionary<string,Type> ProfileTypes = new Dictionary<string,Type>() ; public static List<Type> ProfileTypes = new List<Type>() ;
public static List<PropertyInfo> UserSettings = new List<PropertyInfo> ();
/// <summary> /// <summary>
/// Lists available command forms. /// Lists available command forms.
/// This is hard coded. /// This is hard coded.
/// </summary> /// </summary>
public static readonly string [] Forms = new string [] { "Profiles" , "HairCut" }; public static readonly string [] Forms = new string [] { "Profiles" , "HairCut" };
private void ConfigureWorkflow(IApplicationBuilder app, SiteSettings settings) public static PropertyInfo GetUserSettingPropertyInfo(string settingsClassName)
{
return UserSettings.SingleOrDefault(s => s.PropertyType.GenericTypeArguments[0].FullName == settingsClassName ) ;
}
private void ConfigureWorkflow(IApplicationBuilder app, SiteSettings settings, ILogger logger)
{ {
System.AppDomain.CurrentDomain.ResourceResolve += OnYavscResourceResolve; System.AppDomain.CurrentDomain.ResourceResolve += OnYavscResourceResolve;
@ -26,10 +38,33 @@ namespace Yavsc
foreach (var c in a.GetTypes()) { foreach (var c in a.GetTypes()) {
if (c.IsClass && !c.IsAbstract && if (c.IsClass && !c.IsAbstract &&
c.GetInterface("ISpecializationSettings")!=null) { c.GetInterface("ISpecializationSettings")!=null) {
ProfileTypes.Add(c.FullName,c); ProfileTypes.Add(c);
} }
} }
} }
foreach (var propinfo in typeof(ApplicationDbContext).GetProperties()) {
foreach (var attr in propinfo.CustomAttributes) {
if (attr.AttributeType == typeof(Yavsc.Attributes.ActivitySettingsAttribute)) {
// bingo
if (typeof(IQueryable<ISpecializationSettings>).IsAssignableFrom(propinfo.PropertyType))
{
logger.LogInformation($"Paramêtres utilisateur déclaré: {propinfo.Name}");
UserSettings.Add(propinfo);
} else
// Design time error
{
var msg =
$@"La propriété {propinfo.Name} du contexte de la
base de donnée porte l'attribut [ActivitySetting],
mais n'implemente pas l'interface IQueryable<ISpecializationSettings>
({propinfo.MemberType.GetType()})";
logger.LogCritical(msg);
throw new InvalidWorkflowModelException(msg);
}
}
}
}
} }
public static System.Reflection.Assembly OnYavscResourceResolve (object sender, ResolveEventArgs ev) public static System.Reflection.Assembly OnYavscResourceResolve (object sender, ResolveEventArgs ev)
{ {

View File

@ -335,7 +335,7 @@ namespace Yavsc
ConfigureOAuthApp(app, SiteSetup); ConfigureOAuthApp(app, SiteSetup);
ConfigureFileServerApp(app, SiteSetup, env, authorizationService); ConfigureFileServerApp(app, SiteSetup, env, authorizationService);
ConfigureWebSocketsApp(app, SiteSetup, env); ConfigureWebSocketsApp(app, SiteSetup, env);
ConfigureWorkflow(app, SiteSetup); ConfigureWorkflow(app, SiteSetup, logger);
app.UseRequestLocalization(localizationOptions.Value, (RequestCulture) new RequestCulture((string)"fr")); app.UseRequestLocalization(localizationOptions.Value, (RequestCulture) new RequestCulture((string)"fr"));
app.UseSession(); app.UseSession();

View File

@ -25,6 +25,7 @@ namespace Yavsc.ViewModels.Manage
public List<UserActivity> Activity { get; set; } public List<UserActivity> Activity { get; set; }
public bool HaveProfessionalSettings { get; set; } public bool HaveProfessionalSettings { get; set; }
public bool HaveActivityToConfigure { get; set; }
public long PostsCounter { get; set; } public long PostsCounter { get; set; }

View File

@ -1,6 +1,6 @@
using Yavsc.Models.Billing; using Yavsc.Models.Billing;
namespace Yavsc.ViewModels.WorkFlow namespace Yavsc.ViewModels.Workflow
{ {
public class EstimateEdition public class EstimateEdition
{ {

View File

@ -0,0 +1,11 @@
using Yavsc.Models.Workflow;
namespace Yavsc.ViewModels.Workflow
{
public class UserActivityViewModel
{
public UserActivity Declaration { get; set; }
public bool NeedsSettings { get; set; }
public bool HasSettings { get; set; }
}
}

View File

@ -342,15 +342,15 @@
</dl> </dl>
</fieldset> </fieldset>
<p>
<a asp-action="Edit" >@SR["Edit"]</a>
<a asp-action="Delete" asp-route-id="@Model.UserId">@SR["Delete"]</a>
</p>
} }
else { else {
<p>
@SR["Aucun profile renseigné"] @SR["Aucun profile renseigné"]
<a asp-action="Create" class="btn btn-success">@SR["Renseigner ce paramêtrage"]</a>
</p>
} }
</div> </div>
<p>
<a asp-action="Edit" >@SR["Edit"]</a>
@if (Model!=null) {
<a asp-action="Delete" asp-route-id="@Model.UserId">@SR["Delete"]</a>
}
</p>

View File

@ -0,0 +1,32 @@
@model Yavsc.Models.Musical.Profiles.DjSettings
@{
ViewData["Title"] = "Create";
}
<h2>Create</h2>
<form asp-action="Create">
<div class="form-horizontal">
<h4>DjSettings</h4>
<hr />
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="SoundCloudId" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="SoundCloudId" class="form-control" />
<span asp-validation-for="SoundCloudId" 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,28 @@
@model Yavsc.Models.Musical.Profiles.DjSettings
@{
ViewData["Title"] = "Delete";
}
<h2>Delete</h2>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>DjSettings</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.SoundCloudId)
</dt>
<dd>
@Html.DisplayFor(model => model.SoundCloudId)
</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,24 @@
@model Yavsc.Models.Musical.Profiles.DjSettings
@{
ViewData["Title"] = "Details";
}
<h2>Details</h2>
<div>
<h4>DjSettings</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.SoundCloudId)
</dt>
<dd>
@Html.DisplayFor(model => model.SoundCloudId)
</dd>
</dl>
</div>
<p>
<a asp-action="Edit" asp-route-id="@Model.UserId">Edit</a> |
<a asp-action="Index">Back to List</a>
</p>

View File

@ -0,0 +1,33 @@
@model Yavsc.Models.Musical.Profiles.DjSettings
@{
ViewData["Title"] = "Edit";
}
<h2>Edit</h2>
<form asp-action="Edit">
<div class="form-horizontal">
<h4>DjSettings</h4>
<hr />
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="UserId" />
<div class="form-group">
<label asp-for="SoundCloudId" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="SoundCloudId" class="form-control" />
<span asp-validation-for="SoundCloudId" 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,32 @@
@model IEnumerable<Yavsc.Models.Musical.Profiles.DjSettings>
@{
ViewData["Title"] = "Index";
}
<h2>Index</h2>
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.SoundCloudId)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.SoundCloudId)
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.UserId">Edit</a> |
<a asp-action="Details" asp-route-id="@item.UserId">Details</a> |
<a asp-action="Delete" asp-route-id="@item.UserId">Delete</a>
</td>
</tr>
}
</table>

View File

@ -12,13 +12,13 @@
<hr /> <hr />
<dl class="dl-horizontal"> <dl class="dl-horizontal">
</dl> </dl>
 @Html.DisplayFor(m=>m)
<form asp-action="Delete"> <form asp-action="Delete">
<input type="hidden" asp-for="UserId" /> <input type="hidden" asp-for="UserId" />
<input type="hidden" asp-for="DoesCode" /> <input type="hidden" asp-for="DoesCode" />
<div class="form-actions no-color"> <div class="form-actions no-color">
<input type="submit" value="Delete" class="btn btn-default" /> | <input type="submit" value="Delete" class="btn btn-success" />
<a asp-action="Index">Back to List</a> <a asp-action="Index" class="btn btn-link">Back to List</a>
</div> </div>
</form> </form>
</div> </div>

View File

@ -1,4 +1,4 @@
@model UserActivity @model UserActivityViewModel
@{ @{
ViewData["Title"] = SR["Details"]; ViewData["Title"] = SR["Details"];
@ -7,20 +7,24 @@
<h2>@ViewData["Title"]</h2> <h2>@ViewData["Title"]</h2>
<div> <div>
<h4>Détails de votre activité @Model.DoesCode</h4> <h4>Détails de votre activité en <em>@Model.Declaration.Does.Name</em></h4>
<hr /> <hr />
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>@SR["Activity"]</dt> <dt>@SR["Activity"]</dt>
<dd> @Html.DisplayFor(m=>m.Does) <dd>@Html.DisplayFor(m=>m.Declaration.Does)
@if (ViewBag.HasConfigurableSettings) { @if (Model.NeedsSettings) {
<a asp-controller="@ViewBag.SettingsControllerName" asp-action="Index" > <a asp-controller="@ViewBag.ProfileType.Name" asp-action="Index" class="btn btn-default">
[@SR["Manage"] @SR[Model.Does.SettingsClassName]] @SR[Model.Declaration.Does.SettingsClassName]
@if (!Model.HasSettings) {
<span class="badge">Non renseigné: Cliquez vite<br/> ici pour positionner les<br/> paramêtres de cette activité</span>
}
</a> </a>
} }
</dd> </dd>
</dl> </dl>
</div> </div>
<p> <p>
<a asp-action="Edit" asp-route-id="@Model.UserId" asp-route-activityCode="@Model.DoesCode">Edit</a> | <a asp-action="Edit" asp-route-id="@Model.Declaration.UserId" asp-route-activityCode="@Model.Declaration.DoesCode">Edit</a> |
<a asp-action="Index">Back to List</a> <a asp-action="Index">Back to List</a>
</p> </p>

View File

@ -13,6 +13,7 @@
<tr> <tr>
<th>@SR["Activity"]</th> <th>@SR["Activity"]</th>
<th>@SR["Weight"]</th> <th>@SR["Weight"]</th>
<th>@SR["Settings"]</th>
</tr> </tr>
@foreach (var item in Model) { @foreach (var item in Model) {
@ -21,6 +22,8 @@
</td> </td>
<td> @item.Weight <td> @item.Weight
</td> </td>
<dt>
</dt>
<td> <td>
<a asp-action="Edit" asp-route-id="@item.UserId" asp-route-activityCode="@item.DoesCode">Edit</a> | <a asp-action="Edit" asp-route-id="@item.UserId" asp-route-activityCode="@item.DoesCode">Edit</a> |
<a asp-action="Details" asp-route-id="@item.UserId" asp-route-activityCode="@item.DoesCode">Details</a> | <a asp-action="Details" asp-route-id="@item.UserId" asp-route-activityCode="@item.DoesCode">Details</a> |

View File

@ -0,0 +1,22 @@
@model Yavsc.Models.Workflow.Profiles.FormationSettings
@{
ViewData["Title"] = "Delete";
}
<h2>Delete</h2>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>FormationSettings</h4>
<hr />
<dl class="dl-horizontal">
</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,18 @@
@model Yavsc.Models.Workflow.Profiles.FormationSettings
@{
ViewData["Title"] = "Details";
}
<h2>Details</h2>
<div>
<h4>FormationSettings</h4>
<hr />
<dl class="dl-horizontal">
</dl>
</div>
<p>
<a asp-action="Edit" asp-route-id="@Model.UserId">Edit</a> |
<a asp-action="Index">Back to List</a>
</p>

View File

@ -0,0 +1,26 @@
@model Yavsc.Models.Workflow.Profiles.FormationSettings
@{
ViewData["Title"] = "Edit";
}
<h2>Edit</h2>
<form asp-action="Edit">
<div class="form-horizontal">
<h4>FormationSettings</h4>
<hr />
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="UserId" />
<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,19 @@
@model Yavsc.Models.Workflow.Profiles.FormationSettings
@{
ViewData["Title"] = "Index";
}
<h2>Index</h2>
@if (Model == null) {
<a asp-action="Create" class="btn btn-default">Positionner les paramêtres</a>
} else {
<a asp-action="Edit" class="btn btn-default">Edit</a>
<a asp-action="Delete" asp-route-id="@Model.UserId" class="btn btn-default">Delete</a>
<div>
<h4>FormationSettings</h4>
<hr />
</div>
}

View File

@ -0,0 +1,22 @@
@model Yavsc.Models.Musical.Profiles.GeneralSettings
@{
ViewData["Title"] = "Delete";
}
<h2>Delete</h2>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>GeneralSettings</h4>
<hr />
<dl class="dl-horizontal">
</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,26 @@
@model Yavsc.Models.Musical.Profiles.GeneralSettings
@{
ViewData["Title"] = "Edit";
}
<h2>Edit</h2>
<form asp-action="Edit">
<div class="form-horizontal">
<h4>GeneralSettings</h4>
<hr />
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="UserId" />
<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,25 @@
@model Yavsc.Models.Musical.Profiles.GeneralSettings
@{
ViewData["Title"] = "Details";
}
<h2>Details</h2>
<div>
<h4>GeneralSettings</h4>
<hr />
@if (Model!=null) {
<dl class="dl-horizontal">
</dl>
<p>
<a asp-action="Delete" asp-route-id="@Model.UserId">@SR["Delete"]</a>
</p>
}
else {
<p>
@SR["Aucun profile renseigné"]
<a asp-action="Create" class="btn btn-success">@SR["Renseigner ce paramêtrage"]</a>
</p>
}
</div>

View File

@ -114,8 +114,20 @@ Paul,
</environment> </environment>
<environment names="Dev"> <environment names="Development">
<markdown> <markdown>
Site du développeur ## Ceci est un site de développement.
Cette présente ressource ne concerne que le développement du logiciel qui la met en oeuvre.
Elle est éphémère, et pratiquement en permanence force de codes 500.
Veuillez excuser l'équipe de développement pour vous avoir fait part de cette adresse et pour la gêne occasionnnée.
La "pré-production" affiche les sites suivants:
* [ZicMoove](http://zicmoove.pschneider.fr)
* [Yavsc](http://yavsc.pschneider.fr)
* [Lua (le site perso de l'auteur de ce truc)](http://lua.pschneider.fr)
</markdown> </markdown>
</environment> </environment>

View File

@ -3,7 +3,7 @@
@{ @{
ViewData["Title"] = "Home Page"; ViewData["Title"] = "Home Page";
} }
@section subbanner {
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000"> <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
<ol class="carousel-indicators"> <ol class="carousel-indicators">
@{ @{
@ -62,3 +62,5 @@
<span class="sr-only">Suivant</span> <span class="sr-only">Suivant</span>
</a> </a>
</div> </div>
}

View File

@ -73,6 +73,7 @@ nav {
</div> </div>
</div> </div>
</nav> </nav>
@RenderSection("subbanner", required: false)
<main class="container body-content" role="main"> <main class="container body-content" role="main">
@RenderBody() @RenderBody()
</main> </main>
@ -104,7 +105,7 @@ nav {
data-ref="ZicMoove" data-ref="ZicMoove"
class="fb-like" class="fb-like"
data-share="true" data-share="true"
data-width="200" data-width="300"
data-show-faces="true" data-show-faces="true"
data-colorscheme="dark"> data-colorscheme="dark">
</div> </div>

View File

@ -29,6 +29,7 @@
@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.Workflow;
@inject IViewLocalizer LocString @inject IViewLocalizer LocString
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers" @addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"

View File

@ -3195,26 +3195,26 @@ fieldset[disabled] .btn-primary.active {
} }
.btn-success { .btn-success {
color: #fff; color: #fff;
background-color: #255625; background-color: #976116;
border-color: #4cae4c; border-color: #b1aa14;
} }
.btn-success:focus, .btn-success:focus,
.btn-success.focus { .btn-success.focus {
color: #fff; color: #fff;
background-color: #2b8a2b; background-color: #b1aa14;
border-color: #255625; border-color: #b1aa14;
} }
.btn-success:hover { .btn-success:hover {
color: #fff; color: #fff;
background-color: #2b8a2b; background-color: #b1aa14;
border-color: #398439; border-color: #6a6713;
} }
.btn-success:active, .btn-success:active,
.btn-success.active, .btn-success.active,
.open > .dropdown-toggle.btn-success { .open > .dropdown-toggle.btn-success {
color: #fff; color: #fff;
background-color: #2b8a2b; background-color: #7d780d;
border-color: #398439; border-color: #6a6713;
} }
.btn-success:active:hover, .btn-success:active:hover,
.btn-success.active:hover, .btn-success.active:hover,
@ -3226,8 +3226,8 @@ fieldset[disabled] .btn-primary.active {
.btn-success.active.focus, .btn-success.active.focus,
.open > .dropdown-toggle.btn-success.focus { .open > .dropdown-toggle.btn-success.focus {
color: #fff; color: #fff;
background-color: #398439; background-color: #7d780d;
border-color: #255625; border-color: #6a6713;
} }
.btn-success:active, .btn-success:active,
.btn-success.active, .btn-success.active,

View File

@ -124,8 +124,10 @@ a:hover {
overflow: auto; overflow: auto;
} }
.carousel-inner .item { .carousel-inner .item {
background-color: #301010; /* background-color: #301010; */
color: #FF8; color: #FF8;
margin-left:15%; /* la taille du carousel-control */
margin-right:15%; /* la taille du carousel-control */
} }
.carousel-indicators { .carousel-indicators {
position: absolute; position: absolute;
@ -137,6 +139,14 @@ a:hover {
height: 1em; height: 1em;
} }
main.container {
padding-right: 1em;
padding-left: 1em;
margin-left: 1em;
margin-right: 1em;
}
@-webkit-keyframes mymove { @-webkit-keyframes mymove {
from {text-decoration-color: red;} from {text-decoration-color: red;}
50% {text-decoration-color: blue;} 50% {text-decoration-color: blue;}
@ -166,14 +176,16 @@ footer {
.display-field { .display-field {
font-kerning: none; font-kerning: none;
display: inline-flex; display: inline-flex;
color: #FF8;
background-color: #502020;
} }
.display-label { .display-label {
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-stretch: condensed; font-stretch: condensed;
display: inline-flex; display: inline-flex;
color: rgb(127,127,127); color: #A0A0A0;
background-color: rgba(200,256,200,.4); background-color: #210912;
} }
footer { footer {

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -12,5 +12,6 @@
long Id { get; set; } long Id { get; set; }
string OwnerId { get; set; } string OwnerId { get; set; }
string Title { get; set; } string Title { get; set; }
} }
} }