fix code for leave service

This commit is contained in:
Suphonchai Phoonsawat 2023-11-16 13:17:54 +07:00
parent cc14ec28b0
commit 5cd20a0b47
8 changed files with 16 additions and 28 deletions

View file

@ -35,6 +35,14 @@ namespace BMA.EHR.Application
services.AddTransient<CandidateReportRepository>(); services.AddTransient<CandidateReportRepository>();
services.AddTransient<MinIOExamService>(); services.AddTransient<MinIOExamService>();
//services.AddTransient<DutyTimeRepository>();
//services.AddTransient<UserTimeStampRepository>();
return services;
}
public static IServiceCollection AddLeaveApplication(this IServiceCollection services)
{
services.AddTransient<DutyTimeRepository>(); services.AddTransient<DutyTimeRepository>();
services.AddTransient<UserTimeStampRepository>(); services.AddTransient<UserTimeStampRepository>();

View file

@ -1,5 +1,4 @@
using BMA.EHR.Domain.Models.MetaData; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Application.Common.Interfaces namespace BMA.EHR.Application.Common.Interfaces
{ {

View file

@ -1,5 +1,4 @@
using BMA.EHR.Domain.Models.MetaData; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Application.Common.Interfaces namespace BMA.EHR.Application.Common.Interfaces
{ {

View file

@ -1,18 +1,10 @@
using System.Reflection.Metadata; using BMA.EHR.Application.Common.Interfaces;
using System.Text;
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Responses;
using BMA.EHR.Domain.Extensions; using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Retirement;
using BMA.EHR.Domain.ModelsExam.Candidate; using BMA.EHR.Domain.ModelsExam.Candidate;
using BMA.EHR.Domain.Shared; using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json; using System.Text;
using static BMA.EHR.Domain.Extensions.DateTimeExtension; using static BMA.EHR.Domain.Extensions.DateTimeExtension;
namespace BMA.EHR.Application.Repositories.Reports namespace BMA.EHR.Application.Repositories.Reports

View file

@ -1,18 +1,9 @@
using System; using BMA.EHR.Application.Common.Interfaces;
using System.Reflection.Metadata;
using System.Text.RegularExpressions;
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Responses;
using BMA.EHR.Domain.Extensions; using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.HR; using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Placement; using BMA.EHR.Domain.Models.Placement;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace BMA.EHR.Application.Repositories.Reports namespace BMA.EHR.Application.Repositories.Reports
{ {

View file

@ -12,7 +12,7 @@ namespace BMA.EHR.Infrastructure
public static IServiceCollection AddLeavePersistence(this IServiceCollection services, public static IServiceCollection AddLeavePersistence(this IServiceCollection services,
IConfiguration configuration) IConfiguration configuration)
{ {
services.AddScoped<IApplicationDBExamContext>(provider => provider.GetService<ApplicationDBExamContext>());
// leave db context // leave db context
var connectionStringLeave = configuration.GetConnectionString("LeaveConnection"); var connectionStringLeave = configuration.GetConnectionString("LeaveConnection");
@ -65,7 +65,7 @@ namespace BMA.EHR.Infrastructure
}), }),
ServiceLifetime.Transient); ServiceLifetime.Transient);
services.AddScoped<IApplicationDBExamContext>(provider => provider.GetService<ApplicationDBExamContext>());
return services; return services;
} }

View file

@ -6,10 +6,8 @@ using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence; using BMA.EHR.Infrastructure.Persistence;
using BMA.EHR.Leave.Service.DTOs.CheckIn; using BMA.EHR.Leave.Service.DTOs.CheckIn;
using BMA.EHR.Leave.Service.DTOs.DutyTime; using BMA.EHR.Leave.Service.DTOs.DutyTime;
using iTextSharp.text;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Security.Claims; using System.Security.Claims;

View file

@ -79,6 +79,7 @@ var builder = WebApplication.CreateBuilder(args);
// Add services to the container. // Add services to the container.
builder.Services.AddApplication(); builder.Services.AddApplication();
builder.Services.AddLeaveApplication();
builder.Services.AddPersistence(builder.Configuration); builder.Services.AddPersistence(builder.Configuration);
builder.Services.AddLeavePersistence(builder.Configuration); builder.Services.AddLeavePersistence(builder.Configuration);