minor changes

vnext
Paul Schneider 7 years ago
parent 4ab22d0e6a
commit 808eaa2513
7 changed files with 67 additions and 1293 deletions

@ -229,6 +229,7 @@ Le client final: {clientFinal}
// TODO utiliser Markdown-av+tags // TODO utiliser Markdown-av+tags
var uid = User.GetUserId(); var uid = User.GetUserId();
var prid = model.PerformerId; var prid = model.PerformerId;
var brusherProfile = await _context.BrusherProfile.SingleAsync(p => p.UserId == prid);
long[] longtaintIds = null; long[] longtaintIds = null;
List<HairTaint> colors = null; List<HairTaint> colors = null;
@ -246,52 +247,52 @@ Le client final: {clientFinal}
{ {
_logger.LogInformation("le Model _est_ valide."); _logger.LogInformation("le Model _est_ valide.");
var pro = _context.Performers.Include( var pro = _context.Performers.Include(
u => u.Performer u => u.Performer
).Include(u => u.Performer.Devices) ).Include(u => u.Performer.Devices)
.FirstOrDefault( .FirstOrDefault(
x => x.PerformerId == model.PerformerId x => x.PerformerId == model.PerformerId
); );
if (taintIds != null) if (taintIds != null)
{ {
longtaintIds = taintIds.Split(',').Select(s => long.Parse(s)).ToArray(); longtaintIds = taintIds.Split(',').Select(s => long.Parse(s)).ToArray();
colors = _context.HairTaint.Where(t => longtaintIds.Contains(t.Id)).ToList(); colors = _context.HairTaint.Where(t => longtaintIds.Contains(t.Id)).ToList();
// a Prestation is required // a Prestation is required
model.Prestation.Taints = colors.Select(c => model.Prestation.Taints = colors.Select(c =>
new HairTaintInstance { Taint = c }).ToList(); new HairTaintInstance { Taint = c }).ToList();
} }
// Une prestation pour enfant ou homme inclut toujours la coupe. // Une prestation pour enfant ou homme inclut toujours la coupe.
if (model.Prestation.Gender != HairCutGenders.Women) if (model.Prestation.Gender != HairCutGenders.Women)
model.Prestation.Cut = true; model.Prestation.Cut = true;
if (model.Location != null) if (model.Location != null)
{ {
var existingLocation = await _context.Locations.FirstOrDefaultAsync(x => x.Address == model.Location.Address var existingLocation = await _context.Locations.FirstOrDefaultAsync(x => x.Address == model.Location.Address
&& x.Longitude == model.Location.Longitude && x.Latitude == model.Location.Latitude); && x.Longitude == model.Location.Longitude && x.Latitude == model.Location.Latitude);
if (existingLocation != null) if (existingLocation != null)
{ {
model.Location = existingLocation; model.Location = existingLocation;
} }
else _context.Attach<Location>(model.Location); else _context.Attach<Location>(model.Location);
} }
var existingPrestation = await _context.HairPrestation.FirstOrDefaultAsync(x => model.PrestationId == x.Id); var existingPrestation = await _context.HairPrestation.FirstOrDefaultAsync(x => model.PrestationId == x.Id);
if (existingPrestation != null) if (existingPrestation != null)
{ {
model.Prestation = existingPrestation; model.Prestation = existingPrestation;
} }
else _context.Attach<HairPrestation>(model.Prestation); else _context.Attach<HairPrestation>(model.Prestation);
_context.HairCutQueries.Add(model); _context.HairCutQueries.Add(model);
var brusherProfile = await _context.BrusherProfile.SingleAsync(p => p.UserId == pro.PerformerId);
await _context.SaveChangesAsync(uid);
await _context.SaveChangesAsync(uid);
_logger.LogInformation("la donnée _est_ sauvée."); _logger.LogInformation("la donnée _est_ sauvée.");
var yaev = model.CreateNewHairCutQueryEvent(_localizer);
MessageWithPayloadResponse grep = null; MessageWithPayloadResponse grep = null;
model.SelectedProfile = brusherProfile;
var yaev = model.CreateNewHairCutQueryEvent(_localizer);
if (pro.AcceptPublicContact) if (pro.AcceptPublicContact)
{ {
@ -344,6 +345,7 @@ Le client final: {clientFinal}
} }
ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == model.ActivityCode); ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == model.ActivityCode);
ViewBag.GoogleSettings = _googleSettings; ViewBag.GoogleSettings = _googleSettings;
model.SelectedProfile = brusherProfile;
SetViewData(model.ActivityCode, model.PerformerId, model.Prestation); SetViewData(model.ActivityCode, model.PerformerId, model.Prestation);
return View("HairCut", model); return View("HairCut", model);
} }

