Add Reward To checkout Completed
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<NuGetAudit>false</NuGetAudit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace Company.Domain.CheckoutAgg.ValueObjects;
|
|||||||
|
|
||||||
public class CheckoutReward
|
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;
|
Amount = amount;
|
||||||
AmountDouble = amountDouble;
|
AmountDouble = amountDouble;
|
||||||
@@ -12,6 +12,7 @@ public class CheckoutReward
|
|||||||
GrantDateGr = grantDateGr;
|
GrantDateGr = grantDateGr;
|
||||||
Description = description;
|
Description = description;
|
||||||
Title = title;
|
Title = title;
|
||||||
|
EntityId = entityId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<TargetFramework>net10.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||||
|
<NuGetAudit>false</NuGetAudit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -244,8 +244,8 @@ public class CheckoutApplication : ICheckoutApplication
|
|||||||
double rewardPay = 0;
|
double rewardPay = 0;
|
||||||
if (command.RewardPayCompute)
|
if (command.RewardPayCompute)
|
||||||
{
|
{
|
||||||
rewards = _rollCallMandatoryRepository.RewardForCheckout(command.EmployeeId, command.WorkshopId, checkoutStart.ToGeorgianDateTime(), checkoutEnd.ToGeorgianDateTime())
|
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)).ToList();
|
.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);
|
rewardPay = rewards.Sum(x => x.AmountDouble);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5202,7 +5202,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
|||||||
public List<RewardViewModel> RewardForCheckout(long employeeId, long workshopId, DateTime checkoutEnd,
|
public List<RewardViewModel> RewardForCheckout(long employeeId, long workshopId, DateTime checkoutEnd,
|
||||||
DateTime checkoutStart)
|
DateTime checkoutStart)
|
||||||
{
|
{
|
||||||
return _context.Rewards.Where(x =>
|
var result = _context.Rewards.Where(x =>
|
||||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.GrantDate <= checkoutEnd &&
|
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.GrantDate <= checkoutEnd &&
|
||||||
x.GrantDate >= checkoutStart).Select(x => new RewardViewModel
|
x.GrantDate >= checkoutStart).Select(x => new RewardViewModel
|
||||||
{
|
{
|
||||||
@@ -5215,6 +5215,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
|||||||
IsActive = x.IsActive,
|
IsActive = x.IsActive,
|
||||||
Id = x.id
|
Id = x.id
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<FineViewModel> FinesForCheckout(long employeeId, long workshopId, DateTime contractStart,
|
private List<FineViewModel> FinesForCheckout(long employeeId, long workshopId, DateTime contractStart,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<TargetFramework>net10.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<NuGetAudit>false</NuGetAudit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user