Browse Source

Qualification and univ lookups

zinab_elgendy 8 months ago
parent
commit
3627a7fa8f
26 changed files with 6312 additions and 26 deletions
  1. 23 0
      MTWorkHR.API/Controllers/LookupController.cs
  2. 12 6
      MTWorkHR.Application/Dtos/Identity/UserDto.cs
  3. 21 0
      MTWorkHR.Application/Dtos/Lookup/CityDto.cs
  4. 1 0
      MTWorkHR.Application/Dtos/Lookup/CountryDto.cs
  5. 20 0
      MTWorkHR.Application/Dtos/Lookup/QualificationDto.cs
  6. 20 0
      MTWorkHR.Application/Dtos/Lookup/UniversityDto.cs
  7. 23 17
      MTWorkHR.Application/Filters/AppAuth.cs
  8. 2 1
      MTWorkHR.Application/Mapper/MappingProfile.cs
  9. 4 0
      MTWorkHR.Application/Services/Interfaces/ILookupService.cs
  10. 20 0
      MTWorkHR.Application/Services/User/LookupService.cs
  11. 15 0
      MTWorkHR.Core/IRepositories/Lookups/IQualificationRepository.cs
  12. 15 0
      MTWorkHR.Core/IRepositories/Lookups/IUniversityRepository.cs
  13. 2 0
      MTWorkHR.Core/IUnitOfWork/IUnitOfWork.cs
  14. 32 0
      MTWorkHR.Infrastructure/Configurations/QualificationConfiguration.cs
  15. 32 0
      MTWorkHR.Infrastructure/Configurations/UniversityConfiguration.cs
  16. 4 1
      MTWorkHR.Infrastructure/Configurations/UserConfiguration.cs
  17. 2 0
      MTWorkHR.Infrastructure/Entities/ApplicationUser.cs
  18. 2 0
      MTWorkHR.Infrastructure/InfrastructureServiceRegistration.cs
  19. 2897 0
      MTWorkHR.Infrastructure/Migrations/20240519110611_altrUserBD.Designer.cs
  20. 62 0
      MTWorkHR.Infrastructure/Migrations/20240519110611_altrUserBD.cs
  21. 2937 0
      MTWorkHR.Infrastructure/Migrations/20240519114008_addQualif_Univ.Designer.cs
  22. 70 0
      MTWorkHR.Infrastructure/Migrations/20240519114008_addQualif_Univ.cs
  23. 52 1
      MTWorkHR.Infrastructure/Migrations/HRDataContextModelSnapshot.cs
  24. 19 0
      MTWorkHR.Infrastructure/Repositories/Lookups/QualificationRepository.cs
  25. 19 0
      MTWorkHR.Infrastructure/Repositories/Lookups/UniversityRepository.cs
  26. 6 0
      MTWorkHR.Infrastructure/UnitOfWork/UnitOfWork.cs

+ 23 - 0
MTWorkHR.API/Controllers/LookupController.cs

@@ -43,6 +43,14 @@ namespace MTWorkHR.API.Controllers
             return await _LookupService.GetAllCountries();
         }
 
+        [HttpGet("GetCityByCountry")]
+        [ProducesResponseType(StatusCodes.Status200OK)]
+
+        public async Task<ActionResult<List<CityDto>>> GetCityByCountry(long CountryId)
+        {
+            return await _LookupService.GetCityByCountry(CountryId);
+        }
+
         [HttpGet("GetAllIndustries")]
         [ProducesResponseType(StatusCodes.Status200OK)]
 
@@ -59,6 +67,21 @@ namespace MTWorkHR.API.Controllers
             return await _LookupService.GetAllJobTitles();
         }
 
