Commit e7db6cc3 authored by hasan khaddour's avatar hasan khaddour

fix s.

parent 5e219566
using PSManagement.SharedKernel.DomainErrors;
using ErrorOr;
using PSManagement.SharedKernel.DomainErrors;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -9,6 +10,6 @@ namespace PSManagement.Domain.Customers.DomainErrors
{
public static class CustomerErrors
{
public static DomainError InvalidEntryError { get; } = new DomainError("Invalid Customer Entry.",new DomainError("Invalid Customer Data"));
public static DomainError InvalidEntryError { get; } = new ("Customer.InvalidEntry.","Invalid Customer Data");
}
}
using PSManagement.Domain.Customers.DomainEvents;
using PSManagement.Domain.Customers.Entities;
using PSManagement.Domain.Customers.ValueObjects;
using PSManagement.Domain.Projects.Entities;
using PSManagement.SharedKernel.Aggregate;
......@@ -8,22 +7,22 @@ using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace PSManagement.Domain.Customers.Aggregate
namespace PSManagement.Domain.Customers.Entities
{
public class Customer : IAggregateRoot
{
public String CustomerName { get; set; }
public string CustomerName { get; set; }
public Address Address { get; set; }
public String Email { get; set; }
public string Email { get; set; }
public ICollection<ContactInfo> ContactInfo { get; private set; }
public ICollection<Project> Projects { get; private set; }
public Customer()
{
}
public Customer(String customerName, Address address, string email)
public Customer(string customerName, Address address, string email)
{
CustomerName = customerName;
Address = address;
......@@ -32,11 +31,11 @@ namespace PSManagement.Domain.Customers.Aggregate
public void AddContactInfo(ContactInfo contactInfo)
{
if(ContactInfo is null)
if (ContactInfo is null)
{
ContactInfo = new List<ContactInfo>();
}
ContactInfo.Add(contactInfo);
ContactInfo.Add(contactInfo);
}
......
using PSManagement.Domain.Customers.Aggregate;
using PSManagement.Domain.Customers.Entities;
using PSManagement.SharedKernel.Repositories;
......
using PSManagement.Domain.Employees.Entities;
using PSManagement.SharedKernel.Specification;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Employees.Specification
{
public class EmployeesSpecification : BaseSpecification<Employee>
{
public EmployeesSpecification(Expression<Func<Employee, bool>> criteria=null) : base(criteria)
{
AddInclude(e => e.User);
}
}
}
......@@ -9,8 +9,9 @@ namespace PSManagement.Domain.Identity.DomainErrors
{
public class UserErrors
{
public static readonly DomainError AlreadyUserExist = new ("The User Email Already Exist.", new DomainError("User email is already exist"));
public static readonly DomainError InvalidLoginAttempt = new ("The User Email or Password Are Incorrect.",new DomainError( "invalid credentails for login"));
public static readonly DomainError AlreadyUserExist = new ("The User Email Already Exist.", "User email is already exist");
public static readonly DomainError InvalidLoginAttempt = new ("The User Email or Password Are Incorrect.", "invalid credentails for login");
public static readonly DomainError UnExistUser =new ("The User Dosn't Exist.","invalid credentails ,the provieded credential doesn't match any record");
}
}
......@@ -13,6 +13,7 @@ namespace PSManagement.Domain.Identity.Entities
public string HashedPassword { get; set; }
public ICollection<Role> Roles { get; set; }
}
......
using PSManagement.Domain.Identity.Entities;
using PSManagement.SharedKernel.Interfaces;
using PSManagement.SharedKernel.Repositories;
using System.Threading.Tasks;
namespace PSManagement.Domain.Identity.Repositories
{
public interface IRolesRepository : IRepository<Role>
{
public Task<Role> GetByRoleName(string roleName, ISpecification<Role> specification = null);
}
}
using PSManagement.Domain.Identity.Entities;
using PSManagement.SharedKernel.Specification;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Identity.Specification
{
public class UserSpecification : BaseSpecification<User>
{
public UserSpecification(Expression<Func<User, bool>> criteria = null) : base(criteria)
{
AddInclude(u => u.Roles);
AddInclude(u => u.Employee);
}
}
}
......@@ -15,7 +15,6 @@ namespace PSManagement.Domain.Projects.Builders
{
private ProposalInfo _proposalInfo;
private ProjectInfo _projectInfo;
private ProjectStatus _projectStatus;
private FinancialFund _financialFund;
private Aggreement _projectAggreement;
......@@ -26,22 +25,57 @@ namespace PSManagement.Domain.Projects.Builders
private int _proposerId;
private ICollection<Step> _steps;
private ICollection<Employee> _participants;
private ICollection<EmployeeParticipate> _participants;
private ICollection<Attachment> _attachments;
public ICollection<FinancialSpending> FinancialSpending { get; set; }
private ICollection<FinancialSpending> _financialSpending;
public ProjectBuilder WithParticipants(ICollection<EmployeeParticipate> participates)
{
_participants = participates;
return this;
}
public ProjectBuilder WithFinancialSpending(ICollection<FinancialSpending> financialSpending)
{
_financialSpending = financialSpending;
return this;
}
public ProjectBuilder WithSteps(ICollection<Step> steps)
{
_steps = steps;
return this;
}
public ProjectBuilder WithProposalInfo(ProposalInfo proposalInfo)
{
_proposalInfo = proposalInfo;
return this;
}
public ProjectBuilder WithTeamLeader(int teamLeaderId)
{
_teamLeaderId = teamLeaderId;
return this;
}
public ProjectBuilder WithProjectManager(int projectManagerId)
{
_projectManagerId = projectManagerId;
return this;
}
public ProjectBuilder WithExecuter(int executerId)
{
_executerId = executerId;
return this;
}
public ProjectBuilder WithProjectInfo(ProjectInfo projectInfo)
{
_projectInfo = projectInfo;
return this;
}
public ProjectBuilder WithProposer(int proposerId)
{
_proposerId = proposerId;
return this;
}
public ProjectBuilder WithFinancialFund(FinancialFund financialFund)
{
......@@ -63,7 +97,9 @@ namespace PSManagement.Domain.Projects.Builders
public Project Build()
{
Project project= new Project(_proposalInfo, _projectInfo,_projectAggreement,_proposerId,_teamLeaderId,_projectManagerId ,_executerId);
Project project= new (_proposalInfo, _projectInfo,_projectAggreement,_proposerId,_teamLeaderId,_projectManagerId ,_executerId);
project.FinancialFund = _financialFund;
if (_attachments is not null) {
foreach (Attachment attachment in _attachments) {
......@@ -81,7 +117,15 @@ namespace PSManagement.Domain.Projects.Builders
}
}
if (_participants is not null)
{
foreach (EmployeeParticipate participate in _participants)
{
project.EmployeeParticipates.Add(participate);
}
}
return project;
}
}
......
using PSManagement.SharedKernel.DomainErrors;
using ErrorOr;
using PSManagement.SharedKernel.DomainErrors;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -9,7 +10,7 @@ namespace PSManagement.Domain.Projects.DomainErrors
{
public class ProjectsErrors
{
public static DomainError InvalidEntryError { get; } = new DomainError("Invalid Project Entry.", new DomainError("Invalid Project Data"));
public static Error InvalidEntryError { get; } = Error.Validation("ProjectError.InvalidEntry.", "Invalid Project Data");
}
}
using PSManagement.Domain.Customers.Aggregate;
using PSManagement.Domain.Customers.Entities;
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.ValueObjects;
using PSManagement.Domain.ProjectsStatus.Entites;
......
using System;
using PSManagement.Domain.Projects.Entities;
using PSManagement.SharedKernel.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -6,7 +8,7 @@ using System.Threading.Tasks;
namespace PSManagement.Domain.Projects.Repositories
{
public interface IProjectsRepository
public interface IProjectsRepository :IRepository<Project>
{
}
......
using PSManagement.Domain.Customers.Aggregate;
using System;
using System;
namespace PSManagement.Domain.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