Merge branch 'vnext' of github.com:pazof/yavsc into vnext

This commit is contained in:
2017-02-25 17:48:54 +01:00
88 changed files with 723 additions and 330 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
};
}

View File

@ -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 {

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 });
}

View File

@ -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

View File

@ -39,7 +39,7 @@ namespace Yavsc.Controllers
return HttpBadRequest();
blogpost.Rate = rate;
_context.SaveChanges();
_context.SaveChanges(User.GetUserId());
return Ok();
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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");
}

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -162,7 +162,7 @@ namespace Yavsc.Controllers
}
else _context.Attach<Location>(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");
}
}

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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");

View File

@ -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");
}
}

View File

@ -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
{

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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;

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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);
}
}
}
}

View File

@ -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;

View File

@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Interfaces.Workflow;

View File

@ -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;

View File

@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations

View File

@ -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;

View File

@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations

View File

@ -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;

View File

@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations

View File

@ -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

View File

@ -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
{

View File

@ -1,4 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Billing;

View File

@ -1,5 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Market;
namespace Yavsc.Models.Haircut

View File

@ -7,7 +7,6 @@ namespace Yavsc.Models.Messaging
using Interfaces.Workflow;
using Billing;
using Yavsc.Helpers;
using System;
public class EstimationEvent: IEvent
{

View File

@ -5,7 +5,6 @@ using Newtonsoft.Json;
namespace Yavsc.Models.Workflow
{
using YavscLib;
using Yavsc.Models.Billing;
using Yavsc.Models.Relationship;
/// <summary>

View File

@ -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; }

View File

@ -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<RequestLocalizationOptions> localizationOptions,
IOptions<OAuth2AppSettings> oauth2SettingsContainer,
RoleManager<IdentityRole> roleManager,
UserManager<ApplicationUser> 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(

View File

@ -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<T>()
{
@ -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();
}
}
}
}

View File

@ -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<TouchListener> Instance = new Lazy<TouchListener>(() => new TouchListener());
public static readonly Lazy<ImageButtonTouchListener> Instance = new Lazy<ImageButtonTouchListener>(() => new ImageButtonTouchListener());
/// <summary>
/// Make TouchListener a singleton.
/// </summary>
private TouchListener()
private ImageButtonTouchListener()
{ }
public bool OnTouch(View v, MotionEvent e)

View File

@ -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<SvgImage, ImageView>
{
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<SvgImage> 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);
}
}
}
}
}
}

View File

@ -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);
}
}
}

View File

@ -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,

View File