+        [HttpGet("GetAllUniversities")]
+        [ProducesResponseType(StatusCodes.Status200OK)]
+
+        public async Task<ActionResult<List<UniversityDto>>> GetAllUniversities()
+        {
+            return await _LookupService.GetAllUniversities();
+        }
+        [HttpGet("GetAllQualifications")]
+        [ProducesResponseType(StatusCodes.Status200OK)]
+
+        public async Task<ActionResult<List<QualificationDto>>> GetAllQualifications()
+        {
+            return await _LookupService.GetAllQualifications();
+        }
+
         [HttpGet("CreateCountries")]
         [ProducesResponseType(StatusCodes.Status200OK)]
 

+ 12 - 6
MTWorkHR.Application/Dtos/Identity/UserDto.cs

@@ -12,12 +12,20 @@ namespace MTWorkHR.Application.Models
     public class UserDto
     {
         public string? Id { get; set; }
+       
+        [Required]
+        public string FirstName { get; set; }
+        public DateTime DateOfBirth { get; set; }
+       
+        public string IdNumber { get; set; }
+        public string LastName { get; set; }
         [Required]
         [EmailAddress]
         public string Email { get; set; }
-        [Required]
-        public string FirstName { get; set; } 
-        public string LastName { get; set; }
+
+        public string PassportNumber { get; set; }
+        public string? FavoriteName { get; set; }
+
         public string PhoneNumber { get; set; }
         public string? LinkedInLink { get; set; }
         [Required]
@@ -26,9 +34,7 @@ namespace MTWorkHR.Application.Models
         [MinLength(6)]
         public string UserName { get; set; }
         public string? Password { get; set; }
-
-        public string? FavoriteName { get; set; }
-        public string PassportNumber { get; set; }
+      
         public int? QualificationId { get; set; }
         public int? UniversityId { get; set; }
         public int? JobTitleId { get; set; }

+ 21 - 0
MTWorkHR.Application/Dtos/Lookup/CityDto.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Countries.NET;
+using MTWorkHR.Application.Models;
+using MTWorkHR.Core.Entities.Base;
+using MTWorkHR.Core.Global;
+
+namespace MTWorkHR.Application.Models
+{
+    public class CityDto :EntityDto
+    {
+        public string NameAr { get; set; }
+        public string NameEn { get; set; }
+        public long CountryId { get; set; }
+
+    }
+}

+ 1 - 0
MTWorkHR.Application/Dtos/Lookup/CountryDto.cs

@@ -16,6 +16,7 @@ namespace MTWorkHR.Application.Models
         public string NameAr { get; set; }
         public string NameEn { get; set; }
         public string Code { get; set; }
+        public long CountryId { get; set; }
 
     }
 }

+ 20 - 0
MTWorkHR.Application/Dtos/Lookup/QualificationDto.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Countries.NET;
+using MTWorkHR.Application.Models;
+using MTWorkHR.Core.Entities.Base;
+using MTWorkHR.Core.Global;
+
+namespace MTWorkHR.Application.Models
+{
+    public class QualificationDto : EntityDto
+    {
+        public string NameAr { get; set; }
+        public string NameEn { get; set; }
+
+    }
+}

+ 20 - 0
MTWorkHR.Application/Dtos/Lookup/UniversityDto.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Countries.NET;
+using MTWorkHR.Application.Models;
+using MTWorkHR.Core.Entities.Base;
+using MTWorkHR.Core.Global;
+
+namespace MTWorkHR.Application.Models
+{
+    public class UniversityDto : EntityDto
+    {
+        public string NameAr { get; set; }
+        public string NameEn { get; set; }
+
+    }
+}

+ 23 - 17
MTWorkHR.Application/Filters/AppAuth.cs

@@ -19,31 +19,37 @@ namespace MTWorkHR.Application.Filters
 
             //Identity.Name will have windows logged in user id, in case of Windows Authentication
             //Indentity.Name will have user name passed from token, in case of JWT Authenntication and having claim type "ClaimTypes.Name"
