This repository has been archived by the owner on Aug 30, 2019. It is now read-only.
forked from FritzAndFriends/ResourceManagement
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue FritzAndFriends#8 inital commit
- Loading branch information
1 parent
720ce65
commit 32f46bb
Showing
7 changed files
with
110 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,33 @@ | ||
using System; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Fritz.ResourceManagement.Domain | ||
{ | ||
public class ScheduleException { | ||
public class ScheduleException | ||
{ | ||
|
||
public int Id { get; set; } | ||
public int Id { get; set; } | ||
|
||
public DateTime StartDateTime { get; set; } | ||
public DateTime StartDateTime { get; set; } | ||
|
||
public DateTime EndDateTime { get; set; } | ||
public DateTime EndDateTime { get; set; } | ||
|
||
public string Name { get; set; } | ||
public string Name { get; set; } | ||
|
||
} | ||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) | ||
{ | ||
|
||
var results = new List<ValidationResult>(); | ||
|
||
if (string.IsNullOrWhiteSpace(Name)) | ||
results.Add(new ValidationResult($"{nameof(Name)} cannot be null, empty or consist of only whitespace", new[] { nameof(Name) })); | ||
|
||
if (EndDateTime < StartDateTime) | ||
results.Add(new ValidationResult($"{nameof(EndDateTime)} cannot be before {nameof(StartDateTime)}", new[] { nameof(StartDateTime), nameof(EndDateTime) })); | ||
|
||
return results; | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
using System; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Fritz.ResourceManagement.Domain | ||
{ | ||
public class TimeSlot { | ||
public class TimeSlot | ||
{ | ||
|
||
public DateTime StartDateTime { get; set; } | ||
public DateTime StartDateTime { get; set; } | ||
|
||
public DateTime EndDateTime { get; set; } | ||
public DateTime EndDateTime { get; set; } | ||
|
||
public ScheduleStatus Status { get; set; } | ||
public ScheduleStatus Status { get; set; } | ||
|
||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) | ||
{ | ||
|
||
} | ||
var results = new List<ValidationResult>(); | ||
|
||
if (Status is default(ScheduleStatus)) | ||
results.Add(new ValidationResult($"{nameof(Status)} cannot have the default value of {default(ScheduleStatus)}", new[] { nameof(Status) })); | ||
|
||
if (EndDateTime < StartDateTime) | ||
results.Add(new ValidationResult($"{nameof(EndDateTime)} cannot be before {nameof(StartDateTime)}", new[] { nameof(StartDateTime), nameof(EndDateTime) })); | ||
|
||
return results; | ||
|
||
} | ||
} | ||
} |