@ -10,7 +10,7 @@
android:layout_height="wrap_content"
android:id="@+id/relativeLayout1" />
<TextView
android:text="Validation de votre solvabilité (le retrait n'est effectué qu'un fois la préstation executée et validée par vos soins)"
android:text="Validation de votre solvabilité (le retrait n'est effectué qu'une fois la préstation executée et validée par vos soins)"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:ns1="http://sozi.baierouge.fr"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg2"
sodipodi:docname="mobile phone.svg"
viewBox="0 0 212.6 212.6"
version="1.1"
inkscape:version="0.48.3.1 r9886"
>
<sodipodi:namedview
id="base"
fit-margin-left="0"
inkscape:showpageshadow="false"
inkscape:zoom="0.59451925"
borderopacity="1.0"
inkscape:current-layer="layer1"
inkscape:cx="278.72629"
inkscape:cy="-120.86787"
borderlayer="true"
inkscape:window-maximized="0"
showgrid="false"
fit-margin-right="0"
units="mm"
inkscape:document-units="mm"
bordercolor="#666666"
inkscape:window-x="258"
inkscape:window-y="156"
fit-margin-bottom="0"
inkscape:window-width="676"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
pagecolor="#ffffff"
inkscape:window-height="697"
fit-margin-top="0"
/>
<g
id="layer1"
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
transform="translate(49.578 -405.14)"
>
<path
id="path4240"
style="fill:#939a99"
inkscape:connector-curvature="0"
d="m138.46 518.1c-3.3948 42.183-38.678 75.363-81.735 75.363-24.407 0-46.312-10.671-61.338-27.589 0 0 24.644 3.4644 24.644 3.4644 9.5709 1.3452 18.421-5.3223 19.766-14.894l4.0045-28.501c1.2787-9.0991-4.6893-17.529-13.503-19.498 9.082 0.62988 17.237-5.8496 18.524-15.006l4.0051-28.497c1.3452-9.5715-5.3229-18.422-14.893-19.767 0 0-21.721-3.053-21.721-3.053 11.954-6.8054 25.773-10.712 40.511-10.712 45.303 0 82.028 36.724 82.028 82.026 0 2.1643-0.10988 4.3018-0.27404 6.4233-0.006 0.0794-0.0125 0.15991-0.0182 0.24049zm-157.48 24.854s44.728 6.2854 44.728 6.2854-1.3898 9.8889-1.3898 9.8889-37.839-5.3174-37.839-5.3174c-2.0917-3.4595-3.9294-7.0886-5.4993-10.857zm-4.9982-17.115l7.6074 1.0693s-1.3898 9.8889-1.3898 9.8889-3.6627-0.51513-3.6627-0.51513c-1.076-3.3887-1.9232-6.8787-2.5549-10.443zm1.1762-16.166s14.086 1.98 14.086 1.98-1.3898 9.8889-1.3898 9.8889-14.085-1.98-14.085-1.98l1.3892-9.8889zm37.587 15.367s1.3892-9.8877 1.3892-9.8877 14.086 1.98 14.086 1.98l-1.3898 9.8877s-14.085-1.98-14.085-1.98zm-6.2652 5.3674s14.087 1.98 14.087 1.98l-1.3892 9.8865s-14.086-1.98-14.086-1.98 1.3886-9.8865 1.3886-9.8865zm-5.4022-0.75927l-1.3892 9.8865-14.086-1.9788s1.3898-9.8889 1.3898-9.8889l14.086 1.9812zm-7.821-7.3462l1.3898-9.8901 14.085 1.9812-1.3898 9.8877-14.085-1.9788zm6.5247-71.766s27.39 3.8501 27.39 3.8501l-5.448 38.76s-45.251-6.3611-45.251-6.3611c4.4409-14.11 12.592-26.573 23.31-36.249zm54.942-45.398c-58.707 0-106.3 47.59-106.3 106.3 0 58.708 47.592 106.3 106.3 106.3 58.707 0 106.3-47.59 106.3-106.3 0-58.708-47.592-106.3-106.3-106.3zm35.055 69.49c0.62439-4.4409-0.61524-8.7121-3.1207-12.028l-8.2513 15.372-7.5653 0.23681s-3.985-6.4355-3.985-6.4355l8.3325-15.526c-8.5565-0.7788-16.307 5.2686-17.515 13.868-0.88868 6.3232 2.0111 12.291 6.9556 15.657 0 0-11.881 84.541-11.881 84.541l14.232 1.9983 4.4104-31.383 7.4762-53.196c5.6384-1.8945 10.028-6.814 10.912-13.105zm-6.8634 19.672l12.874 9.9072s3.0158 0.42358 3.0158 0.42358l-7.1362 50.776 14.232 1.9983 7.1362-50.774 8.54 1.2 2.2333-15.885s-25.789-3.6243-25.789-3.6243-15.106 5.9778-15.106 5.9778z"
/>
</g
>
<metadata
>
<rdf:RDF
>
<cc:Work
>
<dc:format
>image/svg+xml</dc:format
>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"
/>
<cc:license
rdf:resource="http://creativecommons.org/licenses/publicdomain/"
/>
<dc:publisher
>
<cc:Agent
rdf:about="http://openclipart.org/"
>
<dc:title
>Openclipart</dc:title
>
</cc:Agent
>
</dc:publisher
>
<dc:title
>Web 2.0</dc:title
>
<dc:date
>2013-01-18T05:56:20</dc:date
>
<dc:description
>Icon for web 2.0</dc:description
>
<dc:source
>https://openclipart.org/detail/174317/web-2.0-by-fallerton-174317</dc:source
>
<dc:creator
>
<cc:Agent
>
<dc:title
>Fallerton</dc:title
>
</cc:Agent
>
</dc:creator
>
<dc:subject
>
<rdf:Bag
>
<rdf:li
>2.0</rdf:li
>
<rdf:li
>extended</rdf:li
>
<rdf:li
>web</rdf:li
>
<rdf:li
>wide</rdf:li
>
<rdf:li
>world</rdf:li
>
<rdf:li
>www</rdf:li
>
</rdf:Bag
>
</dc:subject
>
</cc:Work
>
<cc:License
rdf:about="http://creativecommons.org/licenses/publicdomain/"
>
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction"
/>
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution"
/>
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks"
/>
</cc:License
>
</rdf:RDF
>
</metadata
>
</svg
>

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -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);

View File

