refactoring

vnext
Paul Schneider 7 years ago
parent 52d12985c7
commit 76889c82c5
46 changed files with 3130 additions and 553 deletions

@ -18,7 +18,7 @@ For example, if you distribute copies of such a program, whether gratis or for a
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' aVVnd authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.

@ -101,6 +101,25 @@ public static class GoogleHelper
return null; return null;
} }
#if GoogleApisAuthOAuth2
public static ServiceAccountCredential GetGoogleApiCredentials (string[] scopes)
{
String serviceAccountEmail = "SERVICE_ACCOUNT_EMAIL_HERE";
string private_key = Startup.GoogleSettings.Account.private_key;
string secret = Startup.GoogleSettings.ClientSecret;
var certificate = new X509Certificate2(@"key.p12", secret, X509KeyStorageFlags.Exportable);
return new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = scopes
}.FromCertificate(certificate));
}
#endif
// Get the given subProperty from a list property. // Get the given subProperty from a list property.
private static string TryGetFirstValue(JObject user, string propertyName, string subProperty) private static string TryGetFirstValue(JObject user, string propertyName, string subProperty)
{ {

@ -82,6 +82,10 @@ namespace Yavsc.Controllers
{ {
return View(); return View();
} }
public IActionResult Privacy()
{
return View();
}
public IActionResult AboutMarkdown() public IActionResult AboutMarkdown()
{ {
return View(); return View();

@ -6,15 +6,10 @@ using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Yavsc.Models;
using Yavsc.Services;
using Yavsc.ViewModels.Manage;
using Microsoft.Extensions.OptionsModel; using Microsoft.Extensions.OptionsModel;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Yavsc.Helpers;
using Yavsc.ViewModels.Calendar;
using System.Net; using System.Net;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using Yavsc.Models.Workflow; using Yavsc.Models.Workflow;
@ -22,8 +17,14 @@ using Yavsc.Models.Identity;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
using Yavsc.Helpers;
using Models.Relationship; using Models.Relationship;
using Yavsc.Models.Bank; using Models.Bank;
using ViewModels.Calendar;
using Yavsc.Models;
using Yavsc.Services;
using Yavsc.ViewModels.Manage;
using Yavsc.Models.Calendar;
[Authorize] [Authorize]
public class ManageController : Controller public class ManageController : Controller
@ -43,6 +44,8 @@ namespace Yavsc.Controllers
private SIRENChecker _cchecker; private SIRENChecker _cchecker;
private IStringLocalizer _SR; private IStringLocalizer _SR;
private CompanyInfoSettings _cinfoSettings; private CompanyInfoSettings _cinfoSettings;
ICalendarManager _calendarManager;
public ManageController( public ManageController(
ApplicationDbContext context, ApplicationDbContext context,
@ -55,6 +58,7 @@ namespace Yavsc.Controllers
IOptions<PayPalSettings> paypalSettings, IOptions<PayPalSettings> paypalSettings,
IOptions<CompanyInfoSettings> cinfoSettings, IOptions<CompanyInfoSettings> cinfoSettings,
IStringLocalizer<Yavsc.Resources.YavscLocalisation> SR, IStringLocalizer<Yavsc.Resources.YavscLocalisation> SR,
ICalendarManager calendarManager,
ILoggerFactory loggerFactory) ILoggerFactory loggerFactory)
{ {
_dbContext = context; _dbContext = context;
@ -68,6 +72,7 @@ namespace Yavsc.Controllers
_cinfoSettings = cinfoSettings.Value; _cinfoSettings = cinfoSettings.Value;
_cchecker = new SIRENChecker(cinfoSettings.Value); _cchecker = new SIRENChecker(cinfoSettings.Value);
_SR = SR; _SR = SR;
_calendarManager = calendarManager;
_logger = loggerFactory.CreateLogger<ManageController>(); _logger = loggerFactory.CreateLogger<ManageController>();
} }
@ -269,15 +274,9 @@ namespace Yavsc.Controllers
[HttpGet] [HttpGet]
public async Task<IActionResult> SetGoogleCalendar(string returnUrl) public async Task<IActionResult> SetGoogleCalendar(string returnUrl)
{ {
var credential = await _userManager.GetCredentialForGoogleApiAsync(
_dbContext, User.GetUserId());
if (credential == null)
return RedirectToAction("LinkLogin", new { provider = "Google" });
try try
{ {
ViewBag.Calendars = new GoogleApis.CalendarApi(_googleSettings.ApiKey) ViewBag.Calendars = await _calendarManager.GetCalendarsAsync(User.GetUserId());
.GetCalendars(credential);
} }
catch (WebException ex) catch (WebException ex)
{ {

@ -23,6 +23,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
namespace Yavsc.Helpers namespace Yavsc.Helpers
{ {
using Models.Auth; using Models.Auth;
@ -30,7 +31,8 @@ namespace Yavsc.Helpers
using Models.Messaging; using Models.Messaging;
using Models; using Models;
using Interfaces.Workflow; using Interfaces.Workflow;
using Yavsc.Models.Google;
using Yavsc.Models.Calendar;
/// <summary> /// <summary>
/// Google helpers. /// Google helpers.
@ -109,13 +111,30 @@ namespace Yavsc.Helpers
{ {
var user = await userManager.FindByIdAsync(uid); var user = await userManager.FindByIdAsync(uid);
var googleId = context.UserLogins.FirstOrDefault( var googleId = context.UserLogins.FirstOrDefault(
x => x.UserId == uid x => x.UserId == uid && x.LoginProvider == "Google"
).ProviderKey; ).ProviderKey;
if (string.IsNullOrEmpty(googleId)) if (string.IsNullOrEmpty(googleId))
throw new InvalidOperationException("No Google login"); throw new InvalidOperationException("No Google login");
var token = await context.GetTokensAsync(googleId); var token = await context.GetTokensAsync(googleId);
return new UserCredential(uid, token); return new UserCredential(uid, token);
} }
static string evStatusDispo = "Dispo";
public static async Task<Period[]> GetFreeTime (this ICalendarManager manager, string userId, string calId, DateTime startDate, DateTime endDate)
{
CalendarEventList evlist = await manager.GetCalendarAsync(calId, startDate, endDate, userId) ;
var result = evlist.items
.Where(
ev => ev.status == evStatusDispo
)
.Select(
ev => new Period {
Start = ev.start.datetime,
End = ev.end.datetime
}
);
return result.ToArray();
}
} }
} }

File diff suppressed because it is too large Load Diff

@ -0,0 +1,759 @@
using System;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class BrusherCalendarModel : 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_Period_BrusherProfile_BrusherProfileUserId", table: "Period");
migrationBuilder.DropForeignKey(name: "FK_Connection_ApplicationUser_ApplicationUserId", table: "Connection");
migrationBuilder.DropForeignKey(name: "FK_BrusherProfile_PerformerProfile_UserId", table: "BrusherProfile");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", 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_HairPrestationCollectionItem_HairPrestation_PrestationId", table: "HairPrestationCollectionItem");
migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", table: "HairPrestationCollectionItem");
migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint");
migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairPrestation_PrestationId", table: "HairTaintInstance");
migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairTaint_TaintId", table: "HairTaintInstance");
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_PayPalPayment_ApplicationUser_ExecutorId", table: "PayPalPayment");
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.DropColumn(name: "BrusherProfileUserId", table: "Period");
migrationBuilder.CreateTable(
name: "Schedule",
columns: table => new
{
OwnerId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Schedule", x => x.OwnerId);
table.ForeignKey(
name: "FK_Schedule_ApplicationUser_OwnerId",
column: x => x.OwnerId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ScheduledEvent",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
PeriodEnd = table.Column<DateTime>(nullable: true),
PeriodStart = table.Column<DateTime>(nullable: true),
Reccurence = table.Column<int>(nullable: false),
ScheduleOwnerId = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ScheduledEvent", x => x.Id);
table.ForeignKey(
name: "FK_ScheduledEvent_Schedule_ScheduleOwnerId",
column: x => x.ScheduleOwnerId,
principalTable: "Schedule",
principalColumn: "OwnerId",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_ScheduledEvent_Period_PeriodStart_PeriodEnd",
columns: x => new { x.PeriodStart, x.PeriodEnd },
principalTable: "Period",
principalColumns: new[] { "Start", "End" },
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.AddColumn<string>(
name: "ScheduleOwnerId",
table: "BrusherProfile",
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_PerformerProfile_OwnerId",
table: "Estimate",
column: "OwnerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Connection_ApplicationUser_ApplicationUserId",
table: "Connection",
column: "ApplicationUserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BrusherProfile_Schedule_ScheduleOwnerId",
table: "BrusherProfile",
column: "ScheduleOwnerId",
principalTable: "Schedule",
principalColumn: "OwnerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BrusherProfile_PerformerProfile_UserId",
table: "BrusherProfile",
column: "UserId",
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_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_HairPrestationCollectionItem_HairPrestation_PrestationId",
table: "HairPrestationCollectionItem",
column: "PrestationId",
principalTable: "HairPrestation",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId",
table: "HairPrestationCollectionItem",
column: "QueryId",
principalTable: "HairMultiCutQuery",
principalColumn: "Id",
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_HairTaintInstance_HairPrestation_PrestationId",
table: "HairTaintInstance",
column: "PrestationId",
principalTable: "HairPrestation",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_HairTaintInstance_HairTaint_TaintId",
table: "HairTaintInstance",
column: "TaintId",
principalTable: "HairTaint",
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_PayPalPayment_ApplicationUser_ExecutorId",
table: "PayPalPayment",
column: "ExecutorId",
principalTable: "AspNetUsers",
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_Connection_ApplicationUser_ApplicationUserId", table: "Connection");
migrationBuilder.DropForeignKey(name: "FK_BrusherProfile_Schedule_ScheduleOwnerId", table: "BrusherProfile");
migrationBuilder.DropForeignKey(name: "FK_BrusherProfile_PerformerProfile_UserId", table: "BrusherProfile");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery");
migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", 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_HairPrestationCollectionItem_HairPrestation_PrestationId", table: "HairPrestationCollectionItem");
migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", table: "HairPrestationCollectionItem");
migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint");
migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairPrestation_PrestationId", table: "HairTaintInstance");
migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairTaint_TaintId", table: "HairTaintInstance");
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_PayPalPayment_ApplicationUser_ExecutorId", table: "PayPalPayment");
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.DropColumn(name: "ScheduleOwnerId", table: "BrusherProfile");
migrationBuilder.DropTable("ScheduledEvent");
migrationBuilder.DropTable("Schedule");
migrationBuilder.AddColumn<string>(
name: "BrusherProfileUserId",
table: "Period",
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_Period_BrusherProfile_BrusherProfileUserId",
table: "Period",
column: "BrusherProfileUserId",
principalTable: "BrusherProfile",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Connection_ApplicationUser_ApplicationUserId",
table: "Connection",
column: "ApplicationUserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BrusherProfile_PerformerProfile_UserId",
table: "BrusherProfile",
column: "UserId",
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_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_HairPrestationCollectionItem_HairPrestation_PrestationId",
table: "HairPrestationCollectionItem",
column: "PrestationId",
principalTable: "HairPrestation",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId",
table: "HairPrestationCollectionItem",
column: "QueryId",
principalTable: "HairMultiCutQuery",
principalColumn: "Id",
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_HairTaintInstance_HairPrestation_PrestationId",
table: "HairTaintInstance",
column: "PrestationId",
principalTable: "HairPrestation",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_HairTaintInstance_HairTaint_TaintId",
table: "HairTaintInstance",
column: "TaintId",
principalTable: "HairTaint",
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_PayPalPayment_ApplicationUser_ExecutorId",
table: "PayPalPayment",
column: "ExecutorId",
principalTable: "AspNetUsers",
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);
}
}
}

@ -413,11 +413,32 @@ namespace Yavsc.Migrations
b.Property<DateTime>("End"); b.Property<DateTime>("End");
b.Property<string>("BrusherProfileUserId");
b.HasKey("Start", "End"); b.HasKey("Start", "End");
}); });
modelBuilder.Entity("Yavsc.Models.Calendar.Schedule", b =>
{
b.Property<string>("OwnerId");
b.HasKey("OwnerId");
});
modelBuilder.Entity("Yavsc.Models.Calendar.ScheduledEvent", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime?>("PeriodEnd");
b.Property<DateTime?>("PeriodStart");
b.Property<int>("Reccurence");
b.Property<string>("ScheduleOwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Chat.Connection", b => modelBuilder.Entity("Yavsc.Models.Chat.Connection", b =>
{ {
b.Property<string>("ConnectionId"); b.Property<string>("ConnectionId");
@ -505,6 +526,8 @@ namespace Yavsc.Migrations
b.Property<decimal>("ManCutPrice"); b.Property<decimal>("ManCutPrice");
b.Property<string>("ScheduleOwnerId");
b.Property<decimal>("ShampooPrice"); b.Property<decimal>("ShampooPrice");
b.Property<decimal>("ShortBalayagePrice"); b.Property<decimal>("ShortBalayagePrice");
@ -1263,11 +1286,22 @@ namespace Yavsc.Migrations
.HasForeignKey("AuthorId"); .HasForeignKey("AuthorId");
}); });
modelBuilder.Entity("Yavsc.Models.Calendar.Period", b => modelBuilder.Entity("Yavsc.Models.Calendar.Schedule", b =>
{ {
b.HasOne("Yavsc.Models.Haircut.BrusherProfile") b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany() .WithMany()
.HasForeignKey("BrusherProfileUserId"); .HasForeignKey("OwnerId");
});
modelBuilder.Entity("Yavsc.Models.Calendar.ScheduledEvent", b =>
{
b.HasOne("Yavsc.Models.Calendar.Schedule")
.WithMany()
.HasForeignKey("ScheduleOwnerId");
b.HasOne("Yavsc.Models.Calendar.Period")
.WithMany()
.HasForeignKey("PeriodStart", "PeriodEnd");
}); });
modelBuilder.Entity("Yavsc.Models.Chat.Connection", b => modelBuilder.Entity("Yavsc.Models.Chat.Connection", b =>
@ -1279,6 +1313,10 @@ namespace Yavsc.Migrations
modelBuilder.Entity("Yavsc.Models.Haircut.BrusherProfile", b => modelBuilder.Entity("Yavsc.Models.Haircut.BrusherProfile", b =>
{ {
b.HasOne("Yavsc.Models.Calendar.Schedule")
.WithMany()
.HasForeignKey("ScheduleOwnerId");
b.HasOne("Yavsc.Models.Workflow.PerformerProfile") b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany() .WithMany()
.HasForeignKey("UserId"); .HasForeignKey("UserId");

@ -1,9 +0,0 @@
using System.Collections.Generic;
namespace Yavsc.Models.Calendar
{
public class Availability: List<Period>
{
}
}

@ -0,0 +1,34 @@
//
// IScheduledEvent.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 - 2017 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Yavsc.Models.Calendar
{
public interface IScheduledEvent
{
/// <summary>
/// Gets or sets the period.
/// </summary>
/// <value>The period.</value>
Periodicity Reccurence { get; set; }
Period Period { get; set; }
}
}

@ -4,7 +4,7 @@
// Author: // Author:
// Paul Schneider <paulschneider@free.fr> // Paul Schneider <paulschneider@free.fr>
// //
// Copyright (c) 2015 Paul Schneider // Copyright (c) 2015 - 2017 Paul Schneider
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by // it under the terms of the GNU Lesser General Public License as published by

@ -4,7 +4,7 @@
// Author: // Author:
// Paul Schneider <paulschneider@free.fr> // Paul Schneider <paulschneider@free.fr>
// //
// Copyright (c) 2015 Paul Schneider // Copyright (c) 2015 - 2017 Paul Schneider
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by // it under the terms of the GNU Lesser General Public License as published by

@ -19,32 +19,46 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Calendar.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 - 2017 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Calendar namespace Yavsc.Models.Calendar
{ {
/// <summary> /// <summary>
/// Schedule. /// Le calendrier, l'emploi du temps.
/// </summary> /// </summary>
public class Schedule { public class Schedule {
/// <summary>
/// Gets or sets the period. [Key,Required]
/// </summary> public string OwnerId { get; set; }
/// <value>The period.</value>
public Periodicity Period { get; set; } [ForeignKey("OwnerId")]
[Display(Name="Professionnel")]
/// <summary> public virtual ApplicationUser Owner { get ; set; }
/// Gets or sets the schedule of an open week.
/// One item by bay in the week, public ScheduledEvent [] Events { get ; set; }
/// </summary>
/// <value>The weekly workdays.</value>
public OpenDay [] WeekDays { get; set; }
/// <summary>
/// Gets or sets the hollydays.
/// </summary>
/// <value>The hollydays.</value>
[Required]
public Period [] Validity { get; set; }
} }
} }

@ -0,0 +1,45 @@
//
// ScheduledEvent.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 - 2017 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Calendar
{
public class ScheduledEvent : IScheduledEvent
{
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
public Period Period
{
get;
set;
}
public Periodicity Reccurence
{
get;
set;
}
}
}

@ -1,3 +1,24 @@
//
// Connection.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 - 2017 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json; using Newtonsoft.Json;

@ -1,3 +1,24 @@
//
// Color.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 - 2017 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;

@ -1,4 +1,26 @@
//
// IDocument.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 - 2017 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace Yavsc.Models { namespace Yavsc.Models {
@ -6,6 +28,8 @@ namespace Yavsc.Models {
public string Name { get; set; } public string Name { get; set; }
public string Value { get; set; } public string Value { get; set; }
} }
[Obsolete("Templates are ala Razor")]
public interface IDocument { public interface IDocument {
string Template { get; set; } string Template { get; set; }
Parameter [] Parameters { get; set; } Parameter [] Parameters { get; set; }

@ -1,3 +1,26 @@
//
// FileRecievedInfo.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 - 2017 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Yavsc.Models.FileSystem namespace Yavsc.Models.FileSystem
{ {
public class FileRecievedInfo public class FileRecievedInfo

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

@ -19,7 +19,7 @@
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Yavsc.Models.Google namespace Yavsc.Models.Google.Calendar
{ {
/// <summary> /// <summary>
/// Calendar list entry. /// Calendar list entry.
@ -105,17 +105,6 @@ namespace Yavsc.Models.Google
/// <summary> /// <summary>
/// Reminder. /// Reminder.
/// </summary> /// </summary>
public class Reminder {
/// <summary>
/// Gets or sets the method.
/// </summary>
/// <value>The method.</value>
public string method { get; set; }
/// <summary>
/// Gets or sets the minutes.
/// </summary>
/// <value>The minutes.</value>
public int minutes { get; set; }
}
} }

@ -0,0 +1,15 @@
namespace Yavsc.Models.Google.Calendar
{
public class Reminder {
/// <summary>
/// Gets or sets the method.
/// </summary>
/// <value>The method.</value>
public string method { get; set; }
/// <summary>
/// Gets or sets the minutes.
/// </summary>
/// <value>The minutes.</value>
public int minutes { get; set; }
}
}

@ -1,3 +1,25 @@
//
// BrusherProfile.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 - 2017 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -36,9 +58,9 @@ namespace Yavsc.Models.Haircut
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[DisplayFormat(ConvertEmptyStringToNull = true, NullDisplayText = "[Pas de lieu spécifié]")] [DisplayFormat(ConvertEmptyStringToNull = true, NullDisplayText = "[Pas d'emploi du temps spécifié]")]
[Display(Name="Disponibilités")] [Display(Name="Emploi du temps")]
public virtual Availability Availability { get; set; } public virtual Schedule Schedule { get; set; }
[Display(Name="Coupe femme cheveux longs"),DisplayFormat(DataFormatString="{0:C}")] [Display(Name="Coupe femme cheveux longs"),DisplayFormat(DataFormatString="{0:C}")]

@ -1,3 +1,25 @@
//
// HaircutQueryInfo.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 - 2017 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Yavsc.Models.Auth; using Yavsc.Models.Auth;

@ -1,10 +1,10 @@
// //
// Calendar.cs // CalendarApi.cs
// //
// Author: // Author:
// Paul Schneider <paulschneider@free.fr> // Paul Schneider <paulschneider@free.fr>
// //
// Copyright (c) 2015 Paul Schneider // Copyright (c) 2015 - 2017 Paul Schneider
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by // it under the terms of the GNU Lesser General Public License as published by
@ -23,24 +23,46 @@ using System;
using System.Net; using System.Net;
using System.IO; using System.IO;
using System.Web; using System.Web;
using Yavsc.Models.Google;
using Yavsc.Models.Auth; using Yavsc.Models.Auth;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Yavsc.GoogleApis namespace Yavsc.Models.Google.Calendar
{ {
/// <summary> using System.Threading.Tasks;
/// Google Calendar API client. using Microsoft.AspNet.Identity;
/// </summary> using Microsoft.Extensions.Logging;
public class CalendarApi using Microsoft.Extensions.OptionsModel;
using Models.Google;
using Yavsc.Helpers;
using Yavsc.Models.Calendar;
using Yavsc.ViewModels.Calendar;
/// <summary>
/// Google Calendar API client.
/// </summary>
public class CalendarManager : ICalendarManager
{ {
protected static string scopeCalendar = "https://www.googleapis.com/auth/calendar"; // protected static string scopeCalendar = "https://www.googleapis.com/auth/calendar";
private string _ApiKey; private string _ApiKey;
public CalendarApi(string ApiKey) private readonly UserManager<ApplicationUser> _userManager;
ApplicationDbContext _dbContext;
ILogger _logger;
public CalendarManager(IOptions<GoogleAuthSettings> settings,
UserManager<ApplicationUser> userManager,
ApplicationDbContext dbContext,
ILoggerFactory loggerFactory)
{ {
_ApiKey = ApiKey; _ApiKey = settings.Value.ApiKey;
_userManager = userManager;
_dbContext = dbContext;
_logger = loggerFactory.CreateLogger<CalendarManager>();
} }
/// <summary> /// <summary>
/// The get cal list URI. /// The get cal list URI.
/// </summary> /// </summary>
@ -65,8 +87,10 @@ namespace Yavsc.GoogleApis
/// </summary> /// </summary>
/// <returns>The calendars.</returns> /// <returns>The calendars.</returns>
/// <param name="cred">Cred.</param> /// <param name="cred">Cred.</param>
public CalendarList GetCalendars (UserCredential creds) public async Task<CalendarList> GetCalendarsAsync (string userId)
{ {
UserCredential creds = await _userManager.GetCredentialForGoogleApiAsync(
_dbContext, userId);
if (creds==null) if (creds==null)
throw new InvalidOperationException("No credential"); throw new InvalidOperationException("No credential");
CalendarList res = null; CalendarList res = null;
@ -95,8 +119,12 @@ namespace Yavsc.GoogleApis
/// <param name="mindate">Mindate.</param> /// <param name="mindate">Mindate.</param>
/// <param name="maxdate">Maxdate.</param> /// <param name="maxdate">Maxdate.</param>
/// <param name="cred">credential string.</param> /// <param name="cred">credential string.</param>
public CalendarEventList GetCalendar (string calid, DateTime mindate, DateTime maxdate,string cred) public async Task<CalendarEventList> GetCalendarAsync (string calid, DateTime mindate, DateTime maxdate,string userId)
{ {
UserCredential creds = await _userManager.GetCredentialForGoogleApiAsync(
_dbContext, userId);
if (creds==null)
throw new InvalidOperationException("No credential");
if (string.IsNullOrWhiteSpace (calid)) if (string.IsNullOrWhiteSpace (calid))
throw new Exception ("the calendar identifier is not specified"); throw new Exception ("the calendar identifier is not specified");
@ -108,16 +136,18 @@ namespace Yavsc.GoogleApis
HttpWebRequest webreq = WebRequest.CreateHttp (uri); HttpWebRequest webreq = WebRequest.CreateHttp (uri);
webreq.Headers.Add (HttpRequestHeader.Authorization, cred); webreq.Headers.Add (HttpRequestHeader.Authorization, creds.GetHeader());
webreq.Method = "GET"; webreq.Method = "GET";
webreq.ContentType = "application/http"; webreq.ContentType = "application/http";
CalendarEventList res = null; CalendarEventList res = null;
try { try {
using (WebResponse resp = webreq.GetResponse ()) { using (WebResponse resp = await webreq.GetResponseAsync ()) {
using (Stream respstream = resp.GetResponseStream ()) { using (Stream respstream = resp.GetResponseStream ()) {
try { try {
using (var rdr = new StreamReader(respstream)) { using (var rdr = new StreamReader(respstream)) {
res= JsonConvert.DeserializeObject<CalendarEventList>(rdr.ReadToEnd()); string json = rdr.ReadToEnd();
_logger.LogVerbose(">> Calendar: "+json);
res= JsonConvert.DeserializeObject<CalendarEventList>(json);
} }
} catch (Exception ) { } catch (Exception ) {
respstream.Close (); respstream.Close ();
@ -135,6 +165,18 @@ namespace Yavsc.GoogleApis
webreq.Abort (); webreq.Abort ();
return res; return res;
} }
public async Task<DateTimeChooserViewModel> CreateViewModel(
string inputId,
string calid, DateTime mindate, DateTime maxdate, string userId)
{
var eventList = await GetCalendarAsync(calid, mindate, maxdate, userId);
return new DateTimeChooserViewModel {
InputId = inputId,
MinDate = mindate,
MaxDate = maxdate,
DisabledTimeIntervals = null
};
}
} }
} }

@ -1,5 +1,5 @@
// //
// Google.cs // MapTracks.cs
// //
// Author: // Author:
// Paul Schneider <paulschneider@free.fr> // Paul Schneider <paulschneider@free.fr>

@ -21,26 +21,19 @@
using System;
namespace Yavsc.Models.Calendar namespace Yavsc.Models.Calendar
{ {
using Models.Workflow; using System.Threading.Tasks;
using Models.Messaging; using Yavsc.Models.Google.Calendar;
/// <summary> using Yavsc.Models.Google;
/// I calendar manager.
/// </summary> /// <summary>
public interface ICalendarManager { /// I calendar manager.
/// <summary> /// </summary>
/// Gets the free dates. public interface ICalendarManager {
/// </summary> Task<CalendarList> GetCalendarsAsync (string userId);
/// <returns>The free dates.</returns> Task<CalendarEventList> GetCalendarAsync (string calid, DateTime mindate, DateTime maxdate, string userId);
/// <param name="username">Username.</param>
/// <param name="req">Req.</param>
IFreeDateSet GetFreeDates(string username, RdvQuery req);
/// <summary>
/// Book the specified username and ev.
/// </summary>
/// <param name="username">Username.</param>
/// <param name="ev">Ev.</param>
bool Book(string username, YaEvent ev);
} }
} }

@ -1,5 +1,6 @@
namespace Yavsc
namespace Yavsc
{ {
public class GoogleAuthSettings public class GoogleAuthSettings
{ {
@ -7,5 +8,19 @@ namespace Yavsc
public string ClientSecret { get; set; } public string ClientSecret { get; set; }
public string ClientId { get; set; } public string ClientId { get; set; }
public string BrowserApiKey { get; set; } public string BrowserApiKey { get; set; }
public class ServiceAccount
{
public string project_id { get; set; }
public string private_key_id { get; set; }
public string private_key { get; set; }
public string client_email { get; set; }
public string client_id { get; set; }
public string auth_uri { get; set; }
public string token_uri { get; set; }
public string auth_provider_x509_cert_url { get; set; }
public string client_x509_cert_url { get; set; }
}
public ServiceAccount Account { get; set; }
} }
} }

@ -86,8 +86,10 @@ namespace Yavsc
// .AddTokenProvider<UserTokenProvider>(Constants.AppFactor) // .AddTokenProvider<UserTokenProvider>(Constants.AppFactor)
// //
} }
private void ConfigureOAuthApp(IApplicationBuilder app, SiteSettings settings) private void ConfigureOAuthApp(IApplicationBuilder app,
SiteSettings settingsOptions)
{ {
app.UseIdentity(); app.UseIdentity();
app.UseWhen(context => context.Request.Path.StartsWithSegments("/api"), app.UseWhen(context => context.Request.Path.StartsWithSegments("/api"),
branch => branch =>
@ -128,6 +130,9 @@ namespace Yavsc
ClientId = Configuration["Authentication:Google:ClientId"], ClientId = Configuration["Authentication:Google:ClientId"],
ClientSecret = Configuration["Authentication:Google:ClientSecret"], ClientSecret = Configuration["Authentication:Google:ClientSecret"],
AccessType = "offline", AccessType = "offline",
Scope = { "profile", "https://www.googleapis.com/auth/plus.login",
"https://www.googleapis.com/auth/admin.directory.resource.calendar",
"https://www.googleapis.com/auth/calendar" },
SaveTokensAsClaims = true, SaveTokensAsClaims = true,
UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me", UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me",
Events = new OAuthEvents Events = new OAuthEvents
@ -146,19 +151,10 @@ namespace Yavsc
} }
} }
}; };
YavscGoogleAppOptions.Scope.Add("https://www.googleapis.com/auth/calendar");
branch.UseMiddleware<Yavsc.Auth.GoogleMiddleware>(YavscGoogleAppOptions); branch.UseMiddleware<Yavsc.Auth.GoogleMiddleware>(YavscGoogleAppOptions);
// Facebook
branch.UseFacebookAuthentication(options =>
{
FacebookAppOptions = options;
options.AppId = Configuration["Authentication:Facebook:ClientId"];
options.AppSecret = Configuration["Authentication:Facebook:ClientSecret"];
options.Scope.Add("email");
options.UserInformationEndpoint = "https://graph.facebook.com/v2.5/me?fields=id,name,email,first_name,last_name";
});
branch.UseTwitterAuthentication(options=> branch.UseTwitterAuthentication(options=>
{ {
TwitterAppOptions = options; TwitterAppOptions = options;

@ -32,6 +32,9 @@ namespace Yavsc
using PayPal.Manager; using PayPal.Manager;
using Services; using Services;
using ViewModels.Auth.Handlers; using ViewModels.Auth.Handlers;
using Yavsc.Models.Calendar;
using Yavsc.Models.Google.Calendar;
public partial class Startup public partial class Startup
{ {
public static string ConnectionString { get; private set; } public static string ConnectionString { get; private set; }
@ -226,9 +229,9 @@ namespace Yavsc
// Add application services. // Add application services.
services.AddTransient<IEmailSender, AuthMessageSender>(); services.AddTransient<IEmailSender, AuthMessageSender>();
services.AddTransient<IGoogleCloudMessageSender, AuthMessageSender>(); services.AddTransient<IGoogleCloudMessageSender, AuthMessageSender>();
services.AddTransient<IBillingService, BillingService>((servs) => services.AddTransient<IBillingService, BillingService>();
new BillingService(servs.GetRequiredService<ILoggerFactory>(), servs.GetService<ApplicationDbContext>()) services.AddTransient<ICalendarManager, CalendarManager>();
);
// TODO for SMS: services.AddTransient<ISmsSender, AuthMessageSender>(); // TODO for SMS: services.AddTransient<ISmsSender, AuthMessageSender>();
services.AddLocalization(options => services.AddLocalization(options =>

@ -0,0 +1,51 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Yavsc.Models;
using Yavsc.Models.Calendar;
using Yavsc.ViewModels.Calendar;
namespace Yavsc.ViewComponents
{
public class CalendarViewComponent : ViewComponent
{
ApplicationDbContext _dbContext;
ICalendarManager _manager;
public CalendarViewComponent (
ApplicationDbContext dbContext,
ICalendarManager manager)
{
_manager = manager;
_dbContext = dbContext;
}
/* ,
Google.Apis Google.Apis.Core
"Google.Apis.Auth": "1.27.1",
"Google.Apis.Calendar.v3": "1.27.1.878"
*/
public async Task<IViewComponentResult> InvokeAsync (
string templateName,
string htmlFieldName,
string userId, string calId )
{
var minDate = DateTime.Now;
var maxDate = minDate.AddDays(20);
var cal = await _manager.GetCalendarAsync(
calId, minDate, maxDate, userId
);
ViewData["Calendar"] = cal;
return View(templateName, new DateTimeChooserViewModel {
InputId = htmlFieldName,
MinDate = minDate,
MaxDate = maxDate
});
}
}
}

@ -0,0 +1,14 @@
using System;
using Yavsc.Models.Calendar;
namespace Yavsc.ViewModels.Calendar
{
public class DateTimeChooserViewModel
{
public string InputId { get; set; }
public DateTime MinDate { get; set; }
public DateTime MaxDate { get; set; }
public Period [] DisabledTimeIntervals { get; set; }
}
}

@ -1,7 +1,7 @@
namespace Yavsc.ViewModels.Calendar { namespace Yavsc.ViewModels.Calendar {
public class UpcomingEventsViewModel { public class UpcomingEventsViewModel {
} }
} }

@ -15,10 +15,10 @@
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt> <dt>
@Html.DisplayNameFor(model => model.Availability) @Html.DisplayNameFor(model => model.Schedule)
</dt> </dt>
<dd> <dd>
@Html.DisplayFor(model => model.Availability) @Html.DisplayFor(model => model.Schedule)
</dd> </dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.ActionDistance) @Html.DisplayNameFor(model => model.ActionDistance)

@ -156,11 +156,6 @@
<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',
@ -343,12 +338,13 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class='col-sm-6'> <div class='col-sm-6'>
<div class='input-group date' id='datetimepicker2'> @await Component.InvokeAsync(
<input class="form-control" name="EventDate" /> "Calendar",
<span class="input-group-addon"> "Default",
<span class="glyphicon glyphicon-calendar"></span> "EventDate",
</span> Model.PerformerProfile.PerformerId,
</div> Model.PerformerProfile.Performer.DedicatedGoogleCalendar)
</div> </div>
<span asp-validation-for="EventDate" class="text-danger"> <span asp-validation-for="EventDate" class="text-danger">
</span> </span>

@ -0,0 +1,13 @@
@{
ViewData["Title"] = "Conditions Générales de Vente";
}
<h2>@ViewData["Title"]</h2>
<markdown>
Le paiement intervient à la commande, quelque soit la date d'intervention.
Vous pouvez annuler votre commande depuis la [liste de vos commande en cours](/HairCutCommand/),
Vous pouvez demander le remboursement d'un paiement, dans le cadre d'une réclamation sur l'execution
de votre commande, en nous contactant via courrier éléctronique ou postal, [que vour retrouverez sur la page de contact](/Home/Contact), votre demande sera rapidement traitée.
</markdown>

@ -0,0 +1,14 @@
@{
ViewData["Title"] = @SR["Confidentialité"]+" "+@SiteSettings.Value.Title;
}
<h1>@ViewData["Title"]</h1>
<markdown>
## La confidentialité
À aucun moment, aucune adresse postale, aucune adresse e-mail ni aucun numéro de téléphone
ne sont transmis à personne. Seul le système et son [possesseur](/Home/Contact) a accès à ces informations.
De plus, le droit de retrait est permanent et sa mise en oeuvre [immédiate](/Account/Delete).
</markdown>

@ -0,0 +1,11 @@
@model DateTimeChooserViewModel
@Newtonsoft.Json.JsonConvert.SerializeObject(ViewData["Calendar"])
<div class='input-group date'>
<input class="form-control" name="@Model.InputId" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>

@ -1,3 +1,2 @@
@model Availability @model Availability
L'index des periodes ...

@ -13,3 +13,4 @@
</script> </script>
</environment> </environment>
<script src="~/lib/jquery-validation/additional-methods.js" charset="UTF-8"></script> <script src="~/lib/jquery-validation/additional-methods.js" charset="UTF-8"></script>
<script src="~/js/input-lib.js"></script>

@ -24,6 +24,7 @@
@using Yavsc.Models.Haircut; @using Yavsc.Models.Haircut;
@using Yavsc.Models.Payment; @using Yavsc.Models.Payment;
@using Yavsc.Models.Calendar; @using Yavsc.Models.Calendar;
@using Yavsc.Models.Google.Calendar
@using Yavsc.Billing; @using Yavsc.Billing;
@using Yavsc.ViewModels; @using Yavsc.ViewModels;
@ -48,3 +49,4 @@
@inject IOptions<GoogleAuthSettings> GoogleSettings @inject IOptions<GoogleAuthSettings> GoogleSettings
@inject IOptions<SiteSettings> SiteSettings @inject IOptions<SiteSettings> SiteSettings
@inject IHostingEnvironment HostingEnvironment @inject IHostingEnvironment HostingEnvironment
@inject ICalendarManager CalendarManager;

@ -1,169 +1,167 @@
{ {
"version": "1.0.0-*", "version": "1.0.0-*",
"authors": [ "authors": [
"Paul Schneider" "Paul Schneider"
], ],
"tags": [ "tags": [
"Blog", "Blog",
"PoS", "PoS",
"Chat" "Chat"
], ],
"projectUrl": "http://yavsc.pschneider.fr", "projectUrl": "http://yavsc.pschneider.fr",
"licenseUrl": "", "licenseUrl": "",
"userSecretsId": "aspnet5-YavscWeb-a0dadd21-2ced-43d3-96f9-7e504345102f", "userSecretsId": "aspnet5-YavscWeb-a0dadd21-2ced-43d3-96f9-7e504345102f",
"compilationOptions": { "compilationOptions": {
"emitEntryPoint": true,
"debugType": "portable",
"outputName": "Yavsc"
},
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"compile": [
"*.cs"
],
"resource": [
"Resources/**/*.resx"
],
"namedResource": {},
"configurations": {
"Debug": {
"compilationOptions": {
"emitEntryPoint": true, "emitEntryPoint": true,
"debugType": "portable", "define": [
"outputName": "Yavsc" "DEBUG",
"TRACE"
],
"optimize": false,
"debugType": "portable"
}
}, },
"buildOptions": { "Release": {
"debugType": "portable", "compilationOptions": {
"emitEntryPoint": true "define": [
"RELEASE",
"TRACE"
],
"optimize": true
}
}
},
"webroot": "wwwroot",
"tooling": {
"defaultNamespace": "Yavsc"
},
"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.Core": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"EntityFramework.Relational": "7.0.0-rc1-final",
"EntityFramework7.Npgsql": "3.1.0-rc1-3",
"EntityFramework7.Npgsql.Design": "3.1.0-rc1-5",
"MailKit": "1.12.0",
"MarkdownDeep-av.NET": "1.5.6",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-rc1-final",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-rc1-final",
"Microsoft.AspNet.Authorization": "1.0.0-rc1-final",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
"Microsoft.AspNet.Http.Abstractions": "1.0.0-rc1-final",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-*",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-*",
"Microsoft.AspNet.Localization": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-*",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-*",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
"Microsoft.AspNet.SignalR.Core": "2.2.1",
"Microsoft.AspNet.SignalR.JS": "2.2.1",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-*",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-*",
"Microsoft.AspNet.WebSockets.Server": "1.0.0-rc1-*",
"Microsoft.Extensions.Configuration.Abstractions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.TraceSource": "1.0.0-rc1-final",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final",
"Microsoft.Extensions.Globalization.CultureInfoCache": "1.0.0-rc1-final",
"Microsoft.Extensions.Localization": "1.0.0-rc1-final",
"Microsoft.Extensions.Localization.Abstractions": "1.0.0-rc1-final",
"Microsoft.Extensions.CodeGeneration": "1.0.0-rc1-final",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta8",
"Microsoft.Framework.Configuration.Binder": "1.0.0-beta8",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
"Microsoft.AspNet.Session": "1.0.0-rc1-final",
"Microsoft.AspNet.Web.Optimization": "1.1.3",
"Microsoft.Extensions.WebEncoders.Core": "1.0.0-rc1-final",
"Microsoft.Extensions.Options": "0.0.1-alpha",
"Microsoft.Extensions.WebEncoders": "1.0.0-rc1-final",
"Microsoft.AspNet.DataProtection": "1.0.0-rc1-final",
"Microsoft.AspNet.DataProtection.SystemWeb": "1.0.0-rc1-final",
"Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-rc1-final",
"Microsoft.AspNet.Authentication.OAuth": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc.Formatters.Json": "6.0.0-rc1-final",
"Microsoft.AspNet.OWin": "1.0.0-rc1-final",
"System.Json": "4.0.20126.16343",
"Yavsc.Abstract": {
"type": "build",
"version": "1.0.0"
}, },
"compile": [ "Extensions.AspNet.Authentication.Instagram": "1.0.0-t150809211713",
"*.cs" "Microsoft.AspNet.Http.Extensions": "1.0.0-rc1-final",
], "Microsoft.DiaSymReader.Native": "1.5.0",
"resource": [ "PayPalMerchant-net451": "2.7.109"
"Resources/**/*.resx" },
], "commands": {
"namedResource": {}, "web": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000",
"configurations": { "coiffure": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:88",
"Debug": { "lua": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:85",
"compilationOptions": { "luatest": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5001",
"emitEntryPoint": true, "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000",
"define": [ "zicmoove": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:87",
"DEBUG", "yavsc": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:86",
"TRACE" "yavscpre": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:84",
], "ef": "EntityFramework.Commands",
"optimize": false, "gen": "Microsoft.Extensions.CodeGeneration"
"debugType": "portable" },
} "frameworks": {
}, "dnx451": {
"Release": { "frameworkAssemblies": {
"compilationOptions": { "System.Drawing": "4.0.0.0",
"define": [ "System.Net": "4.0.0.0",
"RELEASE", "System.Xml": "4.0.0.0",
"TRACE" "System": "4.0.0.0"
], }
"optimize": true }
} },
} "exclude": [
}, "wwwroot",
"webroot": "wwwroot", "node_modules",
"tooling": { "bower_components",
"defaultNamespace": "Yavsc" "contrib"
}, ],
"dependencies": { "publishExclude": [
"EntityFramework.Commands": "7.0.0-rc1-final", "**.user",
"EntityFramework.Core": "7.0.0-rc1-final", "**.vspscc",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final", "contrib/**/*.*"
"EntityFramework.Relational": "7.0.0-rc1-final", ],
"EntityFramework7.Npgsql": "3.1.0-rc1-3", "scripts": {
"EntityFramework7.Npgsql.Design": "3.1.0-rc1-5", "prebuild": "echo before building",
"Google.Apis.Core": "1.11.1", "postbuild": "echo after building",
"Google.Apis": "1.11.1", "prepack": "gulp min",
"MailKit": "1.12.0", "postpack": "echo after packing",
"MarkdownDeep-av.NET": "1.5.6", "prerestore": "echo before restoring packages",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final", "postrestore": "echo after restoring packages",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-rc1-final", "prepublish": "gulp min",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-rc1-final", "postpublish": "echo after publish"
"Microsoft.AspNet.Authorization": "1.0.0-rc1-final", },
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final", "embed": "Views/**/*.cshtml"
"Microsoft.AspNet.Http.Abstractions": "1.0.0-rc1-final", }
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-*",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-*",
"Microsoft.AspNet.Localization": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-*",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-*",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
"Microsoft.AspNet.SignalR.Core": "2.2.1",
"Microsoft.AspNet.SignalR.JS": "2.2.1",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-*",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-*",
"Microsoft.AspNet.WebSockets.Server": "1.0.0-rc1-*",
"Microsoft.Extensions.Configuration.Abstractions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.TraceSource": "1.0.0-rc1-final",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final",
"Microsoft.Extensions.Globalization.CultureInfoCache": "1.0.0-rc1-final",
"Microsoft.Extensions.Localization": "1.0.0-rc1-final",
"Microsoft.Extensions.Localization.Abstractions": "1.0.0-rc1-final",
"Microsoft.Extensions.CodeGeneration": "1.0.0-rc1-final",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta8",
"Microsoft.Framework.Configuration.Binder": "1.0.0-beta8",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
"Microsoft.AspNet.Session": "1.0.0-rc1-final",
"Microsoft.AspNet.Web.Optimization": "1.1.3",
"Microsoft.Extensions.WebEncoders.Core": "1.0.0-rc1-final",
"Microsoft.Extensions.Options": "0.0.1-alpha",
"Microsoft.Extensions.WebEncoders": "1.0.0-rc1-final",
"Microsoft.AspNet.DataProtection": "1.0.0-rc1-final",
"Microsoft.AspNet.DataProtection.SystemWeb": "1.0.0-rc1-final",
"Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-rc1-final",
"Microsoft.AspNet.Authentication.OAuth": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc.Formatters.Json": "6.0.0-rc1-final",
"Microsoft.AspNet.OWin": "1.0.0-rc1-final",
"System.Json": "4.0.20126.16343",
"Yavsc.Abstract": {
"type": "build",
"version": "1.0.0"
},
"Extensions.AspNet.Authentication.Instagram": "1.0.0-t150809211713",
"Microsoft.AspNet.Http.Extensions": "1.0.0-rc1-final",
"Microsoft.DiaSymReader.Native": "1.5.0",
"PayPalMerchant-net451": "2.7.109"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000",
"coiffure": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:88",
"lua": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:85",
"luatest": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5001",
"kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000",
"zicmoove": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:87",
"yavsc": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:86",
"yavscpre": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:84",
"ef": "EntityFramework.Commands",
"gen": "Microsoft.Extensions.CodeGeneration"
},
"frameworks": {
"dnx451": {
"frameworkAssemblies": {
"System.Drawing": "4.0.0.0",
"System.Net": "4.0.0.0",
"System.Xml": "4.0.0.0",
"System": "4.0.0.0"
}
}
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components",
"contrib"
],
"publishExclude": [
"**.user",
"**.vspscc",
"contrib/**/*.*"
],
"scripts": {
"prebuild": "echo before building",
"postbuild": "echo after building",
"prepack": "gulp min",
"postpack": "echo after packing",
"prerestore": "echo before restoring packages",
"postrestore": "echo after restoring packages",
"prepublish": "gulp min",
"postpublish": "echo after publish"
},
"embed": "Views/**/*.cshtml"
}

@ -218,34 +218,6 @@
"lib/dnx451/Extensions.AspNet.Authentication.Instagram.dll": {} "lib/dnx451/Extensions.AspNet.Authentication.Instagram.dll": {}
} }
}, },
"Google.Apis/1.11.1": {
"type": "package",
"dependencies": {
"Google.Apis.Core": "1.11.1",
"log4net": "2.0.3",
"Zlib.Portable.Signed": "1.11.0"
},
"compile": {
"lib/net45/Google.Apis.dll": {},
"lib/net45/Google.Apis.PlatformServices.dll": {}
},
"runtime": {
"lib/net45/Google.Apis.dll": {},
"lib/net45/Google.Apis.PlatformServices.dll": {}
}
},
"Google.Apis.Core/1.11.1": {
"type": "package",
"dependencies": {
"Newtonsoft.Json": "7.0.1"
},
"compile": {
"lib/net45/Google.Apis.Core.dll": {}
},
"runtime": {
"lib/net45/Google.Apis.Core.dll": {}
}
},
"Ix-Async/1.2.5": { "Ix-Async/1.2.5": {
"type": "package", "type": "package",
"frameworkAssemblies": [ "frameworkAssemblies": [
@ -262,15 +234,6 @@
"jQuery/1.6.4": { "jQuery/1.6.4": {
"type": "package" "type": "package"
}, },
"log4net/2.0.3": {
"type": "package",
"compile": {
"lib/net40-full/log4net.dll": {}
},
"runtime": {
"lib/net40-full/log4net.dll": {}
}
},
"MailKit/1.12.0": { "MailKit/1.12.0": {
"type": "package", "type": "package",
"dependencies": { "dependencies": {
@ -2860,15 +2823,6 @@
"frameworkAssemblies": [ "frameworkAssemblies": [
"System.ComponentModel.DataAnnotations" "System.ComponentModel.DataAnnotations"
] ]
},
"Zlib.Portable.Signed/1.11.0": {
"type": "package",
"compile": {
"lib/portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid/Zlib.Portable.dll": {}
},
"runtime": {
"lib/portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid/Zlib.Portable.dll": {}
}
} }
}, },
"DNX,Version=v4.5.1/debian.8-x86": { "DNX,Version=v4.5.1/debian.8-x86": {
@ -3087,34 +3041,6 @@
"lib/dnx451/Extensions.AspNet.Authentication.Instagram.dll": {} "lib/dnx451/Extensions.AspNet.Authentication.Instagram.dll": {}
} }
}, },
"Google.Apis/1.11.1": {
"type": "package",
"dependencies": {
"Google.Apis.Core": "1.11.1",
"log4net": "2.0.3",
"Zlib.Portable.Signed": "1.11.0"
},
"compile": {
"lib/net45/Google.Apis.dll": {},
"lib/net45/Google.Apis.PlatformServices.dll": {}
},
"runtime": {
"lib/net45/Google.Apis.dll": {},
"lib/net45/Google.Apis.PlatformServices.dll": {}
}
},
"Google.Apis.Core/1.11.1": {
"type": "package",
"dependencies": {
"Newtonsoft.Json": "7.0.1"
},
"compile": {
"lib/net45/Google.Apis.Core.dll": {}
},
"runtime": {
"lib/net45/Google.Apis.Core.dll": {}
}
},
"Ix-Async/1.2.5": { "Ix-Async/1.2.5": {
"type": "package", "type": "package",
"frameworkAssemblies": [ "frameworkAssemblies": [
@ -3131,15 +3057,6 @@
"jQuery/1.6.4": { "jQuery/1.6.4": {
"type": "package" "type": "package"
}, },
"log4net/2.0.3": {
"type": "package",
"compile": {
"lib/net40-full/log4net.dll": {}
},
"runtime": {
"lib/net40-full/log4net.dll": {}
}
},
"MailKit/1.12.0": { "MailKit/1.12.0": {
"type": "package", "type": "package",
"dependencies": { "dependencies": {
@ -5729,15 +5646,6 @@
"frameworkAssemblies": [ "frameworkAssemblies": [
"System.ComponentModel.DataAnnotations" "System.ComponentModel.DataAnnotations"
] ]
},
"Zlib.Portable.Signed/1.11.0": {
"type": "package",
"compile": {
"lib/portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid/Zlib.Portable.dll": {}
},
"runtime": {
"lib/portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid/Zlib.Portable.dll": {}
}
} }
}, },
"DNX,Version=v4.5.1/debian.8-x64": { "DNX,Version=v4.5.1/debian.8-x64": {
@ -5956,34 +5864,6 @@
"lib/dnx451/Extensions.AspNet.Authentication.Instagram.dll": {} "lib/dnx451/Extensions.AspNet.Authentication.Instagram.dll": {}
} }
}, },
"Google.Apis/1.11.1": {
"type": "package",
"dependencies": {
"Google.Apis.Core": "1.11.1",
"log4net": "2.0.3",
"Zlib.Portable.Signed": "1.11.0"
},
"compile": {
"lib/net45/Google.Apis.dll": {},
"lib/net45/Google.Apis.PlatformServices.dll": {}
},
"runtime": {
"lib/net45/Google.Apis.dll": {},
"lib/net45/Google.Apis.PlatformServices.dll": {}
}
},
"Google.Apis.Core/1.11.1": {
"type": "package",
"dependencies": {
"Newtonsoft.Json": "7.0.1"
},
"compile": {
"lib/net45/Google.Apis.Core.dll": {}
},
"runtime": {
"lib/net45/Google.Apis.Core.dll": {}
}
},
"Ix-Async/1.2.5": { "Ix-Async/1.2.5": {
"type": "package", "type": "package",
"frameworkAssemblies": [ "frameworkAssemblies": [
@ -6000,15 +5880,6 @@
"jQuery/1.6.4": { "jQuery/1.6.4": {
"type": "package" "type": "package"
}, },
"log4net/2.0.3": {
"type": "package",
"compile": {
"lib/net40-full/log4net.dll": {}
},
"runtime": {
"lib/net40-full/log4net.dll": {}
}
},
"MailKit/1.12.0": { "MailKit/1.12.0": {
"type": "package", "type": "package",
"dependencies": { "dependencies": {
@ -8598,15 +8469,6 @@
"frameworkAssemblies": [ "frameworkAssemblies": [
"System.ComponentModel.DataAnnotations" "System.ComponentModel.DataAnnotations"
] ]
},
"Zlib.Portable.Signed/1.11.0": {
"type": "package",
"compile": {
"lib/portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid/Zlib.Portable.dll": {}
},
"runtime": {
"lib/portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid/Zlib.Portable.dll": {}
}
} }
} }
}, },
@ -8771,59 +8633,6 @@
"repo.json" "repo.json"
] ]
}, },
"Google.Apis/1.11.1": {
"type": "package",
"sha512": "GyWdeflVhu01TYh/KOoMceFYy4rc3+uGKFFw17PpABfdRM1wqCiO73asytkcMGUS91GjPwcONZF5UIjDKpeUSQ==",
"files": [
"Google.Apis.1.11.1.nupkg",
"Google.Apis.1.11.1.nupkg.sha512",
"Google.Apis.nuspec",
"lib/net45/Google.Apis.dll",
"lib/net45/Google.Apis.pdb",
"lib/net45/Google.Apis.PlatformServices.dll",
"lib/net45/Google.Apis.PlatformServices.pdb",
"lib/net45/Google.Apis.PlatformServices.xml",
"lib/net45/Google.Apis.xml",
"lib/portable-net45+sl50+netcore45+wpa81+wp8/Google.Apis.dll",
"lib/portable-net45+sl50+netcore45+wpa81+wp8/Google.Apis.pdb",
"lib/portable-net45+sl50+netcore45+wpa81+wp8/Google.Apis.xml",
"lib/win81/Google.Apis.dll",
"lib/win81/Google.Apis.pdb",
"lib/win81/Google.Apis.PlatformServices.dll",
"lib/win81/Google.Apis.PlatformServices.pdb",
"lib/win81/Google.Apis.PlatformServices.xml",
"lib/win81/Google.Apis.xml",
"lib/wp8/Google.Apis.dll",
"lib/wp8/Google.Apis.pdb",
"lib/wp8/Google.Apis.PlatformServices.dll",
"lib/wp8/Google.Apis.PlatformServices.pdb",
"lib/wp8/Google.Apis.PlatformServices.xml",
"lib/wp8/Google.Apis.xml",
"lib/wpa81/Google.Apis.dll",
"lib/wpa81/Google.Apis.pdb",
"lib/wpa81/Google.Apis.PlatformServices.dll",
"lib/wpa81/Google.Apis.PlatformServices.pdb",
"lib/wpa81/Google.Apis.PlatformServices.xml",
"lib/wpa81/Google.Apis.xml",
"License.txt"
]
},
"Google.Apis.Core/1.11.1": {
"type": "package",
"sha512": "0Vg/D4BhfPFrlp5iPmp2WxTm3TpgQuwsd9jiYoVXhnbecTnVhRNqY0sJTK8yoMm+otuJ4Dt1C7KSeQ0yWA1d/g==",
"files": [
"Google.Apis.Core.1.11.1.nupkg",
"Google.Apis.Core.1.11.1.nupkg.sha512",
"Google.Apis.Core.nuspec",
"lib/net45/Google.Apis.Core.dll",
"lib/net45/Google.Apis.Core.pdb",
"lib/net45/Google.Apis.Core.xml",
"lib/portable-net45+sl50+netcore45+wpa81+wp8/Google.Apis.Core.dll",
"lib/portable-net45+sl50+netcore45+wpa81+wp8/Google.Apis.Core.pdb",
"lib/portable-net45+sl50+netcore45+wpa81+wp8/Google.Apis.Core.xml",
"License.txt"
]
},
"Ix-Async/1.2.5": { "Ix-Async/1.2.5": {
"type": "package", "type": "package",
"sha512": "8EXO8q7cpDUH9G2q+UOPOO/6uZ9aN7mx/4xjFIfkp+qLWVJiYuglkRhjY8Ggs2CucXzHR8GHnovJKB5yQoYaJg==", "sha512": "8EXO8q7cpDUH9G2q+UOPOO/6uZ9aN7mx/4xjFIfkp+qLWVJiYuglkRhjY8Ggs2CucXzHR8GHnovJKB5yQoYaJg==",
@ -8854,29 +8663,6 @@
"Tools/uninstall.ps1" "Tools/uninstall.ps1"
] ]
}, },
"log4net/2.0.3": {
"type": "package",
"sha512": "rxMHzK5efGPo5XtRnuUGO4tfW5l74Aji6kVmtMAt2SgcB5PHBNtNY7yj2LCI2VtKrLPO7kCKR6kH6lIZggq3Gg==",
"files": [
"lib/net10-full/log4net.dll",
"lib/net10-full/log4net.xml",
"lib/net11-full/log4net.dll",
"lib/net11-full/log4net.xml",
"lib/net20-full/log4net.dll",
"lib/net20-full/log4net.xml",
"lib/net35-client/log4net.dll",
"lib/net35-client/log4net.xml",
"lib/net35-full/log4net.dll",
"lib/net35-full/log4net.xml",
"lib/net40-client/log4net.dll",
"lib/net40-client/log4net.xml",
"lib/net40-full/log4net.dll",
"lib/net40-full/log4net.xml",
"log4net.2.0.3.nupkg",
"log4net.2.0.3.nupkg.sha512",
"log4net.nuspec"
]
},
"MailKit/1.12.0": { "MailKit/1.12.0": {
"type": "package", "type": "package",
"sha512": "6h6PkKAuMSaTEjXMVSgBqqMrhcRgtBfFwJwA0qxqpQ32IvtG4v2vphB3IBRa3UjX4g1GaWRC+tHwivXGlZ0CtA==", "sha512": "6h6PkKAuMSaTEjXMVSgBqqMrhcRgtBfFwJwA0qxqpQ32IvtG4v2vphB3IBRa3UjX4g1GaWRC+tHwivXGlZ0CtA==",
@ -11548,17 +11334,6 @@
"WebGrease.1.5.2.nupkg.sha512", "WebGrease.1.5.2.nupkg.sha512",
"WebGrease.nuspec" "WebGrease.nuspec"
] ]
},
"Zlib.Portable.Signed/1.11.0": {
"type": "package",
"sha512": "1f4itCxlSBxU8kf85qUmx1+d0iHKLeZK8S7ilb4w0t+uV+/xtOUUVOEAnFMG5uHVBc7L+ycZjWQoA+a1GZKYjg==",
"files": [
"lib/portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid/Zlib.Portable.dll",
"lib/portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid/Zlib.Portable.xml",
"Zlib.Portable.Signed.1.11.0.nupkg",
"Zlib.Portable.Signed.1.11.0.nupkg.sha512",
"Zlib.Portable.Signed.nuspec"
]
} }
}, },
"projectFileDependencyGroups": { "projectFileDependencyGroups": {
@ -11569,8 +11344,6 @@
"EntityFramework.Relational >= 7.0.0-rc1-final", "EntityFramework.Relational >= 7.0.0-rc1-final",
"EntityFramework7.Npgsql >= 3.1.0-rc1-3", "EntityFramework7.Npgsql >= 3.1.0-rc1-3",
"EntityFramework7.Npgsql.Design >= 3.1.0-rc1-5", "EntityFramework7.Npgsql.Design >= 3.1.0-rc1-5",
"Google.Apis.Core >= 1.11.1",
"Google.Apis >= 1.11.1",
"MailKit >= 1.12.0", "MailKit >= 1.12.0",
"MarkdownDeep-av.NET >= 1.5.6", "MarkdownDeep-av.NET >= 1.5.6",
"Microsoft.AspNet.Authentication.Cookies >= 1.0.0-rc1-final", "Microsoft.AspNet.Authentication.Cookies >= 1.0.0-rc1-final",

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@ -0,0 +1,28 @@
+(function($) {
var allowCircleToBlog = function(e) {
var allow = $(this).prop('checked');
var circleid = $(this).data('circle-id');
var targetid = $(this).data('target-id');
var auth = { CircleId: circleid, BlogPostId: targetid };
var url = '/api/blogacl';
if (!allow) url += '/' + circleid;
console.log(auth);
$.ajax({
url: url,
type: allow ? 'POST' : 'DELETE',
data: JSON.stringify(auth),
contentType: "application/json;charset=utf-8",
success: function(data) {
console.log('auth ' + allow ? 'POSTED' : 'DELETED' + data);
},
error: function() {
console.log('Error @' + allow ? 'POSTed' : 'DELETEd');
}
});
e.preventDefault();
};
$(document).ready(function() {
$('input.Blogcirle[type=checkbox]').on('change', allowCircleToBlog);
$('.input-group.date').datetimepicker();
});
})(jQuery);

@ -1,26 +1,5 @@
+(function($) { +(function($) {
var allowCircleToBlog = function(e) {
var allow = $(this).prop('checked');
var circleid = $(this).data('circle-id');
var targetid = $(this).data('target-id');
var auth = { CircleId: circleid, BlogPostId: targetid };
var url = '/api/blogacl';
if (!allow) url += '/' + circleid;
console.log(auth);
$.ajax({
url: url,
type: allow ? 'POST' : 'DELETE',
data: JSON.stringify(auth),
contentType: "application/json;charset=utf-8",
success: function(data) {
console.log('auth ' + allow ? 'POSTED' : 'DELETED' + data);
},
error: function() {
console.log('Error @' + allow ? 'POSTed' : 'DELETEd');
}
});
e.preventDefault();
};
function notifClick(nid) { function notifClick(nid) {
if (nid > 0) {  if (nid > 0) { 
@ -29,7 +8,4 @@
.always(function() {}); .always(function() {});
} }
} }
$(document).ready(function() {
$('input.Blogcirle[type=checkbox]').on('change', allowCircleToBlog);
});
})(jQuery); })(jQuery);
Loading…