-            var userName = context.HttpContext.User.Identity.Name;
-            var userId = context.HttpContext.User.Identities.FirstOrDefault().FindFirst("userId").Value;
-            var tenant = context.HttpContext.User.Identities.FirstOrDefault().FindFirst("tenant").Value;
-            var hierarchyIds = context.HttpContext.User.Identities.FirstOrDefault().FindFirst("hierarchyIds").Value;
-            var allowedBranchs = context.HttpContext.User.Identities.FirstOrDefault().FindFirst("branchs").Value;
-            var branch = context.HttpContext.Request.Headers.FirstOrDefault(x => x.Key == "branch").Value;
+            // var userName = context.HttpContext.User.Identity.Name;
+            var cc = context.HttpContext.User.Identities.FirstOrDefault();
+            var cc2 = cc.Claims.FirstOrDefault(c => c.Type.Contains( "email"));
+            var email = cc2 != null ? cc2.Value : "";
+            var generatedGuid = context.HttpContext.User.Identities.FirstOrDefault().FindFirst("Jti").Value;
+            var userId = context.HttpContext.User.Identities.FirstOrDefault().FindFirst("uid").Value;
+            var userName = context.HttpContext.User.Identities.FirstOrDefault().FindFirst("name").Value;
+        //    var email1 = context.HttpContext.User.Identities.FirstOrDefault().FindFirst("emailaddress").Value;
+        //    var email2 = context.HttpContext.User.Identities.FirstOrDefault().FindFirst("email").Value;
+          //  var hierarchyIds = context.HttpContext.User.Identities.FirstOrDefault().FindFirst("hierarchyIds").Value;
+         //   var allowedBranchs = context.HttpContext.User.Identities.FirstOrDefault().FindFirst("branchs").Value;
+            //var branch = context.HttpContext.Request.Headers.FirstOrDefault(x => x.Key == "branch").Value;
             var lang = context.HttpContext.Request.Headers.FirstOrDefault(x => x.Key == "lang").Value;
-            var tenantLong = string.IsNullOrEmpty(tenant.ToString()) ? (long?)null : long.Parse(tenant);
-            var branchLong = string.IsNullOrEmpty(branch.ToString()) ? (long?)null : long.Parse(branch);
+           // var tenantLong = string.IsNullOrEmpty(tenant.ToString()) ? (long?)null : long.Parse(tenant);
+            //var branchLong = string.IsNullOrEmpty(branch.ToString()) ? (long?)null : long.Parse(branch);
             var token = context.HttpContext.Request.Headers.FirstOrDefault(x => x.Key == "Authorization").Value;
 
-            var allowedHierarchies = hierarchyIds.Split(',');
-            var hierarchyLong = !string.IsNullOrEmpty(hierarchyIds) && allowedHierarchies != null && allowedHierarchies.Count() > 0 ? allowedHierarchies.Select(h => long.Parse(h)).ToArray() : new long[] { };
+           // var allowedHierarchies = hierarchyIds.Split(',');
+          //  var hierarchyLong = !string.IsNullOrEmpty(hierarchyIds) && allowedHierarchies != null && allowedHierarchies.Count() > 0 ? allowedHierarchies.Select(h => long.Parse(h)).ToArray() : new long[] { };
 
             //check if header branch not in allowed branches
-            var allowedBranchsArray = allowedBranchs.Split(',');
-            if (!string.IsNullOrEmpty(branch) && !allowedBranchs.Contains(branch))
-            {
-                context.Result = new UnauthorizedResult();
-                return;
-            }
+         //   var allowedBranchsArray = allowedBranchs.Split(',');
+            //if (!string.IsNullOrEmpty(branch) && !allowedBranchs.Contains(branch))
+            //{
+            //    context.Result = new UnauthorizedResult();
+            //    return;
+            //}
 
 
             var globalInfo = context.HttpContext.RequestServices.GetService<GlobalInfo>();
-            globalInfo.SetValues( userName, userId, branchLong, token, lang);
+            globalInfo.SetValues( userName, userId, 0, token, lang);
 
             var userManager = context.HttpContext.RequestServices.GetService<ApplicationUserManager>();
 

+ 2 - 1
MTWorkHR.Application/Mapper/MappingProfile.cs

