Spaces:
Running
Running
| using System; | |
| using System.Collections.Generic; | |
| using System.ComponentModel.DataAnnotations; | |
| using TaskTrackingSystem.Shared.Enums; | |
| using TaskTrackingSystem.Shared.Localization; | |
| using AppTaskStatus = TaskTrackingSystem.Shared.Enums.AppTaskStatus; | |
| namespace TaskTrackingSystem.Shared.Models.Issue | |
| { | |
| public class CreateIssueDto : IValidatableObject | |
| { | |
| [] | |
| [] | |
| public long TaskId { get; set; } | |
| [] | |
| public string Title { get; set; } = string.Empty; | |
| [] | |
| public string? Description { get; set; } | |
| [] | |
| public long? AssignedTo { get; set; } | |
| [] | |
| public decimal? EstimatedHours { get; set; } | |
| [] | |
| public decimal? ActualHours { get; set; } | |
| [] | |
| public string? DelayReason { get; set; } | |
| public bool IsBlocked { get; set; } | |
| [] | |
| public string? BlockedBy { get; set; } | |
| [] | |
| public int EscalationLevel { get; set; } | |
| [] | |
| public DateTime StartDate { get; set; } | |
| [] | |
| public DateTime DueDate { get; set; } | |
| [] | |
| public AppTaskStatus StatusId { get; set; } | |
| [] | |
| public TaskPriority PriorityId { get; set; } | |
| public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) | |
| { | |
| if (StartDate == default) | |
| { | |
| yield return new ValidationResult(AppLocalization.Text("validation.startDateRequired", "Start date is required."), new[] { nameof(StartDate) }); | |
| } | |
| if (DueDate == default) | |
| { | |
| yield return new ValidationResult(AppLocalization.Text("validation.dueDateRequired", "Due date is required."), new[] { nameof(DueDate) }); | |
| } | |
| if (StartDate != default && DueDate != default && DueDate.Date < StartDate.Date) | |
| { | |
| yield return new ValidationResult(AppLocalization.Text("validation.dueDateBeforeStart", "Due date cannot be earlier than start date."), new[] { nameof(DueDate), nameof(StartDate) }); | |
| } | |
| } | |
| } | |
| } | |