diff --git a/AccountManagement.Application.Contracts/Account/EditAccount.cs b/AccountManagement.Application.Contracts/Account/EditAccount.cs
index 41afe474..877edafc 100644
--- a/AccountManagement.Application.Contracts/Account/EditAccount.cs
+++ b/AccountManagement.Application.Contracts/Account/EditAccount.cs
@@ -1,6 +1,4 @@
-using System.Collections.Generic;
-
-namespace AccountManagement.Application.Contracts.Account;
+namespace AccountManagement.Application.Contracts.Account;
public class EditAccount : CreateAccount
{
diff --git a/AccountManagement.Application.Contracts/Account/EditClientAccount.cs b/AccountManagement.Application.Contracts/Account/EditClientAccount.cs
index eef61835..9d18014f 100644
--- a/AccountManagement.Application.Contracts/Account/EditClientAccount.cs
+++ b/AccountManagement.Application.Contracts/Account/EditClientAccount.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AccountManagement.Application.Contracts.Account;
+namespace AccountManagement.Application.Contracts.Account;
public class EditClientAccount : RegisterAccount
{
diff --git a/AccountManagement.Application.Contracts/Account/IAccountApplication.cs b/AccountManagement.Application.Contracts/Account/IAccountApplication.cs
index 10b107ad..b1da0153 100644
--- a/AccountManagement.Application.Contracts/Account/IAccountApplication.cs
+++ b/AccountManagement.Application.Contracts/Account/IAccountApplication.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-using AccountManagement.Application.Contracts.ProgramManager;
using Shared.Contracts.PmUser.Queries;
namespace AccountManagement.Application.Contracts.Account;
@@ -75,12 +74,8 @@ public interface IAccountApplication
void CameraLogin(CameraLoginRequest request);
- ///
- /// دریافت کاربر پروگرام منیجر با اکانت آی دی
- ///
- ///
- ///
- Task GetPmUserByAccountId(long accountId);
+ Task GetPmUserAsync(long accountId);
+
}
public class CameraLoginRequest
diff --git a/AccountManagement.Application.Contracts/Account/RegisterAccount.cs b/AccountManagement.Application.Contracts/Account/RegisterAccount.cs
index 78b9fcf0..d299dd88 100644
--- a/AccountManagement.Application.Contracts/Account/RegisterAccount.cs
+++ b/AccountManagement.Application.Contracts/Account/RegisterAccount.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using _0_Framework.Application;
+using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Http;
namespace AccountManagement.Application.Contracts.Account;
diff --git a/AccountManagement.Application.Contracts/Account/WorkshopSelectList.cs b/AccountManagement.Application.Contracts/Account/WorkshopSelectList.cs
index 8e17212f..48d952b8 100644
--- a/AccountManagement.Application.Contracts/Account/WorkshopSelectList.cs
+++ b/AccountManagement.Application.Contracts/Account/WorkshopSelectList.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AccountManagement.Application.Contracts.Account;
+namespace AccountManagement.Application.Contracts.Account;
public class WorkshopSelectList
{
diff --git a/AccountManagement.Application.Contracts/ProgramManager/GetRoleDto.cs b/AccountManagement.Application.Contracts/ProgramManager/GetRoleDto.cs
deleted file mode 100644
index a3256abd..00000000
--- a/AccountManagement.Application.Contracts/ProgramManager/GetRoleDto.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System.Collections.Generic;
-
-namespace AccountManagement.Application.Contracts.ProgramManager;
-
-public record GetPmRolesDto
-{
- ///
- /// آی دی نقش
- ///
- public long Id { get; set; }
-
- ///
- /// نام نقش
- ///
- public string RoleName { get; set; }
-
- ///
- /// آی دی نقش در گزارشگیر
- ///
- public long? GozareshgirRoleId { get; set; }
-
- ///
- /// لیست کدهای دسترسی
- ///
- public List Permissions { get; set; }
-
-
-}
\ No newline at end of file
diff --git a/AccountManagement.Application/AccountApplication.cs b/AccountManagement.Application/AccountApplication.cs
index 0736293d..545c991e 100644
--- a/AccountManagement.Application/AccountApplication.cs
+++ b/AccountManagement.Application/AccountApplication.cs
@@ -2,13 +2,9 @@
using _0_Framework.Application.Sms;
using _0_Framework.Exceptions;
using AccountManagement.Application.Contracts.Account;
-using AccountManagement.Application.Contracts.ProgramManagerApiResult;
using AccountManagement.Domain.AccountAgg;
using AccountManagement.Domain.AccountLeftWorkAgg;
using AccountManagement.Domain.CameraAccountAgg;
-using AccountManagement.Domain.InternalApiCaller;
-using AccountManagement.Domain.PmDomains.PmRoleUserAgg;
-using AccountManagement.Domain.PmDomains.PmUserAgg;
using AccountManagement.Domain.PositionAgg;
using AccountManagement.Domain.RoleAgg;
using AccountManagement.Domain.SubAccountAgg;
@@ -17,25 +13,13 @@ using AccountManagement.Domain.SubAccountRoleAgg;
using Company.Domain._common;
using Company.Domain.WorkshopAgg;
using Company.Domain.WorkshopSubAccountAgg;
-using CompanyManagment.App.Contracts.Workshop;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.JsonPatch.Operations;
using Microsoft.AspNetCore.Mvc.Rendering;
-using Microsoft.EntityFrameworkCore;
-using Newtonsoft.Json;
using System;
-using System.Collections;
using System.Collections.Generic;
using System.Linq;
-using System.Net.Http;
-using System.Runtime.InteropServices;
-using System.Security.Claims;
-using System.Text;
-using System.Threading;
using System.Threading.Tasks;
-using AccountManagement.Application.Contracts.ProgramManager;
+
using Shared.Contracts.PmUser.Commands;
-using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
using Shared.Contracts.PmUser.Queries;
//using AccountManagement.Domain.RoleAgg;
@@ -58,13 +42,13 @@ public class AccountApplication : IAccountApplication
private readonly ISubAccountRoleRepository _subAccountRoleRepository;
private readonly IWorkshopSubAccountRepository _workshopSubAccountRepository;
private readonly ISubAccountPermissionSubtitle1Repository _accountPermissionSubtitle1Repository;
- private readonly IPmUserRepository _pmUserRepository;
+
private readonly IUnitOfWork _unitOfWork;
private readonly IPmUserQueryService _pmUserQueryService;
private readonly IPmUserCommandService _pmUserCommandService;
public AccountApplication(IAccountRepository accountRepository, IPasswordHasher passwordHasher,
- IFileUploader fileUploader, IAuthHelper authHelper, IRoleRepository roleRepository, IWorker worker, ISmsService smsService, ICameraAccountRepository cameraAccountRepository, IPositionRepository positionRepository, IAccountLeftworkRepository accountLeftworkRepository, IWorkshopRepository workshopRepository, ISubAccountRepository subAccountRepository, ISubAccountRoleRepository subAccountRoleRepository, IWorkshopSubAccountRepository workshopSubAccountRepository, ISubAccountPermissionSubtitle1Repository accountPermissionSubtitle1Repository, IUnitOfWork unitOfWork, IPmUserRepository pmUserRepository, IPmUserQueryService pmUserQueryService, IPmUserCommandService pmUserCommandService)
+ IFileUploader fileUploader, IAuthHelper authHelper, IRoleRepository roleRepository, IWorker worker, ISmsService smsService, ICameraAccountRepository cameraAccountRepository, IPositionRepository positionRepository, IAccountLeftworkRepository accountLeftworkRepository, IWorkshopRepository workshopRepository, ISubAccountRepository subAccountRepository, ISubAccountRoleRepository subAccountRoleRepository, IWorkshopSubAccountRepository workshopSubAccountRepository, ISubAccountPermissionSubtitle1Repository accountPermissionSubtitle1Repository, IUnitOfWork unitOfWork, IPmUserQueryService pmUserQueryService, IPmUserCommandService pmUserCommandService)
{
_authHelper = authHelper;
_roleRepository = roleRepository;
@@ -78,7 +62,7 @@ public class AccountApplication : IAccountApplication
_workshopSubAccountRepository = workshopSubAccountRepository;
_accountPermissionSubtitle1Repository = accountPermissionSubtitle1Repository;
_unitOfWork = unitOfWork;
- _pmUserRepository = pmUserRepository;
+
_pmUserQueryService = pmUserQueryService;
_pmUserCommandService = pmUserCommandService;
_fileUploader = fileUploader;
@@ -1015,8 +999,8 @@ public class AccountApplication : IAccountApplication
_authHelper.CameraSignIn(authViewModel);
}
- public async Task GetPmUserByAccountId(long accountId)
+ public async Task GetPmUserAsync(long accountId)
{
- return await _pmUserRepository.GetPmUserByAccountId(accountId);
+ return await _pmUserQueryService.GetPmUserDataByAccountId(accountId);
}
}
\ No newline at end of file
diff --git a/AccountManagement.Application/CameraAccountApplication.cs b/AccountManagement.Application/CameraAccountApplication.cs
index bf0c02c2..d5a0ae24 100644
--- a/AccountManagement.Application/CameraAccountApplication.cs
+++ b/AccountManagement.Application/CameraAccountApplication.cs
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Account;
using AccountManagement.Application.Contracts.CameraAccount;
diff --git a/AccountManagement.Application/MediaApplication.cs b/AccountManagement.Application/MediaApplication.cs
index 354027da..48056abb 100644
--- a/AccountManagement.Application/MediaApplication.cs
+++ b/AccountManagement.Application/MediaApplication.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using _0_Framework.Application;
diff --git a/AccountManagement.Application/RoleApplication.cs b/AccountManagement.Application/RoleApplication.cs
index eb25b1dd..b4d7a7db 100644
--- a/AccountManagement.Application/RoleApplication.cs
+++ b/AccountManagement.Application/RoleApplication.cs
@@ -4,13 +4,7 @@ using AccountManagement.Domain.RoleAgg;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using AccountManagement.Application.Contracts.ProgramManagerApiResult;
-using AccountManagement.Domain.InternalApiCaller;
using Company.Domain._common;
-using AccountManagement.Application.Contracts.Ticket;
-using AccountManagement.Domain.PmDomains.PmPermissionAgg;
-using AccountManagement.Domain.PmDomains.PmRoleAgg;
-using AccountManagement.Domain.PmDomains.PmUserAgg;
using Microsoft.AspNetCore.Mvc.Rendering;
using Shared.Contracts.PmRole.Commands;
using GetPmRolesDto = Shared.Contracts.PmRole.Queries.GetPmRolesDto;
@@ -22,18 +16,15 @@ namespace AccountManagement.Application;
public class RoleApplication : IRoleApplication
{
private readonly IRoleRepository _roleRepository;
- private readonly IPmRoleRepository _pmRoleRepository;
- private readonly IPmUserRepository _pmUserRepository;
+
private readonly IPmRoleQueryService _pmRoleQueryService;
private readonly IPmRoleCommandService _pmRoleCommandService;
private readonly IUnitOfWork _unitOfWork;
- public RoleApplication(IRoleRepository roleRepository, IUnitOfWork unitOfWork, IPmRoleRepository pmRoleRepository, IPmUserRepository pmUserRepository, IPmRoleQueryService pmRoleQueryService, IPmRoleCommandService pmRoleCommandService)
+ public RoleApplication(IRoleRepository roleRepository, IUnitOfWork unitOfWork, IPmRoleQueryService pmRoleQueryService, IPmRoleCommandService pmRoleCommandService)
{
_roleRepository = roleRepository;
_unitOfWork = unitOfWork;
- _pmRoleRepository = pmRoleRepository;
- _pmUserRepository = pmUserRepository;
_pmRoleQueryService = pmRoleQueryService;
_pmRoleCommandService = pmRoleCommandService;
}
diff --git a/AccountManagement.Application/SubAccountApplication.cs b/AccountManagement.Application/SubAccountApplication.cs
index 8d2f592f..cd79c847 100644
--- a/AccountManagement.Application/SubAccountApplication.cs
+++ b/AccountManagement.Application/SubAccountApplication.cs
@@ -5,14 +5,11 @@ using AccountManagement.Domain.AccountAgg;
using AccountManagement.Domain.CameraAccountAgg;
using AccountManagement.Domain.SubAccountAgg;
using AccountManagement.Domain.SubAccountRoleAgg;
-using Company.Domain.WorkshopAccountAgg;
using Company.Domain.WorkshopSubAccountAgg;
-using CompanyManagment.App.Contracts.Workshop;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
namespace AccountManagement.Application
diff --git a/AccountManagement.Application/TaskSubjectApplication.cs b/AccountManagement.Application/TaskSubjectApplication.cs
index 42383942..c27fa674 100644
--- a/AccountManagement.Application/TaskSubjectApplication.cs
+++ b/AccountManagement.Application/TaskSubjectApplication.cs
@@ -1,9 +1,7 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.TaskSubject;
using AccountManagement.Domain.TaskSubjectAgg;
-using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
namespace AccountManagement.Application;
diff --git a/AccountManagement.Configuration/PmDbBootstrapper.cs b/AccountManagement.Configuration/PmDbBootstrapper.cs
deleted file mode 100644
index 84d93fa8..00000000
--- a/AccountManagement.Configuration/PmDbBootstrapper.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using AccountManagement.Domain.PmDomains.PmRoleAgg;
-using AccountManagement.Domain.PmDomains.PmUserAgg;
-using AccountMangement.Infrastructure.EFCore.PmDbConetxt;
-using AccountMangement.Infrastructure.EFCore.Repository.PmRepositories;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace AccountManagement.Configuration;
-
-public class PmDbBootstrapper
-{
- public static void Configure(IServiceCollection services, string connectionString)
- {
- services.AddTransient();
- services.AddTransient();
- services.AddDbContext(x => x.UseSqlServer(connectionString));
- }
-}
\ No newline at end of file
diff --git a/AccountManagement.Domain/PmDomains/PmPermissionAgg/PmPermission.cs b/AccountManagement.Domain/PmDomains/PmPermissionAgg/PmPermission.cs
deleted file mode 100644
index 691a9954..00000000
--- a/AccountManagement.Domain/PmDomains/PmPermissionAgg/PmPermission.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using AccountManagement.Domain.PmDomains.PmRoleAgg;
-
-namespace AccountManagement.Domain.PmDomains.PmPermissionAgg;
-
-public class PmPermission
-{
- public long Id { get; private set; }
- public int Code { get; private set; }
- public PmRole Role { get; private set; }
-
- public PmPermission(int code)
- {
- Code = code;
- }
-}
\ No newline at end of file
diff --git a/AccountManagement.Domain/PmDomains/PmRoleAgg/IPmRoleRepository.cs b/AccountManagement.Domain/PmDomains/PmRoleAgg/IPmRoleRepository.cs
deleted file mode 100644
index 49cb7f4e..00000000
--- a/AccountManagement.Domain/PmDomains/PmRoleAgg/IPmRoleRepository.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using _0_Framework.Domain;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using AccountManagement.Application.Contracts.ProgramManager;
-
-namespace AccountManagement.Domain.PmDomains.PmRoleAgg;
-
-public interface IPmRoleRepository :IRepository
-{
- Task> GetPmRoleList(long? gozareshgirRoleId);
-
- Task GetPmRoleToEdit(long gozareshgirRoleId);
-
-}
-
diff --git a/AccountManagement.Domain/PmDomains/PmRoleAgg/PmRole.cs b/AccountManagement.Domain/PmDomains/PmRoleAgg/PmRole.cs
deleted file mode 100644
index ddb305ea..00000000
--- a/AccountManagement.Domain/PmDomains/PmRoleAgg/PmRole.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System.Collections.Generic;
-using _0_Framework.Domain;
-using AccountManagement.Domain.PmDomains.PmPermissionAgg;
-
-namespace AccountManagement.Domain.PmDomains.PmRoleAgg;
-
-public class PmRole : EntityBase
-{
- ///
- /// نام نقش
- ///
- public string RoleName { get; private set; }
-
-
- ///
- /// لیست پرمیشن کد ها
- ///
- public List PmPermission { get; private set; }
-
- ///
- /// ای دی نقش در گزارشگیر
- ///
- public long? GozareshgirRoleId { get; private set; }
-
-
- protected PmRole()
- {
- }
-
- public PmRole(string roleName,long? gozareshgirRolId, List permissions)
- {
- RoleName = roleName;
- PmPermission = permissions;
- GozareshgirRoleId = gozareshgirRolId;
-
- }
-
-
- public void Edit(string roleName, List permissions)
- {
- RoleName = roleName;
- PmPermission = permissions;
- }
-
-
-}
\ No newline at end of file
diff --git a/AccountManagement.Domain/PmDomains/PmRoleUserAgg/PmRoleUser.cs b/AccountManagement.Domain/PmDomains/PmRoleUserAgg/PmRoleUser.cs
deleted file mode 100644
index a7cf6355..00000000
--- a/AccountManagement.Domain/PmDomains/PmRoleUserAgg/PmRoleUser.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using AccountManagement.Domain.PmDomains.PmUserAgg;
-
-namespace AccountManagement.Domain.PmDomains.PmRoleUserAgg;
-
-public class PmRoleUser
-{
- public PmRoleUser(long roleId)
- {
- RoleId = roleId;
- }
-
- public long Id { get; private set; }
- public long RoleId { get; private set; }
-
-
- public PmUser User { get; set; }
-
-
-}
\ No newline at end of file
diff --git a/AccountManagement.Domain/PmDomains/PmUserAgg/IPmUserRepository.cs b/AccountManagement.Domain/PmDomains/PmUserAgg/IPmUserRepository.cs
deleted file mode 100644
index 52c28fc1..00000000
--- a/AccountManagement.Domain/PmDomains/PmUserAgg/IPmUserRepository.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using _0_Framework.Domain;
-using AccountManagement.Application.Contracts.ProgramManager;
-using System.Threading.Tasks;
-using Shared.Contracts.PmUser.Queries;
-
-namespace AccountManagement.Domain.PmDomains.PmUserAgg;
-
-public interface IPmUserRepository : IRepository
-{
- ///
- /// دریافت کاربر پروگرام منیجر جهتد ویرایش
- ///
- ///
- ///
- Task GetByPmUsertoEditbyAccountId(long accountId);
- ///
- /// دریافت کرابر پروگرام منیجر با اکانت آی دی در گزارشگیر
- ///
- ///
- ///
- Task GetPmUserByAccountId(long accountId);
-}
\ No newline at end of file
diff --git a/AccountManagement.Domain/PmDomains/PmUserAgg/PmUser.cs b/AccountManagement.Domain/PmDomains/PmUserAgg/PmUser.cs
deleted file mode 100644
index 6b0c531a..00000000
--- a/AccountManagement.Domain/PmDomains/PmUserAgg/PmUser.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-using System;
-using System.Collections.Generic;
-using _0_Framework.Domain;
-using AccountManagement.Domain.PmDomains.PmRoleUserAgg;
-
-
-namespace AccountManagement.Domain.PmDomains.PmUserAgg;
-
-///
-/// کاربر
-///
-public class PmUser : EntityBase
-{
- ///
- /// ایجاد
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public PmUser(string fullName, string userName, string password, string mobile, string email, long? accountId, List roles)
- {
- FullName = fullName;
- UserName = userName;
- Password = password;
- Mobile = mobile;
- Email = email;
- IsActive = true;
- AccountId = accountId;
- RoleUser = roles;
- }
-
- protected PmUser()
- {
-
- }
- ///
- /// نام و نام خانوادگی
- ///
- public string FullName { get; private set; }
-
- ///
- /// نام کاربری
- ///
- public string UserName { get; private set; }
-
- ///
- /// گذرواژه
- ///
- public string Password { get; private set; }
-
- ///
- /// مسیر عکس پروفایل
- ///
- public string ProfilePhotoPath { get; private set; }
-
- ///
- /// شماره موبایل
- ///
- public string Mobile { get; set; }
-
- ///
- /// ایمیل
- ///
- public string Email { get; private set; }
-
- ///
- /// فعال/غیر فعال بودن یوزر
- ///
- public bool IsActive { get; private set; }
-
-
- ///
- /// کد یکبارمصرف ورود
- ///
- public string VerifyCode { get; private set; }
-
- ///
- /// آی دی کاربر در گزارشگیر
- ///
- public long? AccountId { get; private set; }
-
-
- ///
- /// لیست پرمیشن کد ها
- ///
- public List RoleUser { get; private set; }
-
-
- ///
- /// آپدیت کاربر
- ///
- ///
- ///
- ///
- ///
- ///
- public void Edit(string fullName, string userName, string mobile, List roles, bool isActive)
- {
- FullName = fullName;
- UserName = userName;
- Mobile = mobile;
- RoleUser = roles;
- IsActive = isActive;
- }
-
- ///
- /// غیرفعال سازی
- ///
- public void DeActive()
- {
- IsActive = false;
- }
-
- ///
- /// فعال سازی
- ///
- public void ReActive()
- {
- IsActive = true;
- }
-
-
-}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/PmMappings/PmRoleMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/PmMappings/PmRoleMapping.cs
deleted file mode 100644
index 00324b3d..00000000
--- a/AccountMangement.Infrastructure.EFCore/Mappings/PmMappings/PmRoleMapping.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using AccountManagement.Domain.PmDomains.PmRoleAgg;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
-namespace AccountMangement.Infrastructure.EFCore.Mappings.PmMappings;
-
-public class PmRoleMapping : IEntityTypeConfiguration
-{
- public void Configure(EntityTypeBuilder builder)
- {
- builder.ToTable("PmRoles", t => t.ExcludeFromMigrations());
- builder.HasKey(x => x.id);
-
- builder.Property(x => x.RoleName).HasMaxLength(100).IsRequired();
-
- builder.OwnsMany(x => x.PmPermission, navigationBuilder =>
- {
- navigationBuilder.HasKey(x => x.Id);
- navigationBuilder.ToTable("PmRolePermissions", t => t.ExcludeFromMigrations());
-
- navigationBuilder.WithOwner(x => x.Role);
- });
- }
-}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/PmMappings/PmUserMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/PmMappings/PmUserMapping.cs
deleted file mode 100644
index 9ee5e126..00000000
--- a/AccountMangement.Infrastructure.EFCore/Mappings/PmMappings/PmUserMapping.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using AccountManagement.Domain.PmDomains.PmUserAgg;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
-
-namespace AccountMangement.Infrastructure.EFCore.Mappings.PmMappings;
-
-public class PmUserMapping :IEntityTypeConfiguration
-{
- public void Configure(EntityTypeBuilder builder)
- {
- builder.ToTable("Users");
- builder.HasKey(x => x.id);
-
- builder.Property(x => x.FullName).HasMaxLength(100).IsRequired();
- builder.Property(x => x.UserName).HasMaxLength(100).IsRequired();
- builder.Property(x => x.Password).HasMaxLength(1000).IsRequired();
- builder.Property(x => x.ProfilePhotoPath).HasMaxLength(500).IsRequired(false);
- builder.Property(x => x.Mobile).HasMaxLength(20).IsRequired();
- builder.Property(x => x.Email).HasMaxLength(150).IsRequired(false); ;
- builder.Property(x => x.VerifyCode).HasMaxLength(10).IsRequired(false);
- builder.OwnsMany(x => x.RoleUser, navigationBuilder =>
- {
- navigationBuilder.HasKey(x => x.Id);
- navigationBuilder.ToTable("RoleUsers");
- navigationBuilder.WithOwner(x => x.User);
- });
-
-
- }
-}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/PmDbConetxt/PmDbContext.cs b/AccountMangement.Infrastructure.EFCore/PmDbConetxt/PmDbContext.cs
deleted file mode 100644
index a668490e..00000000
--- a/AccountMangement.Infrastructure.EFCore/PmDbConetxt/PmDbContext.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using AccountManagement.Domain.PmDomains.PmRoleAgg;
-using AccountManagement.Domain.PmDomains.PmUserAgg;
-using AccountMangement.Infrastructure.EFCore.Mappings;
-using AccountMangement.Infrastructure.EFCore.Mappings.PmMappings;
-using Microsoft.EntityFrameworkCore;
-
-namespace AccountMangement.Infrastructure.EFCore.PmDbConetxt;
-
-public class PmDbContext : DbContext
-{
- public PmDbContext(DbContextOptions options) : base(options)
- {
-
- }
- public DbSet Users { get; set; } = null!;
- public DbSet PmRoles { get; set; } = null!;
-
-
- public PmDbContext()
- {
-
- }
-
-
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- var assembly = typeof(PmUserMapping).Assembly;
- modelBuilder.ApplyConfigurationsFromAssembly(assembly);
- //SubAccountPermissionSeeder.Seed(modelBuilder);
- base.OnModelCreating(modelBuilder);
- }
-}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/Repository/PmRepositories/PmRoleRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/PmRepositories/PmRoleRepository.cs
deleted file mode 100644
index e3f93e53..00000000
--- a/AccountMangement.Infrastructure.EFCore/Repository/PmRepositories/PmRoleRepository.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using _0_Framework.InfraStructure;
-using AccountManagement.Application.Contracts.ProgramManager;
-using AccountManagement.Domain.PmDomains.PmRoleAgg;
-using AccountMangement.Infrastructure.EFCore.PmDbConetxt;
-using Microsoft.EntityFrameworkCore;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
-
-namespace AccountMangement.Infrastructure.EFCore.Repository.PmRepositories;
-
-public class PmRoleRepository : RepositoryBase, IPmRoleRepository
-{
- private readonly PmDbContext _pmDbContext;
- public PmRoleRepository(PmDbContext context) : base(context)
- {
- _pmDbContext = context;
- }
-
- public async Task> GetPmRoleList(long? gozareshgirRoleId)
- {
- var query = _pmDbContext.PmRoles.AsQueryable();
- if (gozareshgirRoleId != null && gozareshgirRoleId > 0)
- query = query.Where(x => x.GozareshgirRoleId == gozareshgirRoleId);
- var res = await query
- .Select(p => new GetPmRolesDto()
- {
- Id = p.id,
- RoleName = p.RoleName,
- GozareshgirRoleId = p.GozareshgirRoleId,
- Permissions = p.PmPermission.Select(x => x.Code).ToList()
-
- })
- .ToListAsync();
-
- return res;
- }
-
-
-
- public async Task GetPmRoleToEdit(long gozareshgirRoleId)
- {
- return await _pmDbContext.PmRoles.FirstOrDefaultAsync(x => x.GozareshgirRoleId == gozareshgirRoleId);
-
- }
-
-}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/Repository/PmRepositories/PmUserRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/PmRepositories/PmUserRepository.cs
deleted file mode 100644
index e4915a65..00000000
--- a/AccountMangement.Infrastructure.EFCore/Repository/PmRepositories/PmUserRepository.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using _0_Framework.InfraStructure;
-using AccountManagement.Application.Contracts.ProgramManager;
-using AccountManagement.Domain.PmDomains.PmUserAgg;
-using AccountMangement.Infrastructure.EFCore.PmDbConetxt;
-using Microsoft.EntityFrameworkCore;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Shared.Contracts.PmUser.Queries;
-
-namespace AccountMangement.Infrastructure.EFCore.Repository.PmRepositories;
-
-public class PmUserRepository :RepositoryBase, IPmUserRepository
-{
- private readonly PmDbContext _pmDbContext;
- public PmUserRepository(PmDbContext context, PmDbContext pmDbContext) : base(context)
- {
- _pmDbContext = pmDbContext;
- }
- public async Task GetByPmUsertoEditbyAccountId(long accountId)
- {
- return await _pmDbContext.Users.FirstOrDefaultAsync(x => x.AccountId == accountId);
- }
-
- public async Task GetPmUserByAccountId(long accountId)
- {
- var query = await _pmDbContext.Users.FirstOrDefaultAsync(x => x.AccountId == accountId);
- if (query == null)
- return new GetPmUserDto();
- List roles = query.RoleUser.Select(x => x.RoleId).ToList();
- return new GetPmUserDto()
- {
- FullName = query.FullName,
- UserName = query.UserName,
- ProfilePhotoPath = query.ProfilePhotoPath,
- Mobile = query.Mobile,
- IsActive = query.IsActive,
- AccountId = query.AccountId,
- Roles = roles,
- RoleListDto = await _pmDbContext.PmRoles.Where(x => roles.Contains(x.id)).Select(x => new RoleListDto()
- {
- RoleName = x.RoleName,
- RoleId = x.id,
- Permissions = x.PmPermission.Select(x => x.Code).ToList()
- }).ToListAsync(),
- };
- }
-}
\ No newline at end of file
diff --git a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs
index cb843e5a..a78ff18e 100644
--- a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs
+++ b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs
@@ -64,7 +64,7 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos
}
///
- /// چیک میکند که آیا پرسنل در سال و ماه درخواستی در این کارگاه فیش حقوقی دارد یا خیر
+ /// چک میکند که آیا پرسنل در سال و ماه درخواستی در این کارگاه فیش حقوقی دارد یا خیر
///
///
///
@@ -74,12 +74,21 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos
public (bool hasChekout, double FamilyAlloance, double OverTimePay, double RotatingShift, double Nightwork, double Fridaywork, double YraesPay) HasCheckout(long workshopId, long employeId, string year, string month)
{
var farisMonthName = Tools.ToFarsiMonthByNumber(month);
-
+
var res = _context.CheckoutSet.FirstOrDefault(x =>
x.WorkshopId == workshopId && x.EmployeeId == employeId && x.Year == year && x.Month == farisMonthName &&
x.IsActiveString == "true");
if (res == null)
- return (false, 0, 0,0,0,0,0);
+ {
+ var checkLeftDate = ($"{year}/{month}/01").ToGeorgianDateTime();
+ var hasLeftwork = _context.LeftWorkList.Any(x =>
+ x.EmployeeId == employeId && x.WorkshopId == workshopId && x.LeftWorkDate == checkLeftDate);
+ if(hasLeftwork)
+ return (true, 0, 0, 0, 0, 0, 0);
+
+ return (false, 0, 0, 0, 0, 0, 0);
+ }
+
return (true, res.FamilyAllowance, res.OvertimePay, res.ShiftPay, res.NightworkPay, res.FridayPay,res.YearsPay);
}
diff --git a/ServiceHost/Areas/Admin/Pages/Accounts/Account/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Accounts/Account/Index.cshtml.cs
index e4597d4f..902acf03 100644
--- a/ServiceHost/Areas/Admin/Pages/Accounts/Account/Index.cshtml.cs
+++ b/ServiceHost/Areas/Admin/Pages/Accounts/Account/Index.cshtml.cs
@@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;
using ServiceHost.Hubs;
+using Shared.Contracts.PmUser.Queries;
namespace ServiceHost.Areas.Admin.Pages.Accounts.Account;
@@ -30,6 +31,7 @@ public class IndexModel : PageModel
public List Roless;
public AccountSearchModel SearchModel;
+
public IndexModel(IAccountApplication accountApplication, IRoleApplication roleApplication, IAuthHelper authHelper,
ISmsService smsService, IHubContext hubContext)
@@ -121,11 +123,11 @@ public class IndexModel : PageModel
//);
- var result = _accountApplication.GetPmUserByAccountId(account.Id).GetAwaiter().GetResult();
+ var result = _accountApplication.GetPmUserAsync(account.Id).GetAwaiter().GetResult();
// مثل قبل:
- if (result != null)
+ if (result.AccountId > 0)
{
account.IsProgramManagerUser = (result.AccountId== account.Id && result.IsActive);
account.UserRoles = result.Roles;
@@ -136,6 +138,7 @@ public class IndexModel : PageModel
}
var pmRolseSelectList = _roleApplication.GetPmRoleList(null).GetAwaiter().GetResult();
+ //سلکت لیست تمام رول های پروگرام منیجر
account.RoleList = pmRolseSelectList;
//var response = InternalApiCaller.GetAsync(
diff --git a/ServiceHost/Program.cs b/ServiceHost/Program.cs
index 65ff9eff..bb8de04b 100644
--- a/ServiceHost/Program.cs
+++ b/ServiceHost/Program.cs
@@ -51,7 +51,7 @@ builder.Services.AddHttpContextAccessor();
builder.Services.AddHttpClient("holidayApi", c => c.BaseAddress = new System.Uri("https://api.github.com"));
var connectionString = builder.Configuration.GetConnectionString("MesbahDb");
var connectionStringTestDb = builder.Configuration.GetConnectionString("TestDb");
-var connectionStringProgramManager = builder.Configuration.GetConnectionString("ProgramManagerDb");
+
builder.Services.AddProgramManagerApplication();
@@ -73,7 +73,7 @@ builder.Services.AddSingleton(mongoDatabase);
builder.Services.AddSingleton, CustomJsonResultExecutor>();
PersonalBootstrapper.Configure(builder.Services, connectionString);
TestDbBootStrapper.Configure(builder.Services, connectionStringTestDb);
-PmDbBootstrapper.Configure(builder.Services, connectionStringProgramManager);
+
AccountManagementBootstrapper.Configure(builder.Services, connectionString);
WorkFlowBootstrapper.Configure(builder.Services, connectionString);
QueryBootstrapper.Configure(builder.Services);