diff --git a/SeaHaven.DataServices/Implementation/DispatchDataService.cs b/SeaHaven.DataServices/Implementation/DispatchDataService.cs index 0d5ad4d..16d5747 100644 --- a/SeaHaven.DataServices/Implementation/DispatchDataService.cs +++ b/SeaHaven.DataServices/Implementation/DispatchDataService.cs @@ -55,9 +55,9 @@ namespace SeaHaven.DataServices.Implementation } public async Task<(IEnumerable Items, int TotalCount)> GetPagedAsync( - int page, - int pageSize, - string? search = null, + int page, + int pageSize, + string? search = null, string? status = null) { var query = _context.Dispatches.AsQueryable(); @@ -414,22 +414,22 @@ namespace SeaHaven.DataServices.Implementation .ToListAsync(cancellationToken); var rawComments = await (from c in _context.Comments - where c.DispatchId == id && (c.IsDeleted == null || c.IsDeleted == false) - join u in _context.Users on c.UserId equals u.Id into users - from u in users.DefaultIfEmpty() - orderby c.CreatedDate - select new - { - c.Id, - c.Commenttext, - c.Commenter, - c.CommentType, - c.RecordType, - c.CreatedDate, - c.UserId, - UserFirstName = u != null ? u.FirstName : null, - UserLastName = u != null ? u.LastName : null - }) + where c.DispatchId == id && (c.IsDeleted == null || c.IsDeleted == false) + join u in _context.Users on c.UserId equals u.Id into users + from u in users.DefaultIfEmpty() + orderby c.CreatedDate + select new + { + c.Id, + c.Commenttext, + c.Commenter, + c.CommentType, + c.RecordType, + c.CreatedDate, + c.UserId, + UserFirstName = u != null ? u.FirstName : null, + UserLastName = u != null ? u.LastName : null + }) .ToListAsync(cancellationToken); var comments = rawComments.Select(c => new DispatchCommentDTO @@ -446,25 +446,25 @@ namespace SeaHaven.DataServices.Implementation }).ToList(); var rawUplifts = await (from u in _context.DispatchUpliftRequests - where u.DispatchId == id && (u.IsDeleted == null || u.IsDeleted == false) - join dec in _context.Users on u.DecidedByUserId equals dec.Id into decs - from dec in decs.DefaultIfEmpty() - orderby u.CreatedDate descending - select new - { - u.Id, - u.CurrentNTE, - u.RequestedNTE, - u.VendorReason, - u.Status, - u.RequiredTier, - u.RequestedByVendorName, - RequestedAt = u.CreatedDate, - u.DecidedAt, - u.DecisionNote, - DecidedByFirstName = dec != null ? dec.FirstName : null, - DecidedByLastName = dec != null ? dec.LastName : null - }) + where u.DispatchId == id && (u.IsDeleted == null || u.IsDeleted == false) + join dec in _context.Users on u.DecidedByUserId equals dec.Id into decs + from dec in decs.DefaultIfEmpty() + orderby u.CreatedDate descending + select new + { + u.Id, + u.CurrentNTE, + u.RequestedNTE, + u.VendorReason, + u.Status, + u.RequiredTier, + u.RequestedByVendorName, + RequestedAt = u.CreatedDate, + u.DecidedAt, + u.DecisionNote, + DecidedByFirstName = dec != null ? dec.FirstName : null, + DecidedByLastName = dec != null ? dec.LastName : null + }) .ToListAsync(cancellationToken); var upliftRequests = rawUplifts.Select(u => new DispatchUpliftRequestDTO @@ -488,24 +488,24 @@ namespace SeaHaven.DataServices.Implementation var workOrderIds = linkedWOs.Select(l => l.WorkOrderId).Where(wid => wid > 0).ToList(); var rawAudit = await (from a in _context.WorkOrderAuditLogs - where workOrderIds.Contains(a.WorkOrderId) - && a.FieldName != null - && a.FieldName.Contains(dispatchNumber) - join u in _context.Users on a.UserId equals u.Id into users - from u in users.DefaultIfEmpty() - orderby a.CreatedAt descending - select new - { - a.Id, - a.Action, - a.FieldName, - a.OldValue, - a.NewValue, - a.CreatedAt, - a.UserId, - UserFirstName = u != null ? u.FirstName : null, - UserLastName = u != null ? u.LastName : null - }) + where workOrderIds.Contains(a.WorkOrderId) + && a.FieldName != null + && a.FieldName.Contains(dispatchNumber) + join u in _context.Users on a.UserId equals u.Id into users + from u in users.DefaultIfEmpty() + orderby a.CreatedAt descending + select new + { + a.Id, + a.Action, + a.FieldName, + a.OldValue, + a.NewValue, + a.CreatedAt, + a.UserId, + UserFirstName = u != null ? u.FirstName : null, + UserLastName = u != null ? u.LastName : null + }) .ToListAsync(cancellationToken); var auditLog = rawAudit.Select(a => new DispatchAuditLogDTO diff --git a/SeaHaven.DataServices/Implementation/LocationDataService.cs b/SeaHaven.DataServices/Implementation/LocationDataService.cs index 397dc1d..56ccf52 100644 --- a/SeaHaven.DataServices/Implementation/LocationDataService.cs +++ b/SeaHaven.DataServices/Implementation/LocationDataService.cs @@ -37,16 +37,16 @@ namespace SeaHaven.DataServices.Implementation } public async Task<(IEnumerable Items, int TotalCount)> GetPagedAsync( - int page, - int pageSize, + int page, + int pageSize, string? search = null) { var query = _context.Locations.AsQueryable(); if (!string.IsNullOrWhiteSpace(search)) { - query = query.Where(l => - l.Name!.Contains(search) || + query = query.Where(l => + l.Name!.Contains(search) || l.City!.Contains(search)); } diff --git a/SeaHaven.DataServices/Implementation/QuotesDataService.cs b/SeaHaven.DataServices/Implementation/QuotesDataService.cs index c0d4162..8dd5358 100644 --- a/SeaHaven.DataServices/Implementation/QuotesDataService.cs +++ b/SeaHaven.DataServices/Implementation/QuotesDataService.cs @@ -106,11 +106,11 @@ namespace SeaHaven.DataServices.Implementation ContactId = s.ContactId, Date = s.Date, Lineitems = s.LineItems!.Select(q => new QuoteLineItemReadModel - { - Descriptions = q.Descriptions, - Lineitem = q.Lineitem, - LineitemNumber = q.LineitemNumber - }).ToList(), + { + Descriptions = q.Descriptions, + Lineitem = q.Lineitem, + LineitemNumber = q.LineitemNumber + }).ToList(), }) .ToListAsync(cancellationToken); @@ -137,10 +137,10 @@ namespace SeaHaven.DataServices.Implementation BillingAddress = s.BillingAddress, ShippingAddress = s.ShippingAddress, Lineitems = s.LineItems!.Select(q => new QuoteLineItemReadModel - { - Descriptions = q.Descriptions, - Lineitem = q.Lineitem - }).ToList(), + { + Descriptions = q.Descriptions, + Lineitem = q.Lineitem + }).ToList(), TotalAmount = s.LineItems!.Sum(l => l.Lineitem ?? 0) }) .FirstOrDefaultAsync(cancellationToken); diff --git a/SeaHaven.Services/Implementation/FollowUpService.cs b/SeaHaven.Services/Implementation/FollowUpService.cs index 7331001..cfac5bf 100644 --- a/SeaHaven.Services/Implementation/FollowUpService.cs +++ b/SeaHaven.Services/Implementation/FollowUpService.cs @@ -54,7 +54,7 @@ namespace SeaHaven.Services.Implementation public async Task> GetFollowUpsPagedAsync(int page, int pageSize, string? search = null, string? status = null) { var (items, totalCount) = await _followUpDataService.GetPagedAsync(page, pageSize, search); - + var filteredItems = items.AsEnumerable(); if (!string.IsNullOrWhiteSpace(status)) { diff --git a/SeaHaven.Services/Implementation/QuotesService.cs b/SeaHaven.Services/Implementation/QuotesService.cs index a401ce9..a82dd9c 100644 --- a/SeaHaven.Services/Implementation/QuotesService.cs +++ b/SeaHaven.Services/Implementation/QuotesService.cs @@ -180,11 +180,11 @@ namespace SeaHaven.Services.Implementation private static QuoteLineItemDTO MapLineItem( SeaHaven.DataServices.Models.QuoteLineItemReadModel item) => new() - { - Descriptions = item.Descriptions, - Lineitem = item.Lineitem, - LineitemNumber = item.LineitemNumber - }; + { + Descriptions = item.Descriptions, + Lineitem = item.Lineitem, + LineitemNumber = item.LineitemNumber + }; private static string FormatAmount(decimal amount) => $"${amount}"; }