@ -394,6 +394,14 @@
<HintPath>..\..\packages\Xamarin.PayPal.Android.CardIO.1.0.0\lib\MonoAndroid10\Xamarin.PayPal.Android.CardIO.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XamSvg.Droid, Version=2.3.2.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\MonoAndroid44\XamSvg.Droid.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XamSvg.Shared, Version=2.3.2.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\MonoAndroid44\XamSvg.Shared.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XLabs.Caching, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\XLabs.Caching.2.3.0-pre02\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Caching.dll</HintPath>
<Private>True</Private>
@ -463,6 +471,8 @@
<Compile Include="Markdown\MDWebView.cs" />
<Compile Include="OAuth2\YaOAuth2Authenticator.cs" />
<Compile Include="Rendering\ImageButtonRenderer.cs" />
<Compile Include="Rendering\YaSvgImageView.cs" />
<Compile Include="Rendering\SvgRenderer.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SendFileActivity.cs" />
@ -645,6 +655,7 @@
<ItemGroup>
<Content Include="GeofenceAppStarter.txt" />
<Content Include="Helpers\GeofenceService.txt" />
<AndroidResource Include="Resources\raw\it.svg" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@ -8,6 +8,7 @@
<package id="Plugin.CurrentActivity" version="1.0.1" targetFramework="monoandroid70" />
<package id="Plugin.Permissions" version="1.1.7" targetFramework="monoandroid70" />
<package id="Plugin.Share" version="3.0.1" targetFramework="monoandroid70" />
<package id="Softlion.XamSvg.Free" version="2.3.2.5" targetFramework="monoandroid70" />
<package id="SQLite.Net.Async-PCL" version="3.1.1" targetFramework="monoandroid70" />
<package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="monoandroid70" />
<package id="SQLite.Net.Platform.XamarinAndroid" version="2.5.1" targetFramework="monoandroid70" />

View File

@ -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<bool> 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

View File

@ -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";
}
}

View File

@ -3,18 +3,17 @@ using System.Linq;
namespace ZicMoove.Data
{
/// <summary>
/// Use to not try and update any remote data ...
/// TODO implementation ...
/// </summary>
/// <typeparam name="V"></typeparam>
/// <typeparam name="K"></typeparam>
public class RemoteEntityRO<V,K>: RemoteEntity<V,K> where K: IEquatable<K>
{
public RemoteEntityRO (string controllerName,
Func<V,K> 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);
}
}
}

View File

@ -21,6 +21,7 @@ namespace ZicMoove.Interfaces
void Pay(double amount, PayMethod method, string paymentName);
void UpdateAppImages();
}
}

View File

@ -74,5 +74,6 @@ namespace ZicMoove.Model.Workflow
get;
set;
}
public string LocalPhoto { get; set; }
}
}

View File

@ -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"
>
<CarouselPage.ItemTemplate>
<DataTemplate>
@ -13,22 +14,32 @@
<ScrollView>
<StackLayout>
<Label Text="{Binding Name}" FontSize="Medium" HorizontalOptions="Center" />
<Image Source="{Binding PhotoUri}" Margin="10,10,10,10" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" />
<Label Text="{Binding Descrition}" HorizontalOptions="Center" />
<ListView ItemsSource="{Binding Forms}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout>
<Button Text="{Binding Title}" CommandParameter="{Binding Action}"/>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Frame HasShadow="True">
<StackLayout>
<StackLayout Orientation="Horizontal">
<views:SvgImage Svg="{Binding LocalPhoto}" HorizontalOptions="Start" HeightRequest="100" WidthRequest="100"/>
<Label Text="{Binding Name}" FontSize="Medium" HorizontalOptions="Center" />
</StackLayout>
<Label Text="{Binding Description}" HorizontalOptions="Center" />
<ListView ItemsSource="{Binding Forms}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout>
<Button Text="{Binding Title}" CommandParameter="{Binding Action}"/>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</Frame>
</StackLayout>
</ScrollView>
</ContentPage>

View File

@ -89,7 +89,7 @@
Grid.Row="0" Grid.Column="3"
FontFamily="Monospace"></Label>
<Image Grid.Row="0" Grid.Column="4" Style="{Binding
Path=ViewModelState.IsValid,
Path=ModelState.IsValid,
Converter={StaticResource boolToStyleImage}}" ></Image>
</Grid>
</ViewCell.View>

View File

