Refactor repository and remove unused Index files
Refactored `IPersonalContractingPartyRepository` to replace `GetByRegisterId` with `GetByNationalId`. Updated `InstitutionContractApplication` to use the new method and removed duplicate `RegisterId` validation logic. Removed `Index.cshtml` and `Index.cshtml.cs` files, including all associated HTML, scripts, styles, and backend logic, indicating a deprecation or restructuring of the related functionality.
This commit is contained in:
@@ -75,5 +75,5 @@ public interface IPersonalContractingPartyRepository :IRepository<long, Personal
|
||||
Task<GetLegalContractingPartyDetailsViewModel> GetLegalDetails(long id);
|
||||
|
||||
Task<PersonalContractingParty> GetByNationalCode(string nationalCode);
|
||||
Task<PersonalContractingParty> GetByRegisterId(string registerId);
|
||||
Task<PersonalContractingParty> GetByNationalId(string registerId);
|
||||
}
|
||||
@@ -960,7 +960,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
if (command.ContractingPartyLegalType == LegalType.Legal)
|
||||
{
|
||||
existingContractingParty =
|
||||
await _contractingPartyRepository.GetByRegisterId(command.LegalParty.RegisterId);
|
||||
await _contractingPartyRepository.GetByNationalId(command.LegalParty.NationalId);
|
||||
if (_contractingPartyRepository.Exists(x =>
|
||||
x.LName == command.LegalParty.CompanyName && x.RegisterId == command.LegalParty.RegisterId))
|
||||
{
|
||||
@@ -1491,9 +1491,9 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return opration.Failed("نام شرکت وارد شده تکراری است");
|
||||
|
||||
|
||||
if (_contractingPartyRepository.Exists(x =>
|
||||
x.RegisterId == request.RegisterId && x.LName != request.CompanyName))
|
||||
return opration.Failed("شماره ثبت وارد شده تکراری است");
|
||||
//if (_contractingPartyRepository.Exists(x =>
|
||||
// x.RegisterId == request.RegisterId && x.LName != request.CompanyName))
|
||||
// return opration.Failed("شماره ثبت وارد شده تکراری است");
|
||||
|
||||
|
||||
if (_contractingPartyRepository.Exists(x =>
|
||||
|
||||
@@ -768,9 +768,9 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
|
||||
return await _context.PersonalContractingParties.FirstOrDefaultAsync(x => x.Nationalcode == nationalCode);
|
||||
}
|
||||
|
||||
public async Task<PersonalContractingParty> GetByRegisterId(string registerId)
|
||||
public async Task<PersonalContractingParty> GetByNationalId(string nationalId)
|
||||
{
|
||||
return await _context.PersonalContractingParties.FirstOrDefaultAsync(x => x.RegisterId == registerId);
|
||||
return await _context.PersonalContractingParties.FirstOrDefaultAsync(x => x.NationalId == nationalId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,116 +0,0 @@
|
||||
using _0_Framework.Application;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
|
||||
using CompanyManagment.App.Contracts.CustomizeCheckout;
|
||||
using CompanyManagment.App.Contracts.YearlySalary;
|
||||
using CompanyManagment.Application;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using ServiceHost.Areas.Client.Pages.Company.CustomizeCheckout;
|
||||
using System.Globalization;
|
||||
|
||||
namespace ServiceHost.Areas.AdminNew.Pages.Company.MonthlyOverview
|
||||
{
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly IAdminMonthlyOverviewApplication _adminMonthlyOverviewApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IYearlySalaryApplication _yearlySalaryApplication;
|
||||
public List<string> YearlyList;
|
||||
public AdminMonthlyOverviewSearchModel SearchModel;
|
||||
private readonly IWorkshopApplication _workshopApplication;
|
||||
private readonly IEmployerApplication _employerApplication;
|
||||
private readonly IAccountApplication _accountApplication;
|
||||
|
||||
public IndexModel(IAdminMonthlyOverviewApplication adminMonthlyOverviewApplication, IAuthHelper authHelper,
|
||||
IWorkshopApplication workshopApplication, IEmployerApplication employerApplication,
|
||||
IAccountApplication accountApplication, IYearlySalaryApplication yearlySalaryApplication)
|
||||
{
|
||||
_adminMonthlyOverviewApplication = adminMonthlyOverviewApplication;
|
||||
_yearlySalaryApplication = yearlySalaryApplication;
|
||||
_authHelper = authHelper;
|
||||
_workshopApplication = workshopApplication;
|
||||
_employerApplication = employerApplication;
|
||||
_accountApplication = accountApplication;
|
||||
}
|
||||
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
var accountId = _authHelper.CurrentAccountId();
|
||||
|
||||
YearlyList = _yearlySalaryApplication.GetYears();
|
||||
|
||||
PersianCalendar pc = new PersianCalendar();
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
int year = pc.GetYear(now);
|
||||
int month = pc.GetMonth(now);
|
||||
|
||||
SearchModel = new AdminMonthlyOverviewSearchModel()
|
||||
{
|
||||
Year = year,
|
||||
Month = month,
|
||||
AdminAccountId = accountId
|
||||
};
|
||||
return Page();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetWorkshops(AdminMonthlyOverviewSearchModel searchModel)
|
||||
{
|
||||
var workshopListByStatus = await _adminMonthlyOverviewApplication.GetWorkshopListByStatus(searchModel);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
data = workshopListByStatus
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostNext(long id)
|
||||
{
|
||||
var result = await _adminMonthlyOverviewApplication.Next(id);
|
||||
|
||||
return new JsonResult(result);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostBack(long id)
|
||||
{
|
||||
var result = await _adminMonthlyOverviewApplication.Back(id);
|
||||
|
||||
return new JsonResult(result);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetCounter(int year , int month , long accountId)
|
||||
{
|
||||
var counter = await _adminMonthlyOverviewApplication.GetCounter(year, month, accountId);
|
||||
return new JsonResult(counter);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetEmployerSelectList(string search, long id)
|
||||
{
|
||||
var res = await _employerApplication.GetSelectList(search, id);
|
||||
return new JsonResult(new
|
||||
{
|
||||
data = res
|
||||
});
|
||||
}
|
||||
public async Task<IActionResult> OnGetWorkshopSelectList(string search, long id)
|
||||
{
|
||||
var res = await _workshopApplication.GetSelectList(search, id);
|
||||
return new JsonResult(new
|
||||
{
|
||||
data = res
|
||||
});
|
||||
}
|
||||
public async Task<IActionResult> OnGetAccountSelectList()
|
||||
{
|
||||
var res = await _accountApplication.GetAdminSelectList();
|
||||
//res = res.Where(x => x.RoleId == 5).ToList();
|
||||
return new JsonResult(new
|
||||
{
|
||||
data = res
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user