76 lines
2.6 KiB
C#
76 lines
2.6 KiB
C#
using System;
|
|
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.Models.HR;
|
|
using BMA.EHR.Domain.Models.Organizations;
|
|
using BMA.EHR.Domain.Models.Placement;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace BMA.EHR.Application.Repositories.Reports
|
|
{
|
|
public class TransferReportRepository
|
|
{
|
|
#region " Fields "
|
|
|
|
private readonly IApplicationDBContext _dbContext;
|
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
|
|
|
#endregion
|
|
|
|
#region " Constructor and Destructor "
|
|
|
|
public TransferReportRepository(IApplicationDBContext dbContext, IWebHostEnvironment hostEnvironment)
|
|
{
|
|
_dbContext = dbContext;
|
|
_hostingEnvironment = hostEnvironment;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region " Methods "
|
|
|
|
#region 2
|
|
public async Task<dynamic> GetData2Transfer(Guid id)
|
|
{
|
|
var data = await _dbContext.Set<PlacementTransfer>().AsQueryable()
|
|
.Include(x => x.Profile)
|
|
.Where(x => x.Id == id)
|
|
.FirstOrDefaultAsync();
|
|
|
|
var currentdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 16);
|
|
return new
|
|
{
|
|
CurrentDate = currentdate,
|
|
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
|
Name = $"{data.Profile.Prefix?.Name}{data.Profile.FirstName} {data.Profile.LastName}",
|
|
};
|
|
}
|
|
#endregion
|
|
|
|
#region 3
|
|
public async Task<dynamic> GetData3Transfer(Guid id)
|
|
{
|
|
var data = await _dbContext.Set<PlacementTransfer>().AsQueryable()
|
|
.Include(x => x.Profile)
|
|
.Where(x => x.Id == id)
|
|
.FirstOrDefaultAsync();
|
|
var currentdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 16);
|
|
return new
|
|
{
|
|
CurrentDate = currentdate,
|
|
Subject = $"ข้าราชการขอโอน",
|
|
Name = $"{data.Profile.Prefix?.Name}{data.Profile.FirstName} {data.Profile.LastName}",
|
|
};
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
}
|