From bed9c8a2725d354251c0931f68cb8f5f66a2fd28 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 11 Jul 2026 03:26:13 +0100 Subject: [PATCH] fixes the compile and timestamps to db --- .../PostIt.Android/PlatformBootstrap.cs | 4 ++-- .../Controllers/Business/BillingController.cs | 20 +++++++++---------- .../Business/BookQueryApiController.cs | 2 +- .../Business/EstimateApiController.cs | 2 +- .../Controllers/HairCut/HairCutController.cs | 2 +- .../NativeConfidentialController.cs | 12 +++++------ .../Accounting/ManageController.cs | 2 +- .../Contracting/CommandController.cs | 2 +- .../Haircut/HairCutCommandController.cs | 2 +- .../Services/ChatHubConnexionManager.cs | 2 +- src/Yavsc.Org/Services/DiskUsageTracker.cs | 4 ++-- .../ViewComponents/CalendarViewComponent.cs | 4 ++-- src/Yavsc.Server/Helpers/RequestHelper.cs | 6 +++--- src/Yavsc.Server/Hubs/ChatHub.cs | 2 +- .../Models/ApplicationDbContext.cs | 6 +++--- 15 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/PostIt/PostIt.Android/PlatformBootstrap.cs b/src/PostIt/PostIt.Android/PlatformBootstrap.cs index 0d11035a..d59b154f 100644 --- a/src/PostIt/PostIt.Android/PlatformBootstrap.cs +++ b/src/PostIt/PostIt.Android/PlatformBootstrap.cs @@ -19,11 +19,11 @@ internal static class PlatformBootstrap if (System.Threading.Interlocked.Exchange(ref _initialized, 1) != 0) return; - Platform.DefaultRedirectUri = Settings.AndroidRedirectUri; + Platform.DefaultRedirectUri = ViewModels.Settings.AndroidRedirectUri; Platform.CreateBrowser = () => { var activity = MainActivity.Current; return activity is null ? null : new AndroidSystemBrowser(activity); }; } -} \ No newline at end of file +} diff --git a/src/Yavsc.Api/Controllers/Business/BillingController.cs b/src/Yavsc.Api/Controllers/Business/BillingController.cs index 65a6dbcf..87035406 100644 --- a/src/Yavsc.Api/Controllers/Business/BillingController.cs +++ b/src/Yavsc.Api/Controllers/Business/BillingController.cs @@ -53,18 +53,18 @@ namespace Yavsc.ApiControllers [HttpGet("facture-{billingCode}-{id}.pdf"), Authorize] public async Task GetPdf(string billingCode, long id) - { + { var bill = await billingService.GetBillAsync(billingCode, id); if ( authorizationService.AuthorizeAsync(User, bill, new ReadPermission()).IsFaulted) { return new ChallengeResult(); } - + var fi = bill.GetBillInfo(billingService); if (!fi.Exists) return Ok(new { Error = "Not generated" }); - return File(fi.OpenRead(), "application/x-pdf", fi.Name); + return File(fi.OpenRead(), "application/x-pdf", fi.Name); } [HttpGet("facture-{billingCode}-{id}.tex"), Authorize] @@ -90,7 +90,7 @@ namespace Yavsc.ApiControllers public async Task GeneratePdf(string billingCode, long id) { var bill = await billingService.GetBillAsync(billingCode, id); - + if (bill==null) { logger.LogCritical ( $"# not found !! {id} in {billingCode}"); return this.NotFound(); @@ -111,20 +111,20 @@ namespace Yavsc.ApiControllers return new BadRequestResult(); if (!(await authorizationService.AuthorizeAsync(User, estimate, new ReadPermission())).Succeeded) - + { return new ChallengeResult(); } if (Request.Form.Files.Count!=1) return new BadRequestResult(); await User.ReceiveProSignatureAsync(billingCode,id,Request.Form.Files[0],"pro"); - estimate.ProviderValidationDate = DateTime.Now; + estimate.ProviderValidationDate = DateTime.UtcNow; dbContext.SaveChanges(User.GetUserId()); // Notify the client var locstr = _localizer["EstimationMessageToClient"]; var yaev = new EstimationEvent(estimate,_localizer); - + var regids = new [] { estimate.Client.Id }; bool gcmSent = false; var grep = await _GCMSender.NotifyEstimateAsync(regids,yaev); @@ -138,7 +138,7 @@ namespace Yavsc.ApiControllers // For authorization purpose var estimate = dbContext.Estimates.FirstOrDefault(e=>e.Id == id); if (!(await authorizationService.AuthorizeAsync(User, estimate, new ReadPermission())).Succeeded) - + { return new ChallengeResult(); } @@ -163,7 +163,7 @@ namespace Yavsc.ApiControllers if (Request.Form.Files.Count!=1) return new BadRequestResult(); await User.ReceiveProSignatureAsync(billingCode,id,Request.Form.Files[0],"cli"); - estimate.ClientValidationDate = DateTime.Now; + estimate.ClientValidationDate = DateTime.UtcNow; dbContext.SaveChanges(User.GetUserId()); return Ok (new { ClientValidationDate = estimate.ClientValidationDate }); } @@ -177,7 +177,7 @@ namespace Yavsc.ApiControllers { return new ChallengeResult(); } - + var filename = AbstractFileSystemHelpers.SignFileNameFormat("pro", billingCode, id); FileInfo fi = new FileInfo(Path.Combine(AbstractFileSystemHelpers.UserBillsDirName, filename)); if (!fi.Exists) return NotFound(new { Error = "Professional signature not found" }); diff --git a/src/Yavsc.Api/Controllers/Business/BookQueryApiController.cs b/src/Yavsc.Api/Controllers/Business/BookQueryApiController.cs index 24fa3c28..494075c6 100644 --- a/src/Yavsc.Api/Controllers/Business/BookQueryApiController.cs +++ b/src/Yavsc.Api/Controllers/Business/BookQueryApiController.cs @@ -40,7 +40,7 @@ namespace Yavsc.Controllers public IEnumerable GetCommands(long maxId=long.MaxValue) { var uid = User.FindFirstValue(ClaimTypes.NameIdentifier); - var now = DateTime.Now; + var now = DateTime.UtcNow; var result = _context.RdvQueries.Include(c => c.Location). Include(c => c.Client).Where(c => c.PerformerId == uid && c.Id < maxId && c.EventDate > now diff --git a/src/Yavsc.Api/Controllers/Business/EstimateApiController.cs b/src/Yavsc.Api/Controllers/Business/EstimateApiController.cs index 9b3ca807..41bdd353 100644 --- a/src/Yavsc.Api/Controllers/Business/EstimateApiController.cs +++ b/src/Yavsc.Api/Controllers/Business/EstimateApiController.cs @@ -134,7 +134,7 @@ namespace Yavsc.Controllers { return BadRequest(ModelState); } - query.ValidationDate = DateTime.Now; + query.ValidationDate = DateTime.UtcNow; _context.SaveChanges(User.GetUserId()); _context.Entry(query).State = EntityState.Detached; } diff --git a/src/Yavsc.Api/Controllers/HairCut/HairCutController.cs b/src/Yavsc.Api/Controllers/HairCut/HairCutController.cs index 927c0acc..822c3182 100644 --- a/src/Yavsc.Api/Controllers/HairCut/HairCutController.cs +++ b/src/Yavsc.Api/Controllers/HairCut/HairCutController.cs @@ -44,7 +44,7 @@ namespace Yavsc.ApiControllers var uid = User.FindFirstValue(ClaimTypes.NameIdentifier); - var now = DateTime.Now; + var now = DateTime.UtcNow; var result = _context.HairCutQueries .Include(q => q.Prestation) .Include(q => q.Client) diff --git a/src/Yavsc.Api/Controllers/NativeConfidentialController.cs b/src/Yavsc.Api/Controllers/NativeConfidentialController.cs index c8784cbc..01cd8478 100644 --- a/src/Yavsc.Api/Controllers/NativeConfidentialController.cs +++ b/src/Yavsc.Api/Controllers/NativeConfidentialController.cs @@ -40,14 +40,14 @@ public class NativeConfidentialController : Controller _logger.LogError("Invalid model for GCMD"); return new BadRequestObjectResult(ModelState); } - declaration.LatestActivityUpdate = DateTime.Now; + declaration.LatestActivityUpdate = DateTime.UtcNow; _logger.LogInformation($"Registering device with id:{declaration.DeviceId} for {uid}"); DeviceDeclaration? alreadyRegisteredDevice = _context.DeviceDeclaration.FirstOrDefault(d => d.DeviceId == declaration.DeviceId); var deviceAlreadyRegistered = (alreadyRegisteredDevice!=null); if (alreadyRegisteredDevice==null) { - declaration.DeclarationDate = DateTime.Now; + declaration.DeclarationDate = DateTime.UtcNow; declaration.DeviceOwnerId = uid; _context.DeviceDeclaration.Add(declaration); } @@ -59,12 +59,12 @@ public class NativeConfidentialController : Controller _context.Update(alreadyRegisteredDevice); _context.SaveChanges(User.GetUserId()); } - + _context.SaveChanges(User.GetUserId()); - + var latestActivityUpdate = _context.Activities.Max(a=>a.DateModified); - return Json(new { - IsAnUpdate = deviceAlreadyRegistered, + return Json(new { + IsAnUpdate = deviceAlreadyRegistered, UpdateActivities = latestActivityUpdate != declaration.LatestActivityUpdate }); } diff --git a/src/Yavsc.Org/Controllers/Accounting/ManageController.cs b/src/Yavsc.Org/Controllers/Accounting/ManageController.cs index 4f32a438..7419c889 100644 --- a/src/Yavsc.Org/Controllers/Accounting/ManageController.cs +++ b/src/Yavsc.Org/Controllers/Accounting/ManageController.cs @@ -108,7 +108,7 @@ namespace Yavsc.Controllers UserName = user.UserName, PostsCounter = pc, Balance = user.AccountBalance, - ActiveCommandCount = _dbContext.RdvQueries.Count(x => (x.ClientId == user.Id) && (x.EventDate > DateTime.Now)), + ActiveCommandCount = _dbContext.RdvQueries.Count(x => (x.ClientId == user.Id) && (x.EventDate > DateTime.UtcNow)), HasDedicatedCalendar = !string.IsNullOrEmpty(user.DedicatedGoogleCalendar), Roles = await _userManager.GetRolesAsync(user), PostalAddress = user.PostalAddress?.Address, diff --git a/src/Yavsc.Org/Controllers/Contracting/CommandController.cs b/src/Yavsc.Org/Controllers/Contracting/CommandController.cs index 1a07ff63..7733e1b3 100644 --- a/src/Yavsc.Org/Controllers/Contracting/CommandController.cs +++ b/src/Yavsc.Org/Controllers/Contracting/CommandController.cs @@ -109,7 +109,7 @@ namespace Yavsc.Controllers ViewBag.GoogleSettings = _googleSettings; var userid = User.GetUserId(); var user = _userManager.FindByIdAsync(userid).Result; - return View("Create", new RdvQuery(activityCode, new Location(), DateTime.Now.AddHours(4)) + return View("Create", new RdvQuery(activityCode, new Location(), DateTime.UtcNow.AddHours(4)) { PerformerProfile = pro, PerformerId = pro.PerformerId, diff --git a/src/Yavsc.Org/Controllers/Haircut/HairCutCommandController.cs b/src/Yavsc.Org/Controllers/Haircut/HairCutCommandController.cs index 80e5f80c..2b981c60 100644 --- a/src/Yavsc.Org/Controllers/Haircut/HairCutCommandController.cs +++ b/src/Yavsc.Org/Controllers/Haircut/HairCutCommandController.cs @@ -91,7 +91,7 @@ namespace Yavsc.Controllers // FIXME Assert (command.ValidationDate == null) if (command.ValidationDate == null) { paymentOk = true; - command.ValidationDate = DateTime.Now; + command.ValidationDate = DateTime.UtcNow; } else _logger.LogError ("This Command were yet validated, and is now paied one more ..."); diff --git a/src/Yavsc.Org/Services/ChatHubConnexionManager.cs b/src/Yavsc.Org/Services/ChatHubConnexionManager.cs index bf541a14..43365366 100644 --- a/src/Yavsc.Org/Services/ChatHubConnexionManager.cs +++ b/src/Yavsc.Org/Services/ChatHubConnexionManager.cs @@ -145,7 +145,7 @@ namespace Yavsc.Services if (Channels.TryRemove(roomName, out deadchanInfo)) { var room = _dbContext.ChatRoom.FirstOrDefault(r => r.Name == roomName); - room.LatestJoinPart = DateTime.Now; + room.LatestJoinPart = DateTime.UtcNow; _dbContext.SaveChanges(); } } diff --git a/src/Yavsc.Org/Services/DiskUsageTracker.cs b/src/Yavsc.Org/Services/DiskUsageTracker.cs index eda3f027..90f3e98a 100644 --- a/src/Yavsc.Org/Services/DiskUsageTracker.cs +++ b/src/Yavsc.Org/Services/DiskUsageTracker.cs @@ -10,7 +10,7 @@ public class DiskUsageTracker : IDiskUsageTracker { public DUTInfo() { - Creation = DateTime.Now; + Creation = DateTime.UtcNow; } public long Usage { get; set; } public long Quota { get; set; } @@ -46,7 +46,7 @@ public class DiskUsageTracker : IDiskUsageTracker if (DiskUsage.Count > ulistLength) { // remove the oldest - var oldestts = DateTime.Now; + var oldestts = DateTime.UtcNow; DUTInfo oinfo = null; string ouname = null; foreach (var diskusage in DiskUsage) diff --git a/src/Yavsc.Org/ViewComponents/CalendarViewComponent.cs b/src/Yavsc.Org/ViewComponents/CalendarViewComponent.cs index 2a9b4213..ed8b7acd 100644 --- a/src/Yavsc.Org/ViewComponents/CalendarViewComponent.cs +++ b/src/Yavsc.Org/ViewComponents/CalendarViewComponent.cs @@ -20,7 +20,7 @@ namespace Yavsc.ViewComponents string htmlFieldName, string calId ) { - var minDate = DateTime.Now; + var minDate = DateTime.UtcNow; var maxDate = minDate.AddDays(20); var model = await _manager.CreateViewModelAsync( @@ -30,6 +30,6 @@ namespace Yavsc.ViewComponents return View(model); } - + } } diff --git a/src/Yavsc.Server/Helpers/RequestHelper.cs b/src/Yavsc.Server/Helpers/RequestHelper.cs index 783d471b..9edbbbd8 100644 --- a/src/Yavsc.Server/Helpers/RequestHelper.cs +++ b/src/Yavsc.Server/Helpers/RequestHelper.cs @@ -17,7 +17,7 @@ namespace Yavsc.Server.Helpers string WRPostMultipart(string url, Dictionary parameters, string authorizationHeader = null) { - string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x"); + string boundary = "---------------------------" + DateTime.UtcNow.Ticks.ToString("x"); byte[] boundaryBytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n"); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); @@ -99,7 +99,7 @@ namespace Yavsc.Server.Helpers { var client = new HttpClient(); var formData = new MultipartFormDataContent(); - + if (access_token != null) client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", access_token); foreach (var formFile in formFiles) @@ -108,7 +108,7 @@ namespace Yavsc.Server.Helpers if (formFile.ContentType!=null) fileStreamContent.Headers.ContentType = new MediaTypeHeaderValue(formFile.ContentType); else fileStreamContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); - + // fileStreamContent.Headers.ContentDisposition = formFile.ContentDisposition!=null? new ContentDispositionHeaderValue( // formFile.ContentDisposition) : new ContentDispositionHeaderValue("form-data; name=\"file\"; filename=\"" + formFile.Name + "\""); fileStreamContent.Headers.Add("Content-Disposition", formFile.ContentDisposition); diff --git a/src/Yavsc.Server/Hubs/ChatHub.cs b/src/Yavsc.Server/Hubs/ChatHub.cs index ee6f71df..56ffe901 100644 --- a/src/Yavsc.Server/Hubs/ChatHub.cs +++ b/src/Yavsc.Server/Hubs/ChatHub.cs @@ -204,7 +204,7 @@ namespace Yavsc.Server.Hubs // TODO get and require some admin status for current user on this channel newRoom.Topic = channelInfo.Topic; } - newRoom.LatestJoinPart = DateTime.Now; + newRoom.LatestJoinPart = DateTime.UtcNow; _dbContext.ChatRoom.Add(newRoom); _dbContext.SaveChanges(user.Id); diff --git a/src/Yavsc.Server/Models/ApplicationDbContext.cs b/src/Yavsc.Server/Models/ApplicationDbContext.cs index 94076715..8643f3d3 100644 --- a/src/Yavsc.Server/Models/ApplicationDbContext.cs +++ b/src/Yavsc.Server/Models/ApplicationDbContext.cs @@ -299,7 +299,7 @@ namespace Yavsc.Models public DbSet MusicLoverSettings { get; set; } public DbSet CoWorking { get; set; } - private void AddTimestamps(string userId)  + private void AddTimestamps(string userId) { var entities = ChangeTracker.Entries() .Where(x => x.Entity.GetType().GetInterface(nameof(ITrackedEntity)) != null @@ -310,11 +310,11 @@ namespace Yavsc.Models { if (entity.State == EntityState.Added) { - ((ITrackedEntity)entity.Entity).DateCreated = DateTime.Now; + ((ITrackedEntity)entity.Entity).DateCreated = DateTime.UtcNow; ((ITrackedEntity)entity.Entity).UserCreated = userId; } - ((ITrackedEntity)entity.Entity).DateModified = DateTime.Now; + ((ITrackedEntity)entity.Entity).DateModified = DateTime.UtcNow; ((ITrackedEntity)entity.Entity).UserModified = userId; } }