Commit 92b258cf authored by hasan khaddour's avatar hasan khaddour

fixxed s.

parent 3610daea
using PSManagement.SharedKernel.DomainErrors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Employees.DomainErrors
{
public class EmployeesErrors
{
public static readonly DomainError EmployeeUnExist = new("Employees.UnExist", "The Provided Credential Dosent match any employee. ");
}
}
......@@ -2,13 +2,13 @@
using PSManagement.SharedKernel.ValueObjects;
using System;
namespace PSManagement.Domain.Projects.Entities
namespace PSManagement.Domain.FinancialSpends.Entities
{
public class FinancialSpending: BaseEntity
public class FinancialSpending : BaseEntity
{
public DateTime ExpectedSpendingDate { get; set; }
public String CostType { get; set; }
public String Description { get; set; }
public string CostType { get; set; }
public string Description { get; set; }
public int LocalPurchase { get; set; }
public Money ExternalPurchase { get; set; }
......
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.FinancialSpends.Entities;
using PSManagement.SharedKernel.Repositories;
namespace PSManagement.Domain.FinincialSpending.Repositories
......
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.FinancialSpends.Entities;
using PSManagement.Domain.Projects.DomainEvents;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Projects.ValueObjects;
......
using ErrorOr;
using Ardalis.Result;
using PSManagement.SharedKernel.DomainErrors;
using System;
using System.Collections.Generic;
......@@ -10,7 +10,9 @@ namespace PSManagement.Domain.Projects.DomainErrors
{
public class ProjectsErrors
{
public static Error InvalidEntryError { get; } = Error.Validation("ProjectError.InvalidEntry.", "Invalid Project Data");
public static DomainError InvalidEntryError { get; } = new ("ProjectError.InvalidEntry.", "Invalid Project Data");
public static DomainError ParticipantExistError { get; } = new("ProjectError.Participant.Exist.", "the Project already have the given particpant Data");
public static DomainError ParticipantUnExistError { get; } = new("ProjectError.Participant.UnExist.", "the Project doesnt have the given particpant Data");
}
}
using PSManagement.SharedKernel.Events;
using System;
namespace PSManagement.Domain.Projects.DomainEvents
{
public record ParticipantAddedEvent (
int EmployeeId,
int ProjectId,
int PartialTimeRatio,
String Role
):IDomainEvent;
}
using PSManagement.SharedKernel.Events;
namespace PSManagement.Domain.Projects.DomainEvents
{
public record ParticipantRemovedEvent(
int EmployeeId,
int ProjectId
) : IDomainEvent;
}
using PSManagement.Domain.Projects.ValueObjects;
using PSManagement.SharedKernel.Events;
namespace PSManagement.Domain.Projects.DomainEvents
{
public record ProjectApprovedEvent(
int ProjectId,
Aggreement ProjectAggreement) : IDomainEvent;
}
using System;
using PSManagement.SharedKernel.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace PSManagement.Domain.Projects.DomainEvents
{
class ProjectCancledEvent
{
}
public record ProjectCancelledEvent(
int ProjectId,
DateTime CancellationTime) : IDomainEvent;
}
......@@ -12,5 +12,16 @@ namespace PSManagement.Domain.Projects.Entities
public Project Project { get; set; }
public int PartialTimeRatio { get; set; }
public string Role { get; set; }
public EmployeeParticipate(int employeeId, int projectId, string role, int partialTimeRatio)
{
EmployeeId = employeeId;
ProjectId = projectId;
Role = role;
PartialTimeRatio = partialTimeRatio;
}
public EmployeeParticipate()
{
}
}
}
using PSManagement.Domain.Customers.Entities;
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.FinancialSpends.Entities;
using PSManagement.Domain.Projects.ValueObjects;
using PSManagement.Domain.ProjectsStatus.Entites;
using PSManagement.Domain.ProjectTypes.Entities;
......@@ -114,22 +115,22 @@ namespace PSManagement.Domain.Projects.Entities
}
public void Plan()
{
_state.Complete(this);
_state.Plan(this);
}
public void Approve()
public void Approve(Aggreement projectAggreement)
{
_state.Complete(this);
_state.Approve(this,projectAggreement);
}
public void Cancle()
{
_state.Complete(this);
_state.Cancle(this);
}
public void Propose()
{
_state.Complete(this);
_state.Propose(this);
}
......
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.ValueObjects;
using PSManagement.Domain.Tracking;
using PSManagement.Domain.Tracking.Entities;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -13,23 +13,27 @@ namespace PSManagement.Domain.Projects.Entities
{
public class Step : BaseEntity
{
public string StepName { get; set; }
public string Description { get; set; }
public int Duration { get; set; }
public StepInfo StepInfo { get; set; }
public int CurrentCompletionRatio { get; set; }
public int Weight { get; set; }
public DateTime StartDate { get; set; }
public int ProjectId { get; set; }
public Project Project { get; set; }
public ICollection<StepTrack> StepTracks { get; set; }
//public ICollection<Item> Purchases { get; set; }
//public ICollection<Employee> Participants { get; set; }
public Step()
{
}
public Step(StepInfo stepInfo, int projectId, int weight)
{
StepInfo = stepInfo;
ProjectId = projectId;
Weight = weight;
}
}
}
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Tracking;
using PSManagement.SharedKernel.Interfaces;
using PSManagement.SharedKernel.Repositories;
using System;
using System.Collections.Generic;
......@@ -10,7 +13,10 @@ namespace PSManagement.Domain.Projects.Repositories
{
public interface IProjectsRepository :IRepository<Project>
{
public IEnumerable<EmployeeParticipate> GetProjectParticipants(int projectId);
public IEnumerable<Step> GetProjectPlan(int projectId);
public IEnumerable<Track> GetProjectTracks(int projectId);
}
}
namespace PSManagement.Domain.Projects.Entities
using PSManagement.Domain.Projects.ValueObjects;
namespace PSManagement.Domain.Projects.Entities
{
public class CancledState : IProjectState
{
public string StateName => "CancledState";
public void Approve(Project project)
public void Approve(Project project, Aggreement projectAggreement)
{
}
......
namespace PSManagement.Domain.Projects.Entities
using PSManagement.Domain.Projects.ValueObjects;
namespace PSManagement.Domain.Projects.Entities
{
public class CompletedState : IProjectState
{
public string StateName => "Completed";
public void Approve(Project project)
public void Approve(Project project, Aggreement projectAggreement)
{
}
......
namespace PSManagement.Domain.Projects.Entities
using PSManagement.Domain.Projects.ValueObjects;
namespace PSManagement.Domain.Projects.Entities
{
public interface IProjectState
{
void Complete(Project project);
void Plan(Project project);
void Approve(Project project);
void Approve(Project project, Aggreement projectAggreement);
void Cancle(Project project);
void Propose(Project project);
string StateName { get; }
......
namespace PSManagement.Domain.Projects.Entities
using PSManagement.Domain.Projects.DomainEvents;
using PSManagement.Domain.Projects.ValueObjects;
using System;
namespace PSManagement.Domain.Projects.Entities
{
public class InPlanState : IProjectState
{
public string StateName => "InPlan";
public void Approve(Project project)
public void Approve(Project project, Aggreement projectAggreement)
{
project.ProjectAggreement = projectAggreement;
project.AddDomainEvent(new ProjectApprovedEvent(project.Id,projectAggreement));
project.SetState(new InProgressState());
}
public void Cancle(Project project)
{
project.AddDomainEvent(new ProjectCancelledEvent(project.Id,DateTime.Now));
project.SetState(new CancledState());
}
......
namespace PSManagement.Domain.Projects.Entities
using PSManagement.Domain.Projects.DomainEvents;
using PSManagement.Domain.Projects.ValueObjects;
using System;
namespace PSManagement.Domain.Projects.Entities
{
public class InProgressState : IProjectState
{
public string StateName => "InProgress";
public void Approve(Project project)
public void Approve(Project project, Aggreement projectAggreement)
{
}
public void Cancle(Project project)
{
project.AddDomainEvent(new ProjectCancelledEvent(project.Id, DateTime.Now));
project.SetState(new CancledState());
}
......
namespace PSManagement.Domain.Projects.Entities
using PSManagement.Domain.Projects.ValueObjects;
namespace PSManagement.Domain.Projects.Entities
{
public class ProposedState : IProjectState
{
public string StateName => "Proposed";
public void Approve(Project project)
public void Approve(Project project, Aggreement projectAggreement)
{
project.SetState(new InPlanState());
}
public void Cancle(Project project)
......@@ -26,7 +28,7 @@
public void Propose(Project project)
{
project.SetState(new InPlanState());
}
}
......
using System;
namespace PSManagement.Domain.Projects.ValueObjects
{
public record StepInfo(
string StepName,
string Description,
DateTime StartDate,
int Duration
);
}
......@@ -10,6 +10,7 @@ using PSManagement.Infrastructure.Persistence.Repositories.Base;
using PSManagement.Infrastructure.Persistence.Repositories.CustomerRepository;
using PSManagement.Infrastructure.Persistence.Repositories.EmployeeRepository;
using PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository;
using PSManagement.Infrastructure.Persistence.Repositories.StepRepository;
using PSManagement.Infrastructure.Persistence.Repositories.UserRepository;
using PSManagement.Infrastructure.Persistence.UoW;
using PSManagement.SharedKernel.Interfaces;
......@@ -31,6 +32,7 @@ namespace PSManagement.Infrastructure.Persistence.DI
services.AddScoped<IProjectsRepository, ProjectsRepository>();
services.AddScoped<IRolesRepository, RolesRepository>();
services.AddScoped<IEmployeesRepository, EmployeesRespository>();
services.AddScoped<IStepsRepository, StepsRepository>();
services.AddScoped<ProjectBuilder>();
......
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.FinancialSpends.Entities;
namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
......
......@@ -12,6 +12,15 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
.WithMany(p => p.Steps)
.HasForeignKey(s => s.ProjectId);
builder.OwnsOne(c => c.StepInfo,
p => {
p.Property(e => e.Description).HasColumnName("Description");
p.Property(e => e.StepName).HasColumnName("StepName");
p.Property(e => e.StartDate).HasColumnName("StartDate");
p.Property(e => e.Duration).HasColumnName("Duration");
}
);
builder.HasMany(e => e.StepTracks);
}
......
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240813073337_FixStepConvention")]
partial class FixStepConvention
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:Collation", "Arabic_CI_AS")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.17")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("PSManagement.Domain.Customers.Entities.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CustomerName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Department", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Departments");
b.HasData(
new
{
Id = 1,
Name = "قسم المعلوميات"
},
new
{
Id = 2,
Name = "قسم النظم الإلكترونيى"
},
new
{
Id = 3,
Name = "شؤون الطلاب"
});
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("HIASTId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("Employees");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Permission");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Roles");
b.HasData(
new
{
Id = 1,
Name = "Admin"
},
new
{
Id = 2,
Name = "Employee"
},
new
{
Id = 3,
Name = "Scientific-Supervisor"
});
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
b.HasData(
new
{
Id = 2,
Email = "Admin@Admin",
HashedPassword = "1234",
UserName = "Admin"
});
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AttachmentDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentName")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentUrl")
.HasColumnType("nvarchar(max)");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Attachment");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.EmployeeParticipate", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("PartialTimeRatio")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<string>("Role")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("ProjectId");
b.ToTable("EmployeeParticipate");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.FinancialSpending", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CostType")
.HasColumnType("nvarchar(max)");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("ExpectedSpendingDate")
.HasColumnType("datetime2");
b.Property<int>("LocalPurchase")
.HasColumnType("int");
b.Property<int?>("ProjectId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("FinancialSpending");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CurrentState")
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(max)")
.HasDefaultValue("Proposed");
b.Property<int?>("CustomerId")
.HasColumnType("int");
b.Property<int>("ExecuterId")
.HasColumnType("int");
b.Property<int>("ProjectManagerId")
.HasColumnType("int");
b.Property<int>("ProposerId")
.HasColumnType("int");
b.Property<int>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.HasIndex("ExecuterId");
b.HasIndex("ProjectManagerId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Step", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("CurrentCompletionRatio")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<int>("Weight")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Steps");
});
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.Answer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AnswerValue")
.HasColumnType("nvarchar(max)");
b.Property<int?>("QuestionId")
.HasColumnType("int");
b.Property<int?>("ReportResultId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("QuestionId");
b.HasIndex("ReportResultId");
b.ToTable("Answer");
});
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.Question", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("QuestionName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Question");
});
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.Report", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ReportName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Reports");
});
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.ReportResult", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ReportId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ReportId");
b.ToTable("ReportResults");
});
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.Section", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ReportId")
.HasColumnType("int");
b.Property<string>("SectionName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ReportId");
b.ToTable("Section");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.EmployeeTrack", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AssignedWork")
.HasColumnType("nvarchar(max)");
b.Property<int>("EmloyeeId")
.HasColumnType("int");
b.Property<string>("PerformedWork")
.HasColumnType("nvarchar(max)");
b.Property<int>("TrackId")
.HasColumnType("int");
b.Property<int>("WorkingHours")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmloyeeId");
b.HasIndex("TrackId");
b.ToTable("EmployeeTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ExecutionRatio")
.HasColumnType("int");
b.Property<int>("StepId")
.HasColumnType("int");
b.Property<int>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("TrackId");
b.ToTable("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("TrackDate")
.HasColumnType("datetime2");
b.Property<string>("TrackNote")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Tracks");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.Property<int>("PermissionsId")
.HasColumnType("int");
b.Property<int>("RolesId")
.HasColumnType("int");
b.HasKey("PermissionsId", "RolesId");
b.HasIndex("RolesId");
b.ToTable("PermissionRole");
});
modelBuilder.Entity("QuestionSection", b =>
{
b.Property<int>("QuestionsId")
.HasColumnType("int");
b.Property<int>("SectionsId")
.HasColumnType("int");
b.HasKey("QuestionsId", "SectionsId");
b.HasIndex("SectionsId");
b.ToTable("QuestionSection");
});
modelBuilder.Entity("UserRole", b =>
{
b.Property<int>("RoleId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("RoleId", "UserId");
b.HasIndex("UserId");
b.ToTable("UserRole");
b.HasData(
new
{
RoleId = 1,
UserId = 1
});
});
modelBuilder.Entity("PSManagement.Domain.Customers.Entities.Customer", b =>
{
b.OwnsMany("PSManagement.Domain.Customers.Entities.ContactInfo", "ContactInfo", b1 =>
{
b1.Property<int>("CustomerId")
.HasColumnType("int");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("ContactType")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ContactValue")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.OwnsOne("PSManagement.Domain.Customers.ValueObjects.Address", "Address", b1 =>
{
b1.Property<int>("CustomerId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.HasColumnType("nvarchar(max)")
.HasColumnName("City");
b1.Property<string>("StreetName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StreetName");
b1.Property<int>("StreetNumber")
.HasColumnType("int")
.HasColumnName("StreetNumber");
b1.Property<int>("ZipCode")
.HasColumnType("int")
.HasColumnName("ZipCode");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("Address");
b.Navigation("ContactInfo");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("PSManagement.Domain.Employees.Entities.Availability", "Availability", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CurrentWorkingHours")
.HasColumnType("int")
.HasColumnName("CurrentWorkingHours");
b1.Property<bool>("IsAvailable")
.HasColumnType("bit")
.HasColumnName("IsAvailable");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Entities.PersonalInfo", "PersonalInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FirstName")
.HasColumnType("nvarchar(max)")
.HasColumnName("FirstName");
b1.Property<string>("LastName")
.HasColumnType("nvarchar(max)")
.HasColumnName("LastName");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Entities.WorkInfo", "WorkInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("WorkJob")
.HasColumnType("nvarchar(max)")
.HasColumnName("WorkJob");
b1.Property<string>("WorkType")
.HasColumnType("nvarchar(max)")
.HasColumnName("WorkType");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.Navigation("Availability");
b.Navigation("PersonalInfo");
b.Navigation("User");
b.Navigation("WorkInfo");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", null)
.WithMany("Attachments")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.EmployeeParticipate", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeParticipates")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("EmployeeParticipates")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.FinancialSpending", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", null)
.WithMany("FinancialSpending")
.HasForeignKey("ProjectId");
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "ExternalPurchase", b1 =>
{
b1.Property<int>("FinancialSpendingId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("ExternalPurchaseAmmount");
b1.Property<string>("Currency")
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(max)")
.HasDefaultValue("USD")
.HasColumnName("ExternalPurchaseCurrency");
b1.HasKey("FinancialSpendingId");
b1.ToTable("FinancialSpending");
b1.WithOwner()
.HasForeignKey("FinancialSpendingId");
});
b.Navigation("ExternalPurchase");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{
b.HasOne("PSManagement.Domain.Customers.Entities.Customer", null)
.WithMany("Projects")
.HasForeignKey("CustomerId");
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany()
.HasForeignKey("ExecuterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "ProjectManager")
.WithMany()
.HasForeignKey("ProjectManagerId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("PSManagement.Domain.Customers.Entities.Customer", "Proposer")
.WithMany()
.HasForeignKey("ProposerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany()
.HasForeignKey("TeamLeaderId")
.OnDelete(DeleteBehavior.Restrict);
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.Aggreement", "ProjectAggreement", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("AggreementDate")
.HasColumnType("datetime2")
.HasColumnName("AggreementDate");
b1.Property<int>("AggreementNumber")
.HasColumnType("int")
.HasColumnName("AggreementNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.FinancialFund", "FinancialFund", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FinancialStatus")
.HasColumnType("nvarchar(max)")
.HasColumnName("FinicialStatus");
b1.Property<string>("Source")
.HasColumnType("nvarchar(max)")
.HasColumnName("FinicialSource");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.ProjectInfo", "ProjectInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Code")
.HasColumnType("nvarchar(max)")
.HasColumnName("Code");
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<DateTime>("ExpectedEndDate")
.HasColumnType("datetime2")
.HasColumnName("ExpectedEndDate");
b1.Property<string>("Name")
.HasColumnType("nvarchar(max)")
.HasColumnName("Name");
b1.Property<DateTime>("StartDate")
.HasColumnType("datetime2")
.HasColumnName("StartDate");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.ProposalInfo", "ProposalInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("ProposingBookDate")
.HasColumnType("datetime2")
.HasColumnName("ProposingBookDate");
b1.Property<int>("ProposingBookNumber")
.HasColumnType("int")
.HasColumnName("ProposingBookNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.Navigation("Executer");
b.Navigation("FinancialFund");
b.Navigation("ProjectAggreement");
b.Navigation("ProjectInfo");
b.Navigation("ProjectManager");
b.Navigation("ProposalInfo");
b.Navigation("Proposer");
b.Navigation("TeamLeader");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("Steps")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.StepInfo", "StepInfo", b1 =>
{
b1.Property<int>("StepId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<int>("Duration")
.HasColumnType("int")
.HasColumnName("Duration");
b1.Property<DateTime>("StartDate")
.HasColumnType("datetime2")
.HasColumnName("StartDate");
b1.Property<string>("StepName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StepName");
b1.HasKey("StepId");
b1.ToTable("Steps");
b1.WithOwner()
.HasForeignKey("StepId");
});
b.Navigation("Project");
b.Navigation("StepInfo");
});
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.Answer", b =>
{
b.HasOne("PSManagement.Domain.Reports.Entities.Question", "Question")
.WithMany()
.HasForeignKey("QuestionId");
b.HasOne("PSManagement.Domain.Reports.Entities.ReportResult", null)
.WithMany("Answers")
.HasForeignKey("ReportResultId");
b.Navigation("Question");
});
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.ReportResult", b =>
{
b.HasOne("PSManagement.Domain.Reports.Entities.Report", "Report")
.WithMany()
.HasForeignKey("ReportId");
b.Navigation("Report");
});
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.Section", b =>
{
b.HasOne("PSManagement.Domain.Reports.Entities.Report", "Report")
.WithMany("Sections")
.HasForeignKey("ReportId");
b.Navigation("Report");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.EmployeeTrack", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeTracks")
.HasForeignKey("EmloyeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", "Track")
.WithMany("EmployeeTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("Track");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Step", "Step")
.WithMany("StepTracks")
.HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", "Track")
.WithMany("StepTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Step");
b.Navigation("Track");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("Tracks")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Permission", null)
.WithMany()
.HasForeignKey("PermissionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("QuestionSection", b =>
{
b.HasOne("PSManagement.Domain.Reports.Entities.Question", null)
.WithMany()
.HasForeignKey("QuestionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Reports.Entities.Section", null)
.WithMany()
.HasForeignKey("SectionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("UserRole", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PSManagement.Domain.Customers.Entities.Customer", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Navigation("EmployeeParticipates");
b.Navigation("EmployeeTracks");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Navigation("Employee");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{
b.Navigation("Attachments");
b.Navigation("EmployeeParticipates");
b.Navigation("FinancialSpending");
b.Navigation("Steps");
b.Navigation("Tracks");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Step", b =>
{
b.Navigation("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.Report", b =>
{
b.Navigation("Sections");
});
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.ReportResult", b =>
{
b.Navigation("Answers");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Navigation("EmployeeTracks");
b.Navigation("StepTracks");
});
#pragma warning restore 612, 618
}
}
}
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class FixStepConvention : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "StartDate",
table: "Steps",
type: "datetime2",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.AlterColumn<int>(
name: "Duration",
table: "Steps",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "StartDate",
table: "Steps",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "Duration",
table: "Steps",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
}
}
}
......@@ -303,21 +303,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Property<int>("CurrentCompletionRatio")
.HasColumnType("int");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("StepName")
.HasColumnType("nvarchar(max)");
b.Property<int>("Weight")
.HasColumnType("int");
......@@ -918,7 +906,40 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.StepInfo", "StepInfo", b1 =>
{
b1.Property<int>("StepId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<int>("Duration")
.HasColumnType("int")
.HasColumnName("Duration");
b1.Property<DateTime>("StartDate")
.HasColumnType("datetime2")
.HasColumnName("StartDate");
b1.Property<string>("StepName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StepName");
b1.HasKey("StepId");
b1.ToTable("Steps");
b1.WithOwner()
.HasForeignKey("StepId");
});
b.Navigation("Project");
b.Navigation("StepInfo");
});
modelBuilder.Entity("PSManagement.Domain.Reports.Entities.Answer", b =>
......
......@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>
<ItemGroup>
......
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Projects.Repositories;
using PSManagement.Domain.Tracking;
using PSManagement.Infrastructure.Persistence.Repositories.Base;
using PSManagement.SharedKernel.Interfaces;
using PSManagement.SharedKernel.Repositories;
using System;
using System.Collections.Generic;
......@@ -15,5 +18,24 @@ namespace PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository
public ProjectsRepository(AppDbContext context) : base(context)
{
}
public IEnumerable<EmployeeParticipate> GetProjectParticipants(int projectId)
{
return _dbContext.Projects.Where(p => p.Id == projectId).FirstOrDefault()?.EmployeeParticipates.AsEnumerable();
}
public IEnumerable<Step> GetProjectPlan(int projectId)
{
return _dbContext.Projects.Where(p => p.Id == projectId).FirstOrDefault()?.Steps.AsEnumerable();
}
public IEnumerable<Track> GetProjectTracks(int projectId)
{
return _dbContext.Projects.Where(p => p.Id == projectId).FirstOrDefault()?.Tracks.AsEnumerable();
}
}
}
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Projects.Repositories;
using PSManagement.Infrastructure.Persistence.Repositories.Base;
namespace PSManagement.Infrastructure.Persistence.Repositories.StepRepository
{
public class StepsRepository : BaseRepository<Step>, IStepsRepository
{
public StepsRepository(AppDbContext context) : base(context)
{
}
}
}
......@@ -12,16 +12,13 @@ namespace PSManagement.Infrastructure.BackgroundServcies
{
public class BackgroundJobSyncEmployees: BackgroundService
{
private readonly IDateTimeProvider _timeProvider;
private readonly IServiceScopeFactory _scopeFactory;
private readonly int _syncIntervalInMinutes;
public BackgroundJobSyncEmployees(
IDateTimeProvider timeProvider,
IOptions<EmployeesSyncJobSettings> settings,
IServiceScopeFactory scopeFactory)
{
_timeProvider = timeProvider;
_syncIntervalInMinutes = settings.Value.SyncIntervalInMinutes;
_scopeFactory = scopeFactory;
}
......@@ -35,7 +32,7 @@ namespace PSManagement.Infrastructure.BackgroundServcies
try
{
using (var scope = _scopeFactory.CreateScope())
using (IServiceScope scope = _scopeFactory.CreateScope())
{
// Resolve the scoped IEmployeesRepository
var dataProvider = scope.ServiceProvider.GetRequiredService<IEmployeesProvider>();
......@@ -47,9 +44,9 @@ namespace PSManagement.Infrastructure.BackgroundServcies
Console.WriteLine("A Data sync for Employees Occured At " +response.SyncDate +"\n The number of new Employees are "+response.SyncDataCount );
}
Console.WriteLine("A Sync Employees Data End.");
}
catch (Exception ex)
catch
{
}
......
......@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>
<ItemGroup>
......
......@@ -9,14 +9,15 @@ namespace PSManagement.Infrastructure.Services.Providers
{
public class EmployeesProvider :IEmployeesProvider
{
private static List<Employee> Employees = new List<Employee>
{
new Employee{Availability=new Availability(0,true),PersonalInfo= new ("Hasan","Khaddour"),HIASTId=1,User = new User{UserName="Hasan@mail.hiast",Email="Hasan@mail.hiast" },WorkInfo = new WorkInfo("Researcher","Worker") },
private readonly static List<Employee> _employees = new()
{
new Employee { Availability = new Availability(0, true), PersonalInfo = new PersonalInfo("Hasan", "Khaddour"), HIASTId = 1, User = new User { UserName = "Hasan@mail.hiast", Email = "Hasan@mail.hiast" }, WorkInfo = new WorkInfo("Researcher", "Worker") }
};
public Task<IEnumerable<Employee>> FetchEmployees()
{
return Task.FromResult(Employees.AsEnumerable());
return Task.FromResult(_employees.AsEnumerable());
}
}
}
......@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>
<ItemGroup>
......
......@@ -23,25 +23,25 @@ namespace PSManagement.SharedKernel.Specification
public int Skip { get; private set; }
public bool IsPagingEnabled { get; private set; } = false;
protected virtual void AddInclude(Expression<Func<T, object>> includeExpression)
public virtual void AddInclude(Expression<Func<T, object>> includeExpression)
{
Includes.Add(includeExpression);
}
protected virtual void AddInclude(string includeString)
public virtual void AddInclude(string includeString)
{
IncludeStrings.Add(includeString);
}
protected virtual void ApplyPaging(int skip, int take)
public virtual void ApplyPaging(int skip, int take)
{
Skip = skip;
Take = take;
IsPagingEnabled = true;
}
protected virtual void ApplyOrderBy(Expression<Func<T, object>> orderByExpression)
public virtual void ApplyOrderBy(Expression<Func<T, object>> orderByExpression)
{
OrderBy = orderByExpression;
}
protected virtual void ApplyOrderByDescending(Expression<Func<T, object>> orderByDescendingExpression)
public virtual void ApplyOrderByDescending(Expression<Func<T, object>> orderByDescendingExpression)
{
OrderByDescending = orderByDescendingExpression;
}
......
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