Revize 73fdd4c6
Přidáno uživatelem Milan Hotovec před téměř 4 roky(ů)
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/CreateDefinitionRangeAside.razor | ||
---|---|---|
97 | 97 |
[Parameter] |
98 | 98 |
public bool Show { get; set; } = false; |
99 | 99 |
|
100 |
private Guid _asideId = default(Guid); |
|
101 |
[Parameter] |
|
102 |
public Guid AsideId { |
|
103 |
get { return _asideId; } |
|
104 |
set { _asideId = value; |
|
105 |
LoadArea(); |
|
106 |
} |
|
107 |
} |
|
108 |
|
|
100 | 109 |
[Parameter] |
101 | 110 |
public EventCallback CloseAside { get; set; } |
102 | 111 |
|
... | ... | |
105 | 114 |
|
106 | 115 |
private async Task Create() |
107 | 116 |
{ |
108 |
//TODO: Check data validity |
|
117 |
if(AsideId != default(Guid)) |
|
118 |
{ |
|
119 |
await EditArea(); |
|
120 |
} |
|
121 |
else |
|
122 |
{ |
|
123 |
var response = await _mediator.Send(new CreateNewArea.Command(From, To, VariCompanySuccess)); |
|
124 |
|
|
125 |
if (response.IsSuccess) |
|
126 |
{ |
|
127 |
toastService.ShowSuccess("Oblast úspěšně vytvořena"); |
|
128 |
await LoadAreasInView.InvokeAsync(); |
|
129 |
await Close(); |
|
130 |
} |
|
131 |
else toastService.ShowError($"Oblast se nepodařilo vytvořit {response.Errors.FirstOrDefault() ?? ""}"); |
|
132 |
} |
|
133 |
} |
|
109 | 134 |
|
110 |
var response = await _mediator.Send(new CreateNewArea.Command(From, To, VariCompanySuccess)); |
|
135 |
private async Task LoadArea() |
|
136 |
{ |
|
137 |
if (AsideId != default(Guid)) |
|
138 |
{ |
|
139 |
var response = await _mediator.Send(new GetAreaById.Query(AsideId)); |
|
140 |
|
|
141 |
if (response.IsSuccess) |
|
142 |
{ |
|
143 |
From = response.Result.area.From; |
|
144 |
To = response.Result.area.To; |
|
145 |
VariCompanySuccess = response.Result.area.VariCompanySuccess ?? 0; |
|
146 |
} |
|
147 |
else toastService.ShowError($"Oblast se nepodařilo načíst {response.Errors.FirstOrDefault() ?? ""}"); |
|
148 |
} |
|
149 |
} |
|
111 | 150 |
|
112 |
if (response.IsSuccess) |
|
151 |
private async Task EditArea() |
|
152 |
{ |
|
153 |
if(AsideId != default(Guid)) |
|
113 | 154 |
{ |
114 |
toastService.ShowSuccess("Oblast úspěšně vytvořena"); |
|
115 |
await LoadAreasInView.InvokeAsync(); |
|
116 |
await Close(); |
|
155 |
var response = await _mediator.Send(new EditArea.Command(AsideId, From, To, VariCompanySuccess)); |
|
156 |
|
|
157 |
if (response.IsSuccess) |
|
158 |
{ |
|
159 |
toastService.ShowSuccess("Oblast úspěšně editována"); |
|
160 |
await LoadAreasInView.InvokeAsync(); |
|
161 |
await Close(); |
|
162 |
} |
|
163 |
else toastService.ShowError($"Oblast se nepodařilo editovat {response.Errors.FirstOrDefault() ?? ""}"); |
|
117 | 164 |
} |
118 |
else toastService.ShowError($"Cíl se nepodařilo vytvořit {response.Errors.FirstOrDefault() ?? ""}"); |
|
119 | 165 |
} |
120 | 166 |
|
121 | 167 |
private async Task Close() |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/GoalDetailAside.razor | ||
---|---|---|
1 | 1 |
@inject IMediator _mediator |
2 |
@inject IToastService toastService |
|
2 | 3 |
|
3 | 4 |
<aside class="@_aside goal_detail"> |
4 | 5 |
<div class="goal_detail_header"> |
... | ... | |
23 | 24 |
</div> |
24 | 25 |
<div class="goal_detail_body"> |
25 | 26 |
<div class="goal_detail_area"> |
26 |
<input class="goal_name" type="text" placeholder="Zadejte název cíle" value="@DetailItem.Name" />
|
|
27 |
<input class="goal_name" type="text" placeholder="Zadejte název cíle" @bind-value="Name" />
|
|
27 | 28 |
<div class="goal_description_title">Popis cíle</div> |
28 | 29 |
<textarea oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"' |
29 |
class="goal_description" placeholder="Vyplňte popis cíle">@DetailItem.Description</textarea> |
|
30 |
class="goal_description" placeholder="Vyplňte popis cíle">@Description</textarea> |
|
31 |
<button @onclick="EditGoal">Uložit změny</button> |
|
30 | 32 |
</div> |
31 | 33 |
<div class="goal_communication_area"> |
32 | 34 |
<div class="goal_communication_item"> |
... | ... | |
326 | 328 |
[Parameter] |
327 | 329 |
public bool Show { get; set; } = false; |
328 | 330 |
|
331 |
|
|
332 |
public string Name { get; set; } = ""; |
|
333 |
|
|
334 |
|
|
335 |
public string Description { get; set; } = ""; |
|
336 |
|
|
337 |
|
|
329 | 338 |
private Guid _detailId; |
330 | 339 |
[Parameter] |
331 | 340 |
public Guid DetailId |
... | ... | |
357 | 366 |
if (response.IsSuccess) |
358 | 367 |
{ |
359 | 368 |
DetailItem = response.Result.item; |
369 |
Name = DetailItem.Name; |
|
370 |
Description = DetailItem.Description; |
|
371 |
} |
|
372 |
} |
|
373 |
|
|
374 |
private async Task EditGoal() |
|
375 |
{ |
|
376 |
var response = await _mediator.Send(new EditGoal.Command(DetailId, Name, Description)); |
|
377 |
|
|
378 |
if (response.IsSuccess) |
|
379 |
{ |
|
380 |
toastService.ShowSuccess("Cíl úspěšně editován"); |
|
360 | 381 |
} |
382 |
else toastService.ShowError($"Cíl se nepodařilo editovat {response.Errors.FirstOrDefault() ?? ""}"); |
|
361 | 383 |
} |
362 | 384 |
|
363 | 385 |
private async Task Close() |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/GoalRanges.razor | ||
---|---|---|
59 | 59 |
{ |
60 | 60 |
<div>Loading...</div> |
61 | 61 |
} |
62 |
<Leuze.Modules.Goal.Application.UI.Pages.Components.CreateDefinitionRangeAside Show="ShowAside" LoadAreasInView="LoadAreas" CloseAside="CloseAside" /> |
|
62 |
<Leuze.Modules.Goal.Application.UI.Pages.Components.CreateDefinitionRangeAside Show="ShowAside" AsideId="AsideId" LoadAreasInView="LoadAreas" CloseAside="CloseAside" />
|
|
63 | 63 |
|
64 | 64 |
<BlazorStyled.Styled> |
65 | 65 |
.flex{ |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/GoalsManagement.razor | ||
---|---|---|
1 |
@page "/goals/overview/{id}" |
|
1 |
@page "/goals/overview/{id:guid}"
|
|
2 | 2 |
@attribute [Authorize] |
3 | 3 |
@layout MainLayout |
4 | 4 |
@inject IMediator _mediator |
... | ... | |
17 | 17 |
</button> |
18 | 18 |
</div> |
19 | 19 |
</div> |
20 |
@if (Ranges is not null)
|
|
20 |
@if (Definitions is not null)
|
|
21 | 21 |
{ |
22 | 22 |
<table class="actions" style="width:100%"> |
23 | 23 |
<tr> |
... | ... | |
26 | 26 |
<th>Vytvořil</th> |
27 | 27 |
<th>Akce</th> |
28 | 28 |
</tr> |
29 |
@foreach (var range in Ranges)
|
|
29 |
@foreach (var range in Definitions)
|
|
30 | 30 |
{ |
31 | 31 |
<tr> |
32 |
<td>Nová definice</td>
|
|
33 |
<td>John Doe</td>
|
|
34 |
<td>Admin Admin</td>
|
|
32 |
<td>@range.Name</td>
|
|
33 |
<td>@range.Owner.Name</td>
|
|
34 |
<td>@range.Creator.Name</td>
|
|
35 | 35 |
<td> |
36 | 36 |
<div class="flex"> |
37 |
<div @onclick='() => _nav.NavigateTo("/goals/detail/test")'>
|
|
37 |
<div @onclick='() => _nav.NavigateTo($"/goals/detail/{range.Id}")'>
|
|
38 | 38 |
<i class="fal fa-eye"></i> |
39 | 39 |
Zobrazit |
40 | 40 |
</div> |
41 |
<div @onclick="() => OpenAside(range)"> |
|
41 |
<div @onclick="() => OpenAside(range.Id)">
|
|
42 | 42 |
<i class="fal fa-edit"></i> |
43 | 43 |
Upravit |
44 | 44 |
</div> |
... | ... | |
47 | 47 |
</tr> |
48 | 48 |
} |
49 | 49 |
</table> |
50 |
@if (Ranges.Count > 0)
|
|
50 |
@if (Definitions.Count > 0)
|
|
51 | 51 |
{ |
52 | 52 |
<div class="pagination"> |
53 | 53 |
<div class="left"> |
... | ... | |
57 | 57 |
<button class="pagination_button"><img class="pagination_icon" src="/Resources/Icons/chevron-right.svg" /></button> |
58 | 58 |
<button class="pagination_button"><img class="pagination_icon" src="/Resources/Icons/chevron-double-right.svg" /></button> |
59 | 59 |
</div> |
60 |
<div class="right">Zobrazeno <b>@Ranges.Count z @Total</b></div>
|
|
60 |
<div class="right">Zobrazeno <b>@Definitions.Count z @Total</b></div>
|
|
61 | 61 |
</div> |
62 | 62 |
} |
63 | 63 |
} |
... | ... | |
189 | 189 |
@code { |
190 | 190 |
|
191 | 191 |
[Parameter] |
192 |
public string Id { get; set; } = null!;
|
|
192 |
public Guid Id { get; set; } = default(Guid);
|
|
193 | 193 |
|
194 |
private List<Guid> Ranges { get; set; } = new() { Guid.NewGuid() };
|
|
194 |
private List<GoalDefinition> Definitions { get; set; } = new();
|
|
195 | 195 |
|
196 | 196 |
private int PageNumber { get; set; } = 1; |
197 | 197 |
|
... | ... | |
205 | 205 |
|
206 | 206 |
private void CloseAside() => (ShowAside) = (false); |
207 | 207 |
|
208 |
private async Task GetMyDefinitions() |
|
209 |
{ |
|
210 |
var response = await _mediator.Send(new GetAllForArea.Query(Id)); |
|
211 |
|
|
212 |
if (response.IsSuccess) |
|
213 |
{ |
|
214 |
Definitions = response.Result.list; |
|
215 |
} |
|
216 |
} |
|
217 |
|
|
218 |
protected async override Task OnInitializedAsync() |
|
219 |
{ |
|
220 |
await base.OnInitializedAsync(); |
|
221 |
await GetMyDefinitions(); |
|
222 |
} |
|
223 |
|
|
208 | 224 |
} |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitionAreas/Commands/CreateNewArea.cs | ||
---|---|---|
35 | 35 |
|
36 | 36 |
public async Task<RequestResponse<Response>> Handle(Command request, CancellationToken cancellationToken) |
37 | 37 |
{ |
38 |
//TODO: user muze byt null, ale to my nechceme!!! |
|
38 |
if(request.to <= request.from) |
|
39 |
{ |
|
40 |
return RequestResponse<Response>.CreateErrorResponse($"Zadán nevalidní rozsah!"); |
|
41 |
} |
|
42 |
|
|
39 | 43 |
var state = await _authenticationStateProvider.GetAuthenticationStateAsync(); |
40 | 44 |
var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value); |
41 | 45 |
var user = await _domainUserRepo.GetByIdAsync(id); |
42 |
var allAreas = await _gdAreaRepo.GetAllAsync(); |
|
43 | 46 |
var alreadyExistingAreas = await _gdAreaRepo.GetAllWithinTimeRange(request.from, request.to); |
44 | 47 |
|
45 | 48 |
if(alreadyExistingAreas.Count > 0) |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitionAreas/Commands/EditArea.cs | ||
---|---|---|
1 |
using Leuze.Core.Application.CQRS; |
|
2 |
using Leuze.Core.Domain.Repositories; |
|
3 |
using Leuze.Modules.Goal.Domain.Domains; |
|
4 |
using Leuze.Modules.Goal.Domain.Repositories; |
|
5 |
using Microsoft.AspNetCore.Components.Authorization; |
|
6 |
using System; |
|
7 |
using System.Collections.Generic; |
|
8 |
using System.Linq; |
|
9 |
using System.Security.Claims; |
|
10 |
using System.Text; |
|
11 |
using System.Threading; |
|
12 |
using System.Threading.Tasks; |
|
13 |
|
|
14 |
namespace Leuze.Modules.Goal.Application.CQRS.GoalDefinitionAreas.Commands |
|
15 |
{ |
|
16 |
public static class EditArea |
|
17 |
{ |
|
18 |
public record Command(Guid id, DateTime from, DateTime to, double variCompany) : IBaseRequest<Response>; |
|
19 |
|
|
20 |
public record Response(GlobalDefinitionArea item); |
|
21 |
|
|
22 |
|
|
23 |
public class Handler : IBaseRequestHandler<Command, Response> |
|
24 |
{ |
|
25 |
private readonly IGlobalDefinitionAreaRepository _gdAreaRepo; |
|
26 |
|
|
27 |
public Handler(IGlobalDefinitionAreaRepository gdAreaRepo) |
|
28 |
{ |
|
29 |
_gdAreaRepo = gdAreaRepo; |
|
30 |
} |
|
31 |
|
|
32 |
public async Task<RequestResponse<Response>> Handle(Command request, CancellationToken cancellationToken) |
|
33 |
{ |
|
34 |
if(request.to <= request.from) |
|
35 |
{ |
|
36 |
return RequestResponse<Response>.CreateErrorResponse($"Zadán nevalidní rozsah!"); |
|
37 |
} |
|
38 |
|
|
39 |
var item = await _gdAreaRepo.GetByIdAsync(request.id); |
|
40 |
var alreadyExistingAreas = await _gdAreaRepo.GetAllWithinTimeRange(request.from, request.to); |
|
41 |
alreadyExistingAreas.Remove(item); //remove, will be changed -> or it will cause error |
|
42 |
|
|
43 |
if(alreadyExistingAreas.Count > 0) |
|
44 |
{ |
|
45 |
return RequestResponse<Response>.CreateErrorResponse($"V zadaném rozsahu již existuje oblast!"); |
|
46 |
} |
|
47 |
|
|
48 |
await _gdAreaRepo.SetFrom(request.id, item.From);; |
|
49 |
await _gdAreaRepo.SetTo(request.id, item.To); |
|
50 |
await _gdAreaRepo.SetVariCompanySuccess(request.id, item.VariCompanySuccess); |
|
51 |
|
|
52 |
return RequestResponse<Response>.CreateSuccessResponse(new(item)); |
|
53 |
} |
|
54 |
} |
|
55 |
|
|
56 |
} |
|
57 |
} |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitionAreas/Queries/GetAreaById.cs | ||
---|---|---|
1 |
using Leuze.Core.Application.CQRS; |
|
2 |
using Leuze.Core.Domain.Repositories; |
|
3 |
using Leuze.Modules.Goal.Domain.Domains; |
|
4 |
using Leuze.Modules.Goal.Domain.Repositories; |
|
5 |
using Microsoft.AspNetCore.Components.Authorization; |
|
6 |
using System; |
|
7 |
using System.Collections.Generic; |
|
8 |
using System.Linq; |
|
9 |
using System.Security.Claims; |
|
10 |
using System.Text; |
|
11 |
using System.Threading; |
|
12 |
using System.Threading.Tasks; |
|
13 |
|
|
14 |
namespace Leuze.Modules.Goal.Application.CQRS.GoalDefinitionAreas.Queries |
|
15 |
{ |
|
16 |
public static class GetAreaById |
|
17 |
{ |
|
18 |
public record Query(Guid id) : IBaseRequest<Response>; |
|
19 |
|
|
20 |
public record Response(GlobalDefinitionArea area); |
|
21 |
|
|
22 |
|
|
23 |
public class Handler : IBaseRequestHandler<Query, Response> |
|
24 |
{ |
|
25 |
private readonly IGlobalDefinitionAreaRepository _gdAreaRepo; |
|
26 |
|
|
27 |
public Handler(IGlobalDefinitionAreaRepository gdAreaRepo) |
|
28 |
{ |
|
29 |
_gdAreaRepo = gdAreaRepo; |
|
30 |
} |
|
31 |
|
|
32 |
public async Task<RequestResponse<Response>> Handle(Query request, CancellationToken cancellationToken) |
|
33 |
{ |
|
34 |
var gdArea = await _gdAreaRepo.GetByIdAsync(request.id); |
|
35 |
|
|
36 |
if (gdArea == null) |
|
37 |
{ |
|
38 |
return RequestResponse<Response>.CreateErrorResponse($"Zadané ID není v databázi!"); |
|
39 |
} |
|
40 |
|
|
41 |
return RequestResponse<Response>.CreateSuccessResponse(new(gdArea)); |
|
42 |
} |
|
43 |
} |
|
44 |
} |
|
45 |
} |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Queries/GetAllForArea.cs | ||
---|---|---|
1 |
using Leuze.Core.Application.CQRS; |
|
2 |
using Leuze.Core.Domain.Repositories; |
|
3 |
using Leuze.Modules.Goal.Domain.Domains; |
|
4 |
using Leuze.Modules.Goal.Domain.Repositories; |
|
5 |
using Microsoft.AspNetCore.Components.Authorization; |
|
6 |
using System; |
|
7 |
using System.Collections.Generic; |
|
8 |
using System.Linq; |
|
9 |
using System.Security.Claims; |
|
10 |
using System.Text; |
|
11 |
using System.Threading; |
|
12 |
using System.Threading.Tasks; |
|
13 |
|
|
14 |
namespace Leuze.Modules.Goal.Application.CQRS.GoalDefinitions.Queries |
|
15 |
{ |
|
16 |
public static class GetAllForArea |
|
17 |
{ |
|
18 |
public record Query(Guid areaId) : IBaseRequest<Response>; |
|
19 |
|
|
20 |
public record Response(List<GoalDefinition> list); |
|
21 |
|
|
22 |
|
|
23 |
public class Handler : IBaseRequestHandler<Query, Response> |
|
24 |
{ |
|
25 |
private readonly IGoalDefinitionRepository _goalDefinitionRepo; |
|
26 |
|
|
27 |
public Handler(IGoalDefinitionRepository goalDefinitionRepo) |
|
28 |
{ |
|
29 |
_goalDefinitionRepo = goalDefinitionRepo; |
|
30 |
} |
|
31 |
|
|
32 |
public async Task<RequestResponse<Response>> Handle(Query request, CancellationToken cancellationToken) |
|
33 |
{ |
|
34 |
var goalDefs = await _goalDefinitionRepo.GetAllForAreaAsync(request.areaId); |
|
35 |
|
|
36 |
if (goalDefs == null) |
|
37 |
{ |
|
38 |
return RequestResponse<Response>.CreateErrorResponse($"Nelze načíst definice pro oblast: {request.areaId}!"); |
|
39 |
} |
|
40 |
|
|
41 |
return RequestResponse<Response>.CreateSuccessResponse(new(goalDefs)); |
|
42 |
} |
|
43 |
} |
|
44 |
} |
|
45 |
} |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Commands/EditGoal.cs | ||
---|---|---|
1 |
using Leuze.Core.Application.CQRS; |
|
2 |
using Leuze.Core.Domain.Repositories; |
|
3 |
using Leuze.Modules.Goal.Domain.Domains; |
|
4 |
using Leuze.Modules.Goal.Domain.Repositories; |
|
5 |
using Microsoft.AspNetCore.Components.Authorization; |
|
6 |
using System; |
|
7 |
using System.Collections.Generic; |
|
8 |
using System.Linq; |
|
9 |
using System.Security.Claims; |
|
10 |
using System.Text; |
|
11 |
using System.Threading; |
|
12 |
using System.Threading.Tasks; |
|
13 |
|
|
14 |
namespace Leuze.Modules.Goal.Application.CQRS.Goals.Commands |
|
15 |
{ |
|
16 |
public static class EditGoal |
|
17 |
{ |
|
18 |
public record Command(Guid goalId, string name, string description) : IBaseRequest<Response>; |
|
19 |
|
|
20 |
public record Response(); |
|
21 |
|
|
22 |
|
|
23 |
public class Handler : IBaseRequestHandler<Command, Response> |
|
24 |
{ |
|
25 |
private readonly IGoalItemRepository _goalItemRepo; |
|
26 |
private readonly IGoalDefinitionRepository _goalDefinitionRepo; |
|
27 |
private readonly AuthenticationStateProvider _authenticationStateProvider; |
|
28 |
private readonly IDomainUserRepository _domainUserRepository; |
|
29 |
|
|
30 |
public Handler(IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo, |
|
31 |
AuthenticationStateProvider authenticationStateProvider, IDomainUserRepository domainUserRepository) |
|
32 |
{ |
|
33 |
_goalItemRepo = goalItemRepo; |
|
34 |
_goalDefinitionRepo = goalDefinitionRepo; |
|
35 |
_authenticationStateProvider = authenticationStateProvider; |
|
36 |
_domainUserRepository = domainUserRepository; |
|
37 |
} |
|
38 |
|
|
39 |
public async Task<RequestResponse<Response>> Handle(Command request, CancellationToken cancellationToken) |
|
40 |
{ |
|
41 |
//TODO: user muze byt null, ale to my nechceme!!! |
|
42 |
var state = await _authenticationStateProvider.GetAuthenticationStateAsync(); |
|
43 |
var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value); |
|
44 |
var user = await _domainUserRepository.GetByIdAsync(id); |
|
45 |
|
|
46 |
var goal = await _goalItemRepo.GetByIdAsync(request.goalId); |
|
47 |
|
|
48 |
if(goal == null) |
|
49 |
{ |
|
50 |
return RequestResponse<Response>.CreateErrorResponse($"Cíl s ID: {request.goalId} nebyl nalezen!"); |
|
51 |
} |
|
52 |
|
|
53 |
if(request.name == null || request.name == "") |
|
54 |
{ |
|
55 |
return RequestResponse<Response>.CreateErrorResponse($"Nelze změnit název cíle"); |
|
56 |
} |
|
57 |
|
|
58 |
await _goalItemRepo.SetNameAsync(request.goalId, request.name); |
|
59 |
await _goalItemRepo.SetDescriptionAsync(request.goalId, request.description); |
|
60 |
|
|
61 |
return RequestResponse<Response>.CreateSuccessResponse(new()); |
|
62 |
} |
|
63 |
} |
|
64 |
|
|
65 |
} |
|
66 |
} |
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GlobalDefinitionArea.cs | ||
---|---|---|
51 | 51 |
this.To = to; |
52 | 52 |
} |
53 | 53 |
|
54 |
public void SetVariCompanySuccess(double vari) |
|
54 |
public void SetVariCompanySuccess(double? vari)
|
|
55 | 55 |
{ |
56 | 56 |
this.VariCompanySuccess = vari; |
57 | 57 |
} |
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Repositories/IGlobalDefinitionAreaRepository.cs | ||
---|---|---|
21 | 21 |
|
22 | 22 |
Task<bool> SetTo(Guid id, DateTime to); |
23 | 23 |
|
24 |
Task<bool> SetVariCompanySuccess(Guid id, double vari); |
|
24 |
Task<bool> SetVariCompanySuccess(Guid id, double? vari);
|
|
25 | 25 |
|
26 | 26 |
|
27 | 27 |
Task<List<GlobalDefinitionArea>> GetAllWithinTimeRange(DateTime from, DateTime to); |
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Repositories/IGoalDefinitionRepository.cs | ||
---|---|---|
12 | 12 |
{ |
13 | 13 |
Task<List<GoalDefinition>> GetAllForUserAsync(Guid userId); |
14 | 14 |
|
15 |
Task<List<GoalDefinition>> GetAllForAreaAsync(Guid areaId); |
|
16 |
|
|
15 | 17 |
Task<List<GoalDefinition>> GetAllAsync(); |
16 | 18 |
|
17 | 19 |
Task<GoalDefinition> GetByIdAsync(Guid id); |
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GlobalDefinitionAreaRepository.cs | ||
---|---|---|
47 | 47 |
return true; |
48 | 48 |
} |
49 | 49 |
|
50 |
public async Task<bool> SetVariCompanySuccess(Guid id, double vari) |
|
50 |
public async Task<bool> SetVariCompanySuccess(Guid id, double? vari)
|
|
51 | 51 |
{ |
52 | 52 |
GlobalDefinitionArea item = await dbSet.FindAsync(id); |
53 | 53 |
if (item == null) return false; |
... | ... | |
76 | 76 |
|
77 | 77 |
public async Task<List<GlobalDefinitionArea>> GetAllWithinTimeRange(DateTime from, DateTime to) |
78 | 78 |
{ |
79 |
GlobalDefinitionArea gdArea = dbSet.FirstOrDefault(); |
|
80 |
if(gdArea != null) |
|
81 |
{ |
|
82 |
Console.WriteLine(gdArea.From >= from); |
|
83 |
Console.WriteLine(gdArea.From <= to); |
|
84 |
Console.WriteLine(gdArea.To >= from); |
|
85 |
Console.WriteLine(gdArea.To <= to); |
|
86 |
} |
|
87 |
//return await dbSet.Where(item => ((item.From >= from && item.From <= to) || (item.To <= to && item.To >= from))).ToListAsync(); |
|
88 |
return await dbSet.Where(item => ((item.From >= from && item.From <= to) || (item.To <= to && item.To >= from))).ToListAsync(); |
|
79 |
return await dbSet.Where(item => ((from >= item.From && from <= item.To) || (to <= item.To && to >= item.From))).ToListAsync(); |
|
89 | 80 |
} |
90 | 81 |
} |
91 | 82 |
} |
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalDefinitionRepository.cs | ||
---|---|---|
38 | 38 |
return true; |
39 | 39 |
} |
40 | 40 |
|
41 |
public async Task<List<GoalDefinition>> GetAllForAreaAsync(Guid areaId) |
|
42 |
{ |
|
43 |
return await dbSet.Include(item => item.Creator).Include(item => item.Owner).Where(item => item.GDAreaId == areaId).ToListAsync(); |
|
44 |
} |
|
45 |
|
|
41 | 46 |
public async Task<List<GoalDefinition>> GetAllForUserAsync(Guid userId) |
42 | 47 |
{ |
43 | 48 |
return await dbSet.Include(item => item.Creator).Include(item => item.Goals).Include(item => item.GDArea).Where(item => item.OwnerId == userId).ToListAsync(); |
Také k dispozici: Unified diff
Area -> Goal view + basic edit prepared