@ -273,10 +273,14 @@ namespace Yavsc.Controllers
[HttpGet] [HttpGet]
public async Task<IActionResult> SetGoogleCalendar(string returnUrl, string pageToken) public async Task<IActionResult> SetGoogleCalendar(string returnUrl, string pageToken)
{ {
var calendar = await _calendarManager.GetCalendarsAsync(User.GetUserId(), pageToken);
if (calendar == null)
return new ChallengeResult();
return View(new SetGoogleCalendarViewModel { return View(new SetGoogleCalendarViewModel {
ReturnUrl = returnUrl, ReturnUrl = returnUrl,
Calendars = await _calendarManager.GetCalendarsAsync(User.GetUserId(), pageToken) Calendars = calendar
}); });
} }

@ -2,7 +2,7 @@ DESTDIR=/srv/www/yavscpre
PRODDESTDIR=/srv/www/yavsc PRODDESTDIR=/srv/www/yavsc
ASPNET_ENV=Development ASPNET_ENV=Development
CONFIGURATION=Release CONFIGURATION=Release
ASPNET_LOG_LEVEL=warn ASPNET_LOG_LEVEL=info #warn
all: bin/$(CONFIGURATION) all: bin/$(CONFIGURATION)

@ -70,10 +70,8 @@ namespace Yavsc.Models.Haircut
List<IBillItem> bill = new List<IBillItem>(); List<IBillItem> bill = new List<IBillItem>();
#if DEBUG if (this.Prestation==null) throw new InvalidOperationException("Prestation property is null");
if (this.Prestation==null) throw new InvalidOperationException("Prestation"); if (this.SelectedProfile==null) throw new InvalidOperationException("SelectedProfile property is null");
if (this.SelectedProfile==null) throw new InvalidOperationException("SelectedProfile");
#endif
// Le shampoing // Le shampoing
if (this.Prestation.Shampoo) if (this.Prestation.Shampoo)
bill.Add(new CommandLine { Name = "Shampoing", Description="Shampoing", UnitaryCost = SelectedProfile.ShampooPrice }); bill.Add(new CommandLine { Name = "Shampoing", Description="Shampoing", UnitaryCost = SelectedProfile.ShampooPrice });

@ -238,6 +238,7 @@ namespace Yavsc.Services
public async Task<CalendarService> CreateUserCalendarServiceAsync(string userId) public async Task<CalendarService> CreateUserCalendarServiceAsync(string userId)
{ {
var login = await _dbContext.GetGoogleUserLoginAsync(userId); var login = await _dbContext.GetGoogleUserLoginAsync(userId);
if (login == null) return null;
var token = await _flow.LoadTokenAsync(login.ProviderKey, CancellationToken.None); var token = await _flow.LoadTokenAsync(login.ProviderKey, CancellationToken.None);
UserCredential cred = new UserCredential(_flow,login.ProviderKey,token); UserCredential cred = new UserCredential(_flow,login.ProviderKey,token);
return new CalendarService(new BaseClientService.Initializer() return new CalendarService(new BaseClientService.Initializer()

File diff suppressed because it is too large Load Diff

@ -261,7 +261,7 @@
"lib/net451/MailKit.dll": {} "lib/net451/MailKit.dll": {}
} }
}, },
"MarkdownDeep-av.NET/1.5.6.3": { "MarkdownDeep-av.NET/1.5.6": {
"type": "package", "type": "package",
"compile": { "compile": {
"lib/net451/MarkdownDeep.dll": {} "lib/net451/MarkdownDeep.dll": {}
@ -2834,7 +2834,7 @@
] ]
} }
}, },
"DNX,Version=v4.5.1/win7-x86": { "DNX,Version=v4.5.1/debian.9-x86": {
"Antlr/3.4.1.9004": { "Antlr/3.4.1.9004": {
"type": "package", "type": "package",
"compile": { "compile": {
@ -3093,7 +3093,7 @@
"lib/net451/MailKit.dll": {} "lib/net451/MailKit.dll": {}
} }
}, },
"MarkdownDeep-av.NET/1.5.6.3": { "MarkdownDeep-av.NET/1.5.6": {
"type": "package", "type": "package",
"compile": { "compile": {
"lib/net451/MarkdownDeep.dll": {} "lib/net451/MarkdownDeep.dll": {}
@ -4136,9 +4136,6 @@
}, },
"runtime": { "runtime": {
"lib/dnx451/Microsoft.AspNet.Server.Kestrel.dll": {} "lib/dnx451/Microsoft.AspNet.Server.Kestrel.dll": {}
},
"native": {
"runtimes/win7-x86/native/libuv.dll": {}
} }
}, },
"Microsoft.AspNet.Server.WebListener/1.0.0-rc1-final": { "Microsoft.AspNet.Server.WebListener/1.0.0-rc1-final": {
@ -4343,12 +4340,7 @@
} }
}, },
"Microsoft.DiaSymReader.Native/1.5.0": { "Microsoft.DiaSymReader.Native/1.5.0": {
"type": "package", "type": "package"
"native": {
"runtimes/win/native/Microsoft.DiaSymReader.Native.amd64.dll": {},
"runtimes/win/native/Microsoft.DiaSymReader.Native.arm.dll": {},
"runtimes/win/native/Microsoft.DiaSymReader.Native.x86.dll": {}
}
}, },
"Microsoft.Dnx.Compilation.Abstractions/1.0.0-rc1-final": { "Microsoft.Dnx.Compilation.Abstractions/1.0.0-rc1-final": {
"type": "package", "type": "package",
@ -5674,7 +5666,7 @@
] ]
} }
}, },
"DNX,Version=v4.5.1/win7-x64": { "DNX,Version=v4.5.1/debian.9-x64": {
"Antlr/3.4.1.9004": { "Antlr/3.4.1.9004": {
"type": "package", "type": "package",
"compile": { "compile": {
@ -5933,7 +5925,7 @@
"lib/net451/MailKit.dll": {} "lib/net451/MailKit.dll": {}
} }
}, },
"MarkdownDeep-av.NET/1.5.6.3": { "MarkdownDeep-av.NET/1.5.6": {
"type": "package", "type": "package",
"compile": { "compile": {
"lib/net451/MarkdownDeep.dll": {} "lib/net451/MarkdownDeep.dll": {}
@ -6976,9 +6968,6 @@
}, },
"runtime": { "runtime": {
"lib/dnx451/Microsoft.AspNet.Server.Kestrel.dll": {} "lib/dnx451/Microsoft.AspNet.Server.Kestrel.dll": {}
},
"native": {
"runtimes/win7-x64/native/libuv.dll": {}
} }
}, },
"Microsoft.AspNet.Server.WebListener/1.0.0-rc1-final": { "Microsoft.AspNet.Server.WebListener/1.0.0-rc1-final": {
@ -7183,12 +7172,7 @@
} }
}, },
"Microsoft.DiaSymReader.Native/1.5.0": { "Microsoft.DiaSymReader.Native/1.5.0": {
"type": "package", "type": "package"
"native": {
"runtimes/win/native/Microsoft.DiaSymReader.Native.amd64.dll": {},
"runtimes/win/native/Microsoft.DiaSymReader.Native.arm.dll": {},
"runtimes/win/native/Microsoft.DiaSymReader.Native.x86.dll": {}
}
}, },
"Microsoft.Dnx.Compilation.Abstractions/1.0.0-rc1-final": { "Microsoft.Dnx.Compilation.Abstractions/1.0.0-rc1-final": {
"type": "package", "type": "package",
@ -8743,15 +8727,15 @@
"MailKit.nuspec" "MailKit.nuspec"
] ]
}, },
"MarkdownDeep-av.NET/1.5.6.3": { "MarkdownDeep-av.NET/1.5.6": {
"type": "package", "type": "package",
"sha512": "ToMBBut9I6k5WV3lv42D7NTwqL67+JS5CNVgc89+3gVk8n1Y2faSbNOKv1qfYQ0Dt9591iAZyIGhBdnptxzX5A==", "sha512": "/nK/Hzru+vAmNGX5tZtEkKxCqjUS8a/u1vZaQ4pEmlvm6C9IIJ5rWIJephDWVwbzi6eKdEeduU+xmPfLNXrQwQ==",
"files": [ "files": [
"lib/dnxcore50/MarkdownDeep.dll", "lib/dnxcore50/MarkdownDeep.dll",
"lib/MonoAndroid10/MarkdownDeep.dll",
"lib/net451/MarkdownDeep.dll", "lib/net451/MarkdownDeep.dll",
"lib/portable-net45+win8+wpa81+wp8/MarkdownDeep.dll", "MarkdownDeep-av.NET.1.5.6.nupkg",
"MarkdownDeep-av.NET.1.5.6.3.nupkg", "MarkdownDeep-av.NET.1.5.6.nupkg.sha512",
"MarkdownDeep-av.NET.1.5.6.3.nupkg.sha512",
"MarkdownDeep-av.NET.nuspec" "MarkdownDeep-av.NET.nuspec"
] ]
}, },
@ -11014,7 +10998,7 @@
"System.Reflection.Metadata/1.1.0": { "System.Reflection.Metadata/1.1.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "RLIE4sSt2zngMLuqM6YmxBH99mTumtT4DNZE4+msfEaInUP5iCLQT+BHPl+2cjSAP1pdALyAjLB8RtCB+WGGWQ==", "sha512": "a8VsRm/B0Ik1o5FumSMWmpwbG7cvIIajAYhzTTy9VB9XItByJDQHGZkQTIAdsvVJ6MI5O3uH/lb0izgQDlDIWA==",
"files": [ "files": [
"lib/dotnet5.2/System.Reflection.Metadata.dll", "lib/dotnet5.2/System.Reflection.Metadata.dll",
"lib/dotnet5.2/System.Reflection.Metadata.xml", "lib/dotnet5.2/System.Reflection.Metadata.xml",

Loading…