@@ -83,7 +83,8 @@ namespace MTWorkHR.Application.Mapper
             CreateMap<CountryLookup, CountryDto>().ReverseMap();
             CreateMap<Industry, IndustryDto>().ReverseMap();
             CreateMap<JobTitle, JobTitleDto>().ReverseMap();
-
+            CreateMap<University, UniversityDto>().ReverseMap();
+            CreateMap<Qualification, QualificationDto>().ReverseMap();
 
         }
     }

+ 4 - 0
MTWorkHR.Application/Services/Interfaces/ILookupService.cs

@@ -10,10 +10,14 @@ namespace MTWorkHR.Application.Services.Interfaces
         Task<List<OrderTypeDto>> GetAllOrderType();
         Task<List<LeaveTypeDto>> GetAllLeaveType();
         Task<List<CountryDto>> GetAllCountries();
+        Task<List<CityDto>> GetCityByCountry(long CountryId);
+
         Task<List<CountryDto>> CreateCountries();
 
         Task<List<IndustryDto>> GetAllIndustries();
         Task<List<JobTitleDto>> GetAllJobTitles();
 
+        Task<List<UniversityDto>> GetAllUniversities();
+        Task<List<QualificationDto>> GetAllQualifications();
     }
 }

+ 20 - 0
MTWorkHR.Application/Services/User/LookupService.cs

@@ -48,6 +48,14 @@ namespace MTWorkHR.Application.Services
             return response;
         }
 
+        public async Task<List<CityDto>> GetCityByCountry(long CountryId)
+        {
+            List<CityDto> city = new List<CityDto> { new CityDto { NameEn = "Riyadh", NameAr = "الرياض", CountryId=1, Id = 1 }, new CityDto { NameEn = "Giddah", CountryId = 1, NameAr = "جده", Id = 2 }};
+            //var entity = await _unitOfWork.CountryLookup.GetAllAsync();
+            //var response = MapperObject.Mapper.Map<List<CountryDto>>(entity.Item1);
+            return city;
+        }
+        
         public async Task<List<IndustryDto>> GetAllIndustries()
         {
             var entity = await _unitOfWork.Industry.GetAllAsync();
@@ -61,6 +69,18 @@ namespace MTWorkHR.Application.Services
             var response = MapperObject.Mapper.Map<List<JobTitleDto>>(entity.Item1);
             return response;
         }
