private IncidentApplication(IncidentApplicationId incidentApplicationId, Content content, Title title, IncidentType incidentType, EmployeeId applicantId, List <SuspiciousEmployee> suspiciousEmployees, List <Attachment> attachments, DateTime postDate, ApplicationNumber applicationNumber) { this.ApplicantId = Guard.Argument(applicantId, nameof(applicantId)).NotNull(); this.Content = Guard.Argument(content, nameof(content)).NotNull(); this.Title = Guard.Argument(title, nameof(title)).NotNull(); this.IncidentType = Guard.Argument(incidentType, nameof(incidentType)).NotNull(); this.Id = Guard.Argument(incidentApplicationId, nameof(incidentApplicationId)).NotNull(); this.PostDate = Guard.Argument(postDate, nameof(postDate)).NotDefault(); this.CheckRule(new IndicateAtLeastOneSuspectRule(suspiciousEmployees)); this.CheckRule(new ApplicantCannotBeSuspectRule(suspiciousEmployees.Select(x => x.EmployeeId).ToList(), applicantId)); this.SuspiciousEmployees = suspiciousEmployees; this.ApplicationNumber = applicationNumber; this.ApplicationState = ApplicationStateValue.Created; this.Attachments = attachments ?? new List <Attachment>(); }
public override int GetHashCode() { int result = 1; result = (result * 397) ^ (ApplicationNumber != null ? ApplicationNumber.GetHashCode() : 0); result = (result * 397) ^ CreatedOn.GetHashCode(); result = (result * 397) ^ Id.GetHashCode(); result = (result * 397) ^ (SignitureName != null ? SignitureName.GetHashCode() : 0); result = (result * 397) ^ (UnderGradEntryKind != null ? UnderGradEntryKind.GetHashCode() : 0); return(result); }
public void Add() { ApplicationNumber applicationNumber = new ApplicationNumber() { PersonApplicationTypeId = 1, PeriodId = 1, Prefix = "A", LastNumber = "12" }; var result = _unitOfWork.Repository <ApplicationNumber>().Add(applicationNumber); Assert.IsTrue(result.IsSuccess); }
public static IncidentApplication Create(Title title, Content content, IncidentType incidentType, EmployeeId applicantId, List <EmployeeId> suspiciousEmployees, List <Attachment> attachments) { var id = IncidentApplicationId.Create(); var postDate = SystemClock.Now; var applicationNumber = new ApplicationNumber(postDate, incidentType); var suspiciousEmployeesList = suspiciousEmployees.Select(x => new SuspiciousEmployee(x)).ToList(); var application = new IncidentApplication(id, content, title, incidentType, applicantId, suspiciousEmployeesList, attachments, postDate, applicationNumber); application.AddDomainEvent(new IncidentApplicationCreated(application)); return(application); }
public IncidentApplication(IncidentApplicationId id, ApplicationNumber applicationNumber) { this.Id = id; this.ApplicationNumber = applicationNumber; }
public static IncidentApplication Create(ApplicationNumber applicationNumber) { var id = IncidentApplicationId.Create(); return(new IncidentApplication(id, applicationNumber)); }