@ -17,7 +17,7 @@
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout Padding="10,10,10,10" x:Name="mainLayout">
<ScrollView>
<ScrollView VerticalOptions="Start">
<StackLayout>
<Grid MinimumHeightRequest="12">
<Grid.RowDefinitions>
@ -82,11 +82,11 @@
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
BackgroundColor="White"
CaptionText="{Binding Data.Owner?.UserName}" CaptionTextColor="Black"
CaptionText="{Binding CaptionText}" CaptionTextColor="Black"
ClearText="Effacer!" ClearTextColor="Red"
PromptText="Prompt Here" PromptTextColor="Red"
SignatureLineColor="Aqua" StrokeColor="Black" StrokeWidth="2" />
<Button Clicked="OnValidate" Text="Valider cette signature" x:Name="btnValidate" />
PromptText="{Binding PromptText}" PromptTextColor="Red"
SignatureLineColor="Green" StrokeColor="Black" StrokeWidth="3" />
<Button Clicked="OnValidate" Text="Valider cette signature" x:Name="btnValidate" VerticalOptions="End" />
</StackLayout>
</ContentPage.Content>

View File

@ -32,21 +32,8 @@ namespace ZicMoove.Pages.EstimatePages
var evm = (EditEstimateViewModel)BindingContext;
var estimate = evm.Data;
using (var stream = await padView.GetImageStreamAsync(SignatureImageFormat.Png))
{
/*
var signatureMemoryStream = pngStream as MemoryStream;
if (signatureMemoryStream == null)
{
signatureMemoryStream = new MemoryStream();
pngStream.CopyTo(signatureMemoryStream);
}
var byteArray = signatureMemoryStream.ToArray();
var base64String = Convert.ToBase64String(byteArray)
*/
stream.Seek(0, SeekOrigin.Begin);
await DataManager.Instance.Estimates.SignAsProvider(estimate, stream);
DataManager.Instance.Estimates.SaveEntity();
@ -60,33 +47,6 @@ namespace ZicMoove.Pages.EstimatePages
}
private async void OnChangeTheme(object sender, EventArgs e)
{
var action = await DisplayActionSheet("Change Theme", "Cancel", null, "White", "Black", "Aqua");
switch (action)
{
case "White":
padView.BackgroundColor = Color.White;
padView.StrokeColor = Color.Black;
padView.ClearTextColor = Color.Black;
padView.ClearText = "Clear Markers";
break;
case "Black":
padView.BackgroundColor = Color.Black;
padView.StrokeColor = Color.White;
padView.ClearTextColor = Color.White;
padView.ClearText = "Clear Chalk";
break;
case "Aqua":
padView.BackgroundColor = Color.Aqua;
padView.StrokeColor = Color.Red;
padView.ClearTextColor = Color.Black;
padView.ClearText = "Clear The Aqua";
break;
}
}
}
}

View File

@ -12,6 +12,7 @@ namespace ZicMoove.Settings
using Model.Social;
using Model.Auth.Account;
using Model.Musical;
using System.Threading.Tasks;
/// <summary>
/// This is the Settings static class that can be used in your Core solution or in any
@ -92,7 +93,13 @@ namespace ZicMoove.Settings
// Inform the server of it.
if (oldregid != value)
{
App.PostDeviceInfo();
var dit = App.PostDeviceInfo();
dit.Wait();
if (dit.IsCompleted)
{
if (dit.Result)
App.PlatformSpecificInstance.UpdateAppImages();
}
}
}
get { return AppSettings.GetValueOrDefault<string>(GoogleRegIdKey); }

View File

