Revize a163f8f1
Přidáno uživatelem Milan Hotovec před téměř 4 roky(ů)
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/Leuze.Modules.Goal.Application.csproj | ||
---|---|---|
23 | 23 |
<ProjectReference Include="..\..\Domain\Leuze.Modules.Goal.Domain\Leuze.Modules.Goal.Domain.csproj" /> |
24 | 24 |
</ItemGroup> |
25 | 25 | |
26 |
<ItemGroup> |
|
27 |
<Folder Include="CQRS\Comments\Commands\" /> |
|
28 |
<Folder Include="CQRS\Comments\Queries\" /> |
|
29 |
<Folder Include="CQRS\Reviews\Commands\" /> |
|
30 |
<Folder Include="CQRS\Reviews\Queries\" /> |
|
31 |
</ItemGroup> |
|
32 | ||
26 | 33 |
</Project> |
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/Comment.cs | ||
---|---|---|
30 | 30 |
public Guid CreatorId { get; private set; } |
31 | 31 |
public GoalItem Goal { get; private set; } |
32 | 32 |
public Guid GoalId { get; private set; } |
33 |
public string Text { get; set; } |
|
33 |
public string Text { get; private set; }
|
|
34 | 34 |
public bool IsPrivate { get; private set; } |
35 | 35 |
public bool IsChanged { get; set; } |
36 | ||
37 |
public void SetText(string text) |
|
38 |
{ |
|
39 |
this.Text = text; |
|
40 |
} |
|
36 | 41 |
} |
37 | 42 |
} |
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalDefinition.cs | ||
---|---|---|
32 | 32 |
public Guid OwnerId { get; private set; } |
33 | 33 |
public DomainUser Creator { get; private set; } |
34 | 34 |
public Guid CreatorId { get; private set; } |
35 |
public string Name { get; set; } |
|
36 |
public DateTime From { get; set; } |
|
37 |
public DateTime To { get; set; } |
|
35 |
public string Name { get; private set; }
|
|
36 |
public DateTime From { get; private set; }
|
|
37 |
public DateTime To { get; private set; }
|
|
38 | 38 |
public bool OwnerLocked { get; private set; } |
39 | 39 |
public bool SupervisorLocked { get; private set; } |
40 |
public decimal? Vari { get; set; } |
|
40 |
public decimal? Vari { get; private set; }
|
|
41 | 41 | |
42 | 42 |
private List<GoalItem> _goals { get; set; } |
43 | 43 |
public IReadOnlyList<GoalItem> Goals => _goals.AsReadOnly(); |
44 | ||
45 |
public void SetName(string name) |
|
46 |
{ |
|
47 |
this.Name = name; |
|
48 |
} |
|
49 |
public void SetFrom(DateTime from) |
|
50 |
{ |
|
51 |
this.From = from; |
|
52 |
} |
|
53 |
public void SetTo(DateTime to) |
|
54 |
{ |
|
55 |
this.To = to; |
|
56 |
} |
|
57 |
public void SetVari(decimal vari) |
|
58 |
{ |
|
59 |
this.Vari = vari; |
|
60 |
} |
|
61 | ||
44 | 62 |
} |
45 | 63 |
} |
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalItem.cs | ||
---|---|---|
30 | 30 |
public Guid GoalDefinitionId { get; private set; } |
31 | 31 |
public DomainUser Creator { get; private set; } |
32 | 32 |
public Guid CreatorId { get; private set; } |
33 |
public string Name { get; set; } |
|
34 |
public string Description { get; set; } |
|
35 |
public decimal PercentileUser { get; set; } |
|
36 |
public decimal PercentileFinal { get; set; } |
|
33 |
public string Name { get; private set; }
|
|
34 |
public string Description { get; private set; }
|
|
35 |
public decimal PercentileUser { get; private set; }
|
|
36 |
public decimal PercentileFinal { get; private set; }
|
|
37 | 37 | |
38 | 38 |
private List<Comment> _comments { get; set; } |
39 | 39 |
public IReadOnlyList<Comment> Comments => _comments.AsReadOnly(); |
... | ... | |
43 | 43 | |
44 | 44 |
private List<Review> _reviews { get; set; } |
45 | 45 |
public IReadOnlyList<Review> Reviews => _reviews.AsReadOnly(); |
46 | ||
47 |
public void SetName(string name) |
|
48 |
{ |
|
49 |
this.Name = name; |
|
50 |
} |
|
51 |
public void SetDescription(string desc) |
|
52 |
{ |
|
53 |
this.Description = desc; |
|
54 |
} |
|
55 |
public void SetPercentileUser(decimal perc) |
|
56 |
{ |
|
57 |
this.PercentileUser = perc; |
|
58 |
} |
|
59 |
public void SetPercentileFinal(decimal perc) |
|
60 |
{ |
|
61 |
this.PercentileFinal = perc; |
|
62 |
} |
|
63 | ||
46 | 64 |
} |
47 | 65 |
} |
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/CommentRepository.cs | ||
---|---|---|
55 | 55 |
{ |
56 | 56 |
Comment item = await dbSet.FindAsync(id); |
57 | 57 |
if (item == null) return false; |
58 |
item.Text = text;
|
|
58 |
item.SetText(text);
|
|
59 | 59 |
item.IsChanged = true; |
60 | 60 |
await storageContext.SaveChangesAsync(); |
61 | 61 |
return true; |
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalDefinitionRepository.cs | ||
---|---|---|
40 | 40 | |
41 | 41 |
public async Task<List<GoalDefinition>> GetAllForUserAsync(Guid userId) |
42 | 42 |
{ |
43 |
return dbSet.Where(item => item.OwnerId == userId).ToList(); //TODO: await??
|
|
43 |
return await dbSet.Where(item => item.OwnerId == userId).ToListAsync();
|
|
44 | 44 |
} |
45 | 45 | |
46 | 46 |
public async Task<List<GoalDefinition>> GetAllAsync() |
47 | 47 |
{ |
48 |
return dbSet.ToList(); //TODO: Await??
|
|
48 |
return await dbSet.ToListAsync();
|
|
49 | 49 |
} |
50 | 50 | |
51 | 51 |
public async Task<GoalDefinition> GetByIdAsync(Guid id) |
... | ... | |
58 | 58 |
{ |
59 | 59 |
GoalDefinition item = await dbSet.FindAsync(id); |
60 | 60 |
if (item == null) return false; |
61 |
item.Vari = vari;
|
|
61 |
item.SetVari(vari);
|
|
62 | 62 |
await storageContext.SaveChangesAsync(); |
63 | 63 |
return true; |
64 | 64 |
} |
... | ... | |
67 | 67 |
{ |
68 | 68 |
GoalDefinition item = await dbSet.FindAsync(id); |
69 | 69 |
if (item == null) return false; |
70 |
item.From = from;
|
|
70 |
item.SetFrom(from);
|
|
71 | 71 |
await storageContext.SaveChangesAsync(); |
72 | 72 |
return true; |
73 | 73 |
} |
... | ... | |
76 | 76 |
{ |
77 | 77 |
GoalDefinition item = await dbSet.FindAsync(id); |
78 | 78 |
if (item == null) return false; |
79 |
item.To = to;
|
|
79 |
item.SetTo(to);
|
|
80 | 80 |
await storageContext.SaveChangesAsync(); |
81 | 81 |
return true; |
82 | 82 |
} |
... | ... | |
85 | 85 |
{ |
86 | 86 |
GoalDefinition item = await dbSet.FindAsync(id); |
87 | 87 |
if (item == null) return false; |
88 |
item.Name = name;
|
|
88 |
item.SetName(name);
|
|
89 | 89 |
await storageContext.SaveChangesAsync(); |
90 | 90 |
return true; |
91 | 91 |
} |
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalItemRepository.cs | ||
---|---|---|
54 | 54 |
{ |
55 | 55 |
GoalItem item = await dbSet.FindAsync(id); |
56 | 56 |
if(item == null) return false; |
57 |
item.Name = name;
|
|
57 |
item.SetName(name);
|
|
58 | 58 |
await storageContext.SaveChangesAsync(); |
59 | 59 |
return true; |
60 | 60 |
} |
... | ... | |
63 | 63 |
{ |
64 | 64 |
GoalItem item = await dbSet.FindAsync(id); |
65 | 65 |
if (item == null) return false; |
66 |
item.Description = description;
|
|
66 |
item.SetDescription(description);
|
|
67 | 67 |
await storageContext.SaveChangesAsync(); |
68 | 68 |
return true; |
69 | 69 |
} |
... | ... | |
72 | 72 |
{ |
73 | 73 |
GoalItem item = await dbSet.FindAsync(id); |
74 | 74 |
if (item == null) return false; |
75 |
item.PercentileUser = percentile;
|
|
75 |
item.SetPercentileUser(percentile);
|
|
76 | 76 |
await storageContext.SaveChangesAsync(); |
77 | 77 |
return true; |
78 | 78 |
} |
... | ... | |
81 | 81 |
{ |
82 | 82 |
GoalItem item = await dbSet.FindAsync(id); |
83 | 83 |
if (item == null) return false; |
84 |
item.PercentileFinal = percentile;
|
|
84 |
item.SetPercentileFinal(percentile);
|
|
85 | 85 |
await storageContext.SaveChangesAsync(); |
86 | 86 |
return true; |
87 | 87 |
} |
Také k dispozici: Unified diff
Edit repo, added set methods