2023-08-20 12:00:14 +07:00
|
|
|
|
using BMA.EHR.Application.Repositories.Commands;
|
|
|
|
|
|
using BMA.EHR.Domain.Common;
|
|
|
|
|
|
using BMA.EHR.Domain.Extensions;
|
|
|
|
|
|
using BMA.EHR.Domain.Shared;
|
2024-01-12 09:53:10 +07:00
|
|
|
|
using iTextSharp.text.pdf;
|
2023-08-20 12:00:14 +07:00
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2024-01-06 03:00:04 +07:00
|
|
|
|
using Newtonsoft.Json;
|
2023-08-20 12:00:14 +07:00
|
|
|
|
using Swashbuckle.AspNetCore.Annotations;
|
|
|
|
|
|
using Telerik.Reporting;
|
|
|
|
|
|
using Telerik.Reporting.Processing;
|
2024-06-19 14:50:38 +07:00
|
|
|
|
using System.Net.Http.Headers;
|
2023-08-20 12:00:14 +07:00
|
|
|
|
|
|
|
|
|
|
namespace BMA.EHR.Report.Service.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
[Route("api/v{version:apiVersion}/report/order")]
|
|
|
|
|
|
[ApiVersion("2.0")]
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
|
[Produces("application/json")]
|
|
|
|
|
|
[Authorize]
|
|
|
|
|
|
[SwaggerTag("API รายงานระบบออกคำสั่ง")]
|
|
|
|
|
|
public class CommandReportController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
#region " Fields "
|
|
|
|
|
|
|
|
|
|
|
|
private readonly CommandRepository _repository;
|
|
|
|
|
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
|
|
|
|
|
private readonly IConfiguration _configuration;
|
2023-08-20 19:29:03 +07:00
|
|
|
|
private readonly CommandReportRepository _commandReportRepository;
|
2023-08-24 12:14:01 +07:00
|
|
|
|
private readonly GenericReportGenerator _reportGenerator;
|
2023-08-20 12:00:14 +07:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " Constuctor and Destructor "
|
|
|
|
|
|
|
|
|
|
|
|
public CommandReportController(CommandRepository repository,
|
|
|
|
|
|
IWebHostEnvironment hostingEnvironment,
|
2023-08-20 19:29:03 +07:00
|
|
|
|
IConfiguration configuration,
|
2023-08-24 12:14:01 +07:00
|
|
|
|
CommandReportRepository commandReportRepository,
|
|
|
|
|
|
GenericReportGenerator reportGenerator)
|
2023-08-20 12:00:14 +07:00
|
|
|
|
{
|
|
|
|
|
|
_repository = repository;
|
|
|
|
|
|
_hostingEnvironment = hostingEnvironment;
|
|
|
|
|
|
_configuration = configuration;
|
2023-08-20 19:29:03 +07:00
|
|
|
|
_commandReportRepository = commandReportRepository;
|
2023-08-24 12:14:01 +07:00
|
|
|
|
_reportGenerator = reportGenerator;
|
2023-08-20 12:00:14 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " Methods "
|
|
|
|
|
|
|
|
|
|
|
|
#region " Private "
|
|
|
|
|
|
|
2023-08-24 12:31:16 +07:00
|
|
|
|
#region " C-PM-01 "
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType01_Cover(Guid commandId, string exportType)
|
2023-08-20 12:00:14 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-02 22:50:38 +07:00
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
2023-09-25 17:06:20 +07:00
|
|
|
|
var positionList = await _repository.GetReceiverPositionByCommandIdAsync(commandId);
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2023-08-20 12:00:14 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-08-20 12:00:14 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-25 17:06:20 +07:00
|
|
|
|
PositionList = positionList,
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-02 22:50:38 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-08-20 12:00:14 +07:00
|
|
|
|
};
|
2024-06-26 16:46:40 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-1.trdp");
|
2023-08-20 12:00:14 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-08-20 12:00:14 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-08-20 12:00:14 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-08-20 12:00:14 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-08-20 12:00:14 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-08-20 12:00:14 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-08-20 12:00:14 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-08-20 12:00:14 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType01_Attachment(Guid commandId, string exportType)
|
2023-08-20 19:29:03 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-08-20 19:29:03 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-28 17:15:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-08-20 19:29:03 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType01AttachmentAsync(commandId);
|
2024-06-28 17:15:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-2.trdp");
|
2023-08-20 19:29:03 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-08-20 19:29:03 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
2023-08-20 19:29:03 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-08-20 19:29:03 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-08-20 19:29:03 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-08-20 19:29:03 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-08-20 19:29:03 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-08-20 19:29:03 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-08-20 19:29:03 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-08-20 19:29:03 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-20 12:00:14 +07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-09-02 22:50:38 +07:00
|
|
|
|
#region " C-PM-02 "
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType02_Cover(Guid commandId, string exportType)
|
2023-09-02 22:50:38 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
2023-09-25 17:06:20 +07:00
|
|
|
|
var positionList = await _repository.GetReceiverPositionByCommandIdAsync(commandId);
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-02 22:50:38 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-25 17:06:20 +07:00
|
|
|
|
PositionList = positionList,
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-02 22:50:38 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-02 22:50:38 +07:00
|
|
|
|
};
|
2024-06-26 16:46:40 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-3.trdp");
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-02 22:50:38 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType02_Attachment(Guid commandId, string exportType)
|
2023-09-02 22:50:38 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-02 22:50:38 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-28 17:15:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-02 22:50:38 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType02AttachmentAsync(commandId);
|
2024-06-28 17:15:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-4.trdp");
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-02 22:50:38 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
#region " C-PM-03 "
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType03_Cover(Guid commandId, string exportType)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
2023-09-25 17:06:20 +07:00
|
|
|
|
var positionList = await _repository.GetReceiverPositionByCommandIdAsync(commandId);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-03 13:35:58 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-25 17:06:20 +07:00
|
|
|
|
PositionList = positionList,
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 13:35:58 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-03 13:35:58 +07:00
|
|
|
|
};
|
2024-06-26 16:46:40 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"03-คำสั่งแต่งตั้งผู้สอบแข่งขัน-Head.trdp");
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType03_Attachment(Guid commandId, string exportType)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-28 17:15:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType03AttachmentAsync(commandId);
|
2024-06-28 17:15:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"03-คำสั่งแต่งตั้งผู้สอบแข่งขัน.trdp");
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-04 "
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType04_Cover(Guid commandId, string exportType)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
2023-09-25 17:06:20 +07:00
|
|
|
|
var positionList = await _repository.GetReceiverPositionByCommandIdAsync(commandId);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-03 13:35:58 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-25 17:06:20 +07:00
|
|
|
|
PositionList = positionList,
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 13:35:58 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-03 13:35:58 +07:00
|
|
|
|
};
|
2024-06-26 16:46:40 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"04-คำสั่งย้ายผู้สอบแข่งขัน-Head.trdp");
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType04_Attachment(Guid commandId, string exportType)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-28 17:15:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType03AttachmentAsync(commandId);
|
2024-06-28 17:15:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"04-คำสั่งย้ายผู้สอบแข่งขัน.trdp");
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-07-09 17:03:54 +07:00
|
|
|
|
#region " C-PM-39 "
|
|
|
|
|
|
|
|
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType39_Cover(Guid commandId, string exportType)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var positionList = await _repository.GetReceiverPositionByCommandIdAsync(commandId);
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
|
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
|
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
PositionList = positionList,
|
|
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
|
|
|
|
|
};
|
|
|
|
|
|
return command;
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType39_Attachment(Guid commandId, string exportType)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
|
|
|
|
|
var data = await _commandReportRepository.GetCommandType03AttachmentAsync(commandId);
|
|
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
#region " C-PM-05 "
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType05_Cover(Guid commandId, string exportType)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
2023-09-25 17:06:20 +07:00
|
|
|
|
var positionList = await _repository.GetReceiverPosition2ByCommandIdAsync(commandId);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-03 13:35:58 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionMeetingNo = raw_data.ConclusionMeetingNo == null ? "" : raw_data.ConclusionMeetingNo.ToThaiNumber(),
|
2023-10-05 16:09:59 +07:00
|
|
|
|
ConclusionMeetingDate = raw_data.ConclusionMeetingDate == null ? "" : raw_data.ConclusionMeetingDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-25 17:06:20 +07:00
|
|
|
|
PositionList = positionList,
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 13:35:58 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-03 13:35:58 +07:00
|
|
|
|
};
|
2024-06-26 16:46:40 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-คำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp");
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType05_Attachment(Guid commandId, string exportType)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-27 18:02:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType05_06AttachmentAsync(commandId);
|
2024-06-27 18:02:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp");
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-06 "
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType06_Cover(Guid commandId, string exportType)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
2023-09-25 17:06:20 +07:00
|
|
|
|
var positionList = await _repository.GetReceiverPosition2ByCommandIdAsync(commandId);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-03 13:35:58 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-25 17:06:20 +07:00
|
|
|
|
PositionList = positionList,
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 13:35:58 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionMeetingNo = raw_data.ConclusionMeetingNo == null ? "" : raw_data.ConclusionMeetingNo.ToThaiNumber(),
|
2023-10-03 09:44:14 +07:00
|
|
|
|
ConclusionMeetingDate = raw_data.ConclusionMeetingDate == null ? "" : raw_data.ConclusionMeetingDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-03 13:35:58 +07:00
|
|
|
|
};
|
2024-06-26 16:46:40 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-คำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp");
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType06_Attachment(Guid commandId, string exportType)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-27 18:02:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType05_06AttachmentAsync(commandId);
|
2024-06-27 18:02:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp");
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-07 "
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType07_Cover(Guid commandId, string exportType)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
2023-09-25 17:06:20 +07:00
|
|
|
|
var positionList = await _repository.GetReceiverPosition2ByCommandIdAsync(commandId);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-03 13:35:58 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-25 17:06:20 +07:00
|
|
|
|
PositionList = positionList,
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 13:35:58 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-03 13:35:58 +07:00
|
|
|
|
};
|
2024-06-26 16:46:40 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"07-คำสั่งย้าย.trdp");
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType07_Attachment(Guid commandId, string exportType)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-03 13:35:58 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-27 18:02:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-06 13:25:50 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType07AttachmentAsync(commandId);
|
2024-06-27 18:02:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"07-แนบท้ายคำสั่งย้าย.trdp");
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 13:35:58 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-09-03 20:54:12 +07:00
|
|
|
|
#region " C-PM-08 "
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType08_Cover(Guid commandId, string exportType)
|
2023-09-03 20:54:12 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
PositionList = "",
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionReturnNo = raw_data.ConclusionReturnNo == null ? "" : raw_data.ConclusionReturnNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionReturnDate = raw_data.ConclusionReturnDate == null ? "" : raw_data.ConclusionReturnDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-03 20:54:12 +07:00
|
|
|
|
};
|
2024-06-26 16:46:40 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-5.trdp");
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType08_Attachment(Guid commandId, string exportType)
|
2023-09-03 20:54:12 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-03 20:54:12 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-27 18:02:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType08AttachmentAsync(commandId);
|
2024-06-28 17:38:58 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-6.trdp");
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return content;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-09 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType09_Cover(Guid commandId, string exportType)
|
2023-09-03 20:54:12 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
PositionList = "",
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionReturnNo = raw_data.ConclusionReturnNo == null ? "" : raw_data.ConclusionReturnNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionReturnDate = raw_data.ConclusionReturnDate == null ? "" : raw_data.ConclusionReturnDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
SourceOrganizationName = raw_data.SourceOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
MilitaryCommandNo = raw_data.MilitaryCommandNo == null ? "" : raw_data.MilitaryCommandNo.ToThaiNumber(),
|
2023-10-03 09:44:14 +07:00
|
|
|
|
MilitaryCommanDate = raw_data.MilitaryCommanDate == null ? "" : raw_data.MilitaryCommanDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-03 20:54:12 +07:00
|
|
|
|
};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-7.trdp");
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType09_Attachment(Guid commandId, string exportType)
|
2023-09-03 20:54:12 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-03 20:54:12 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-27 18:02:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType09AttachmentAsync(commandId);
|
2024-06-27 18:02:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-8.trdp");
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-10 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType10_Cover(Guid commandId, string exportType)
|
2023-09-03 20:54:12 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
PositionList = "",
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
|
|
|
|
|
|
PlacementCommandIssuer = raw_data.PlacementCommandIssuer,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
PlacementCommandNo = raw_data.PlacementCommandNo == null ? "" : raw_data.PlacementCommandNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
PlacementCommandDate = raw_data.PlacementCommandDate == null ? "" : raw_data.PlacementCommandDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
PlacementPositionName = raw_data.PlacementPositionName,
|
|
|
|
|
|
PlacementOrganizationName = raw_data.PlacementOrganizationName,
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ProbationStartDate = raw_data.ProbationStartDate == null ? "" : raw_data.ProbationStartDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
ProbationEndDate = raw_data.ProbationEndDate == null ? "" : raw_data.ProbationEndDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 20:54:12 +07:00
|
|
|
|
ChairManFullName = raw_data.ChairManFullName,
|
|
|
|
|
|
Member1FullName = raw_data.Member1FullName,
|
|
|
|
|
|
Member2FullName = raw_data.Member2FullName,
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Duration = raw_data.ProbationStartDate == null || raw_data.ProbationEndDate == null ? "" : raw_data.ProbationStartDate.Value.CalculateBetweenDateV2(raw_data.ProbationEndDate.Value).ToThaiNumber(),
|
|
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-03 20:54:12 +07:00
|
|
|
|
};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"10-แต่งตั้งคณะกรรมการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ.trdp");
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-03 20:54:12 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-09-04 09:17:18 +07:00
|
|
|
|
#region " C-PM-11 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType11_Cover(Guid commandId, string exportType)
|
2023-09-04 09:17:18 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (command == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var data = await _commandReportRepository.GetCommandType11Async(commandId);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return data;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"11-คำสั่งให้ข้าราชการที่ผ่านการประเมิน รับราชการต่อไป.trdp");
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = data;
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-04 09:17:18 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-12 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType12_Cover(Guid commandId, string exportType)
|
2023-09-04 09:17:18 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (command == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var data = await _commandReportRepository.GetCommandType11Async(commandId);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return data;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"12-คำสั่งให้ข้าราชการที่ไม่ผ่านการประเมิน ออกจากราชการ.trdp");
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = data;
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-04 09:17:18 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-09-04 11:37:37 +07:00
|
|
|
|
#region " C-PM-13 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType13_Cover(Guid commandId, string exportType)
|
2023-09-04 11:37:37 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-04 11:37:37 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-04 11:37:37 +07:00
|
|
|
|
PositionList = "",
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-04 11:37:37 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-04 11:37:37 +07:00
|
|
|
|
};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-1.trdp");
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-04 11:37:37 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType13_Attachment(Guid commandId, string exportType)
|
2023-09-04 11:37:37 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-04 11:37:37 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-27 18:02:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-04 11:37:37 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType13AttachmentAsync(commandId);
|
2024-06-27 18:02:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-2.trdp");
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-04 11:37:37 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-04 11:37:37 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-09-04 13:44:34 +07:00
|
|
|
|
#region " C-PM-14 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType14_Cover(Guid commandId, string exportType)
|
2023-09-04 13:44:34 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-04 13:44:34 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-04 13:44:34 +07:00
|
|
|
|
PositionList = "",
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-04 13:44:34 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
TransferOrganizationName = raw_data.TransferOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionReceiveNo = raw_data.ConclusionReceiveNo == null ? "" : raw_data.ConclusionReceiveNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionReceiveDate = raw_data.ConclusionReceiveDate == null ? "" : raw_data.ConclusionReceiveDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-04 13:44:34 +07:00
|
|
|
|
};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ-5.trdp");
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-04 13:44:34 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType14_Attachment(Guid commandId, string exportType)
|
2023-09-04 13:44:34 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-04 13:44:34 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-27 18:02:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-04 13:44:34 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType14AttachmentAsync(commandId);
|
2024-06-27 18:02:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ5-10.trdp");
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-04 13:44:34 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-04 13:44:34 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
#region " C-PM-15 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType15_Cover(Guid commandId, string exportType)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-03 18:14:07 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 18:14:07 +07:00
|
|
|
|
PositionList = "",
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 18:14:07 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-03 18:14:07 +07:00
|
|
|
|
};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"29-คำสั่งให้ช่วยราชการ-1.trdp");
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType15_Attachment(Guid commandId, string exportType)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-27 18:02:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
|
|
|
|
|
var data = await _commandReportRepository.GetCommandType15AttachmentAsync(commandId);
|
2024-06-27 18:02:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"29-คำสั่งให้ช่วยราชการ-2.trdp");
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-16 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType16_Cover(Guid commandId, string exportType)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
|
|
|
|
|
|
2023-09-27 12:36:21 +07:00
|
|
|
|
//var command = new
|
|
|
|
|
|
//{
|
|
|
|
|
|
// CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
// CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
// IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
// ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
|
|
|
|
|
// ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
// ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
|
|
|
|
|
// ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
// PositionList = "",
|
|
|
|
|
|
// Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
// CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
// AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
// AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
// GovAidCommandNo = raw_data.GovAidCommandNo.ToThaiNumber(),
|
|
|
|
|
|
// GovAidCommandDate = raw_data.GovAidCommandDate == null ? "" : raw_data.GovAidCommandDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
//};
|
|
|
|
|
|
|
|
|
|
|
|
var data = await _commandReportRepository.GetCommandType16Async(commandId);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return data;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"30-คำสั่งส่งตัวกลับไปปฏิบัติงานทางต้นสังกัดเดิม.trdp");
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = data;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-17 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType17_Cover(Guid commandId, string exportType)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-03 18:14:07 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 18:14:07 +07:00
|
|
|
|
PositionList = "",
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-03 18:14:07 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2023-09-03 18:14:07 +07:00
|
|
|
|
};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"34-คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ-4.trdp");
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType17_Attachment(Guid commandId, string exportType)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-28 17:15:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
|
|
|
|
|
var data = await _commandReportRepository.GetCommandType17AttachmentAsync(commandId);
|
2024-06-28 17:15:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"34-คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ-5.trdp");
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-18 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType18_Cover(Guid commandId, string exportType)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (command == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var data = await _commandReportRepository.GetCommandType18Async(commandId);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return data;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"37-คำสั่งให้ออกจากราชการ.trdp");
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = data;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-19 "
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
private async Task<dynamic> GenerateCommandReportType19_Cover(Guid commandId, string exportType, string token)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-01-09 12:45:17 +07:00
|
|
|
|
// var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
// if (command == null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
// }
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-09 12:45:17 +07:00
|
|
|
|
// var data = await _commandReportRepository.GetCommandType19Async(commandId);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-09 12:45:17 +07:00
|
|
|
|
// var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"37-คำสั่งปลดออกจากราชการ.trdp");
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-09 12:45:17 +07:00
|
|
|
|
// ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
// Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
// using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// report.DataSource = data;
|
|
|
|
|
|
|
|
|
|
|
|
// System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
|
|
|
|
|
|
// InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
// ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
// RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
|
|
|
|
|
|
|
|
|
|
|
// var content = result.DocumentBytes;
|
|
|
|
|
|
|
|
|
|
|
|
// return content;
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
2024-01-09 12:45:17 +07:00
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId, token);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-09 12:45:17 +07:00
|
|
|
|
var command = new
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
2024-01-09 12:45:17 +07:00
|
|
|
|
No = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
Year = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
Issuerorganizationname = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2024-01-09 12:45:17 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2024-01-09 12:45:17 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
PositionList = "",
|
|
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
|
|
|
|
|
|
Title = $"{raw_data.CommandSubject}",
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-26 11:48:26 +07:00
|
|
|
|
CaseFault = raw_data.CaseFault == null ? "" : raw_data.CaseFault.ToThaiNumber(),
|
|
|
|
|
|
FaultLevel = raw_data.FaultLevel == null ? "" : raw_data.FaultLevel.ToThaiNumber(),
|
2024-01-12 13:30:34 +07:00
|
|
|
|
RefRaw = raw_data.RefRaw == null ? "" : raw_data.RefRaw.ToThaiNumber(),
|
2024-01-26 11:48:26 +07:00
|
|
|
|
Result = raw_data.Result == null ? "" : raw_data.Result.ToThaiNumber(),
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
Fullname = raw_data_profile == null ? "" : raw_data_profile.fullName,
|
|
|
|
|
|
Positionname = raw_data_profile == null ? "" : raw_data_profile.positionname,
|
|
|
|
|
|
Positionno = raw_data_profile == null ? "" : raw_data_profile.positionno.ToThaiNumber(),
|
|
|
|
|
|
Organizationname = raw_data_profile == null ? "" : raw_data_profile.organizationname.ToThaiNumber(),
|
|
|
|
|
|
Salary = raw_data_profile == null ? "" : raw_data_profile.salary.ToThaiNumber(),
|
2024-01-12 09:53:10 +07:00
|
|
|
|
|
|
|
|
|
|
OrderDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
SignatoryBy = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
SignatoryPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
|
2024-01-12 13:30:34 +07:00
|
|
|
|
ConclusionFireNo = raw_data.ConclusionFireNo == null ? "" : raw_data.ConclusionFireNo.ToThaiNumber(),
|
2024-01-12 09:53:10 +07:00
|
|
|
|
ConclusionFireDate = raw_data.ConclusionFireDate == null ? "" : raw_data.ConclusionFireDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
ConclusionFireResolution = raw_data.ConclusionFireResolution,
|
2024-01-09 12:45:17 +07:00
|
|
|
|
};
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-09 12:45:17 +07:00
|
|
|
|
return command;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-20 "
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
private async Task<dynamic> GenerateCommandReportType20_Cover(Guid commandId, string exportType, string token)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-01-09 12:45:17 +07:00
|
|
|
|
// var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
// if (command == null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
// }
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-09 12:45:17 +07:00
|
|
|
|
// var data = await _commandReportRepository.GetCommandType20Async(commandId);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-09 12:45:17 +07:00
|
|
|
|
// var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"38-คำสั่งลงโทษไล่ข้าราชการออกจากราชการ.trdp");
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-09 12:45:17 +07:00
|
|
|
|
// ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
// Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
// using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// report.DataSource = data;
|
|
|
|
|
|
|
|
|
|
|
|
// System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
|
|
|
|
|
|
// InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
// ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
// RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
|
|
|
|
|
|
|
|
|
|
|
// var content = result.DocumentBytes;
|
|
|
|
|
|
|
|
|
|
|
|
// return content;
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
2024-01-09 12:45:17 +07:00
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId, token);
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-09 12:45:17 +07:00
|
|
|
|
var command = new
|
2023-09-03 18:14:07 +07:00
|
|
|
|
{
|
2024-01-09 12:45:17 +07:00
|
|
|
|
No = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
Year = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
Issuerorganizationname = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2024-01-09 12:45:17 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2024-01-09 12:45:17 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
PositionList = "",
|
|
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
|
|
|
|
|
|
Title = $"{raw_data.CommandSubject}",
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-26 11:48:26 +07:00
|
|
|
|
CaseFault = raw_data.CaseFault == null ? "" : raw_data.CaseFault.ToThaiNumber(),
|
|
|
|
|
|
FaultLevel = raw_data.FaultLevel == null ? "" : raw_data.FaultLevel.ToThaiNumber(),
|
2024-01-12 13:30:34 +07:00
|
|
|
|
RefRaw = raw_data.RefRaw == null ? "" : raw_data.RefRaw.ToThaiNumber(),
|
2024-01-26 11:48:26 +07:00
|
|
|
|
Result = raw_data.Result == null ? "" : raw_data.Result.ToThaiNumber(),
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
Fullname = raw_data_profile == null ? "" : raw_data_profile.fullName,
|
|
|
|
|
|
Positionname = raw_data_profile == null ? "" : raw_data_profile.positionname,
|
|
|
|
|
|
Positionno = raw_data_profile == null ? "" : raw_data_profile.positionno.ToThaiNumber(),
|
|
|
|
|
|
Organizationname = raw_data_profile == null ? "" : raw_data_profile.organizationname.ToThaiNumber(),
|
|
|
|
|
|
Salary = raw_data_profile == null ? "" : raw_data_profile.salary.ToThaiNumber(),
|
2024-01-12 09:53:10 +07:00
|
|
|
|
|
2024-07-04 18:06:33 +07:00
|
|
|
|
OrderDate = raw_data.CommandExcecuteDate == null ? "" : raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-12 09:53:10 +07:00
|
|
|
|
SignatoryBy = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
SignatoryPosition = raw_data.AuthorizedPosition,
|
2024-01-12 13:30:34 +07:00
|
|
|
|
|
|
|
|
|
|
ConclusionFireNo = raw_data.ConclusionFireNo == null ? "" : raw_data.ConclusionFireNo.ToThaiNumber(),
|
|
|
|
|
|
ConclusionFireDate = raw_data.ConclusionFireDate == null ? "" : raw_data.ConclusionFireDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-22 14:36:12 +07:00
|
|
|
|
ConclusionFireResolution = raw_data.ConclusionFireResolution == null ? "" : raw_data.ConclusionFireResolution.ToThaiNumber(),
|
2024-01-09 12:45:17 +07:00
|
|
|
|
};
|
2023-09-03 18:14:07 +07:00
|
|
|
|
|
2024-01-09 12:45:17 +07:00
|
|
|
|
return command;
|
2023-09-03 18:14:07 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-09-05 12:02:25 +07:00
|
|
|
|
#region " C-PM-21 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType21_Cover(Guid commandId, string exportType)
|
2023-09-05 12:02:25 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
|
|
|
|
|
|
2024-06-28 17:15:07 +07:00
|
|
|
|
//GetCommandType21AttachmentAsync
|
|
|
|
|
|
var receiver = await _commandReportRepository.GetCommandType21AttachmentAsync(commandId);
|
2023-09-05 12:02:25 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
2023-09-21 15:42:11 +07:00
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
2023-09-05 12:02:25 +07:00
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-09-21 15:42:11 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-05 12:02:25 +07:00
|
|
|
|
PositionList = "",
|
2023-09-21 15:42:11 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-09-05 12:02:25 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2023-10-03 09:44:14 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2024-06-28 17:15:07 +07:00
|
|
|
|
employee = receiver,
|
2023-09-05 12:02:25 +07:00
|
|
|
|
};
|
2024-07-09 17:03:54 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return command;
|
2024-06-28 17:15:07 +07:00
|
|
|
|
//return new
|
|
|
|
|
|
//{
|
|
|
|
|
|
// CommandNo = command.CommandNo,
|
|
|
|
|
|
// CommandYear = command.CommandYear,
|
|
|
|
|
|
// IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
// CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
// data = data,
|
|
|
|
|
|
//};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var receiver = await _commandReportRepository.GetCommandType21AttachmentAsync(commandId);
|
2023-09-05 12:02:25 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"20-คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ-2.trdp");
|
2023-09-05 12:02:25 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-09-05 12:02:25 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-09-05 12:02:25 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
2023-09-05 12:02:25 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//tblData.DataSource = receiver;
|
2023-09-05 12:02:25 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-09-05 12:02:25 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-09-05 12:02:25 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-09-05 12:02:25 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-09-05 12:02:25 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-09-05 12:02:25 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-10-11 14:07:01 +07:00
|
|
|
|
#region " C-PM-22 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType22_Cover(Guid commandId, string exportType)
|
2023-10-11 14:07:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2023-10-30 20:36:53 +07:00
|
|
|
|
// ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-10-11 14:07:01 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-10-30 20:36:53 +07:00
|
|
|
|
// ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
|
|
|
|
|
// ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
// PositionList = "",
|
2023-10-11 14:07:01 +07:00
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
2023-10-30 20:36:53 +07:00
|
|
|
|
// ConclusionReturnNo = raw_data.ConclusionReturnNo.ToThaiNumber(),
|
|
|
|
|
|
// ConclusionReturnDate = raw_data.ConclusionReturnDate == null ? "" : raw_data.ConclusionReturnDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-10-11 14:07:01 +07:00
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
|
|
|
|
|
};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน).trdp");
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
|
|
|
|
|
|
|
|
|
|
|
//return content;
|
2023-10-11 14:07:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType22_Attachment(Guid commandId, string exportType)
|
2023-10-30 20:36:53 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-10-30 20:36:53 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-28 17:15:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-10-30 20:36:53 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType22AttachmentAsync(commandId);
|
2024-06-28 17:15:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)-แนบท้าย.trdp");
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-10-30 20:36:53 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-10-11 14:07:01 +07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-23 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType23_Cover(Guid commandId, string exportType)
|
2023-10-11 14:07:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
2024-06-28 17:15:07 +07:00
|
|
|
|
var receiver = await _commandReportRepository.GetCommandType23AttachmentAsync(commandId);
|
2023-10-11 14:07:01 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-10-11 14:07:01 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-10-11 14:07:01 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
PositionList = "",
|
|
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
2024-06-28 17:15:07 +07:00
|
|
|
|
employee = receiver
|
2023-10-11 14:07:01 +07:00
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var receiver = await _commandReportRepository.GetCommandType23AttachmentAsync(commandId);
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"35-คำสั่งอนุญาตให้ลูกจ้างลาออก.trdp");
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//tblData.DataSource = receiver;
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-10-11 14:07:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-10-30 20:36:53 +07:00
|
|
|
|
#region " C-PM-24 "
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType24_Cover(Guid commandId, string exportType)
|
2023-10-30 20:36:53 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
|
|
|
|
|
//var positionList = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionTranferNo = raw_data.ConclusionTranferNo == null ? "" : raw_data.ConclusionTranferNo.ToThaiNumber(),
|
2023-10-30 20:36:53 +07:00
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-10-30 20:36:53 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
// ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
|
|
|
|
|
// ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
// PositionList = "",
|
|
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-10-31 23:02:23 +07:00
|
|
|
|
ConclusionTranferDate = raw_data.ConclusionTranferDate == null ? "" : raw_data.ConclusionTranferDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2023-10-30 20:36:53 +07:00
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
// ConclusionReturnNo = raw_data.ConclusionReturnNo.ToThaiNumber(),
|
|
|
|
|
|
// ConclusionReturnDate = raw_data.ConclusionReturnDate == null ? "" : raw_data.ConclusionReturnDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
|
|
|
|
|
};
|
2024-06-26 09:56:34 +07:00
|
|
|
|
return command;
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย).trdp");
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.DataSource = command;
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
|
|
|
|
//if (exportType == "docx")
|
|
|
|
|
|
// deviceInfo["OutputFormat"] = "DOCX";
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-10-30 20:36:53 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType24_Attachment(Guid commandId, string exportType)
|
2023-10-30 20:36:53 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
//var command = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
//if (command == null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
//}
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
2023-10-30 20:36:53 +07:00
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
2024-06-28 17:15:07 +07:00
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
2023-10-30 20:36:53 +07:00
|
|
|
|
var data = await _commandReportRepository.GetCommandType24AttachmentAsync(commandId);
|
2024-06-28 17:15:07 +07:00
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)-แนบท้าย.trdp");
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportPackager reportPackager = new ReportPackager();
|
|
|
|
|
|
//Telerik.Reporting.Report? report = null;
|
|
|
|
|
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
|
|
|
|
//}
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//tblData.DataSource = data;
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
|
|
|
|
|
//report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber();
|
|
|
|
|
|
//report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber();
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ReportDocument = report
|
|
|
|
|
|
//};
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
|
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
|
|
|
|
//RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//var content = result.DocumentBytes;
|
2023-10-30 20:36:53 +07:00
|
|
|
|
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return content;
|
2023-10-30 20:36:53 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-07-18 20:37:17 +07:00
|
|
|
|
#region " C-PM-40 "
|
|
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType40_Attachment(Guid commandId, string exportType, string token)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
|
|
|
|
|
var data = await _commandReportRepository.GetCommandType40AttachmentAsync(commandId, token);
|
|
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-41 "
|
|
|
|
|
|
|
|
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType41_Cover(Guid commandId, string exportType)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
|
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
|
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
PositionList = "",
|
|
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
|
|
|
|
|
};
|
|
|
|
|
|
return command;
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async Task</*byte[]*/dynamic> GenerateCommandReportType41_Attachment(Guid commandId, string exportType)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var data = await _commandReportRepository.GetCommandType41AttachmentAsync(commandId);
|
|
|
|
|
|
return new
|
|
|
|
|
|
{
|
|
|
|
|
|
CommandNo = command.CommandNo,
|
|
|
|
|
|
CommandYear = command.CommandYear,
|
|
|
|
|
|
IssuerOrganizationName = command.IssuerOrganizationName,
|
|
|
|
|
|
CommandExcecuteDate = command.CommandExcecuteDate,
|
|
|
|
|
|
data = data,
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-12-23 13:48:56 +07:00
|
|
|
|
#region " C-PM-25 "
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
private async Task<dynamic> GenerateCommandReportType25_Cover(Guid commandId, string exportType, string token)
|
2023-12-23 13:48:56 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId, token);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
No = raw_data.CommandNo.ToThaiNumber(),
|
2024-04-26 10:18:59 +07:00
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
2023-12-23 13:48:56 +07:00
|
|
|
|
Year = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
Issuerorganizationname = raw_data.IssuerOrganizationName,
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
2023-12-23 13:48:56 +07:00
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
2024-01-19 20:47:32 +07:00
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
2023-12-23 13:48:56 +07:00
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
PositionList = "",
|
|
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
|
2024-01-06 03:00:04 +07:00
|
|
|
|
Title = $"{raw_data.CommandSubject}",
|
2023-12-23 13:48:56 +07:00
|
|
|
|
|
2024-01-22 14:36:12 +07:00
|
|
|
|
CaseFault = raw_data.CaseFault == null ? "" : raw_data.CaseFault.ToThaiNumber(),
|
|
|
|
|
|
FaultLevel = raw_data.FaultLevel == null ? "" : raw_data.FaultLevel.ToThaiNumber(),
|
2024-01-12 13:30:34 +07:00
|
|
|
|
RefRaw = raw_data.RefRaw == null ? "" : raw_data.RefRaw.ToThaiNumber(),
|
2024-01-22 14:36:12 +07:00
|
|
|
|
Result = raw_data.Result == null ? "" : raw_data.Result.ToThaiNumber(),
|
2023-12-23 13:48:56 +07:00
|
|
|
|
|
2024-06-26 22:57:50 +07:00
|
|
|
|
Fullname = raw_data_profile == null ? "" : raw_data_profile.fullName != null ? raw_data_profile.fullName : "-",
|
|
|
|
|
|
Positionname = raw_data_profile == null ? "" : raw_data_profile.positionname != null ? raw_data_profile.positionname : "-",
|
|
|
|
|
|
Positionno = raw_data_profile == null ? "" : raw_data_profile.positionno != null ? raw_data_profile.positionno.ToThaiNumber() : "-",
|
|
|
|
|
|
Organizationname = raw_data_profile == null ? "" : raw_data_profile.organizationname != null ? raw_data_profile.organizationname.ToThaiNumber() : "-",
|
|
|
|
|
|
Salary = raw_data_profile == null ? "" : raw_data_profile.salary != null ? raw_data_profile.salary.ToThaiNumber() : "-",
|
2024-01-12 09:53:10 +07:00
|
|
|
|
|
|
|
|
|
|
OrderDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
SignatoryBy = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
SignatoryPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
|
|
|
|
|
|
CreatedAt = raw_data.CreatedAt.ToThaiFullDate3().ToThaiNumber(),
|
2023-12-23 13:48:56 +07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return command;
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-26 10:18:59 +07:00
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2024-04-26 10:18:59 +07:00
|
|
|
|
#region " C-PM-33 "
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<dynamic> GenerateCommandReportType33_Cover(Guid commandId, string exportType)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw_data = await _repository.GetByIdAsync(commandId);
|
|
|
|
|
|
if (raw_data == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId);
|
|
|
|
|
|
|
|
|
|
|
|
var command = new
|
|
|
|
|
|
{
|
|
|
|
|
|
No = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
|
|
|
|
|
Year = raw_data.Year.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
YearOld = (raw_data.Year.ToInteger() - 1).ToThaiYear().ToString().ToThaiNumber(),
|
|
|
|
|
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
|
|
|
|
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
|
|
|
|
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
|
|
|
|
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
PositionList = "",
|
|
|
|
|
|
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
|
|
|
|
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
|
|
|
|
|
|
Title = $"{raw_data.CommandSubject}",
|
|
|
|
|
|
|
|
|
|
|
|
CaseFault = raw_data.CaseFault == null ? "" : raw_data.CaseFault.ToThaiNumber(),
|
|
|
|
|
|
FaultLevel = raw_data.FaultLevel == null ? "" : raw_data.FaultLevel.ToThaiNumber(),
|
|
|
|
|
|
RefRaw = raw_data.RefRaw == null ? "" : raw_data.RefRaw.ToThaiNumber(),
|
|
|
|
|
|
Result = raw_data.Result == null ? "" : raw_data.Result.ToThaiNumber(),
|
|
|
|
|
|
|
|
|
|
|
|
// Fullname = raw_data_profile == null ? "" : raw_data_profile.FullName,
|
|
|
|
|
|
// Positionname = raw_data_profile == null ? "" : raw_data_profile.Positionname,
|
|
|
|
|
|
// Positionno = raw_data_profile == null || raw_data_profile.Positionno == null ? "" : raw_data_profile.Positionno.ToThaiNumber(),
|
|
|
|
|
|
// Organizationname = raw_data_profile == null || raw_data_profile.Organizationname == null ? "" : raw_data_profile.Organizationname.ToThaiNumber(),
|
|
|
|
|
|
// Salary = raw_data_profile == null || raw_data_profile.Salary == null ? "" : raw_data_profile.Salary.ToThaiNumber(),
|
|
|
|
|
|
|
|
|
|
|
|
OrderDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
SignatoryBy = raw_data.AuthorizedUserFullName,
|
|
|
|
|
|
SignatoryPosition = raw_data.AuthorizedPosition,
|
|
|
|
|
|
|
|
|
|
|
|
CreatedAt = raw_data.CreatedAt.ToThaiFullDate3().ToThaiNumber(),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return command;
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-12-23 13:48:56 +07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-08-24 12:31:16 +07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
#region " C-PM-01 คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-01 คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-01/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-08-24 12:31:16 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType01CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-24 12:31:16 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-08-24 12:31:16 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType01_Cover(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-01",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-01 คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-01/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-08-24 12:31:16 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType01AttachmentReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-08-24 12:31:16 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-24 12:31:16 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType01_Attachment(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
template = "C-PM-01-attachment",
|
2024-06-26 16:46:40 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-02 คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้ได้รับคัดเลือก "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-02 คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้ได้รับคัดเลือก
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-02/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-02 22:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType02CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-02 22:50:38 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType02_Cover(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-02",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-09-02 22:50:38 +07:00
|
|
|
|
|
|
|
|
|
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-3.trdp");
|
|
|
|
|
|
//var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
|
|
|
|
|
|
|
|
//return File(contentData, mimeType, $"command.{exportType.Trim().ToLower()}");
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-02 คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้ได้รับคัดเลือก
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-02/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-02 22:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType02AttachmentReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-09-02 22:50:38 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-02 22:50:38 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType02_Attachment(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
template = "C-PM-02-attachment",
|
2024-06-26 16:46:40 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-03 คำสั่งแต่งตั้ง : สำหรับข้าราชการ กทม. เดิม "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-03 คำสั่งแต่งตั้ง : สำหรับข้าราชการ กทม. เดิม
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-03/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 13:35:58 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType03CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType03_Cover(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-03",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-03 คำสั่งแต่งตั้ง : สำหรับข้าราชการ กทม. เดิม
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-03/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 13:35:58 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType03AttachmentReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType03_Attachment(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
template = "C-PM-03-attachment",
|
2024-06-26 16:46:40 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-04 คำสั่งย้าย : สำหรับข้าราชการ กทม. เดิม "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-04 คำสั่งย้าย : สำหรับข้าราชการ กทม. เดิม
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-04/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 13:35:58 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType04CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType04_Cover(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-04",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-04 คำสั่งย้าย : สำหรับข้าราชการ กทม. เดิม
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-04/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 13:35:58 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType04AttachmentReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType04_Attachment(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
template = "C-PM-04-attachment",
|
2024-06-26 16:46:40 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-07-09 17:03:54 +07:00
|
|
|
|
#region " C-PM-39 คำสั่งเลื่อน : สำหรับข้าราชการ กทม. เดิม "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-39 คำสั่งเลื่อน : สำหรับข้าราชการ กทม. เดิม
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-39/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType39CoverReportAsync(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType39_Cover(id, exportType);
|
|
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-39",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-39 คำสั่งเลื่อน : สำหรับข้าราชการ กทม. เดิม
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-39/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType39AttachmentReportAsync(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType39_Attachment(id, exportType);
|
|
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-39-attachment",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
#region " C-PM-05 คำสั่งแต่งตั้ง "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-05 คำสั่งแต่งตั้ง
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-05/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 13:35:58 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType05CoverReport(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType05_Cover(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-05",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-05 คำสั่งแต่งตั้ง
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-05/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 13:35:58 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType05AttachmentReport(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType05_Attachment(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
template = "C-PM-05-attachment",
|
2024-06-26 16:46:40 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-06 คำสั่งเลื่อน "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-06 คำสั่งเลื่อน
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-06/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 13:35:58 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType06CoverReport(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType06_Cover(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-06",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-06 คำสั่งเลื่อน
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-06/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 13:35:58 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType06AttachmentReport(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType06_Attachment(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
2024-06-26 17:16:32 +07:00
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
template = "C-PM-06-attachment",
|
2024-06-26 17:16:32 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-07 คำสั่งย้าย "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-07 คำสั่งย้าย
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-07/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 13:35:58 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType07CoverReport(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType07_Cover(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-07",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-07 คำสั่งย้าย
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-07/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 13:35:58 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType07AttachmentReport(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 13:35:58 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType07_Attachment(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
template = "C-PM-07-attachment",
|
2024-06-26 16:46:40 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-08 คำสั่งบรรจุและแต่งตั้งข้าราชการฯ กลับเข้ารับราชการ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-08 คำสั่งบรรจุและแต่งตั้งข้าราชการฯ กลับเข้ารับราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-08/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 20:54:12 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType08CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType08_Cover(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-08",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-08 คำสั่งบรรจุและแต่งตั้งข้าราชการฯ กลับเข้ารับราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-08/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 20:54:12 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType08AttachmentReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType08_Attachment(id, exportType);
|
2024-06-26 16:46:40 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
template = "C-PM-08-attachment",
|
2024-06-26 16:46:40 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-09 คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-09 คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-09/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 20:54:12 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType09CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType09_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-09",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-09 คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-09/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 20:54:12 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType09AttachmentReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType09_Attachment(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
template = "C-PM-09-attachment",
|
2024-06-26 09:56:34 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-10 คำสั่งแต่งตั้งคณะกรรมการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-10 คำสั่งแต่งตั้งคณะกรรมการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-10/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 20:54:12 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType10CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 20:54:12 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType10_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-10",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-11 คำสั่งให้ข้าราชการที่มีผลการทดลองปฏิบัติหน้าที่ราชการไม่ต่ำกว่ามาตรฐานที่กำหนดรับราชการต่อไป "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-11 คำสั่งให้ข้าราชการที่มีผลการทดลองปฏิบัติหน้าที่ราชการไม่ต่ำกว่ามาตรฐานที่กำหนดรับราชการต่อไป
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-11/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-04 09:17:18 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType11CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-04 09:17:18 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-04 09:17:18 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType11_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-11",
|
|
|
|
|
|
reportName = "docx-report",
|
2024-06-26 22:57:50 +07:00
|
|
|
|
data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
}
|
2024-06-26 09:56:34 +07:00
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-12 คำสั่งให้ข้าราชการออกจากราชการเพราะผลการทดลองปฏิบัติหน้าที่ราชการต่ำกว่ามาตรฐานที่กำหนด "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-12 คำสั่งให้ข้าราชการออกจากราชการเพราะผลการทดลองปฏิบัติหน้าที่ราชการต่ำกว่ามาตรฐานที่กำหนด
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-12/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-04 09:17:18 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType12CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-04 09:17:18 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-04 09:17:18 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType12_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-12",
|
|
|
|
|
|
reportName = "docx-report",
|
2024-06-26 22:57:50 +07:00
|
|
|
|
data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
}
|
2024-06-26 09:56:34 +07:00
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-13 คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-13 คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-13/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-04 11:37:37 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType13CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-04 11:37:37 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-04 11:37:37 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType13_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-13",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-13 คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-13/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-04 11:37:37 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType13AttachmentReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-09-04 11:37:37 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-04 11:37:37 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType13_Attachment(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
template = "C-PM-13-attachment",
|
2024-06-26 09:56:34 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-14 คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-14 คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-14/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-04 13:44:34 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType14CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-04 13:44:34 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-04 13:44:34 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType14_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-14",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-14 คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-14/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-04 13:44:34 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType14AttachmentReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-09-04 13:44:34 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-04 13:44:34 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType14_Attachment(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
template = "C-PM-14-attachment",
|
2024-06-26 09:56:34 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-15 คำสั่งให้ช่วยราชการ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-15 คำสั่งให้ช่วยราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-15/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 18:14:07 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType15CoverReport(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType15_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-15",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-15 คำสั่งให้ช่วยราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-15/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 18:14:07 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType15AttachmentReport(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2023-08-24 12:14:01 +07:00
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType15_Attachment(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-27 18:02:07 +07:00
|
|
|
|
template = "C-PM-15-attachment",
|
2024-06-26 09:56:34 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-16 คำสั่งส่งตัวกลับ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-16 คำสั่งส่งตัวกลับ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-16/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 18:14:07 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType16CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType16_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-16",
|
|
|
|
|
|
reportName = "docx-report",
|
2024-06-26 22:57:50 +07:00
|
|
|
|
data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
}
|
2024-06-26 09:56:34 +07:00
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-17 คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-17 คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-17/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 18:14:07 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType17CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType17_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-17",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-17 คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-17/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 18:14:07 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType17AttachmentReportAsync(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType17_Attachment(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
template = "C-PM-17-attachment",
|
2024-06-26 09:56:34 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-18 คำสั่งให้ออกจากราชการ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-18 คำสั่งให้ออกจากราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-18/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-03 18:14:07 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType18CoverReport(Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType18_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-18",
|
|
|
|
|
|
reportName = "docx-report",
|
2024-06-26 22:57:50 +07:00
|
|
|
|
data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
}
|
2024-06-26 09:56:34 +07:00
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-19 คำสั่งปลดออกจากราชการ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-19 คำสั่งปลดออกจากราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-19/cover/{exportType}/{id}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2024-06-19 14:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType19CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var token = string.Empty;
|
|
|
|
|
|
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
var scheme = headerValue.Scheme;
|
|
|
|
|
|
token = headerValue.Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
var contentData = await GenerateCommandReportType19_Cover(id, exportType, token);
|
2024-01-09 12:45:17 +07:00
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "DP6_005",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
|
|
|
|
// using (var client = new HttpClient())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
|
|
|
|
|
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
|
|
|
|
|
// // var res = await client.SendAsync(req);
|
|
|
|
|
|
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
|
|
|
|
|
// var result = await res.Content.ReadAsStringAsync();
|
|
|
|
|
|
// return Success(res);
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-20 คำสั่งไล่ออกจากราชการ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-20 คำสั่งไล่ออกจากราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-20/cover/{exportType}/{id}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2024-06-19 14:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType20CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
|
2023-08-24 12:14:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 18:14:07 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var token = string.Empty;
|
|
|
|
|
|
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
var scheme = headerValue.Scheme;
|
|
|
|
|
|
token = headerValue.Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
var contentData = await GenerateCommandReportType20_Cover(id, exportType, token);
|
2024-01-09 12:45:17 +07:00
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "DP6_008",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
|
|
|
|
// using (var client = new HttpClient())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
|
|
|
|
|
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
|
|
|
|
|
// // var res = await client.SendAsync(req);
|
|
|
|
|
|
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
|
|
|
|
|
// var result = await res.Content.ReadAsStringAsync();
|
|
|
|
|
|
// return Success(res);
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
return Success(data);
|
2023-08-24 12:14:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-09-04 09:17:18 +07:00
|
|
|
|
#region " C-PM-21 คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-21 คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-21/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-09-05 12:02:25 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType21CoverReportAsync(Guid id, string exportType = "pdf")
|
2023-09-04 09:17:18 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-05 12:02:25 +07:00
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
2023-09-04 09:17:18 +07:00
|
|
|
|
|
2023-09-05 12:02:25 +07:00
|
|
|
|
var contentData = await GenerateCommandReportType21_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-21",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-09-04 09:17:18 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-10-30 20:36:53 +07:00
|
|
|
|
#region " C-PM-22 คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) "
|
2023-10-11 14:07:01 +07:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-10-30 20:36:53 +07:00
|
|
|
|
/// คำสั่ง C-PM-22 คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)
|
2023-10-11 14:07:01 +07:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-22/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2023-10-30 20:36:53 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType22CoverReport(Guid id, string exportType = "pdf")
|
2023-10-11 14:07:01 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType22_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-22",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-10-11 14:07:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-30 20:36:53 +07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-22 คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-22/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType22AttachmentReport(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType22_Attachment(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
template = "C-PM-22-attachment",
|
2024-06-26 09:56:34 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-10-30 20:36:53 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-11 14:07:01 +07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-23 คำสั่งให้ลูกจ้างออกจากราชการ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-23 คำสั่งให้ลูกจ้างออกจากราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-23/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType23CoverReportAsync(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType23_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-23",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-10-11 14:07:01 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-10-30 20:36:53 +07:00
|
|
|
|
#region " C-PM-24 คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-24 คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-24/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType24CoverReport(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType24_Cover(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-24",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-10-30 20:36:53 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-24 คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-24/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType24AttachmentReport(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType24_Attachment(id, exportType);
|
2024-06-26 09:56:34 +07:00
|
|
|
|
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
2024-06-28 17:15:07 +07:00
|
|
|
|
template = "C-PM-24-attachment",
|
2024-06-26 09:56:34 +07:00
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
2023-10-30 20:36:53 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-12-23 13:48:56 +07:00
|
|
|
|
#region " C-PM-25 คำสั่งพักจากราชการxxxx "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-25 คำสั่งพักจากราชการ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-25/cover/{exportType}/{id}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2024-06-19 14:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType25CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
|
2023-12-23 13:48:56 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var token = string.Empty;
|
|
|
|
|
|
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
var scheme = headerValue.Scheme;
|
|
|
|
|
|
token = headerValue.Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "DP6_006",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
|
|
|
|
// using (var client = new HttpClient())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
|
|
|
|
|
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
|
|
|
|
|
// // var res = await client.SendAsync(req);
|
|
|
|
|
|
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
|
|
|
|
|
// var result = await res.Content.ReadAsStringAsync();
|
|
|
|
|
|
// return Success(res);
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
2024-01-06 03:00:04 +07:00
|
|
|
|
return Success(data);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2023-12-23 13:48:56 +07:00
|
|
|
|
#region " C-PM-26 คำสั่งให้ออกจากราชการไว้ก่อนxxxx "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-26 คำสั่งให้ออกจากราชการไว้ก่อน
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-26/cover/{exportType}/{id}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2024-06-19 14:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType26CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
|
2023-12-23 13:48:56 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var token = string.Empty;
|
|
|
|
|
|
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
var scheme = headerValue.Scheme;
|
|
|
|
|
|
token = headerValue.Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "DP6_006",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
|
|
|
|
// using (var client = new HttpClient())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
|
|
|
|
|
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
|
|
|
|
|
// // var res = await client.SendAsync(req);
|
|
|
|
|
|
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
|
|
|
|
|
// var result = await res.Content.ReadAsStringAsync();
|
|
|
|
|
|
// return Success(res);
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
2024-01-06 03:00:04 +07:00
|
|
|
|
return Success(data);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2023-12-23 13:48:56 +07:00
|
|
|
|
#region " C-PM-27 คำสั่งลงโทษ ภาคทัณฑ์ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-27 คำสั่งลงโทษ ภาคทัณฑ์
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-27/cover/{exportType}/{id}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2024-06-19 14:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType27CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
|
2023-12-23 13:48:56 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var token = string.Empty;
|
|
|
|
|
|
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
var scheme = headerValue.Scheme;
|
|
|
|
|
|
token = headerValue.Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "DP6_006",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
|
|
|
|
// using (var client = new HttpClient())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
|
|
|
|
|
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
|
|
|
|
|
// // var res = await client.SendAsync(req);
|
|
|
|
|
|
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
|
|
|
|
|
// var result = await res.Content.ReadAsStringAsync();
|
|
|
|
|
|
// return Success(res);
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
2024-01-06 03:00:04 +07:00
|
|
|
|
return Success(data);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2023-12-23 13:48:56 +07:00
|
|
|
|
#region " C-PM-28 คำสั่งลงโทษ ตัดเงินเดือน "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-28 คำสั่งลงโทษ ตัดเงินเดือน
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-28/cover/{exportType}/{id}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2024-06-19 14:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType28CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
|
2023-12-23 13:48:56 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var token = string.Empty;
|
|
|
|
|
|
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
var scheme = headerValue.Scheme;
|
|
|
|
|
|
token = headerValue.Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "DP6_004",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
|
|
|
|
// using (var client = new HttpClient())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
|
|
|
|
|
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
|
|
|
|
|
// // var res = await client.SendAsync(req);
|
|
|
|
|
|
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
|
|
|
|
|
// var result = await res.Content.ReadAsStringAsync();
|
|
|
|
|
|
// return Success(res);
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
2024-01-06 03:00:04 +07:00
|
|
|
|
return Success(data);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2023-12-23 13:48:56 +07:00
|
|
|
|
#region " C-PM-29 คำสั่งลงโทษ ลดขั้นเงินเดือน "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-29 คำสั่งลงโทษ ลดขั้นเงินเดือน
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-29/cover/{exportType}/{id}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2024-06-19 14:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType29CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
|
2023-12-23 13:48:56 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var token = string.Empty;
|
|
|
|
|
|
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
var scheme = headerValue.Scheme;
|
|
|
|
|
|
token = headerValue.Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "DP6_007",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
|
|
|
|
// using (var client = new HttpClient())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
|
|
|
|
|
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
|
|
|
|
|
// // var res = await client.SendAsync(req);
|
|
|
|
|
|
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
|
|
|
|
|
// var result = await res.Content.ReadAsStringAsync();
|
|
|
|
|
|
// return Success(res);
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
2024-01-06 03:00:04 +07:00
|
|
|
|
return Success(data);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2023-12-23 13:48:56 +07:00
|
|
|
|
#region " C-PM-30 คำสั่งเพิ่มโทษ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-30 คำสั่งเพิ่มโทษ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-30/cover/{exportType}/{id}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2024-06-19 14:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType30CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
|
2023-12-23 13:48:56 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var token = string.Empty;
|
|
|
|
|
|
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
var scheme = headerValue.Scheme;
|
|
|
|
|
|
token = headerValue.Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "DP6_002",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
|
|
|
|
// using (var client = new HttpClient())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
|
|
|
|
|
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
|
|
|
|
|
// // var res = await client.SendAsync(req);
|
|
|
|
|
|
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
|
|
|
|
|
// var result = await res.Content.ReadAsStringAsync();
|
|
|
|
|
|
// return Success(res);
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
2024-01-06 03:00:04 +07:00
|
|
|
|
return Success(data);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2023-12-23 13:48:56 +07:00
|
|
|
|
#region " C-PM-31 คำสั่งงดโทษ "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-31 คำสั่งงดโทษ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-31/cover/{exportType}/{id}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2024-06-19 14:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType31CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
|
2023-12-23 13:48:56 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var token = string.Empty;
|
|
|
|
|
|
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
var scheme = headerValue.Scheme;
|
|
|
|
|
|
token = headerValue.Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "DP6_001",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
|
|
|
|
// using (var client = new HttpClient())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
|
|
|
|
|
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
|
|
|
|
|
// // var res = await client.SendAsync(req);
|
|
|
|
|
|
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
|
|
|
|
|
// var result = await res.Content.ReadAsStringAsync();
|
|
|
|
|
|
// return Success(res);
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
2024-01-06 03:00:04 +07:00
|
|
|
|
return Success(data);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2023-12-23 13:48:56 +07:00
|
|
|
|
#region " C-PM-32 คำสั่งยุติเรื่อง "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-32 คำสั่งยุติเรื่อง
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-32/cover/{exportType}/{id}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
2024-06-19 14:50:38 +07:00
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType32CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
|
2023-12-23 13:48:56 +07:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
2024-06-19 14:50:38 +07:00
|
|
|
|
var token = string.Empty;
|
|
|
|
|
|
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
var scheme = headerValue.Scheme;
|
|
|
|
|
|
token = headerValue.Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "DP6_003",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
|
|
|
|
|
// using (var client = new HttpClient())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
|
|
|
|
|
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
|
|
|
|
|
// // var res = await client.SendAsync(req);
|
|
|
|
|
|
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
|
|
|
|
|
// var result = await res.Content.ReadAsStringAsync();
|
|
|
|
|
|
// return Success(res);
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
2024-01-06 03:00:04 +07:00
|
|
|
|
return Success(data);
|
2023-12-23 13:48:56 +07:00
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2024-04-26 10:18:59 +07:00
|
|
|
|
#region " C-PM-33 คำสั่งยุติเรื่อง "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-33 คำสั่งยุติเรื่อง
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-33/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType33CoverReport(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = cmd.SalaryPeriod == "APR" ? "gov1-07" : "gov2-08",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2024-04-26 10:18:59 +07:00
|
|
|
|
#region " C-PM-34 คำสั่งยุติเรื่อง "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-34 คำสั่งยุติเรื่อง
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-34/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType34CoverReport(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = cmd.SalaryPeriod == "APR" ? "gov1-08" : "gov2-09",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2024-04-26 10:18:59 +07:00
|
|
|
|
#region " C-PM-35 คำสั่งยุติเรื่อง "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-35 คำสั่งยุติเรื่อง
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-35/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType35CoverReport(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "gov2-07",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2024-04-26 10:18:59 +07:00
|
|
|
|
#region " C-PM-36 คำสั่งยุติเรื่อง "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-36 คำสั่งยุติเรื่อง
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-36/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType36CoverReport(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = cmd.SalaryPeriod == "APR" ? "emp1-11" : "emp2-12",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2024-04-26 10:18:59 +07:00
|
|
|
|
#region " C-PM-37 คำสั่งยุติเรื่อง "
|
2023-12-23 13:48:56 +07:00
|
|
|
|
|
2024-04-26 10:18:59 +07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-37 คำสั่งยุติเรื่อง
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-37/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType37CoverReport(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = cmd.SalaryPeriod == "APR" ? "emp1-14" : "emp2-16",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2024-06-26 22:57:50 +07:00
|
|
|
|
|
2024-06-28 17:38:58 +07:00
|
|
|
|
#region " C-PM-38 คำสั่งปรับโครงสร้าง "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-38 คำสั่งปรับโครงสร้าง
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-38/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType38CoverReport(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-38",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-07-18 20:37:17 +07:00
|
|
|
|
#region " C-PM-40 คำสั่งปรับโครงสร้าง "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-40 คำสั่งปรับโครงสร้าง
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-40/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType40CoverReport(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-40",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-40 คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-40/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType40AttachmentReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var token = string.Empty;
|
|
|
|
|
|
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
|
|
|
|
|
{
|
|
|
|
|
|
var scheme = headerValue.Scheme;
|
|
|
|
|
|
token = headerValue.Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
var contentData = await GenerateCommandReportType40_Attachment(id, exportType, token);
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-40-attachment",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " C-PM-41 คำสั่งยกเลิกการลาออก "
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// คำสั่ง C-PM-41 คำสั่งยกเลิกการลาออก
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-41/cover/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType41CoverReportAsync(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType41_Cover(id, exportType);
|
|
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-41",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เอกสารแนบท้าย C-PM-41 คำสั่งยกเลิกการลาออก
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">Record Id ของคำสั่ง</param>
|
|
|
|
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("c-pm-41/attachment/{exportType}/{id}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetCommandType41AttachmentReportAsync(Guid id, string exportType = "pdf")
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var mimeType = "";
|
|
|
|
|
|
switch (exportType.Trim().ToLower())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
|
|
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
|
|
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var cmd = await _repository.GetByIdAsync(id);
|
|
|
|
|
|
if (cmd == null)
|
|
|
|
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
|
|
|
|
|
|
|
|
|
|
var contentData = await GenerateCommandReportType41_Attachment(id, exportType);
|
|
|
|
|
|
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
|
|
|
|
|
var data = new
|
|
|
|
|
|
{
|
|
|
|
|
|
template = "C-PM-41-attachment",
|
|
|
|
|
|
reportName = "docx-report",
|
|
|
|
|
|
data = contentData
|
|
|
|
|
|
};
|
|
|
|
|
|
return Success(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2023-08-20 12:00:14 +07:00
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|