Commit 1ae9e12a authored by hasan khaddour's avatar hasan khaddour

Add Customer Domain.

parent 815af4a2
using PSManagement.Domain.Customers.Entities; using PSManagement.Domain.Customers.DomainEvents;
using PSManagement.Domain.Customers.Entities;
using PSManagement.Domain.Customers.ValueObjects; using PSManagement.Domain.Customers.ValueObjects;
using PSManagement.SharedKernel.Aggregate; using PSManagement.SharedKernel.Aggregate;
using System; using System;
...@@ -11,7 +12,8 @@ namespace PSManagement.Domain.Customers.Aggregate ...@@ -11,7 +12,8 @@ namespace PSManagement.Domain.Customers.Aggregate
public class Customer : IAggregateRoot public class Customer : IAggregateRoot
{ {
public String CustomerName { get; set; } public String CustomerName { get; set; }
public Address Address { get; set; } public Address Address { get; set; }
public String Email { get; set; }
public IEnumerable<ContactInfo> ContactInfo { get; private set; } public IEnumerable<ContactInfo> ContactInfo { get; private set; }
public Customer() public Customer()
...@@ -19,10 +21,11 @@ namespace PSManagement.Domain.Customers.Aggregate ...@@ -19,10 +21,11 @@ namespace PSManagement.Domain.Customers.Aggregate
} }
public Customer(String customerName, Address address) public Customer(String customerName, Address address, string email)
{ {
CustomerName = customerName; CustomerName = customerName;
Address = address; Address = address;
Email = email;
} }
public void AddContactInfo(ContactInfo contactInfo) public void AddContactInfo(ContactInfo contactInfo)
...@@ -31,9 +34,10 @@ namespace PSManagement.Domain.Customers.Aggregate ...@@ -31,9 +34,10 @@ namespace PSManagement.Domain.Customers.Aggregate
{ {
ContactInfo = new List<ContactInfo>(); ContactInfo = new List<ContactInfo>();
} }
ContactInfo= ContactInfo.Append(contactInfo); ContactInfo= ContactInfo.Append(contactInfo);
} }
} }
} }
using FluentResults;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Customers.DomainErrors
{
public static class CustomerErrors
{
public static Error InvalidEntryError { get; } = new Error("Customer Invalid Entry Erorr.");
}
}
using PSManagement.SharedKernel.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Customers.DomainEvents
{
public record CutsomerCreatedEvent (
int CustomerId ,
String CustomerName): IDomainEvent;
}
...@@ -12,21 +12,19 @@ namespace PSManagement.Domain.Customers.Entities ...@@ -12,21 +12,19 @@ namespace PSManagement.Domain.Customers.Entities
{ {
public sealed class ContactInfo : BaseEntity public sealed class ContactInfo : BaseEntity
{ {
public ContactNumber PhoneNumber { get; set; } public String ContactType { get; private set; }
public ContactNumber MobileNumber { get; set; } public String ConatctValue { get; private set; }
public String Email { get; set; }
public ContactInfo() public ContactInfo(string conatctValue, string contactType)
{ {
ConatctValue = conatctValue;
ContactType = contactType;
} }
public ContactInfo(string email, ContactNumber mobileNumber, ContactNumber phoneNumer)
public ContactInfo()
{ {
Email = email;
MobileNumber = mobileNumber;
PhoneNumber = phoneNumer;
} }
} }
} }
...@@ -5,9 +5,13 @@ ...@@ -5,9 +5,13 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Customers\DomainErrors\" />
<Folder Include="Identity\Entities\" /> <Folder Include="Identity\Entities\" />
<Folder Include="Identity\ValueObjects\" /> <Folder Include="Identity\ValueObjects\" />
<Folder Include="Employees\" />
<Folder Include="Departments\" />
<Folder Include="Phases\" />
<Folder Include="ProjectTypes\" />
<Folder Include="Tracking\" />
<Folder Include="Projects\DomainErrors\" /> <Folder Include="Projects\DomainErrors\" />
<Folder Include="Projects\Entities\" /> <Folder Include="Projects\Entities\" />
<Folder Include="Projects\ValueObjects\" /> <Folder Include="Projects\ValueObjects\" />
......
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