diff --git a/Yavsc/ApiControllers/ApplicationUserApiController.cs b/Yavsc/ApiControllers/ApplicationUserApiController.cs index 6ab29293..618ba30a 100644 --- a/Yavsc/ApiControllers/ApplicationUserApiController.cs +++ b/Yavsc/ApiControllers/ApplicationUserApiController.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Security.Claims; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc; @@ -63,7 +64,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -92,7 +93,7 @@ namespace Yavsc.Controllers _context.Users.Add(applicationUser); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -125,7 +126,7 @@ namespace Yavsc.Controllers } _context.Users.Remove(applicationUser); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(applicationUser); } diff --git a/Yavsc/ApiControllers/BlackListApiController.cs b/Yavsc/ApiControllers/BlackListApiController.cs index 379eea9a..50dcd8e1 100644 --- a/Yavsc/ApiControllers/BlackListApiController.cs +++ b/Yavsc/ApiControllers/BlackListApiController.cs @@ -75,7 +75,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -107,7 +107,7 @@ namespace Yavsc.Controllers _context.BlackListed.Add(blackListed); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -143,7 +143,7 @@ namespace Yavsc.Controllers return HttpBadRequest(); _context.BlackListed.Remove(blackListed); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(blackListed); } diff --git a/Yavsc/ApiControllers/BlogAclApiController.cs b/Yavsc/ApiControllers/BlogAclApiController.cs index 92253043..0f884302 100644 --- a/Yavsc/ApiControllers/BlogAclApiController.cs +++ b/Yavsc/ApiControllers/BlogAclApiController.cs @@ -70,7 +70,7 @@ namespace Yavsc.Controllers try { - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -109,7 +109,7 @@ namespace Yavsc.Controllers _context.BlogACL.Add(circleAuthorizationToBlogPost); try { - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); } catch (DbUpdateException) { @@ -145,7 +145,7 @@ namespace Yavsc.Controllers return HttpNotFound(); } _context.BlogACL.Remove(circleAuthorizationToBlogPost); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return Ok(circleAuthorizationToBlogPost); } diff --git a/Yavsc/ApiControllers/BlogApiController.cs b/Yavsc/ApiControllers/BlogApiController.cs index a60142bd..86be090f 100644 --- a/Yavsc/ApiControllers/BlogApiController.cs +++ b/Yavsc/ApiControllers/BlogApiController.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Security.Claims; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc; using Microsoft.Data.Entity; @@ -62,7 +63,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -91,7 +92,7 @@ namespace Yavsc.Controllers _context.Blogspot.Add(blog); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -124,7 +125,7 @@ namespace Yavsc.Controllers } _context.Blogspot.Remove(blog); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(blog); } diff --git a/Yavsc/ApiControllers/BookQueryApiController.cs b/Yavsc/ApiControllers/BookQueryApiController.cs index 9a8d9367..74d7f54e 100644 --- a/Yavsc/ApiControllers/BookQueryApiController.cs +++ b/Yavsc/ApiControllers/BookQueryApiController.cs @@ -102,7 +102,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -136,7 +136,7 @@ namespace Yavsc.Controllers _context.Commands.Add(bookQuery); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -171,7 +171,7 @@ namespace Yavsc.Controllers if (bookQuery.ClientId != uid) return HttpNotFound(); _context.Commands.Remove(bookQuery); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(bookQuery); } diff --git a/Yavsc/ApiControllers/CircleApiController.cs b/Yavsc/ApiControllers/CircleApiController.cs index a5fbe226..bc636f73 100644 --- a/Yavsc/ApiControllers/CircleApiController.cs +++ b/Yavsc/ApiControllers/CircleApiController.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc; @@ -64,7 +65,7 @@ namespace Yavsc.Controllers try { - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -93,7 +94,7 @@ namespace Yavsc.Controllers _context.Circle.Add(circle); try { - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); } catch (DbUpdateException) { @@ -126,7 +127,7 @@ namespace Yavsc.Controllers } _context.Circle.Remove(circle); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return Ok(circle); } diff --git a/Yavsc/ApiControllers/ContactsApiController.cs b/Yavsc/ApiControllers/ContactsApiController.cs index 6e217d26..ee1f6234 100644 --- a/Yavsc/ApiControllers/ContactsApiController.cs +++ b/Yavsc/ApiControllers/ContactsApiController.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Security.Claims; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc; using Microsoft.Data.Entity; @@ -43,7 +44,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -72,7 +73,7 @@ namespace Yavsc.Controllers _context.ClientProviderInfo.Add(clientProviderInfo); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -105,7 +106,7 @@ namespace Yavsc.Controllers } _context.ClientProviderInfo.Remove(clientProviderInfo); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(clientProviderInfo); } diff --git a/Yavsc/ApiControllers/DimissClicksApiController.cs b/Yavsc/ApiControllers/DimissClicksApiController.cs index a51f7d89..d8c6cdc7 100644 --- a/Yavsc/ApiControllers/DimissClicksApiController.cs +++ b/Yavsc/ApiControllers/DimissClicksApiController.cs @@ -86,7 +86,7 @@ namespace Yavsc.Controllers try { - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -118,7 +118,7 @@ namespace Yavsc.Controllers _context.DimissClicked.Add(dimissClicked); try { - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); } catch (DbUpdateException) { @@ -155,7 +155,7 @@ namespace Yavsc.Controllers } _context.DimissClicked.Remove(dimissClicked); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return Ok(dimissClicked); } diff --git a/Yavsc/ApiControllers/EstimateApiController.cs b/Yavsc/ApiControllers/EstimateApiController.cs index 59e601ab..6ae3ce8c 100644 --- a/Yavsc/ApiControllers/EstimateApiController.cs +++ b/Yavsc/ApiControllers/EstimateApiController.cs @@ -91,7 +91,7 @@ namespace Yavsc.Controllers var entry = _context.Attach(estimate); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -143,7 +143,7 @@ namespace Yavsc.Controllers */ try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -184,7 +184,7 @@ namespace Yavsc.Controllers } } _context.Estimates.Remove(estimate); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(estimate); } diff --git a/Yavsc/ApiControllers/EstimateTemplatesApiController.cs b/Yavsc/ApiControllers/EstimateTemplatesApiController.cs index 921ff548..19b73f83 100644 --- a/Yavsc/ApiControllers/EstimateTemplatesApiController.cs +++ b/Yavsc/ApiControllers/EstimateTemplatesApiController.cs @@ -70,7 +70,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -100,7 +100,7 @@ namespace Yavsc.Controllers _context.EstimateTemplates.Add(estimateTemplate); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -137,7 +137,7 @@ namespace Yavsc.Controllers return new HttpStatusCodeResult(StatusCodes.Status403Forbidden); _context.EstimateTemplates.Remove(estimateTemplate); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(estimateTemplate); } diff --git a/Yavsc/ApiControllers/FileSystemApiController.cs b/Yavsc/ApiControllers/FileSystemApiController.cs index b2231447..dde4474e 100644 --- a/Yavsc/ApiControllers/FileSystemApiController.cs +++ b/Yavsc/ApiControllers/FileSystemApiController.cs @@ -57,7 +57,7 @@ namespace Yavsc.ApiControllers foreach (var f in Request.Form.Files) { var item = user.ReceiveUserFile(root, f); - dbContext.SaveChanges(); + dbContext.SaveChanges(User.GetUserId()); yield return item; }; } diff --git a/Yavsc/ApiControllers/GCMController.cs b/Yavsc/ApiControllers/GCMController.cs index 189b384f..aa0ebcd4 100644 --- a/Yavsc/ApiControllers/GCMController.cs +++ b/Yavsc/ApiControllers/GCMController.cs @@ -48,7 +48,7 @@ public class GCMController : Controller alreadyRegisteredDevice.Platform = declaration.Platform; alreadyRegisteredDevice.Version = declaration.Version; _context.Update(alreadyRegisteredDevice); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } else { @@ -56,7 +56,7 @@ public class GCMController : Controller declaration.DeclarationDate = DateTime.Now; declaration.DeviceOwnerId = uid; _context.GCMDevices.Add(declaration as GoogleCloudMobileDeclaration); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } var latestActivityUpdate = _context.Activities.Max(a=>a.DateModified); return Json(new { diff --git a/Yavsc/ApiControllers/MusicalPreferencesApiController.cs b/Yavsc/ApiControllers/MusicalPreferencesApiController.cs index 35bf5f08..b5a06ea5 100644 --- a/Yavsc/ApiControllers/MusicalPreferencesApiController.cs +++ b/Yavsc/ApiControllers/MusicalPreferencesApiController.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Security.Claims; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc; using Microsoft.Data.Entity; @@ -62,7 +63,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -91,7 +92,7 @@ namespace Yavsc.Controllers _context.MusicalPreferences.Add(musicalPreference); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -124,7 +125,7 @@ namespace Yavsc.Controllers } _context.MusicalPreferences.Remove(musicalPreference); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(musicalPreference); } diff --git a/Yavsc/ApiControllers/MusicalTendenciesApiController.cs b/Yavsc/ApiControllers/MusicalTendenciesApiController.cs index 9dcb81d1..5f0cb222 100644 --- a/Yavsc/ApiControllers/MusicalTendenciesApiController.cs +++ b/Yavsc/ApiControllers/MusicalTendenciesApiController.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Security.Claims; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc; using Microsoft.Data.Entity; @@ -63,7 +64,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -92,7 +93,7 @@ namespace Yavsc.Controllers _context.MusicalTendency.Add(musicalTendency); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -125,7 +126,7 @@ namespace Yavsc.Controllers } _context.MusicalTendency.Remove(musicalTendency); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(musicalTendency); } diff --git a/Yavsc/ApiControllers/PdfEstimateController.cs b/Yavsc/ApiControllers/PdfEstimateController.cs index 5fbd6816..78e09c53 100644 --- a/Yavsc/ApiControllers/PdfEstimateController.cs +++ b/Yavsc/ApiControllers/PdfEstimateController.cs @@ -104,7 +104,7 @@ namespace Yavsc.ApiControllers return new BadRequestResult(); User.ReceiveProSignature(id,Request.Form.Files[0],"pro"); estimate.ProviderValidationDate = DateTime.Now; - dbContext.SaveChanges(); + dbContext.SaveChanges(User.GetUserId()); // Notify the client var locstr = _localizer["EstimationMessageToClient"]; @@ -148,7 +148,7 @@ namespace Yavsc.ApiControllers return new BadRequestResult(); User.ReceiveProSignature(id,Request.Form.Files[0],"cli"); estimate.ClientValidationDate = DateTime.Now; - dbContext.SaveChanges(); + dbContext.SaveChanges(User.GetUserId()); return Ok (new { ClientValidationDate = estimate.ClientValidationDate }); } diff --git a/Yavsc/ApiControllers/PerformersApiController.cs b/Yavsc/ApiControllers/PerformersApiController.cs index 0c2bb0b2..509cf97e 100644 --- a/Yavsc/ApiControllers/PerformersApiController.cs +++ b/Yavsc/ApiControllers/PerformersApiController.cs @@ -1,15 +1,13 @@ -using System.Collections.Generic; using Microsoft.AspNet.Mvc; using System.Linq; -using Yavsc.Models; -using Yavsc.Models.Workflow; using System.Security.Claims; using Microsoft.AspNet.Authorization; using Microsoft.Data.Entity; namespace Yavsc.Controllers { + using Models; [Produces("application/json")] [Route("api/performers")] public class PerformersApiController : Controller diff --git a/Yavsc/ApiControllers/PostRateApiController.cs b/Yavsc/ApiControllers/PostRateApiController.cs index 42cc6e44..2ecfd6b7 100644 --- a/Yavsc/ApiControllers/PostRateApiController.cs +++ b/Yavsc/ApiControllers/PostRateApiController.cs @@ -39,7 +39,7 @@ namespace Yavsc.Controllers return HttpBadRequest(); blogpost.Rate = rate; - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(); } diff --git a/Yavsc/ApiControllers/PostTagsApiController.cs b/Yavsc/ApiControllers/PostTagsApiController.cs index a2e268e7..3292a5d0 100644 --- a/Yavsc/ApiControllers/PostTagsApiController.cs +++ b/Yavsc/ApiControllers/PostTagsApiController.cs @@ -6,9 +6,10 @@ using Microsoft.Data.Entity; namespace Yavsc.Controllers { + using System.Security.Claims; using Models; using Models.Relationship; - + [Produces("application/json")] [Route("~/api/PostTagsApi")] public class PostTagsApiController : Controller @@ -64,7 +65,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -93,7 +94,7 @@ namespace Yavsc.Controllers _context.TagsDomain.Add(postTag); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -126,7 +127,7 @@ namespace Yavsc.Controllers } _context.TagsDomain.Remove(postTag); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(postTag); } diff --git a/Yavsc/ApiControllers/ProductApiController.cs b/Yavsc/ApiControllers/ProductApiController.cs index 9300ec37..7fdb0f38 100644 --- a/Yavsc/ApiControllers/ProductApiController.cs +++ b/Yavsc/ApiControllers/ProductApiController.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Security.Claims; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc; @@ -64,7 +65,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -93,7 +94,7 @@ namespace Yavsc.Controllers _context.Products.Add(product); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -126,7 +127,7 @@ namespace Yavsc.Controllers } _context.Products.Remove(product); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(product); } diff --git a/Yavsc/ApiControllers/ServiceApiController.cs b/Yavsc/ApiControllers/ServiceApiController.cs index bf1b2417..ee0d2de3 100644 --- a/Yavsc/ApiControllers/ServiceApiController.cs +++ b/Yavsc/ApiControllers/ServiceApiController.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Security.Claims; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc; @@ -64,7 +65,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -93,7 +94,7 @@ namespace Yavsc.Controllers _context.Services.Add(service); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -126,7 +127,7 @@ namespace Yavsc.Controllers } _context.Services.Remove(service); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(service); } diff --git a/Yavsc/ApiControllers/TagsApiController.cs b/Yavsc/ApiControllers/TagsApiController.cs index 8f24f0e9..d7dfb59a 100644 --- a/Yavsc/ApiControllers/TagsApiController.cs +++ b/Yavsc/ApiControllers/TagsApiController.cs @@ -7,6 +7,7 @@ using Yavsc.Models; namespace Yavsc.Controllers { + using System.Security.Claims; using Models.Relationship; [Produces("application/json")] [Route("api/TagsApi")] @@ -63,7 +64,7 @@ namespace Yavsc.Controllers try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateConcurrencyException) { @@ -92,7 +93,7 @@ namespace Yavsc.Controllers _context.Tags.Add(tag); try { - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } catch (DbUpdateException) { @@ -125,7 +126,7 @@ namespace Yavsc.Controllers } _context.Tags.Remove(tag); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return Ok(tag); } diff --git a/Yavsc/Controllers/AccountController.cs b/Yavsc/Controllers/AccountController.cs index eeaa9983..46aa79cf 100644 --- a/Yavsc/Controllers/AccountController.cs +++ b/Yavsc/Controllers/AccountController.cs @@ -241,7 +241,7 @@ namespace Yavsc.Controllers var ninfo = _dbContext.UserLogins.First(l=>l.ProviderKey == info.ProviderKey && l.LoginProvider == info.LoginProvider); ninfo.ProviderDisplayName = info.ProviderDisplayName; _dbContext.Entry(ninfo).State = EntityState.Modified; - _dbContext.SaveChanges(); + _dbContext.SaveChanges(User.GetUserId()); return Redirect(returnUrl); } diff --git a/Yavsc/Controllers/BlogspotController.cs b/Yavsc/Controllers/BlogspotController.cs index be942c25..542443b9 100644 --- a/Yavsc/Controllers/BlogspotController.cs +++ b/Yavsc/Controllers/BlogspotController.cs @@ -134,7 +134,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Blogspot.Add(blog); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } ModelState.AddModelError("Unknown","Invalid Blog posted ..."); @@ -188,7 +188,7 @@ namespace Yavsc.Controllers { // saves the change _context.Update(blog); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); ViewData["StatusMessage"] = "Post modified"; return RedirectToAction("Index"); } @@ -231,7 +231,7 @@ namespace Yavsc.Controllers if (auth.Result) { _context.Blogspot.Remove(blog); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); } return RedirectToAction("Index"); } diff --git a/Yavsc/Controllers/CircleController.cs b/Yavsc/Controllers/CircleController.cs index f439d762..56f480bf 100644 --- a/Yavsc/Controllers/CircleController.cs +++ b/Yavsc/Controllers/CircleController.cs @@ -1,4 +1,5 @@ +using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.Data.Entity; @@ -53,7 +54,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Circle.Add(circle); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } return View(circle); @@ -83,7 +84,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(circle); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } return View(circle); @@ -114,7 +115,7 @@ namespace Yavsc.Controllers { Circle circle = await _context.Circle.SingleAsync(m => m.Id == id); _context.Circle.Remove(circle); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/CircleMembersController.cs b/Yavsc/Controllers/CircleMembersController.cs index bf4bc15f..a3ad7d60 100644 --- a/Yavsc/Controllers/CircleMembersController.cs +++ b/Yavsc/Controllers/CircleMembersController.cs @@ -68,7 +68,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.CircleMembers.Add(circleMember); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } ViewData["CircleId"] = new SelectList(_context.Circle, "Id", "Name", circleMember.CircleId); @@ -102,7 +102,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(circleMember); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } ViewData["CircleId"] = new SelectList(_context.Circle, "Id", "Circle", circleMember.CircleId); @@ -135,7 +135,7 @@ namespace Yavsc.Controllers { CircleMember circleMember = await _context.CircleMembers.SingleAsync(m => m.MemberId == id); _context.CircleMembers.Remove(circleMember); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/ClientController.cs b/Yavsc/Controllers/ClientController.cs index 76fbed7e..5c7e0a63 100644 --- a/Yavsc/Controllers/ClientController.cs +++ b/Yavsc/Controllers/ClientController.cs @@ -6,6 +6,7 @@ using Microsoft.Data.Entity; using System.Collections.Generic; using Yavsc.Models; using Yavsc.Models.Auth; +using System.Security.Claims; namespace Yavsc.Controllers { @@ -56,7 +57,7 @@ namespace Yavsc.Controllers { client.Id = Guid.NewGuid().ToString(); _context.Applications.Add(client); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } SetAppTypesInputValues(); @@ -100,7 +101,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(client); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } return View(client); @@ -131,7 +132,7 @@ namespace Yavsc.Controllers { Client client = await _context.Applications.SingleAsync(m => m.Id == id); _context.Applications.Remove(client); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/CoWorkingController.cs b/Yavsc/Controllers/CoWorkingController.cs index 583fd25f..c1f7bd3e 100644 --- a/Yavsc/Controllers/CoWorkingController.cs +++ b/Yavsc/Controllers/CoWorkingController.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Rendering; @@ -57,7 +58,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.WorkflowProviders.Add(coWorking); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } ViewData["PerformerId"] = new SelectList(_context.Performers, "PerformerId", "Performer", coWorking.PerformerId); @@ -91,7 +92,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(coWorking); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } ViewData["PerformerId"] = new SelectList(_context.Performers, "PerformerId", "Performer", coWorking.PerformerId); @@ -124,7 +125,7 @@ namespace Yavsc.Controllers { CoWorking coWorking = await _context.WorkflowProviders.SingleAsync(m => m.Id == id); _context.WorkflowProviders.Remove(coWorking); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/ColorsController.cs b/Yavsc/Controllers/ColorsController.cs index a01b1a10..a97dba84 100644 --- a/Yavsc/Controllers/ColorsController.cs +++ b/Yavsc/Controllers/ColorsController.cs @@ -1,3 +1,4 @@ +using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.Data.Entity; @@ -52,7 +53,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Color.Add(color); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } return View(color); @@ -82,7 +83,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(color); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } return View(color); @@ -113,7 +114,7 @@ namespace Yavsc.Controllers { Color color = await _context.Color.SingleAsync(m => m.Id == id); _context.Color.Remove(color); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/CommandController.cs b/Yavsc/Controllers/CommandController.cs index a13069ef..a1d58653 100644 --- a/Yavsc/Controllers/CommandController.cs +++ b/Yavsc/Controllers/CommandController.cs @@ -162,7 +162,7 @@ namespace Yavsc.Controllers } else _context.Attach(command.Location); _context.BookQueries.Add(command, GraphBehavior.IncludeDependents); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); var yaev = command.CreateEvent(_localizer); MessageWithPayloadResponse grep = null; @@ -222,7 +222,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(command); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } return View(command); @@ -253,7 +253,7 @@ namespace Yavsc.Controllers { BookQuery command = _context.BookQueries.Single(m => m.Id == id); _context.BookQueries.Remove(command); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/CommandFormsController.cs b/Yavsc/Controllers/CommandFormsController.cs index 9c3c9720..4fd40812 100644 --- a/Yavsc/Controllers/CommandFormsController.cs +++ b/Yavsc/Controllers/CommandFormsController.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Rendering; @@ -59,7 +60,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.CommandForm.Add(commandForm); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } SetViewBag(commandForm); @@ -91,7 +92,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(commandForm); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } SetViewBag(commandForm); @@ -123,7 +124,7 @@ namespace Yavsc.Controllers { CommandForm commandForm = await _context.CommandForm.SingleAsync(m => m.Id == id); _context.CommandForm.Remove(commandForm); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/DoController.cs b/Yavsc/Controllers/DoController.cs index d1d81bfb..bd59f1e8 100644 --- a/Yavsc/Controllers/DoController.cs +++ b/Yavsc/Controllers/DoController.cs @@ -78,7 +78,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.UserActivities.Add(userActivity); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } ViewBag.DoesCode = new SelectList(_context.Activities, "Code", "Name", userActivity.DoesCode); @@ -120,7 +120,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(userActivity); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } ViewData["DoesCode"] = new SelectList(_context.Activities, "Code", "Does", userActivity.DoesCode); @@ -161,7 +161,7 @@ namespace Yavsc.Controllers return RedirectToAction("Index"); } _context.UserActivities.Remove(userActivity); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/EstimateController.cs b/Yavsc/Controllers/EstimateController.cs index 016a96b9..288d914c 100644 --- a/Yavsc/Controllers/EstimateController.cs +++ b/Yavsc/Controllers/EstimateController.cs @@ -102,7 +102,7 @@ namespace Yavsc.Controllers { _context.Estimates .Add(estimate); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); var query = _context.BookQueries.FirstOrDefault( q=>q.Id == estimate.CommandId ); @@ -178,7 +178,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(estimate); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } return View(estimate); @@ -211,7 +211,7 @@ namespace Yavsc.Controllers { Estimate estimate = _context.Estimates.Single(m => m.Id == id); _context.Estimates.Remove(estimate); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/FormsController.cs b/Yavsc/Controllers/FormsController.cs index 7be26a6a..b1898821 100644 --- a/Yavsc/Controllers/FormsController.cs +++ b/Yavsc/Controllers/FormsController.cs @@ -1,3 +1,4 @@ +using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.Data.Entity; @@ -52,7 +53,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Form.Add(form); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } return View(form); @@ -82,7 +83,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(form); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } return View(form); @@ -113,7 +114,7 @@ namespace Yavsc.Controllers { Form form = await _context.Form.SingleAsync(m => m.Id == id); _context.Form.Remove(form); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/FrontOfficeController.cs b/Yavsc/Controllers/FrontOfficeController.cs index 282d64bb..31635d73 100644 --- a/Yavsc/Controllers/FrontOfficeController.cs +++ b/Yavsc/Controllers/FrontOfficeController.cs @@ -79,7 +79,7 @@ namespace Yavsc.Controllers { _context.BookQueries.Update(bookQuery); } - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); // TODO Send sys notifications & // notify the user (make him a basket badge) return View("Index"); diff --git a/Yavsc/Controllers/HairTaintsController.cs b/Yavsc/Controllers/HairTaintsController.cs index 49bf9502..6fca488c 100644 --- a/Yavsc/Controllers/HairTaintsController.cs +++ b/Yavsc/Controllers/HairTaintsController.cs @@ -1,3 +1,4 @@ +using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Mvc; @@ -57,7 +58,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.HairTaint.Add(hairTaint); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } ViewBag.ColorId = new SelectList(_context.Color, "Id", "Name", hairTaint.ColorId); @@ -89,7 +90,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(hairTaint); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } ViewBag.ColorId = new SelectList(_context.Color, "Id", "Name", hairTaint.ColorId); @@ -121,7 +122,7 @@ namespace Yavsc.Controllers { HairTaint hairTaint = await _context.HairTaint.SingleAsync(m => m.Id == id); _context.HairTaint.Remove(hairTaint); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/HomeController.cs b/Yavsc/Controllers/HomeController.cs index a9edbf59..b57a9704 100644 --- a/Yavsc/Controllers/HomeController.cs +++ b/Yavsc/Controllers/HomeController.cs @@ -4,17 +4,17 @@ using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Diagnostics; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Hosting; -using Yavsc.Models; using Microsoft.AspNet.Identity; using System.Linq; using System.Security.Claims; using Microsoft.Data.Entity; -using System.Collections.Generic; using Microsoft.AspNet.Http; using System.Threading.Tasks; namespace Yavsc.Controllers { + using Models; + [ServiceFilter(typeof(LanguageActionFilter)),AllowAnonymous] public class HomeController : Controller { diff --git a/Yavsc/Controllers/InstrumentationController.cs b/Yavsc/Controllers/InstrumentationController.cs index e9e7a2c5..3bde85b0 100644 --- a/Yavsc/Controllers/InstrumentationController.cs +++ b/Yavsc/Controllers/InstrumentationController.cs @@ -68,7 +68,7 @@ namespace Yavsc.Controllers return new ChallengeResult(); _context.Instrumentation.Add(model); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } return View(model); @@ -103,7 +103,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(musicianSettings); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } return View(musicianSettings); @@ -142,7 +142,7 @@ namespace Yavsc.Controllers _context.Instrumentation.Remove(musicianSettings); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/InstrumentsController.cs b/Yavsc/Controllers/InstrumentsController.cs index 4ad6b778..354a7bc4 100644 --- a/Yavsc/Controllers/InstrumentsController.cs +++ b/Yavsc/Controllers/InstrumentsController.cs @@ -3,6 +3,7 @@ using Microsoft.AspNet.Mvc; namespace Yavsc.Controllers { + using System.Security.Claims; using Models; using Models.Musical; public class InstrumentsController : Controller @@ -51,7 +52,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Instrument.Add(instrument); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } return View(instrument); @@ -81,7 +82,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(instrument); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } return View(instrument); @@ -112,7 +113,7 @@ namespace Yavsc.Controllers { Instrument instrument = _context.Instrument.Single(m => m.Id == id); _context.Instrument.Remove(instrument); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/LocationTypesController.cs b/Yavsc/Controllers/LocationTypesController.cs index d7890aaa..c9557229 100644 --- a/Yavsc/Controllers/LocationTypesController.cs +++ b/Yavsc/Controllers/LocationTypesController.cs @@ -3,6 +3,7 @@ using Microsoft.AspNet.Mvc; namespace Yavsc.Controllers { + using System.Security.Claims; using Models; using Models.Relationship; public class LocationTypesController : Controller @@ -51,7 +52,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.LocationType.Add(locationType); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } return View(locationType); @@ -81,7 +82,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(locationType); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } return View(locationType); @@ -112,7 +113,7 @@ namespace Yavsc.Controllers { LocationType locationType = _context.LocationType.Single(m => m.Id == id); _context.LocationType.Remove(locationType); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/ManageController.cs b/Yavsc/Controllers/ManageController.cs index 3217646e..34649b19 100644 --- a/Yavsc/Controllers/ManageController.cs +++ b/Yavsc/Controllers/ManageController.cs @@ -25,7 +25,6 @@ namespace Yavsc.Controllers using Models.Relationship; using PayPal.PayPalAPIInterfaceService; using PayPal.PayPalAPIInterfaceService.Model; - using PayPal.PayPalAPIInterfaceService.Model; [Authorize, ServiceFilter(typeof(LanguageActionFilter))] public class ManageController : Controller @@ -295,7 +294,7 @@ namespace Yavsc.Controllers { var user = _dbContext.Users.FirstOrDefault(u => u.Id == User.GetUserId()); user.DedicatedGoogleCalendar = model.GoogleCalendarId; - await _dbContext.SaveChangesAsync(); + await _dbContext.SaveChangesAsync(User.GetUserId()); if (string.IsNullOrEmpty(model.ReturnUrl)) return RedirectToAction("Index"); else return Redirect(model.ReturnUrl); @@ -570,7 +569,7 @@ namespace Yavsc.Controllers _dbContext.Update(model); } else _dbContext.Performers.Add(model); - _dbContext.SaveChanges(); + _dbContext.SaveChanges(User.GetUserId()); // Give this user the Performer role if (!User.IsInRole("Performer")) await _userManager.AddToRoleAsync(user, "Performer"); @@ -597,7 +596,7 @@ namespace Yavsc.Controllers _dbContext.Performers.Remove( _dbContext.Performers.First(x => x.PerformerId == uid) ); - _dbContext.SaveChanges(); + _dbContext.SaveChanges(User.GetUserId()); await _userManager.RemoveFromRoleAsync(user, "Performer"); } var message = ManageMessageId.UnsetActivitySuccess; diff --git a/Yavsc/Controllers/MusicalTendenciesController.cs b/Yavsc/Controllers/MusicalTendenciesController.cs index df35e49e..75b07f2c 100644 --- a/Yavsc/Controllers/MusicalTendenciesController.cs +++ b/Yavsc/Controllers/MusicalTendenciesController.cs @@ -3,6 +3,7 @@ using Microsoft.AspNet.Mvc; namespace Yavsc.Controllers { + using System.Security.Claims; using Models; using Models.Musical; public class MusicalTendenciesController : Controller @@ -51,7 +52,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.MusicalTendency.Add(musicalTendency); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } return View(musicalTendency); @@ -81,7 +82,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(musicalTendency); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } return View(musicalTendency); @@ -112,7 +113,7 @@ namespace Yavsc.Controllers { MusicalTendency musicalTendency = _context.MusicalTendency.Single(m => m.Id == id); _context.MusicalTendency.Remove(musicalTendency); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/NotificationsController.cs b/Yavsc/Controllers/NotificationsController.cs index 61307d6a..53c4b76c 100644 --- a/Yavsc/Controllers/NotificationsController.cs +++ b/Yavsc/Controllers/NotificationsController.cs @@ -1,7 +1,6 @@ -using System.Linq; +using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.Rendering; using Microsoft.Data.Entity; using Yavsc.Models; using Yavsc.Models.Messaging; @@ -54,7 +53,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Notification.Add(notification); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } return View(notification); @@ -84,7 +83,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(notification); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } return View(notification); @@ -115,7 +114,7 @@ namespace Yavsc.Controllers { Notification notification = await _context.Notification.SingleAsync(m => m.Id == id); _context.Notification.Remove(notification); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Controllers/SIRENExceptionsController.cs b/Yavsc/Controllers/SIRENExceptionsController.cs index 9cd19866..e3e511d1 100644 --- a/Yavsc/Controllers/SIRENExceptionsController.cs +++ b/Yavsc/Controllers/SIRENExceptionsController.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Security.Claims; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Mvc; using Yavsc.Models; @@ -53,7 +54,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.ExceptionsSIREN.Add(exceptionSIREN); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } return View(exceptionSIREN); @@ -83,7 +84,7 @@ namespace Yavsc.Controllers if (ModelState.IsValid) { _context.Update(exceptionSIREN); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } return View(exceptionSIREN); @@ -114,7 +115,7 @@ namespace Yavsc.Controllers { ExceptionSIREN exceptionSIREN = _context.ExceptionsSIREN.Single(m => m.SIREN == id); _context.ExceptionsSIREN.Remove(exceptionSIREN); - _context.SaveChanges(); + _context.SaveChanges(User.GetUserId()); return RedirectToAction("Index"); } } diff --git a/Yavsc/Hubs/ChatHub.cs b/Yavsc/Hubs/ChatHub.cs index a5f0522b..957bc13c 100644 --- a/Yavsc/Hubs/ChatHub.cs +++ b/Yavsc/Hubs/ChatHub.cs @@ -38,7 +38,6 @@ namespace Yavsc if (Context.User != null) { isAuth = Context.User.Identity.IsAuthenticated; - userName = Context.User.Identity.Name; var group = isAuth ? "authenticated" : "anonymous"; // Log ("Cx: " + group); @@ -55,9 +54,8 @@ namespace Yavsc UserAgent = Context.Request.Headers["User-Agent"], Connected = true }); - db.SaveChanges(); + db.SaveChanges(user.Id); } - } } else Groups.Add(Context.ConnectionId, "anonymous"); @@ -78,16 +76,16 @@ namespace Yavsc var cx = db.Connections.SingleOrDefault(c => c.ConnectionId == Context.ConnectionId); if (cx != null) { + var user = db.Users.Single(u => u.UserName == userName); if (stopCalled) { - var user = db.Users.Single(u => u.UserName == userName); user.Connections.Remove(cx); } else { cx.Connected = false; } - db.SaveChanges(); + db.SaveChanges(user.Id); } } } @@ -110,7 +108,7 @@ namespace Yavsc if (cx != null) { cx.Connected = true; - db.SaveChanges(); + db.SaveChanges(user.Id); } else cx = new Connection { ConnectionId = Context.ConnectionId, UserAgent = Context.Request.Headers["User-Agent"], @@ -147,10 +145,9 @@ namespace Yavsc var cx = db.Connections.SingleOrDefault(c=>c.ConnectionId == Context.ConnectionId); if (cx!=null) { db.Connections.Remove(cx); - db.SaveChanges(); + db.SaveChanges(cx.ApplicationUserId); } } - } } diff --git a/Yavsc/Migrations/20170217221646_bookQueryStatus.Designer.cs b/Yavsc/Migrations/20170217221646_bookQueryStatus.Designer.cs index ba879c17..59e80846 100644 --- a/Yavsc/Migrations/20170217221646_bookQueryStatus.Designer.cs +++ b/Yavsc/Migrations/20170217221646_bookQueryStatus.Designer.cs @@ -1,7 +1,6 @@ using System; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Infrastructure; -using Microsoft.Data.Entity.Metadata; using Microsoft.Data.Entity.Migrations; using Yavsc.Models; diff --git a/Yavsc/Migrations/20170217221646_bookQueryStatus.cs b/Yavsc/Migrations/20170217221646_bookQueryStatus.cs index 805d3deb..53aac870 100644 --- a/Yavsc/Migrations/20170217221646_bookQueryStatus.cs +++ b/Yavsc/Migrations/20170217221646_bookQueryStatus.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using Microsoft.Data.Entity.Migrations; using Yavsc.Interfaces.Workflow; diff --git a/Yavsc/Migrations/20170220102125_notifications.Designer.cs b/Yavsc/Migrations/20170220102125_notifications.Designer.cs index 38f96ada..bbc61f0d 100644 --- a/Yavsc/Migrations/20170220102125_notifications.Designer.cs +++ b/Yavsc/Migrations/20170220102125_notifications.Designer.cs @@ -1,7 +1,6 @@ using System; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Infrastructure; -using Microsoft.Data.Entity.Metadata; using Microsoft.Data.Entity.Migrations; using Yavsc.Models; diff --git a/Yavsc/Migrations/20170220102125_notifications.cs b/Yavsc/Migrations/20170220102125_notifications.cs index 57dcaeef..12bbbcd2 100644 --- a/Yavsc/Migrations/20170220102125_notifications.cs +++ b/Yavsc/Migrations/20170220102125_notifications.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using Microsoft.Data.Entity.Migrations; namespace Yavsc.Migrations diff --git a/Yavsc/Migrations/20170220125518_dimissclick.Designer.cs b/Yavsc/Migrations/20170220125518_dimissclick.Designer.cs index 085e520e..68dfef30 100644 --- a/Yavsc/Migrations/20170220125518_dimissclick.Designer.cs +++ b/Yavsc/Migrations/20170220125518_dimissclick.Designer.cs @@ -1,7 +1,6 @@ using System; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Infrastructure; -using Microsoft.Data.Entity.Metadata; using Microsoft.Data.Entity.Migrations; using Yavsc.Models; diff --git a/Yavsc/Migrations/20170220125518_dimissclick.cs b/Yavsc/Migrations/20170220125518_dimissclick.cs index 3d49c187..9bdc51ab 100644 --- a/Yavsc/Migrations/20170220125518_dimissclick.cs +++ b/Yavsc/Migrations/20170220125518_dimissclick.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using Microsoft.Data.Entity.Migrations; namespace Yavsc.Migrations diff --git a/Yavsc/Migrations/20170220144141_hiddenActivity.Designer.cs b/Yavsc/Migrations/20170220144141_hiddenActivity.Designer.cs index a9686b3e..2c4591f0 100644 --- a/Yavsc/Migrations/20170220144141_hiddenActivity.Designer.cs +++ b/Yavsc/Migrations/20170220144141_hiddenActivity.Designer.cs @@ -1,7 +1,6 @@ using System; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Infrastructure; -using Microsoft.Data.Entity.Metadata; using Microsoft.Data.Entity.Migrations; using Yavsc.Models; diff --git a/Yavsc/Migrations/20170220144141_hiddenActivity.cs b/Yavsc/Migrations/20170220144141_hiddenActivity.cs index c6a8d2da..23647b1a 100644 --- a/Yavsc/Migrations/20170220144141_hiddenActivity.cs +++ b/Yavsc/Migrations/20170220144141_hiddenActivity.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using Microsoft.Data.Entity.Migrations; namespace Yavsc.Migrations diff --git a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs index d40bb11d..811d6f93 100644 --- a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs @@ -1,8 +1,6 @@ using System; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Infrastructure; -using Microsoft.Data.Entity.Metadata; -using Microsoft.Data.Entity.Migrations; using Yavsc.Models; namespace Yavsc.Migrations diff --git a/Yavsc/Models/Billing/NominativeServiceCommand.cs b/Yavsc/Models/Billing/NominativeServiceCommand.cs index e824acf6..c11b22bb 100644 --- a/Yavsc/Models/Billing/NominativeServiceCommand.cs +++ b/Yavsc/Models/Billing/NominativeServiceCommand.cs @@ -2,13 +2,12 @@ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using Yavsc.Interfaces.Workflow; -using Yavsc.Models.Market; -using Yavsc.Models.Workflow; -using YavscLib; namespace Yavsc.Models.Billing { +using Interfaces.Workflow; +using Workflow; +using YavscLib; public abstract class NominativeServiceCommand : IBaseTrackedEntity, IQuery { diff --git a/Yavsc/Models/Haircut/HairCutQuery.cs b/Yavsc/Models/Haircut/HairCutQuery.cs index 1464f0ee..57bd3a6a 100644 --- a/Yavsc/Models/Haircut/HairCutQuery.cs +++ b/Yavsc/Models/Haircut/HairCutQuery.cs @@ -1,4 +1,4 @@ -using System; + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Billing; diff --git a/Yavsc/Models/Haircut/HairPrestation.cs b/Yavsc/Models/Haircut/HairPrestation.cs index e3825420..66ecac62 100644 --- a/Yavsc/Models/Haircut/HairPrestation.cs +++ b/Yavsc/Models/Haircut/HairPrestation.cs @@ -1,5 +1,4 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; + using Yavsc.Models.Market; namespace Yavsc.Models.Haircut diff --git a/Yavsc/Models/Messaging/EstimationEvent.cs b/Yavsc/Models/Messaging/EstimationEvent.cs index 66133e8c..1425f708 100644 --- a/Yavsc/Models/Messaging/EstimationEvent.cs +++ b/Yavsc/Models/Messaging/EstimationEvent.cs @@ -7,7 +7,6 @@ namespace Yavsc.Models.Messaging using Interfaces.Workflow; using Billing; using Yavsc.Helpers; - using System; public class EstimationEvent: IEvent { diff --git a/Yavsc/Models/Workflow/BookQuery.cs b/Yavsc/Models/Workflow/BookQuery.cs index 9f7edec7..c27890db 100644 --- a/Yavsc/Models/Workflow/BookQuery.cs +++ b/Yavsc/Models/Workflow/BookQuery.cs @@ -5,7 +5,6 @@ using Newtonsoft.Json; namespace Yavsc.Models.Workflow { - using YavscLib; using Yavsc.Models.Billing; using Yavsc.Models.Relationship; /// diff --git a/Yavsc/Models/Workflow/Query.cs b/Yavsc/Models/Workflow/Query.cs index c619f78b..32c2d74d 100644 --- a/Yavsc/Models/Workflow/Query.cs +++ b/Yavsc/Models/Workflow/Query.cs @@ -1,11 +1,8 @@ -using System; - namespace Yavsc.Models.Workflow { - using Interfaces.Workflow; - using Models.Market; - using YavscLib; - + using Interfaces.Workflow; + using YavscLib; + public interface IQuery: IBaseTrackedEntity { QueryStatus Status { get; set; } diff --git a/Yavsc/Startup/Startup.cs b/Yavsc/Startup/Startup.cs index 39f587c9..37a879ab 100755 --- a/Yavsc/Startup/Startup.cs +++ b/Yavsc/Startup/Startup.cs @@ -16,7 +16,6 @@ using Microsoft.AspNet.Localization; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Filters; using Microsoft.AspNet.Mvc.Razor; -using Microsoft.AspNet.Http.Extensions; using Microsoft.Data.Entity; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -232,6 +231,7 @@ namespace Yavsc IOptions localizationOptions, IOptions oauth2SettingsContainer, RoleManager roleManager, + UserManager userManager, IAuthorizationService authorizationService, ILoggerFactory loggerFactory) { @@ -320,7 +320,7 @@ namespace Yavsc { foreach (var c in db.Connections) db.Connections.Remove(c); - db.SaveChanges(); + db.SaveChanges("Startup"); } }); @@ -339,7 +339,6 @@ namespace Yavsc ConfigureWorkflow(app, SiteSetup); app.UseRequestLocalization(localizationOptions.Value, (RequestCulture) new RequestCulture((string)"fr")); app.UseSession(); - app.UseMvc(routes => { routes.MapRoute( diff --git a/ZicMoove/ZicMoove.Droid/MainActivity.cs b/ZicMoove/ZicMoove.Droid/MainActivity.cs index 274c7e38..c5e81e86 100644 --- a/ZicMoove/ZicMoove.Droid/MainActivity.cs +++ b/ZicMoove/ZicMoove.Droid/MainActivity.cs @@ -53,9 +53,9 @@ namespace ZicMoove.Droid using Xamarin.Forms; [Activity( - Name = Constants.ApplicationName+".MainActivity", - Label = Constants.ApplicationLabel, - Theme = "@style/MainTheme", + Name = Constants.ApplicationName + ".MainActivity", + Label = Constants.ApplicationLabel, + Theme = "@style/MainTheme", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] @@ -74,8 +74,8 @@ namespace ZicMoove.Droid .LanguageOrLocale("fr") .RememberUser(true) .AcceptCreditCards(true) // needs card.io - // TODO .MerchantPrivacyPolicyUri(new Uri("http://")) - // TODO .MerchantUserAgreementUri(new Uri("http://")) + // TODO .MerchantPrivacyPolicyUri(new Uri("http://")) + // TODO .MerchantUserAgreementUri(new Uri("http://")) .ClientId(Constants.PaypalClientId) .SandboxUserPassword(Constants.PaypalClientSecret) ; @@ -85,7 +85,7 @@ namespace ZicMoove.Droid TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); - + XamSvg.Setup.InitSvgLib(); // FIXME usefull? SetPersistent(true); // global::Xamarin.Forms.Forms.SetTitleBarVisibility(Xamarin.Forms.AndroidTitleBarVisibility.Never); @@ -152,7 +152,8 @@ namespace ZicMoove.Droid public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) { base.OnRequestPermissionsResult(requestCode, permissions, grantResults); - if (requestCode == Constants.AllowBeATarget) { + if (requestCode == Constants.AllowBeATarget) + { if (grantResults.Length > 0) { if (grantResults[0] == Android.Content.PM.Permission.Granted) @@ -279,7 +280,7 @@ namespace ZicMoove.Droid { Task.Run(async () => { - var query = DataManager.Instance.BookQueries.LocalGet(queryId); + var query = DataManager.Instance.BookQueries.LocalGet(queryId); App.ShowBookQuery(query); }); } @@ -315,7 +316,7 @@ namespace ZicMoove.Droid return manager.FindAccountsForService(Constants.ApplicationLabel); }); } - + public void AddAccount() { var auth = new YaOAuth2Authenticator( @@ -392,9 +393,9 @@ namespace ZicMoove.Droid // TODO handle } - - + + public T Resolve() { @@ -441,7 +442,7 @@ namespace ZicMoove.Droid } } - public void Pay(double amount, PayMethod method, string name= null ) + public void Pay(double amount, PayMethod method, string name = null) { if (name == null) name = $"Votre commande {Constants.ApplicationLabel}"; var payment = new PayPalPayment(new BigDecimal(amount), "EUR", "the item", @@ -450,40 +451,40 @@ namespace ZicMoove.Droid var intent = new Intent(this, typeof(PaymentActivity)); intent.PutExtra(PayPalService.ExtraPaypalConfiguration, config); intent.PutExtra(PaymentActivity.ExtraPayment, payment); - this.StartActivityForResult(intent, (int) RequestCode.PayImmediate); + this.StartActivityForResult(intent, (int)RequestCode.PayImmediate); } protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { - if (requestCode == (int) RequestCode.PayDelayed) - if (resultCode == Result.Ok) - { - var confirm = data.GetParcelableExtra(PaymentActivity.ExtraResultConfirmation); - if (confirm != null) + if (requestCode == (int)RequestCode.PayDelayed) + if (resultCode == Result.Ok) { - try + var confirm = data.GetParcelableExtra(PaymentActivity.ExtraResultConfirmation); + if (confirm != null) { - Log.Info("xam.paypal.test", confirm.ToString()); + try + { + Log.Info("xam.paypal.test", confirm.ToString()); - // TODO: send 'confirm' to your server for verification. - // see https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/ - // for more details. + // TODO: send 'confirm' to your server for verification. + // see https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/ + // for more details. - } - catch (JSONException e) - { - Log.Error("xam.paypal.test", "something went really wrong here: ", e); + } + catch (JSONException e) + { + Log.Error("xam.paypal.test", "something went really wrong here: ", e); + } } } - } - else if (resultCode == Result.Canceled) - { - Log.Info("xam.paypal.test", "Canceled."); - } - else if ((int)resultCode == PaymentActivity.ResultExtrasInvalid) - { - Log.Info("xam.paypal.test", "Invalid Payment or PayPalConfiguration."); - } + else if (resultCode == Result.Canceled) + { + Log.Info("xam.paypal.test", "Canceled."); + } + else if ((int)resultCode == PaymentActivity.ResultExtrasInvalid) + { + Log.Info("xam.paypal.test", "Invalid Payment or PayPalConfiguration."); + } } @@ -493,11 +494,61 @@ namespace ZicMoove.Droid base.OnDestroy(); } - enum RequestCode : int { + enum RequestCode : int + { PayImmediate = 1, PayDelayed } - + private static string imagesFolder = null; + public static string ImagesFolder + { + get + { + if (imagesFolder != null) return imagesFolder; + var appData = + System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData); + imagesFolder = System.IO.Path.Combine(appData, Constants.ImagePath); + DirectoryInfo di = new DirectoryInfo(imagesFolder); + if (!di.Exists) di.Create(); + return imagesFolder; + } + } + + public void UpdateAppImages() + { + var images = ImagesFolder; + + using (var client = new HttpClient()) + { + client.BaseAddress = new Uri(Constants.YavscHomeUrl); + var targets = DataManager.Instance.Activities.Select( + a => new string[2] { a.Photo, a.Code } + ).ToArray(); + foreach (var photo in targets) + { + if (photo[0] != null) + { + var streamtask = client.GetStreamAsync(photo[0]); + streamtask.Wait(); + if (streamtask.IsCompleted) + { + using (streamtask.Result) + { + FileInfo fi = new FileInfo(Path.Combine(images, $"{photo[1]}.svg")); + using (var ostr = fi.OpenWrite()) + { + streamtask.Result.CopyTo(ostr); + } + } + } + + } + } + foreach (var act in DataManager.Instance.Activities) + { act.LocalPhoto = Path.Combine(images, $"{act.Code}.svg"); } + DataManager.Instance.Activities.SaveEntity(); + } + } } } diff --git a/ZicMoove/ZicMoove.Droid/Rendering/ImageButtonRenderer.cs b/ZicMoove/ZicMoove.Droid/Rendering/ImageButtonRenderer.cs index 3007d81c..09b3abc5 100644 --- a/ZicMoove/ZicMoove.Droid/Rendering/ImageButtonRenderer.cs +++ b/ZicMoove/ZicMoove.Droid/Rendering/ImageButtonRenderer.cs @@ -67,7 +67,7 @@ namespace ZicMoove.Rendering _density = Resources.DisplayMetrics.Density; var targetButton = Control; - if (targetButton != null) targetButton.SetOnTouchListener(TouchListener.Instance.Value); + if (targetButton != null) targetButton.SetOnTouchListener(ImageButtonTouchListener.Instance.Value); if (Element != null && Element.Font != Font.Default && targetButton != null) targetButton.Typeface = Element.Font.ToExtendedTypeface(Context); @@ -274,14 +274,14 @@ namespace ZicMoove.Rendering } //Hot fix for the layout positioning issue on Android as described in http://forums.xamarin.com/discussion/20608/fix-for-button-layout-bug-on-android - class TouchListener : Java.Lang.Object, View.IOnTouchListener + class ImageButtonTouchListener : Java.Lang.Object, View.IOnTouchListener { - public static readonly Lazy Instance = new Lazy(() => new TouchListener()); + public static readonly Lazy Instance = new Lazy(() => new ImageButtonTouchListener()); /// /// Make TouchListener a singleton. /// - private TouchListener() + private ImageButtonTouchListener() { } public bool OnTouch(View v, MotionEvent e) diff --git a/ZicMoove/ZicMoove.Droid/Rendering/SvgRenderer.cs b/ZicMoove/ZicMoove.Droid/Rendering/SvgRenderer.cs new file mode 100644 index 00000000..65535203 --- /dev/null +++ b/ZicMoove/ZicMoove.Droid/Rendering/SvgRenderer.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Net.Http; +using Android.App; +using Android.Content; +using Android.OS; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Android.Graphics; +using Xamarin.Forms; +using ZicMoove.Views; +using XamSvg; +using Xamarin.Forms.Platform.Android; + +[assembly: ExportRenderer(typeof(SvgImage), typeof(ZicMoove.Droid.Rendering.SvgRenderer))] +namespace ZicMoove.Droid.Rendering +{ + class SvgRenderer : Xamarin.Forms.Platform.Android.AppCompat.ViewRenderer + { + private ImageView view; + private ImageView CreateNativeControl() + { + view = new ImageView(Context); + view.LayoutParameters = new Gallery.LayoutParams(LayoutParams.WrapContent, LayoutParams.FillParent); + + return view; + } + protected override void OnElementChanged(ElementChangedEventArgs e) + { + base.OnElementChanged(e); + + if (Control == null) + { + // Init + SetNativeControl(CreateNativeControl()); + } + if (e.OldElement != null) + { + // Unsubscribe + } + if (e.NewElement != null) if (e.NewElement.Svg != null) + { + // Subscribe + + if (!e.NewElement.Svg.EndsWith(".svg")) + throw new NotSupportedException("Source must end width '.svg'"); + var fi = new System.IO.FileInfo(e.NewElement.Svg); + if (fi.Exists) + { + using (var stream = fi.OpenRead()) + { + var svg = SvgFactory.GetSvg(System.Threading.CancellationToken.None, + stream); + var drawable = XamSvg.SvgFactory.GetDrawable(svg, XamSvg.Shared.Cross.SvgFillMode.Fill); + view.SetImageDrawable(drawable); + } + } + + } + } + } +} \ No newline at end of file diff --git a/ZicMoove/ZicMoove.Droid/Rendering/YaSvgImageView.cs b/ZicMoove/ZicMoove.Droid/Rendering/YaSvgImageView.cs new file mode 100644 index 00000000..63a4875a --- /dev/null +++ b/ZicMoove/ZicMoove.Droid/Rendering/YaSvgImageView.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Android.App; +using Android.Content; +using Android.Graphics; +using Android.OS; +using Android.Runtime; +using Android.Util; +using Android.Views; +using Android.Widget; + +namespace ZicMoove.Droid.Rendering +{ + public class YaSvgImageView : ImageView + { + Bitmap currentBitmap; + public YaSvgImageView(Context context, IAttributeSet attrs) : + base(context, attrs) + { + Initialize(); + } + public YaSvgImageView(Context context) : base(context) + { + Initialize(); + } + public YaSvgImageView(Context context, IAttributeSet attrs, int defStyle) : + base(context, attrs, defStyle) + { + Initialize(); + } + + private void Initialize() + { + } + XamSvg.Svg svg; + XamSvg.SvgPictureDrawable drawable; + + public void SetSvg(XamSvg.Svg svg) + { + this.svg = svg; + this.drawable = XamSvg.SvgFactory.GetDrawable(svg, XamSvg.Shared.Cross.SvgFillMode.Fill); + this.SetImageDrawable(drawable); + } + } +} \ No newline at end of file diff --git a/ZicMoove/ZicMoove.Droid/Resources/Resource.Designer.cs b/ZicMoove/ZicMoove.Droid/Resources/Resource.Designer.cs index fd36580d..41ba1446 100644 --- a/ZicMoove/ZicMoove.Droid/Resources/Resource.Designer.cs +++ b/ZicMoove/ZicMoove.Droid/Resources/Resource.Designer.cs @@ -29,6 +29,17 @@ namespace ZicMoove.Droid global::SQLite.Net.Platform.XamarinAndroid.Resource.String.ApplicationName = global::ZicMoove.Droid.Resource.String.ApplicationName; global::SQLite.Net.Platform.XamarinAndroid.Resource.String.Hello = global::ZicMoove.Droid.Resource.String.Hello; global::Xamarin.Forms.Platform.Android.Resource.Attribute.actionBarSize = global::ZicMoove.Droid.Resource.Attribute.actionBarSize; + global::XamSvg.Resource.Attribute.colorMapping = global::ZicMoove.Droid.Resource.Attribute.colorMapping; + global::XamSvg.Resource.Attribute.colorMappingSelected = global::ZicMoove.Droid.Resource.Attribute.colorMappingSelected; + global::XamSvg.Resource.Attribute.loadAsync = global::ZicMoove.Droid.Resource.Attribute.loadAsync; + global::XamSvg.Resource.Attribute.svg = global::ZicMoove.Droid.Resource.Attribute.svg; + global::XamSvg.Resource.Attribute.traceEnabled = global::ZicMoove.Droid.Resource.Attribute.traceEnabled; + global::XamSvg.Resource.Styleable.SvgImageView = global::ZicMoove.Droid.Resource.Styleable.SvgImageView; + global::XamSvg.Resource.Styleable.SvgImageView_colorMapping = global::ZicMoove.Droid.Resource.Styleable.SvgImageView_colorMapping; + global::XamSvg.Resource.Styleable.SvgImageView_colorMappingSelected = global::ZicMoove.Droid.Resource.Styleable.SvgImageView_colorMappingSelected; + global::XamSvg.Resource.Styleable.SvgImageView_loadAsync = global::ZicMoove.Droid.Resource.Styleable.SvgImageView_loadAsync; + global::XamSvg.Resource.Styleable.SvgImageView_svg = global::ZicMoove.Droid.Resource.Styleable.SvgImageView_svg; + global::XamSvg.Resource.Styleable.SvgImageView_traceEnabled = global::ZicMoove.Droid.Resource.Styleable.SvgImageView_traceEnabled; global::XLabs.Forms.Droid.Resource.Animation.abc_fade_in = global::ZicMoove.Droid.Resource.Animation.abc_fade_in; global::XLabs.Forms.Droid.Resource.Animation.abc_fade_out = global::ZicMoove.Droid.Resource.Animation.abc_fade_out; global::XLabs.Forms.Droid.Resource.Animation.abc_grow_fade_in_from_bottom = global::ZicMoove.Droid.Resource.Animation.abc_grow_fade_in_from_bottom; @@ -2229,6 +2240,12 @@ namespace ZicMoove.Droid // aapt resource value: 0x7f0100b9 public const int colorControlNormal = 2130772153; + // aapt resource value: 0x7f010157 + public const int colorMapping = 2130772311; + + // aapt resource value: 0x7f010158 + public const int colorMappingSelected = 2130772312; + // aapt resource value: 0x7f0100b6 public const int colorPrimary = 2130772150; @@ -2520,6 +2537,9 @@ namespace ZicMoove.Droid // aapt resource value: 0x7f010006 public const int liteMode = 2130771974; + // aapt resource value: 0x7f01015a + public const int loadAsync = 2130772314; + // aapt resource value: 0x7f01004a public const int logo = 2130772042; @@ -2760,6 +2780,9 @@ namespace ZicMoove.Droid // aapt resource value: 0x7f0100f3 public const int suggestionRowLayout = 2130772211; + // aapt resource value: 0x7f010156 + public const int svg = 2130772310; + // aapt resource value: 0x7f0100f9 public const int switchMinWidth = 2130772217; @@ -2898,6 +2921,9 @@ namespace ZicMoove.Droid // aapt resource value: 0x7f01009e public const int toolbarStyle = 2130772126; + // aapt resource value: 0x7f010159 + public const int traceEnabled = 2130772313; + // aapt resource value: 0x7f0100f6 public const int track = 2130772214; @@ -5482,6 +5508,9 @@ namespace ZicMoove.Droid // aapt resource value: 0x7f070000 public const int gtm_analytics = 2131165184; + // aapt resource value: 0x7f070001 + public const int it = 2131165185; + static Raw() { global::Android.Runtime.ResourceIdManager.UpdateIdValues(); @@ -8523,6 +8552,28 @@ namespace ZicMoove.Droid // aapt resource value: 4 public const int Spinner_popupTheme = 4; + public static int[] SvgImageView = new int[] { + 2130772310, + 2130772311, + 2130772312, + 2130772313, + 2130772314}; + + // aapt resource value: 1 + public const int SvgImageView_colorMapping = 1; + + // aapt resource value: 2 + public const int SvgImageView_colorMappingSelected = 2; + + // aapt resource value: 4 + public const int SvgImageView_loadAsync = 4; + + // aapt resource value: 0 + public const int SvgImageView_svg = 0; + + // aapt resource value: 3 + public const int SvgImageView_traceEnabled = 3; + public static int[] SwitchCompat = new int[] { 16843044, 16843045, diff --git a/ZicMoove/ZicMoove.Droid/Resources/layout/Payment.axml b/ZicMoove/ZicMoove.Droid/Resources/layout/Payment.axml index bdf33690..53ea1ef4 100644 --- a/ZicMoove/ZicMoove.Droid/Resources/layout/Payment.axml +++ b/ZicMoove/ZicMoove.Droid/Resources/layout/Payment.axml @@ -10,7 +10,7 @@ android:layout_height="wrap_content" android:id="@+id/relativeLayout1" /> + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Web 2.0 + 2013-01-18T05:56:20 + Icon for web 2.0 + https://openclipart.org/detail/174317/web-2.0-by-fallerton-174317 + + + Fallerton + + + + + 2.0 + extended + web + wide + world + www + + + + + + + + + + + diff --git a/ZicMoove/ZicMoove.Droid/Services/GcmRegistrationIntentService.cs b/ZicMoove/ZicMoove.Droid/Services/GcmRegistrationIntentService.cs index 4b33057b..26fd3ad8 100644 --- a/ZicMoove/ZicMoove.Droid/Services/GcmRegistrationIntentService.cs +++ b/ZicMoove/ZicMoove.Droid/Services/GcmRegistrationIntentService.cs @@ -20,10 +20,8 @@ namespace ZicMoove.Droid static object locker = new object(); public GcmRegistrationIntentService() : base("RegistrationIntentService") { - } - static PowerManager.WakeLock sWakeLock; static object LOCK = new object(); @@ -102,9 +100,9 @@ namespace ZicMoove.Droid { var pubSub = GcmPubSub.GetInstance(this); pubSub.Subscribe(token, "/topics/global", null); - if (MainSettings.CurrentUser.Roles.Contains("Performer")) + ///if (MainSettings.CurrentUser.Roles.Contains("Performer")) // TODO add activity codes in the bundle - pubSub.Subscribe(token, "/topics/jobs", null); + //pubSub.Subscribe(token, "/topics/jobs", null); // TODO if a Activity is specified, // and general annonces in this activity are accepted: // pubSub.Subscribe(token, "/topics/jobs/"+ActivityCode, null); diff --git a/ZicMoove/ZicMoove.Droid/ZicMoove.Droid.csproj b/ZicMoove/ZicMoove.Droid/ZicMoove.Droid.csproj index 98b8ccc7..4b56829f 100644 --- a/ZicMoove/ZicMoove.Droid/ZicMoove.Droid.csproj +++ b/ZicMoove/ZicMoove.Droid/ZicMoove.Droid.csproj @@ -394,6 +394,14 @@ ..\..\packages\Xamarin.PayPal.Android.CardIO.1.0.0\lib\MonoAndroid10\Xamarin.PayPal.Android.CardIO.dll True + + ..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\MonoAndroid44\XamSvg.Droid.dll + True + + + ..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\MonoAndroid44\XamSvg.Shared.dll + True + ..\..\packages\XLabs.Caching.2.3.0-pre02\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Caching.dll True @@ -463,6 +471,8 @@ + + @@ -645,6 +655,7 @@ + diff --git a/ZicMoove/ZicMoove.Droid/packages.config b/ZicMoove/ZicMoove.Droid/packages.config index 9675bba1..9c0a8475 100644 --- a/ZicMoove/ZicMoove.Droid/packages.config +++ b/ZicMoove/ZicMoove.Droid/packages.config @@ -8,6 +8,7 @@ + diff --git a/ZicMoove/ZicMoove/App.xaml.cs b/ZicMoove/ZicMoove/App.xaml.cs index ea3bdf16..eafcafc0 100644 --- a/ZicMoove/ZicMoove/App.xaml.cs +++ b/ZicMoove/ZicMoove/App.xaml.cs @@ -379,8 +379,6 @@ namespace ZicMoove public void SetupHubConnection() { - if (chatHubConnection != null) - chatHubConnection.Dispose(); chatHubConnection = new HubConnection(Constants.SignalRHubsUrl); chatHubConnection.Error += ChatHubConnection_Error; @@ -452,9 +450,11 @@ namespace ZicMoove } } - public static async Task PostDeviceInfo() + + public static async Task PostDeviceInfo() { var info = GetDeviceInfo(); + bool updateImages = false; if (!string.IsNullOrWhiteSpace(info.GCMRegistrationId)) { if (MainSettings.CurrentUser != null) @@ -479,7 +479,7 @@ namespace ZicMoove if ((bool)jvalue["UpdateActivities"]) { DataManager.Instance.Activities.Execute(null); - DataManager.Instance.Activities.SaveEntity(); + updateImages = true; } } } @@ -491,7 +491,9 @@ namespace ZicMoove } } } + return (updateImages); } + public static GCMRegIdDeclaration GetDeviceInfo() { var devinfo = CrossDeviceInfo.Current; @@ -511,7 +513,6 @@ namespace ZicMoove }; } - public static void ShowBookQuery(BookQuery query) { var page = new BookQueryPage diff --git a/ZicMoove/ZicMoove/Constants.cs b/ZicMoove/ZicMoove/Constants.cs index 22c62e47..46a055ec 100644 --- a/ZicMoove/ZicMoove/Constants.cs +++ b/ZicMoove/ZicMoove/Constants.cs @@ -28,6 +28,6 @@ namespace ZicMoove public const string PermissionMapReceive = Constants.ApplicationName + ".permission.MAPS_RECEIVE"; public const string PermissionC2DMessage = Constants.ApplicationName + ".permission.C2D_MESSAGE"; - + public const string ImagePath = "images"; } } diff --git a/ZicMoove/ZicMoove/Data/RemoteEntityRO.cs b/ZicMoove/ZicMoove/Data/RemoteEntityRO.cs index 62a50364..85556bf9 100644 --- a/ZicMoove/ZicMoove/Data/RemoteEntityRO.cs +++ b/ZicMoove/ZicMoove/Data/RemoteEntityRO.cs @@ -3,18 +3,17 @@ using System.Linq; namespace ZicMoove.Data { + /// + /// Use to not try and update any remote data ... + /// TODO implementation ... + /// + /// + /// public class RemoteEntityRO: RemoteEntity where K: IEquatable { public RemoteEntityRO (string controllerName, Func getKey) : base(controllerName,getKey) { } - - public override void Merge(V item) - { - var key = GetKey(item); - if (this.Any(x => GetKey(x).Equals(key))) { return; } - Add(item); - } } } diff --git a/ZicMoove/ZicMoove/Interfaces/IPlatform.cs b/ZicMoove/ZicMoove/Interfaces/IPlatform.cs index 730e5608..d8a89263 100644 --- a/ZicMoove/ZicMoove/Interfaces/IPlatform.cs +++ b/ZicMoove/ZicMoove/Interfaces/IPlatform.cs @@ -21,6 +21,7 @@ namespace ZicMoove.Interfaces void Pay(double amount, PayMethod method, string paymentName); + void UpdateAppImages(); } } diff --git a/ZicMoove/ZicMoove/Model/Workflow/Activity.cs b/ZicMoove/ZicMoove/Model/Workflow/Activity.cs index 1724d734..39149d20 100644 --- a/ZicMoove/ZicMoove/Model/Workflow/Activity.cs +++ b/ZicMoove/ZicMoove/Model/Workflow/Activity.cs @@ -74,5 +74,6 @@ namespace ZicMoove.Model.Workflow get; set; } + public string LocalPhoto { get; set; } } } diff --git a/ZicMoove/ZicMoove/Pages/ClientPages/ActivityPage.xaml b/ZicMoove/ZicMoove/Pages/ClientPages/ActivityPage.xaml index 678b7df7..cfb658e5 100644 --- a/ZicMoove/ZicMoove/Pages/ClientPages/ActivityPage.xaml +++ b/ZicMoove/ZicMoove/Pages/ClientPages/ActivityPage.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ZicMoove.Pages.ClientPages.ActivityPage" xmlns:local="clr-namespace:ZicMoove;assembly=ZicMoove" + xmlns:views="clr-namespace:ZicMoove.Views;assembly=ZicMoove" > @@ -13,22 +14,32 @@ -