+        public async Task<List<QualificationDto>> GetAllQualifications()
+        {
+            var entity = await _unitOfWork.Qualification.GetAllAsync();
+            var response = MapperObject.Mapper.Map<List<QualificationDto>>(entity.Item1);
+            return response;
+        }
+        public async Task<List<UniversityDto>> GetAllUniversities()
+        {
+            var entity = await _unitOfWork.University.GetAllAsync();
+            var response = MapperObject.Mapper.Map<List<UniversityDto>>(entity.Item1);
+            return response;
+        }
 
         public async Task<List<CountryDto>> CreateCountries()
         {

+ 15 - 0
MTWorkHR.Core/IRepositories/Lookups/IQualificationRepository.cs

@@ -0,0 +1,15 @@
+using MTWorkHR.Core.Entities;
+using MTWorkHR.Core.IRepositories.Base;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTWorkHR.Core.IRepositories
+{
+    public interface IQualificationRepository : IRepository<Qualification>
+    {
+
+    }
+}

+ 15 - 0
MTWorkHR.Core/IRepositories/Lookups/IUniversityRepository.cs

@@ -0,0 +1,15 @@
+using MTWorkHR.Core.Entities;
+using MTWorkHR.Core.IRepositories.Base;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTWorkHR.Core.IRepositories
+{
+    public interface IUniversityRepository : IRepository<University>
+    {
+
+    }
+}

+ 2 - 0
MTWorkHR.Core/IUnitOfWork/IUnitOfWork.cs

@@ -25,6 +25,8 @@ namespace MTWorkHR.Core.UnitOfWork
         ICountryLookupRepository CountryLookup { get; }
         IIndustryRepository Industry { get; }
         IJobTitleRepository JobTitle { get; }
+        IUniversityRepository University { get; }
+        IQualificationRepository Qualification { get; }
         Task<int> CompleteAsync();
 
         void BeginTran();

+ 32 - 0
MTWorkHR.Infrastructure/Configurations/QualificationConfiguration.cs

@@ -0,0 +1,32 @@
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MTWorkHR.Infrastructure.Entities;
+using MTWorkHR.Core.Entities.Base;
+using MTWorkHR.Core.Entities;
+using Countries.NET.Database;
+using System.Runtime.ConstrainedExecution;
+
+namespace MTWorkHR.Infrastructure.Configurations
+{
+    public class QualificationConfiguration : IEntityTypeConfiguration<Qualification>
+    {
+
+        public void Configure(EntityTypeBuilder<Qualification> builder)
+        {
+            
+            builder.HasData(
+                new Qualification { NameEn = "BSC", NameAr = "بكالوريوس", Id = 1 },
+                new Qualification { NameEn = "Master", NameAr = "درجة الماجيستير", Id = 2 },
+                new Qualification { NameEn = "Doctor", NameAr = "درحة الدكتوراه", Id = 3 }
+
+
+            );
+        }
+    }
+}

+ 32 - 0
MTWorkHR.Infrastructure/Configurations/UniversityConfiguration.cs

@@ -0,0 +1,32 @@
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MTWorkHR.Infrastructure.Entities;
+using MTWorkHR.Core.Entities.Base;
+using MTWorkHR.Core.Entities;
+using Countries.NET.Database;
+using System.Runtime.ConstrainedExecution;
+
+namespace MTWorkHR.Infrastructure.Configurations
+{
+    public class UniversityConfiguration : IEntityTypeConfiguration<University>
+    {
+
+        public void Configure(EntityTypeBuilder<University> builder)
+        {
+            
+            builder.HasData(
+                new University { NameEn = "Fahd Univ", NameAr = "جامعة الملك فهد", Id = 1 },
+                new University { NameEn = "Riydh Univ", NameAr = "جامعة الرياض", Id = 2 },
+                new University { NameEn = "Geda Univ", NameAr = "جامعة جدة", Id = 3 }
+
+
+            );
+        }
+    }
+}

+ 4 - 1
MTWorkHR.Infrastructure/Configurations/UserConfiguration.cs

@@ -37,6 +37,7 @@ namespace MTWorkHR.Infrastructure.Configurations
                     PassportNumber = "1234567",
                     TaxNumber = 111,
                     IncomeTaxValue = 1,QualificationId = null,
+                    IdNumber = "123", DateOfBirth = new DateTime(2000,2,10), 
                     PasswordHash = "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==" //hasher.HashPassword(null, "P@ssword1")
                 },
                 new ApplicationUser
@@ -49,7 +50,7 @@ namespace MTWorkHR.Infrastructure.Configurations
                     NormalizedEmail = "ALI@B.COM",
                     EmailConfirmed = true,
                     NormalizedUserName = "ALI",
-                    PhoneNumber = "1234567890",
+                    PhoneNumber = "1234567888",
                     PhoneNumberConfirmed = true,
                     DeleteUserId = null,
                     AccessFailedCount = 0,
@@ -62,6 +63,8 @@ namespace MTWorkHR.Infrastructure.Configurations
                     TaxNumber = 222,
                     IncomeTaxValue = 100,
                     QualificationId = null,
+                    IdNumber = "343434",
+                    DateOfBirth = new DateTime(2001, 5, 13),
                     PasswordHash = "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ=="// hasher.HashPassword(null, "P@ssword1")
                 }) ;
         }

+ 2 - 0
MTWorkHR.Infrastructure/Entities/ApplicationUser.cs