@ -187,6 +187,24 @@ namespace ZicMoove {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Bon pour accord et execution.
/// </summary>
public static string EstimateSigningCaption {
get {
return ResourceManager.GetString("EstimateSigningCaption", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Signez ici.
/// </summary>
public static string EstimateSigningPrompt {
get {
return ResourceManager.GetString("EstimateSigningPrompt", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Star.
/// </summary>

View File

@ -233,4 +233,10 @@
<data name="ProviderContracts" xml:space="preserve">
<value>Contrats fournisseur</value>
</data>
<data name="EstimateSigningCaption" xml:space="preserve">
<value>Bon pour accord et execution</value>
</data>
<data name="EstimateSigningPrompt" xml:space="preserve">
<value>Signez ici</value>
</data>
</root>

View File

@ -64,5 +64,20 @@ namespace ZicMoove.ViewModels.Signing
}
}
}
public string CaptionText
{
get
{
return Strings.EstimateSigningCaption;
}
}
public string PromptText
{
get
{
return Strings.EstimateSigningPrompt;
}
}
}
}

View File

@ -9,9 +9,9 @@
<signature:SignaturePadView x:Name="padView"
HeightRequest="150" WidthRequest="240"
BackgroundColor="White"
CaptionText="Caption This" CaptionTextColor="Black"
ClearText="Efface moi!" ClearTextColor="Red"
PromptText="Prompt Here" PromptTextColor="Red"
CaptionText="{Binding CaptionText}" CaptionTextColor="Black"
ClearText="{Binding ClearText}" ClearTextColor="Red"
PromptText="{Binding PromptText}" PromptTextColor="Red"
SignatureLineColor="Aqua" StrokeColor="Black" StrokeWidth="2" />
<Button Clicked="OnChangeTheme" Text="Changer le Theme" />
<Button Clicked="OnGetStats" Text="Obtenir les stats de la signature " />

View File

@ -11,53 +11,19 @@ namespace ZicMoove.Views
{
public partial class MDSigningView : ContentView
{
public static readonly BindableProperty SignForProperty = BindableProperty.Create(
"SignFor", typeof(string), typeof(MDSigningView), null, BindingMode.OneWay
);
public MDSigningView()
{
InitializeComponent();
}
private async void OnChangeTheme(object sender, EventArgs e)
public string SignFor
{
var action = await App.DisplayActionSheet(
"Change Theme", "Cancel", null,
new string[] { "White", "Black", "Aqua" } );
switch (action)
{
case "White":
padView.BackgroundColor = Color.White;
padView.StrokeColor = Color.Black;
padView.ClearTextColor = Color.Black;
padView.ClearText = "Clear Markers";
break;
case "Black":
padView.BackgroundColor = Color.Black;
padView.StrokeColor = Color.White;
padView.ClearTextColor = Color.White;
padView.ClearText = "Clear Chalk";
break;
case "Aqua":
padView.BackgroundColor = Color.Aqua;
padView.StrokeColor = Color.Red;
padView.ClearTextColor = Color.Black;
padView.ClearText = "Clear The Aqua";
break;
get {
return GetValue(SignForProperty) as string;
}
}
private async void OnGetStats(object sender, EventArgs e)
{
var points = padView.Points.ToArray();
var image = await padView.GetImageStreamAsync(SignatureImageFormat.Png);
var pointCount = points.Count();
var imageSize = image.Length / 1000;
var linesCount = points.Count(p => p == Point.Zero) + (points.Length > 0 ? 1 : 0);
image.Dispose();
await App.DisplayAlert("Stats", $"The signature has {linesCount} lines or {pointCount} points, and is {imageSize:#,###.0}KB (in memory) when saved as a PNG.", "Cool");
}
}
}

View File

@ -0,0 +1,23 @@
using Xamarin.Forms;
namespace ZicMoove.Views
{
public class SvgImage : View
{
public string Svg
{
get
{
return GetValue(SvgProperty) as string;
}
set
{
SetValue(SvgProperty, value);
}
}
public static readonly BindableProperty SvgProperty =
BindableProperty.Create("Svg", typeof(string), typeof(SvgImage),
null, BindingMode.TwoWay);
}
}

View File

@ -277,6 +277,7 @@
<Compile Include="Views\RatingView.xaml.cs">
<DependentUpon>RatingView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SvgImage.cs" />
<Compile Include="Views\UserListView.xaml.cs">
<DependentUpon>UserListView.xaml</DependentUpon>
</Compile>
@ -389,6 +390,9 @@
<Reference Include="System.Web.Services">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Web.Services.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Vector.Drawable">
<HintPath>..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private>
@ -409,6 +413,13 @@
<HintPath>..\..\packages\XamForms.Controls.Calendar.1.0.7\lib\portable-net45+wp8+win8+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\XamForms.Controls.Calendar.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XamSvg.Droid">
<HintPath>..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\MonoAndroid44\XamSvg.Droid.dll</HintPath>
</Reference>
<Reference Include="XamSvg.Shared, Version=2.3.2.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Softlion.XamSvg.Free.2.3.2.5\lib\portable-win8+net45+wpa81+MonoAndroid44+Xamarin.iOS10\XamSvg.Shared.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="XLabs.Caching, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\XLabs.Caching.2.3.0-pre02\lib\portable-net45+netcore45+wpa81+wp8+monoandroid+monotouch+xamarinios10+xamarinmac\XLabs.Caching.dll</HintPath>
<Private>True</Private>

View File

@ -8,6 +8,7 @@
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable45-net45+win8+wpa81" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable45-net45+win8+wpa81" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="Softlion.XamSvg.Free" version="2.3.2.5" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLite.Net-PCL" version="3.1.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xam.Plugin.Geofence" version="1.1.2" targetFramework="portable45-net45+win8+wpa81" developmentDependency="true" />