From c97ea5356fa862ca76a0b402ff677c70a1407050 Mon Sep 17 00:00:00 2001 From: gozareshgir Date: Sat, 24 Jan 2026 18:57:53 +0330 Subject: [PATCH] Add Reward To checkout Completed --- .../AccountManagement.Application.Contracts.csproj | 1 + Company.Domain/CheckoutAgg/ValueObjects/CheckoutReward.cs | 3 ++- .../CompanyManagment.App.Contracts.csproj | 1 + CompanyManagment.Application/CheckoutApplication.cs | 4 ++-- .../Repository/RollCallMandatoryRepository.cs | 4 +++- .../WorkFlow.Application.Contracts.csproj | 1 + gg.text | 5 +++++ 7 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 gg.text diff --git a/AccountManagement.Application.Contracts/AccountManagement.Application.Contracts.csproj b/AccountManagement.Application.Contracts/AccountManagement.Application.Contracts.csproj index 57db0cd1..197b9109 100644 --- a/AccountManagement.Application.Contracts/AccountManagement.Application.Contracts.csproj +++ b/AccountManagement.Application.Contracts/AccountManagement.Application.Contracts.csproj @@ -2,6 +2,7 @@ net10.0 + false diff --git a/Company.Domain/CheckoutAgg/ValueObjects/CheckoutReward.cs b/Company.Domain/CheckoutAgg/ValueObjects/CheckoutReward.cs index 34ed8d2a..3df92026 100644 --- a/Company.Domain/CheckoutAgg/ValueObjects/CheckoutReward.cs +++ b/Company.Domain/CheckoutAgg/ValueObjects/CheckoutReward.cs @@ -4,7 +4,7 @@ namespace Company.Domain.CheckoutAgg.ValueObjects; public class CheckoutReward { - public CheckoutReward(string amount, double amountDouble, string grantDateFa, DateTime grantDateGr, string description, string title) + public CheckoutReward(string amount, double amountDouble, string grantDateFa, DateTime grantDateGr, string description, string title, long entityId) { Amount = amount; AmountDouble = amountDouble; @@ -12,6 +12,7 @@ public class CheckoutReward GrantDateGr = grantDateGr; Description = description; Title = title; + EntityId = entityId; } /// diff --git a/CompanyManagment.App.Contracts/CompanyManagment.App.Contracts.csproj b/CompanyManagment.App.Contracts/CompanyManagment.App.Contracts.csproj index 8704ce17..eb68a02a 100644 --- a/CompanyManagment.App.Contracts/CompanyManagment.App.Contracts.csproj +++ b/CompanyManagment.App.Contracts/CompanyManagment.App.Contracts.csproj @@ -4,6 +4,7 @@ net10.0 true $(NoWarn);1591 + false diff --git a/CompanyManagment.Application/CheckoutApplication.cs b/CompanyManagment.Application/CheckoutApplication.cs index 195c498f..111a117c 100644 --- a/CompanyManagment.Application/CheckoutApplication.cs +++ b/CompanyManagment.Application/CheckoutApplication.cs @@ -244,8 +244,8 @@ public class CheckoutApplication : ICheckoutApplication double rewardPay = 0; if (command.RewardPayCompute) { - rewards = _rollCallMandatoryRepository.RewardForCheckout(command.EmployeeId, command.WorkshopId, checkoutStart.ToGeorgianDateTime(), checkoutEnd.ToGeorgianDateTime()) - .Select(x => new CheckoutReward(x.Amount, x.AmountDouble, x.GrantDateFa, x.GrantDateGr, x.Description, x.Title)).ToList(); + rewards = _rollCallMandatoryRepository.RewardForCheckout(command.EmployeeId, command.WorkshopId, checkoutEnd.ToGeorgianDateTime(), checkoutStart.ToGeorgianDateTime()) + .Select(x => new CheckoutReward(x.Amount, x.AmountDouble, x.GrantDateFa, x.GrantDateGr, x.Description, x.Title, x.Id)).ToList(); rewardPay = rewards.Sum(x => x.AmountDouble); } diff --git a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs index f95ddf34..b15729d6 100644 --- a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs @@ -5202,7 +5202,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll public List RewardForCheckout(long employeeId, long workshopId, DateTime checkoutEnd, DateTime checkoutStart) { - return _context.Rewards.Where(x => + var result = _context.Rewards.Where(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.GrantDate <= checkoutEnd && x.GrantDate >= checkoutStart).Select(x => new RewardViewModel { @@ -5215,6 +5215,8 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll IsActive = x.IsActive, Id = x.id }).ToList(); + + return result; } private List FinesForCheckout(long employeeId, long workshopId, DateTime contractStart, diff --git a/WorkFlow/Application/WorkFlow.Application.Contracts/WorkFlow.Application.Contracts.csproj b/WorkFlow/Application/WorkFlow.Application.Contracts/WorkFlow.Application.Contracts.csproj index 6801f518..1e123253 100644 --- a/WorkFlow/Application/WorkFlow.Application.Contracts/WorkFlow.Application.Contracts.csproj +++ b/WorkFlow/Application/WorkFlow.Application.Contracts/WorkFlow.Application.Contracts.csproj @@ -4,6 +4,7 @@ net10.0 enable enable + false diff --git a/gg.text b/gg.text new file mode 100644 index 00000000..34f6e7ae --- /dev/null +++ b/gg.text @@ -0,0 +1,5 @@ + + + None + +