@@ -13,6 +13,8 @@ namespace MTWorkHR.Infrastructure.Entities
     {
         public string FirstName { get; set; }
         public string LastName { get; set; }
+        public string IdNumber { get; set; }
+        public DateTime DateOfBirth { get; set; }
         public int UserType { get; set; }
         public string? FavoriteName { get; set; }
         public string PassportNumber { get; set; }

+ 2 - 0
MTWorkHR.Infrastructure/InfrastructureServiceRegistration.cs

@@ -75,6 +75,8 @@ namespace MTWorkHR.Infrastructure
             services.AddScoped(typeof(ICountryLookupRepository), typeof(CountryLookupRepository));
             services.AddScoped(typeof(IIndustryRepository), typeof(IndustryRepository));
             services.AddScoped(typeof(IJobTitleRepository), typeof(JobTitleRepository));
+            services.AddScoped(typeof(IQualificationRepository), typeof(QualificationRepository));
+            services.AddScoped(typeof(IUniversityRepository), typeof(UniversityRepository));
 
 
 

File diff suppressed because it is too large
+ 2897 - 0
MTWorkHR.Infrastructure/Migrations/20240519110611_altrUserBD.Designer.cs


+ 62 - 0
MTWorkHR.Infrastructure/Migrations/20240519110611_altrUserBD.cs

@@ -0,0 +1,62 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace MTWorkHR.Infrastructure.Migrations
+{
+    /// <inheritdoc />
+    public partial class altrUserBD : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.AddColumn<DateTime>(
+                name: "DateOfBirth",
+                table: "AspNetUsers",
+                type: "datetime2",
+                nullable: false,
+                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
+
+            migrationBuilder.AddColumn<string>(
+                name: "IdNumber",
+                table: "AspNetUsers",
+                type: "nvarchar(max)",
+                nullable: false,
+                defaultValue: "");
+
+            migrationBuilder.UpdateData(
+                table: "AspNetUsers",
+                keyColumn: "Id",
+                keyValue: "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
+                columns: new[] { "DateOfBirth", "IdNumber" },
+                values: new object[] { new DateTime(2000, 2, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), "123" });
+
+            migrationBuilder.UpdateData(
+                table: "AspNetUsers",
+                keyColumn: "Id",
+                keyValue: "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
+                columns: new[] { "DateOfBirth", "IdNumber", "PhoneNumber" },
+                values: new object[] { new DateTime(2001, 5, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), "343434", "1234567888" });
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropColumn(
+                name: "DateOfBirth",
+                table: "AspNetUsers");
+
+            migrationBuilder.DropColumn(
+                name: "IdNumber",
+                table: "AspNetUsers");
+
+            migrationBuilder.UpdateData(
+                table: "AspNetUsers",
+                keyColumn: "Id",
+                keyValue: "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
+                column: "PhoneNumber",
+                value: "1234567890");
+        }
+    }
+}

File diff suppressed because it is too large
+ 2937 - 0
MTWorkHR.Infrastructure/Migrations/20240519114008_addQualif_Univ.Designer.cs


+ 70 - 0
MTWorkHR.Infrastructure/Migrations/20240519114008_addQualif_Univ.cs

@@ -0,0 +1,70 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
+
+namespace MTWorkHR.Infrastructure.Migrations
+{
+    /// <inheritdoc />
+    public partial class addQualif_Univ : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.InsertData(
+                table: "Qualifications",
+                columns: new[] { "Id", "NameAr", "NameEn" },
+                values: new object[,]
+                {
+                    { 1L, "بكالوريوس", "BSC" },
+                    { 2L, "درجة الماجيستير", "Master" },
+                    { 3L, "درحة الدكتوراه", "Doctor" }
+                });
+
+            migrationBuilder.InsertData(
+                table: "Universities",
+                columns: new[] { "Id", "NameAr", "NameEn" },
+                values: new object[,]
+                {
+                    { 1L, "جامعة الملك فهد", "Fahd Univ" },
+                    { 2L, "جامعة الرياض", "Riydh Univ" },
+                    { 3L, "جامعة جدة", "Geda Univ" }
+                });
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DeleteData(
+                table: "Qualifications",
+                keyColumn: "Id",
+                keyValue: 1L);
+
+            migrationBuilder.DeleteData(
+                table: "Qualifications",
+                keyColumn: "Id",
+                keyValue: 2L);
+
+            migrationBuilder.DeleteData(
+                table: "Qualifications",
+                keyColumn: "Id",
+                keyValue: 3L);
+
+            migrationBuilder.DeleteData(
+                table: "Universities",
+                keyColumn: "Id",
+                keyValue: 1L);
+
+            migrationBuilder.DeleteData(
+                table: "Universities",
+                keyColumn: "Id",
+                keyValue: 2L);
+
+            migrationBuilder.DeleteData(
+                table: "Universities",
+                keyColumn: "Id",
+                keyValue: 3L);
+        }
+    }
+}

