Commit bdff6c68 authored by hasan khaddour's avatar hasan khaddour

Update domains

parent 3523f34a
......@@ -7,33 +7,9 @@ using System.Threading.Tasks;
namespace PSManagement.Domain.Customers.ValueObjects
{
public class Address :ValueObject
{
public int StreetNumber { get; private set; }
public int ZipCode { get; private set; }
public String StreetName { get; private set; }
public String City { get; private set; }
public Address()
{
}
public Address(string city, string streetName, int zipCode, int streetNumber)
{
City = city;
StreetName = streetName;
ZipCode = zipCode;
StreetNumber = streetNumber;
}
protected override IEnumerable<object> GetEqualityComponents()
{
yield return StreetName;
yield return StreetNumber;
yield return City;
yield return ZipCode;
}
}
public record Address(
int StreetNumber ,
int ZipCode ,
String StreetName ,
String City );
}
......@@ -4,11 +4,12 @@ using System;
namespace PSManagement.Domain.Projects.Entities
{
public class FinincialSpending: BaseEntity
public class FinancialSpending: BaseEntity
{
public DateTime ExpectedSpendingDate { get; set; }
public String CostType { get; set; }
public String Description { get; set; }
public Money LocalPurchase { get; set; }
public int LocalPurchase { get; set; }
public Money ExternalPurchase { get; set; }
......
using PSManagement.Domain.Projects.Entities;
using PSManagement.SharedKernel.Repositories;
namespace PSManagement.Domain.FinincialSpending.Repositories
{
public interface IFinancialSpendingRepository :IRepository<FinancialSpending>
{
}
}
namespace PSManagement.Domain.FinincialSpending.Repositories
{
public interface IFinicialSpendingRepository
{
}
}
......@@ -6,7 +6,6 @@
<ItemGroup>
<Folder Include="Identity\ValueObjects\" />
<Folder Include="Projects\DomainErrors\" />
<Folder Include="Reports\Entities\" />
<Folder Include="Reports\Repositories\" />
</ItemGroup>
......
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.DomainEvents;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Projects.ValueObjects;
using PSManagement.Domain.ProjectsStatus.Entites;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Projects.Builders
{
public class ProjectBuilder
{
private ProposalInfo _proposalInfo;
private ProjectInfo _projectInfo;
private ProjectStatus _projectStatus;
private FinancialFund _financialFund;
private Aggreement _projectAggreement;
// information about who lead and execute the project
private int _teamLeaderId;
private int _projectManagerId;
private int _executerId;
private int _proposerId;
private ICollection<Step> _steps;
private ICollection<Employee> _participants;
private ICollection<Attachment> _attachments;
public ICollection<FinancialSpending> FinancialSpending { get; set; }
public ProjectBuilder WithProposalInfo(ProposalInfo proposalInfo)
{
_proposalInfo = proposalInfo;
return this;
}
public ProjectBuilder WithProjectInfo(ProjectInfo projectInfo)
{
_projectInfo = projectInfo;
return this;
}
public ProjectBuilder WithFinancialFund(FinancialFund financialFund)
{
_financialFund = financialFund;
return this;
}
public ProjectBuilder WithProjectAggreement(Aggreement projectAggreement)
{
_projectAggreement = projectAggreement;
return this;
}
public ProjectBuilder WithAttachment(Attachment[] attachments)
{
foreach (Attachment attachment in attachments) {
_attachments.Add(attachment);
}
return this;
}
public Project Build()
{
Project project= new Project(_proposalInfo, _projectInfo,_projectAggreement,_proposerId,_teamLeaderId,_projectManagerId ,_executerId);
if (_attachments is not null) {
foreach (Attachment attachment in _attachments) {
project.AddAttachment(attachment);
}
}
if (_steps is not null)
{
foreach (Step step in _steps)
{
project.AddStep(step);
}
}
return project;
}
}
}
using PSManagement.SharedKernel.DomainErrors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Projects.DomainErrors
{
public class ProjectsErrors
{
public static DomainError InvalidEntryError { get; } = new DomainError("Invalid Project Entry.", new DomainError("Invalid Project Data"));
}
}
using System;
using PSManagement.SharedKernel.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -6,7 +7,5 @@ using System.Threading.Tasks;
namespace PSManagement.Domain.Projects.DomainEvents
{
class ProjectCreatedEvent
{
}
public record ProjectCreatedEvent(int projectId) : IDomainEvent;
}
......@@ -39,13 +39,32 @@ namespace PSManagement.Domain.Projects.Entities
public ICollection<Attachment> Attachments { get; set; }
// finincial plan
public FinincialFund FinincialFund { get; set; }
public ICollection<FinincialSpending> FinincialSpending { get; set; }
public FinancialFund FinancialFund { get; set; }
public ICollection<FinancialSpending> FinancialSpending { get; set; }
public ICollection<EmployeeParticipate> EmployeeParticipates { get; set; }
public ICollection<Track> Tracks { get; set; }
public void AddAttachment(Attachment attachment) {
Attachments.Add(attachment);
}
public void AddFinacialSpend(FinancialSpending financialSpending)
{
FinancialSpending.Add(financialSpending);
}
public void AddStep(Step step)
{
Steps.Add(step);
}
public Project(
ProposalInfo proposalInfo,
ProjectInfo projectInfo,
......@@ -63,10 +82,18 @@ namespace PSManagement.Domain.Projects.Entities
ExecuterId = executerId;
ProposerId = proposerId;
Attachments = new List<Attachment>();
FinancialSpending = new List<FinancialSpending>();
Steps = new List<Step>();
Participants = new List<Employee>();
EmployeeParticipates = new List<EmployeeParticipate>();
}
public Project()
{
}
}
}
namespace PSManagement.Domain.Projects.ValueObjects
{
public record FinincialFund(
string FinicialStatus,
public record FinancialFund(
string FinancialStatus,
string Source
);
}
......@@ -5,7 +5,9 @@ namespace PSManagement.Domain.Projects.ValueObjects
public record ProjectInfo(
string Name,
string Code,
string Description
string Description,
DateTime StartDate,
DateTime ExpectedEndDate
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment