diff --git a/Yavsc/Controllers/FrontOfficeController.cs b/Yavsc/Controllers/FrontOfficeController.cs index 70f18539..e9efd1c9 100644 --- a/Yavsc/Controllers/FrontOfficeController.cs +++ b/Yavsc/Controllers/FrontOfficeController.cs @@ -52,10 +52,13 @@ namespace Yavsc.Controllers { throw new NotImplementedException("No Activity code"); } - ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == id); - var result = _context.Performers - .Include(p=>p.Performer).Where(p => p.Activity.Any(u=>u.DoesCode==id)).OrderBy( x => x.MinDailyCost ); - + ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == id); + var result = _context.Performers + .Include(p=>p.Activity) + .Include(p=>p.Performer) + .Include(p=>p.Performer.Posts) + .Include(p=>p.Performer.Devices) + .Where(p => p.Active && p.Activity.Any(u=>u.DoesCode==id)).OrderBy( x => x.Rate ).ToList(); return View(result); } diff --git a/Yavsc/Controllers/ManageController.cs b/Yavsc/Controllers/ManageController.cs index b533399b..fa71b0b5 100644 --- a/Yavsc/Controllers/ManageController.cs +++ b/Yavsc/Controllers/ManageController.cs @@ -491,8 +491,11 @@ namespace Yavsc.Controllers { var user = GetCurrentUserAsync().Result; var uid = user.Id; - var existing = _dbContext.Performers.Include(x => x.OrganizationAddress) - .Include(p=>p.Activity).FirstOrDefault(x => x.PerformerId == uid); + var existing = _dbContext.Performers + .Include(p=>p.Performer) + .Include(x => x.OrganizationAddress) + .Include(p=>p.Activity) + .FirstOrDefault(x => x.PerformerId == uid); ViewBag.GoogleSettings = _googleSettings; if (existing!=null) diff --git a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs index 2e02ba6d..d37b7a5c 100644 --- a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs @@ -1,6 +1,8 @@ using System; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Infrastructure; +using Microsoft.Data.Entity.Metadata; +using Microsoft.Data.Entity.Migrations; using Yavsc.Models; namespace Yavsc.Migrations diff --git a/Yavsc/Models/IT/Modeling/Code.cs b/Yavsc/Models/IT/Modeling/Code.cs new file mode 100644 index 00000000..3dc54117 --- /dev/null +++ b/Yavsc/Models/IT/Modeling/Code.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using YavscLib; + +namespace Yavsc.Models.IT.Modeling +{ + public abstract class Code : ICode where TLetter : ILetter + { + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + /// + /// !a Count^3 task len + /// + /// + public bool Validate() + { + foreach (var letter in this) { + var word = this.CreateWord(letter); + foreach (var other in this) { + IWord first = word.Aggregate(other); + foreach (var tierce in this) + { + var otherword = word.Aggregate(tierce); + if (first.Equals(otherword)) + return false; + } + } + } + return true; + } + + public abstract IEnumerator GetEnumerator(); + + public abstract IWord CreateWord(TLetter letter); + } +} \ No newline at end of file diff --git a/Yavsc/Models/IT/Modeling/Letter.cs b/Yavsc/Models/IT/Modeling/Letter.cs new file mode 100644 index 00000000..770c1031 --- /dev/null +++ b/Yavsc/Models/IT/Modeling/Letter.cs @@ -0,0 +1,16 @@ + +using YavscLib; + +namespace Yavsc.Models.IT.Modeling +{ + public abstract class Letter : ILetter + { + public abstract bool Equals(T x, T y); + + public int GetHashCode(T obj) + { + return obj.GetHashCode(); + } + + } +} \ No newline at end of file diff --git a/Yavsc/Models/Workflow/PerformerProfile.cs b/Yavsc/Models/Workflow/PerformerProfile.cs index 9c2b0bd8..dcbc34ab 100644 --- a/Yavsc/Models/Workflow/PerformerProfile.cs +++ b/Yavsc/Models/Workflow/PerformerProfile.cs @@ -10,7 +10,7 @@ namespace Yavsc.Models.Workflow [Key] public string PerformerId { get; set; } - [ForeignKey("PerformerId"),Display(Name="Performer")] + [ForeignKey("PerformerId")] public virtual ApplicationUser Performer { get; set; } [InverseProperty("User")] diff --git a/Yavsc/Views/FrontOffice/Book.cshtml b/Yavsc/Views/FrontOffice/Book.cshtml index 33a8c4aa..ee399d0a 100644 --- a/Yavsc/Views/FrontOffice/Book.cshtml +++ b/Yavsc/Views/FrontOffice/Book.cshtml @@ -1,5 +1,5 @@ - @model IEnumerable - +@model IEnumerable + @{ ViewData["Title"] = "Book - " + (ViewBag.Activity?.Name ?? SR["Any"]); } @@ -7,10 +7,11 @@ @foreach (var profile in Model) {
- @Html.DisplayFor(m=>m) + @Html.DisplayFor(m=>m)
-
+ } + diff --git a/Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml b/Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml index dd5654e0..da570bfe 100644 --- a/Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml +++ b/Yavsc/Views/Shared/DisplayTemplates/ApplicationUser.cshtml @@ -1,4 +1,5 @@ @model ApplicationUser + avatar @Model.UserName
    @@ -18,5 +19,4 @@ asp-route-id="@Model.UserName">@SR["His blog"]
  • @SR["Uses the mobile application, and receives push notifications"]
  • } -
- + diff --git a/Yavsc/Views/Shared/DisplayTemplates/PerformerProfile.cshtml b/Yavsc/Views/Shared/DisplayTemplates/PerformerProfile.cshtml index 7be85db3..228e8a2b 100644 --- a/Yavsc/Views/Shared/DisplayTemplates/PerformerProfile.cshtml +++ b/Yavsc/Views/Shared/DisplayTemplates/PerformerProfile.cshtml @@ -1,7 +1,6 @@ @model PerformerProfile
- @Html.DisplayFor(m=>m.Performer)
    diff --git a/Yavsc/Views/Shared/PerformerProfile.cshtml b/Yavsc/Views/Shared/PerformerProfile.cshtml deleted file mode 100644 index dccb92aa..00000000 --- a/Yavsc/Views/Shared/PerformerProfile.cshtml +++ /dev/null @@ -1,42 +0,0 @@ -@model PerformerProfile - -
    - @if (Model.Performer != null) { - @if (Model.Performer.Avatar != null) { - avatar - } - @Model.Performer.UserName - -
      - -
    • @SR["Rating"]: @Model.Rate %
    • - @if (Model.MinDailyCost != null) { -
    • @SR["MinDailyCost"]: @Model.MinDailyCost€
    • - } - @if (Model.MinDailyCost != null) { -
    • @SR["MaxDailyCost"]: @Model.MaxDailyCost€
    • - } - @if (Model.WebSite!=null) { -
    • @SR["WebSite"]: @Model.WebSite
    • - } - @if (Model.DoesBlog) { -
    • @SR["His blog"] -
    • - } - @if (!string.IsNullOrEmpty( - Model.Performer.DedicatedGoogleCalendar)) - { -
    • @SR["Exposes his Google calendar!"] -
    • - } - @if (Model.Performer.Devices?.Count>0) - { -
    • @SR["Uses the mobile application, and receives push notifications"] -
    • - } - -
    - - } -
    diff --git a/YavscLib/ICode.cs b/YavscLib/ICode.cs new file mode 100644 index 00000000..25cf54ab --- /dev/null +++ b/YavscLib/ICode.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace YavscLib +{ + public interface ILetter : IEqualityComparer { + } + public interface IWord where TLetter : ILetter + { + IWord Aggregate(TLetter other); + } + + public interface ICode : IEnumerable where TLetter : ILetter + { + /// + /// Checks that (b!=c) => a.b != a.c + /// + /// + bool Validate(); + + IWord CreateWord(TLetter letter); + } +} \ No newline at end of file