+ 52 - 1
MTWorkHR.Infrastructure/Migrations/HRDataContextModelSnapshot.cs

@@ -1363,6 +1363,26 @@ namespace MTWorkHR.Infrastructure.Migrations
                     b.HasKey("Id");
 
                     b.ToTable("Qualifications");
+
+                    b.HasData(
+                        new
+                        {
+                            Id = 1L,
+                            NameAr = "بكالوريوس",
+                            NameEn = "BSC"
+                        },
+                        new
+                        {
+                            Id = 2L,
+                            NameAr = "درجة الماجيستير",
+                            NameEn = "Master"
+                        },
+                        new
+                        {
+                            Id = 3L,
+                            NameAr = "درحة الدكتوراه",
+                            NameEn = "Doctor"
+                        });
                 });
 
             modelBuilder.Entity("MTWorkHR.Core.Entities.RoleLog", b =>
@@ -1656,6 +1676,26 @@ namespace MTWorkHR.Infrastructure.Migrations
                     b.HasKey("Id");
 
                     b.ToTable("Universities");
+
+                    b.HasData(
+                        new
+                        {
+                            Id = 1L,
+                            NameAr = "جامعة الملك فهد",
+                            NameEn = "Fahd Univ"
+                        },
+                        new
+                        {
+                            Id = 2L,
+                            NameAr = "جامعة الرياض",
+                            NameEn = "Riydh Univ"
+                        },
+                        new
+                        {
+                            Id = 3L,
+                            NameAr = "جامعة جدة",
+                            NameEn = "Geda Univ"
+                        });
                 });
 
             modelBuilder.Entity("MTWorkHR.Core.Entities.User.OrderRequest", b =>
@@ -2162,6 +2202,9 @@ namespace MTWorkHR.Infrastructure.Migrations
                     b.Property<string>("CreateUser")
                         .HasColumnType("nvarchar(max)");
 
+                    b.Property<DateTime>("DateOfBirth")
+                        .HasColumnType("datetime2");
+
                     b.Property<string>("DeleteUserId")
                         .HasColumnType("nvarchar(max)");
 
@@ -2179,6 +2222,10 @@ namespace MTWorkHR.Infrastructure.Migrations
                         .IsRequired()
                         .HasColumnType("nvarchar(max)");
 
+                    b.Property<string>("IdNumber")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
                     b.Property<decimal?>("IncomeTaxValue")
                         .HasColumnType("decimal(18,2)");
 
@@ -2286,9 +2333,11 @@ namespace MTWorkHR.Infrastructure.Migrations
                             Id = "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
                             AccessFailedCount = 0,
                             ConcurrencyStamp = "7cc87689-9eab-4280-b8e3-1834080783a5",
+                            DateOfBirth = new DateTime(2000, 2, 10, 0, 0, 0, 0, DateTimeKind.Unspecified),
                             Email = "a@b.com",
                             EmailConfirmed = true,
                             FirstName = "Zinab",
+                            IdNumber = "123",
                             IncomeTaxValue = 1m,
                             IsDeleted = false,
                             IsStopped = false,
@@ -2311,9 +2360,11 @@ namespace MTWorkHR.Infrastructure.Migrations
                             Id = "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
                             AccessFailedCount = 0,
                             ConcurrencyStamp = "4af7b4cf-802a-455b-b598-997e167745b3",
+                            DateOfBirth = new DateTime(2001, 5, 13, 0, 0, 0, 0, DateTimeKind.Unspecified),
                             Email = "ali@b.com",
                             EmailConfirmed = true,
                             FirstName = "Ali",
+                            IdNumber = "343434",
                             IncomeTaxValue = 100m,
                             IsDeleted = false,
                             IsStopped = false,
@@ -2323,7 +2374,7 @@ namespace MTWorkHR.Infrastructure.Migrations
                             NormalizedUserName = "ALI",
                             PassportNumber = "7654321001010",
                             PasswordHash = "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==",
-                            PhoneNumber = "1234567890",
+                            PhoneNumber = "1234567888",
                             PhoneNumberConfirmed = true,
                             SecurityStamp = "62549056-1b9d-46d4-84f8-adea3e4d8b68",
                             TaxNumber = 222m,

+ 19 - 0
MTWorkHR.Infrastructure/Repositories/Lookups/QualificationRepository.cs

@@ -0,0 +1,19 @@
+using Microsoft.EntityFrameworkCore;
+using MTWorkHR.Core.Entities;
+using MTWorkHR.Core.IDto;
+using MTWorkHR.Core.IRepositories;
+using MTWorkHR.Infrastructure.Entities;
+using MTWorkHR.Infrastructure.DBContext;
+
+namespace MTWorkHR.Infrastructure.Repositories
+{
+    public class QualificationRepository : Repository<Qualification>, IQualificationRepository
+    {
+        private readonly DbSet<Qualification> dbSet;
+        public QualificationRepository(HRDataContext context) : base(context)
+        {
+            dbSet = context.Set<Qualification>();
+        }
+
+    }
+}

+ 19 - 0
MTWorkHR.Infrastructure/Repositories/Lookups/UniversityRepository.cs

@@ -0,0 +1,19 @@
+using Microsoft.EntityFrameworkCore;
+using MTWorkHR.Core.Entities;
+using MTWorkHR.Core.IDto;
+using MTWorkHR.Core.IRepositories;
+using MTWorkHR.Infrastructure.Entities;
+using MTWorkHR.Infrastructure.DBContext;
+
+namespace MTWorkHR.Infrastructure.Repositories
+{
+    public class UniversityRepository : Repository<University>, IUniversityRepository
+    {
+        private readonly DbSet<University> dbSet;
+        public UniversityRepository(HRDataContext context) : base(context)
+        {
+            dbSet = context.Set<University>();
+        }
+
+    }
+}

+ 6 - 0
MTWorkHR.Infrastructure/UnitOfWork/UnitOfWork.cs

@@ -31,6 +31,8 @@ namespace MTWorkHR.Infrastructure.UnitOfWorks
         public ICountryLookupRepository CountryLookup { get; }
         public IIndustryRepository Industry { get; }
         public IJobTitleRepository JobTitle { get; }
+        public IQualificationRepository Qualification { get; }
+        public IUniversityRepository University { get; }
 
         public UnitOfWork(HRDataContext _context
             , IPermissionRepository permission
@@ -50,6 +52,8 @@ namespace MTWorkHR.Infrastructure.UnitOfWorks
             , ICountryLookupRepository countryLookup
             , IIndustryRepository industry
             , IJobTitleRepository jobTitle
+            , IQualificationRepository qualification
+            , IUniversityRepository university
 
             )
         {
@@ -71,6 +75,8 @@ namespace MTWorkHR.Infrastructure.UnitOfWorks
             this.CountryLookup = countryLookup;
             this.Industry = industry;
             this.JobTitle = jobTitle;
+            this.Qualification = qualification;
+            this.University = university;
         }
 
         public async Task<int> CompleteAsync()