Commit 2fddc523 authored by hasan khaddour's avatar hasan khaddour

Add Cutomer Domain

parent 5d39c9ea
using PSManagement.Domain.Customers.Entities;
using PSManagement.Domain.Customers.ValueObjects;
using PSManagement.SharedKernel.Aggregate;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace PSManagement.Domain.Customers.Aggregate
{
public class Customer : IAggregateRoot
{
public String CustomerName { get; set; }
public Address Address { get; set; }
public IEnumerable<ContactInfo> ContactInfo { get; private set; }
public Customer()
{
}
public Customer(String customerName, Address address)
{
CustomerName = customerName;
Address = address;
}
public void AddContactInfo(ContactInfo contactInfo)
{
if(ContactInfo is null)
{
ContactInfo = new List<ContactInfo>();
}
ContactInfo= ContactInfo.Append(contactInfo);
}
}
}
using PSManagement.Domain.Customers.ValueObjects;
using PSManagement.SharedKernel.Entities;
using PSManagement.SharedKernel.ValueObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace PSManagement.Domain.Customers.Entities
{
public sealed class ContactInfo : BaseEntity
{
public ContactNumber PhoneNumber { get; set; }
public ContactNumber MobileNumber { get; set; }
public String Email { get; set; }
public ContactInfo()
{
}
public ContactInfo(string email, ContactNumber mobileNumber, ContactNumber phoneNumer)
{
Email = email;
MobileNumber = mobileNumber;
PhoneNumber = phoneNumer;
}
}
}
using PSManagement.Domain.Customers.Aggregate;
using PSManagement.SharedKernel.Repositories;
namespace PSManagement.Domain.Customers.Repositories
{
public interface ICustomersRepository :IRepository<Customer>
{
}
}
using PSManagement.SharedKernel.ValueObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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;
}
}
}
using PSManagement.SharedKernel.ValueObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Customers.ValueObjects
{
public sealed class ContactNumber : ValueObject
{
public int Number { get; private set; }
public ContactNumber(int number)
{
SetNumber(number);
}
public ContactNumber()
{
}
private void SetNumber(int number)
{
Number = number;
}
protected override IEnumerable<object> GetEqualityComponents()
{
yield return Number;
}
}
}
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