commit
896fd63a2d
@ -0,0 +1,400 @@ |
||||
## Ignore Visual Studio temporary files, build results, and |
||||
## files generated by popular Visual Studio add-ons. |
||||
## |
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore |
||||
|
||||
# User-specific files |
||||
*.rsuser |
||||
*.suo |
||||
*.user |
||||
*.userosscache |
||||
*.sln.docstates |
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio) |
||||
*.userprefs |
||||
|
||||
# Mono auto generated files |
||||
mono_crash.* |
||||
|
||||
# Build results |
||||
[Dd]ebug/ |
||||
[Dd]ebugPublic/ |
||||
[Rr]elease/ |
||||
[Rr]eleases/ |
||||
x64/ |
||||
x86/ |
||||
[Ww][Ii][Nn]32/ |
||||
[Aa][Rr][Mm]/ |
||||
[Aa][Rr][Mm]64/ |
||||
bld/ |
||||
bin/* |
||||
Bin/* |
||||
obj/* |
||||
Obj/* |
||||
[Ll]og/ |
||||
[Ll]ogs/ |
||||
|
||||
# Visual Studio 2015/2017 cache/options directory |
||||
.vs/ |
||||
# Uncomment if you have tasks that create the project's static files in wwwroot |
||||
#wwwroot/ |
||||
|
||||
# Visual Studio 2017 auto generated files |
||||
Generated\ Files/ |
||||
|
||||
# MSTest test Results |
||||
[Tt]est[Rr]esult*/ |
||||
[Bb]uild[Ll]og.* |
||||
|
||||
# NUnit |
||||
*.VisualState.xml |
||||
TestResult.xml |
||||
nunit-*.xml |
||||
|
||||
# Build Results of an ATL Project |
||||
[Dd]ebugPS/ |
||||
[Rr]eleasePS/ |
||||
dlldata.c |
||||
|
||||
# Benchmark Results |
||||
BenchmarkDotNet.Artifacts/ |
||||
|
||||
# .NET Core |
||||
project.lock.json |
||||
project.fragment.lock.json |
||||
artifacts/ |
||||
|
||||
# ASP.NET Scaffolding |
||||
ScaffoldingReadMe.txt |
||||
|
||||
# StyleCop |
||||
StyleCopReport.xml |
||||
|
||||
# Files built by Visual Studio |
||||
*_i.c |
||||
*_p.c |
||||
*_h.h |
||||
*.ilk |
||||
*.meta |
||||
*.obj |
||||
*.iobj |
||||
*.pch |
||||
*.pdb |
||||
*.ipdb |
||||
*.pgc |
||||
*.pgd |
||||
*.rsp |
||||
*.sbr |
||||
*.tlb |
||||
*.tli |
||||
*.tlh |
||||
*.tmp |
||||
*.tmp_proj |
||||
*_wpftmp.csproj |
||||
*.log |
||||
*.tlog |
||||
*.vspscc |
||||
*.vssscc |
||||
.builds |
||||
*.pidb |
||||
*.svclog |
||||
*.scc |
||||
|
||||
# Chutzpah Test files |
||||
_Chutzpah* |
||||
|
||||
# Visual C++ cache files |
||||
ipch/ |
||||
*.aps |
||||
*.ncb |
||||
*.opendb |
||||
*.opensdf |
||||
*.sdf |
||||
*.cachefile |
||||
*.VC.db |
||||
*.VC.VC.opendb |
||||
|
||||
# Visual Studio profiler |
||||
*.psess |
||||
*.vsp |
||||
*.vspx |
||||
*.sap |
||||
|
||||
# Visual Studio Trace Files |
||||
*.e2e |
||||
|
||||
# TFS 2012 Local Workspace |
||||
$tf/ |
||||
|
||||
# Guidance Automation Toolkit |
||||
*.gpState |
||||
|
||||
# ReSharper is a .NET coding add-in |
||||
_ReSharper*/ |
||||
*.[Rr]e[Ss]harper |
||||
*.DotSettings.user |
||||
|
||||
# TeamCity is a build add-in |
||||
_TeamCity* |
||||
|
||||
# DotCover is a Code Coverage Tool |
||||
*.dotCover |
||||
|
||||
# AxoCover is a Code Coverage Tool |
||||
.axoCover/* |
||||
!.axoCover/settings.json |
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool |
||||
coverage*.json |
||||
coverage*.xml |
||||
coverage*.info |
||||
|
||||
# Visual Studio code coverage results |
||||
*.coverage |
||||
*.coveragexml |
||||
|
||||
# NCrunch |
||||
_NCrunch_* |
||||
.*crunch*.local.xml |
||||
nCrunchTemp_* |
||||
|
||||
# MightyMoose |
||||
*.mm.* |
||||
AutoTest.Net/ |
||||
|
||||
# Web workbench (sass) |
||||
.sass-cache/ |
||||
|
||||
# Installshield output folder |
||||
[Ee]xpress/ |
||||
|
||||
# DocProject is a documentation generator add-in |
||||
DocProject/buildhelp/ |
||||
DocProject/Help/*.HxT |
||||
DocProject/Help/*.HxC |
||||
DocProject/Help/*.hhc |
||||
DocProject/Help/*.hhk |
||||
DocProject/Help/*.hhp |
||||
DocProject/Help/Html2 |
||||
DocProject/Help/html |
||||
|
||||
# Click-Once directory |
||||
publish/ |
||||
|
||||
# Publish Web Output |
||||
*.[Pp]ublish.xml |
||||
*.azurePubxml |
||||
# Note: Comment the next line if you want to checkin your web deploy settings, |
||||
# but database connection strings (with potential passwords) will be unencrypted |
||||
*.pubxml |
||||
*.publishproj |
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to |
||||
# checkin your Azure Web App publish settings, but sensitive information contained |
||||
# in these scripts will be unencrypted |
||||
PublishScripts/ |
||||
|
||||
# NuGet Packages |
||||
*.nupkg |
||||
# NuGet Symbol Packages |
||||
*.snupkg |
||||
# The packages folder can be ignored because of Package Restore |
||||
**/[Pp]ackages/* |
||||
# except build/, which is used as an MSBuild target. |
||||
!**/[Pp]ackages/build/ |
||||
# Uncomment if necessary however generally it will be regenerated when needed |
||||
#!**/[Pp]ackages/repositories.config |
||||
# NuGet v3's project.json files produces more ignorable files |
||||
*.nuget.props |
||||
*.nuget.targets |
||||
|
||||
# Microsoft Azure Build Output |
||||
csx/ |
||||
*.build.csdef |
||||
|
||||
# Microsoft Azure Emulator |
||||
ecf/ |
||||
rcf/ |
||||
|
||||
# Windows Store app package directories and files |
||||
AppPackages/ |
||||
BundleArtifacts/ |
||||
Package.StoreAssociation.xml |
||||
_pkginfo.txt |
||||
*.appx |
||||
*.appxbundle |
||||
*.appxupload |
||||
|
||||
# Visual Studio cache files |
||||
# files ending in .cache can be ignored |
||||
*.[Cc]ache |
||||
# but keep track of directories ending in .cache |
||||
!?*.[Cc]ache/ |
||||
|
||||
# Others |
||||
ClientBin/ |
||||
~$* |
||||
*~ |
||||
*.dbmdl |
||||
*.dbproj.schemaview |
||||
*.jfm |
||||
*.pfx |
||||
*.publishsettings |
||||
orleans.codegen.cs |
||||
|
||||
# Including strong name files can present a security risk |
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424) |
||||
#*.snk |
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components |
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) |
||||
#bower_components/ |
||||
|
||||
# RIA/Silverlight projects |
||||
Generated_Code/ |
||||
|
||||
# Backup & report files from converting an old project file |
||||
# to a newer Visual Studio version. Backup files are not needed, |
||||
# because we have git ;-) |
||||
_UpgradeReport_Files/ |
||||
Backup*/ |
||||
UpgradeLog*.XML |
||||
UpgradeLog*.htm |
||||
ServiceFabricBackup/ |
||||
*.rptproj.bak |
||||
|
||||
# SQL Server files |
||||
*.mdf |
||||
*.ldf |
||||
*.ndf |
||||
|
||||
# Business Intelligence projects |
||||
*.rdl.data |
||||
*.bim.layout |
||||
*.bim_*.settings |
||||
*.rptproj.rsuser |
||||
*- [Bb]ackup.rdl |
||||
*- [Bb]ackup ([0-9]).rdl |
||||
*- [Bb]ackup ([0-9][0-9]).rdl |
||||
|
||||
# Microsoft Fakes |
||||
FakesAssemblies/ |
||||
|
||||
# GhostDoc plugin setting file |
||||
*.GhostDoc.xml |
||||
|
||||
# Node.js Tools for Visual Studio |
||||
.ntvs_analysis.dat |
||||
node_modules/ |
||||
|
||||
# Visual Studio 6 build log |
||||
*.plg |
||||
|
||||
# Visual Studio 6 workspace options file |
||||
*.opt |
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) |
||||
*.vbw |
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.) |
||||
*.vbp |
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project) |
||||
*.dsw |
||||
*.dsp |
||||
|
||||
# Visual Studio 6 technical files |
||||
*.ncb |
||||
*.aps |
||||
|
||||
# Visual Studio LightSwitch build output |
||||
**/*.HTMLClient/GeneratedArtifacts |
||||
**/*.DesktopClient/GeneratedArtifacts |
||||
**/*.DesktopClient/ModelManifest.xml |
||||
**/*.Server/GeneratedArtifacts |
||||
**/*.Server/ModelManifest.xml |
||||
_Pvt_Extensions |
||||
|
||||
# Paket dependency manager |
||||
.paket/paket.exe |
||||
paket-files/ |
||||
|
||||
# FAKE - F# Make |
||||
.fake/ |
||||
|
||||
# CodeRush personal settings |
||||
.cr/personal |
||||
|
||||
# Python Tools for Visual Studio (PTVS) |
||||
__pycache__/ |
||||
*.pyc |
||||
|
||||
# Cake - Uncomment if you are using it |
||||
# tools/** |
||||
# !tools/packages.config |
||||
|
||||
# Tabs Studio |
||||
*.tss |
||||
|
||||
# Telerik's JustMock configuration file |
||||
*.jmconfig |
||||
|
||||
# BizTalk build output |
||||
*.btp.cs |
||||
*.btm.cs |
||||
*.odx.cs |
||||
*.xsd.cs |
||||
|
||||
# OpenCover UI analysis results |
||||
OpenCover/ |
||||
|
||||
# Azure Stream Analytics local run output |
||||
ASALocalRun/ |
||||
|
||||
# MSBuild Binary and Structured Log |
||||
*.binlog |
||||
|
||||
# NVidia Nsight GPU debugger configuration file |
||||
*.nvuser |
||||
|
||||
# MFractors (Xamarin productivity tool) working folder |
||||
.mfractor/ |
||||
|
||||
# Local History for Visual Studio |
||||
.localhistory/ |
||||
|
||||
# Visual Studio History (VSHistory) files |
||||
.vshistory/ |
||||
|
||||
# BeatPulse healthcheck temp database |
||||
healthchecksdb |
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017 |
||||
MigrationBackup/ |
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder |
||||
.ionide/ |
||||
|
||||
# Fody - auto-generated XML schema |
||||
FodyWeavers.xsd |
||||
|
||||
# VS Code files for those working on multiple tools |
||||
.vscode/* |
||||
!.vscode/settings.json |
||||
!.vscode/tasks.json |
||||
!.vscode/launch.json |
||||
!.vscode/extensions.json |
||||
*.code-workspace |
||||
|
||||
# Local History for Visual Studio Code |
||||
.history/ |
||||
|
||||
# Windows Installer files from build outputs |
||||
*.cab |
||||
*.msi |
||||
*.msix |
||||
*.msm |
||||
*.msp |
||||
|
||||
# JetBrains Rider |
||||
*.sln.iml |
@ -0,0 +1,36 @@ |
||||
{ |
||||
"version": "0.2.0", |
||||
"configurations": [ |
||||
{ |
||||
// Use IntelliSense to find out which attributes exist for C# debugging |
||||
// Use hover for the description of the existing attributes |
||||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md |
||||
"name": ".NET Core Launch (web)", |
||||
"type": "coreclr", |
||||
"request": "launch", |
||||
"preLaunchTask": "build", |
||||
// If you have changed target frameworks, make sure to update the program path. |
||||
"program": "${workspaceFolder}/bin/Debug/net6.0/AOLBackend.dll", |
||||
"args": [], |
||||
"cwd": "${workspaceFolder}", |
||||
"stopAtEntry": false, |
||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser |
||||
"serverReadyAction": { |
||||
"action": "openExternally", |
||||
"pattern": "\\bNow listening on:\\s+https?://\\S+", |
||||
"uriFormat": "https://localhost:5050/swagger/index.html" |
||||
}, |
||||
"env": { |
||||
"ASPNETCORE_ENVIRONMENT": "Development" |
||||
}, |
||||
"sourceFileMap": { |
||||
"/Views": "${workspaceFolder}/Views" |
||||
} |
||||
}, |
||||
{ |
||||
"name": ".NET Core Attach", |
||||
"type": "coreclr", |
||||
"request": "attach" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,41 @@ |
||||
{ |
||||
"version": "2.0.0", |
||||
"tasks": [ |
||||
{ |
||||
"label": "build", |
||||
"command": "dotnet", |
||||
"type": "process", |
||||
"args": [ |
||||
"build", |
||||
"${workspaceFolder}/AOLBackend.csproj", |
||||
"/property:GenerateFullPaths=true", |
||||
"/consoleloggerparameters:NoSummary" |
||||
], |
||||
"problemMatcher": "$msCompile" |
||||
}, |
||||
{ |
||||
"label": "publish", |
||||
"command": "dotnet", |
||||
"type": "process", |
||||
"args": [ |
||||
"publish", |
||||
"${workspaceFolder}/AOLBackend.csproj", |
||||
"/property:GenerateFullPaths=true", |
||||
"/consoleloggerparameters:NoSummary" |
||||
], |
||||
"problemMatcher": "$msCompile" |
||||
}, |
||||
{ |
||||
"label": "watch", |
||||
"command": "dotnet", |
||||
"type": "process", |
||||
"args": [ |
||||
"watch", |
||||
"run", |
||||
"--project", |
||||
"${workspaceFolder}/AOLBackend.csproj" |
||||
], |
||||
"problemMatcher": "$msCompile" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,22 @@ |
||||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
||||
|
||||
<PropertyGroup> |
||||
<TargetFramework>net6.0</TargetFramework> |
||||
<Nullable>enable</Nullable> |
||||
<ImplicitUsings>enable</ImplicitUsings> |
||||
</PropertyGroup> |
||||
|
||||
<ItemGroup> |
||||
<PackageReference Include="Dapper" Version="2.0.123" /> |
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.8" /> |
||||
<!-- <PackageReference Include="Microsoft.Exchange.WebServices" Version="2.2.0" /> --> |
||||
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="6.22.0" /> |
||||
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.22.0" /> |
||||
<PackageReference Include="MySql.Data" Version="8.0.32.1" /> |
||||
<PackageReference Include="MySqlConnector" Version="2.2.5" /> |
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> |
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" /> |
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.22.0" /> |
||||
</ItemGroup> |
||||
|
||||
</Project> |
@ -0,0 +1,11 @@ |
||||
using AOLBackend.Models.Catalogos; |
||||
|
||||
namespace AOLBackend.Contracts.Catalogos |
||||
{ |
||||
public interface ICatClientesRepository |
||||
{ |
||||
public Task<ICatClientes> Append(ICatClientes data); |
||||
public Task<IEnumerable<ICatClientes>> GetAll(); |
||||
public Task<Boolean> Delete(int id); |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
using AOLBackend.Models.Catalogos; |
||||
|
||||
namespace AOLBackend.Contracts.Catalogos |
||||
{ |
||||
public interface ICatProveedoresRepository |
||||
{ |
||||
public Task<ICatProveedores> Append(ICatProveedores data); |
||||
public Task<IEnumerable<ICatProveedores>> GetAll(); |
||||
public Task<Boolean> Delete(int id); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
using AOLBackend.Models.Catalogos; |
||||
using AOLBackend.DTO.Catalogos; |
||||
|
||||
namespace AOLBackend.Contracts.Catalogos |
||||
{ |
||||
public interface ICatRutasRepository |
||||
{ |
||||
public Task<ICatRutas> Append(ICatRutas data); |
||||
public Task<IEnumerable<DTOCatRutas>> GetAll(); |
||||
public Task<Boolean> Delete(int id); |
||||
} |
||||
} |
@ -0,0 +1,11 @@ |
||||
using AOLBackend.Models.Catalogos; |
||||
|
||||
namespace AOLBackend.Contracts.Catalogos |
||||
{ |
||||
public interface ICatServiciosRepository |
||||
{ |
||||
public Task<ICatServicios> Append(ICatServicios data); |
||||
public Task<IEnumerable<ICatServicios>> GetAll(); |
||||
public Task<Boolean> Delete(int id); |
||||
} |
||||
} |
@ -0,0 +1,11 @@ |
||||
using AOLBackend.Models.Catalogos; |
||||
|
||||
namespace AOLBackend.Contracts.Catalogos |
||||
{ |
||||
public interface ICatTipoUnidadRepository |
||||
{ |
||||
public Task<ICatTipoUnidad> Append(ICatTipoUnidad data); |
||||
public Task<IEnumerable<ICatTipoUnidad>> GetAll(); |
||||
public Task<Boolean> Delete(int id); |
||||
} |
||||
} |
@ -0,0 +1,11 @@ |
||||
using AOLBackend.Models.Catalogos; |
||||
|
||||
namespace AOLBackend.Contracts.Catalogos |
||||
{ |
||||
public interface ICatUbicacionesRepository |
||||
{ |
||||
public Task<ICatUbicaciones> Append(ICatUbicaciones data); |
||||
public Task<IEnumerable<ICatUbicaciones>> GetAll(); |
||||
public Task<Boolean> Delete(int id); |
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
using AOLBackend.DTO.Operaciones; |
||||
|
||||
namespace AOLBackend.Contracts.Operaciones |
||||
{ |
||||
public interface IOpViajesRepository |
||||
{ |
||||
public Task<DTOOpViajes> Append(DTOOpViajes data); |
||||
public Task<IEnumerable<DTOOpViajesServicios>> AppendServicio(DTOOpViajesServicios data); |
||||
public Task<IEnumerable<DTOOpViajes>> GetAll(); |
||||
public Task<IEnumerable<DTOOpViajesServicios>> GetAllServices(int Status); |
||||
public Task<DTOUltimaCaja> GetLastTrailerBox(int idViaje); |
||||
public Task<IEnumerable<DTOOpViajesEstatusSecuencia>> GetStatusSecuence(); |
||||
public Task<DTOResultTripStatus> ChangeTripStatus(DTOChangeTripStatus data); |
||||
public Task<Boolean> Delete(int id); |
||||
public Task<Boolean> DeleteService(int id); |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
using AOLBackend.Models.Utils; |
||||
namespace AOLBackend.Contracts.Utils |
||||
{ |
||||
public interface IFileManagerRepository |
||||
{ |
||||
public Task<FileManager> FileManager(FileManager data); |
||||
public Task<FileManager> getFileByProcess(long id, int Proceso); |
||||
public Task<List<FileManager>> getAllFilesByProcess(long Tags, int Proceso); |
||||
public Task<FileManager> getFileById(long id); |
||||
public Task<Boolean> deleteFileByProcess(long id, int Proceso); |
||||
} |
||||
} |
@ -0,0 +1,9 @@ |
||||
using AOLBackend.Models.Utils; |
||||
|
||||
namespace AOLBackend.Contracts.Utils |
||||
{ |
||||
public interface IFilePaths4ProcessRepository |
||||
{ |
||||
public Task<FilePaths4Process> getPaths4ProcessById(long id); |
||||
} |
||||
} |
@ -0,0 +1,44 @@ |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using Microsoft.AspNetCore.Mvc; |
||||
using Microsoft.AspNetCore.Authorization; |
||||
|
||||
namespace AOLBackend.Controllers.Catalogos |
||||
{ |
||||
[Authorize] |
||||
[ApiController] |
||||
[Route("api/Catalogos/[controller]")]
|
||||
public class CatClientesController : ControllerBase |
||||
{ |
||||
private readonly ICatClientesRepository _Repo; |
||||
|
||||
public CatClientesController(ICatClientesRepository Repo) |
||||
{ |
||||
_Repo = Repo; |
||||
} |
||||
|
||||
[HttpPost] |
||||
[Route("Append")] |
||||
public async Task<ICatClientes> Append([FromBody] ICatClientes data) |
||||
{ |
||||
var entrada = await _Repo.Append(data); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("Get")] |
||||
public async Task<IEnumerable<ICatClientes>> GetAll() |
||||
{ |
||||
var entrada = await _Repo.GetAll(); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpDelete("Delete/{id}")] |
||||
public async Task<IActionResult> Delete(int id) |
||||
{ |
||||
await _Repo.Delete(id); |
||||
return new OkObjectResult(new { respuesta = "Se elimino el registro" }); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,43 @@ |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using Microsoft.AspNetCore.Mvc; |
||||
using Microsoft.AspNetCore.Authorization; |
||||
|
||||
namespace AOLBackend.Controllers.Catalogos |
||||
{ |
||||
/*[Authorize]*/ |
||||
[ApiController] |
||||
[Route("api/Catalogos/[controller]")]
|
||||
public class CatProveedoresController : ControllerBase |
||||
{ |
||||
private readonly ICatProveedoresRepository _Repo; |
||||
|
||||
public CatProveedoresController(ICatProveedoresRepository Repo) |
||||
{ |
||||
_Repo = Repo; |
||||
} |
||||
|
||||
[HttpPost] |
||||
[Route("Append")] |
||||
public async Task<ICatProveedores> Append([FromBody] ICatProveedores data) |
||||
{ |
||||
var entrada = await _Repo.Append(data); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("Get")] |
||||
public async Task<IEnumerable<ICatProveedores>> GetAll() |
||||
{ |
||||
var entrada = await _Repo.GetAll(); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpDelete("Delete/{id}")] |
||||
public async Task<IActionResult> Delete(int id) |
||||
{ |
||||
await _Repo.Delete(id); |
||||
return new OkObjectResult(new { respuesta = "Se elimino el registro" }); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,44 @@ |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using AOLBackend.DTO.Catalogos; |
||||
using Microsoft.AspNetCore.Mvc; |
||||
using Microsoft.AspNetCore.Authorization; |
||||
|
||||
namespace AOLBackend.Controllers.Catalogos |
||||
{ |
||||
[Authorize] |
||||
[ApiController] |
||||
[Route("api/Catalogos/[controller]")]
|
||||
public class CatRutasController : ControllerBase |
||||
{ |
||||
private readonly ICatRutasRepository _Repo; |
||||
|
||||
public CatRutasController(ICatRutasRepository Repo) |
||||
{ |
||||
_Repo = Repo; |
||||
} |
||||
|
||||
[HttpPost] |
||||
[Route("Append")] |
||||
public async Task<ICatRutas> Append([FromBody] ICatRutas data) |
||||
{ |
||||
var entrada = await _Repo.Append(data); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("Get")] |
||||
public async Task<IEnumerable<DTOCatRutas>> GetAll() |
||||
{ |
||||
var entrada = await _Repo.GetAll(); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpDelete("Delete/{id}")] |
||||
public async Task<IActionResult> Delete(int id) |
||||
{ |
||||
await _Repo.Delete(id); |
||||
return new OkObjectResult(new { respuesta = "Se elimino el registro" }); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,43 @@ |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using Microsoft.AspNetCore.Mvc; |
||||
using Microsoft.AspNetCore.Authorization; |
||||
|
||||
namespace AOLBackend.Controllers.Catalogos |
||||
{ |
||||
[Authorize] |
||||
[ApiController] |
||||
[Route("api/Catalogos/[controller]")]
|
||||
public class CatServiciosController : ControllerBase |
||||
{ |
||||
private readonly ICatServiciosRepository _Repo; |
||||
|
||||
public CatServiciosController(ICatServiciosRepository Repo) |
||||
{ |
||||
_Repo = Repo; |
||||
} |
||||
|
||||
[HttpPost] |
||||
[Route("Append")] |
||||
public async Task<ICatServicios> Append([FromBody] ICatServicios data) |
||||
{ |
||||
var entrada = await _Repo.Append(data); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("Get")] |
||||
public async Task<IEnumerable<ICatServicios>> GetAll() |
||||
{ |
||||
var entrada = await _Repo.GetAll(); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpDelete("Delete/{id}")] |
||||
public async Task<IActionResult> Delete(int id) |
||||
{ |
||||
await _Repo.Delete(id); |
||||
return new OkObjectResult(new { respuesta = "Se elimino el registro" }); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,42 @@ |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using Microsoft.AspNetCore.Mvc; |
||||
using Microsoft.AspNetCore.Authorization; |
||||
|
||||
namespace AOLBackend.Controllers.Catalogos |
||||
{ |
||||
[Authorize] |
||||
[ApiController] |
||||
[Route("api/Catalogos/[controller]")]
|
||||
public class CatTipoUnidadController : ControllerBase |
||||
{ |
||||
private readonly ICatTipoUnidadRepository _Repo; |
||||
public CatTipoUnidadController(ICatTipoUnidadRepository Repo) |
||||
{ |
||||
_Repo = Repo; |
||||
} |
||||
|
||||
[HttpPost] |
||||
[Route("Append")] |
||||
public async Task<ICatTipoUnidad> Append([FromBody] ICatTipoUnidad data) |
||||
{ |
||||
var entrada = await _Repo.Append(data); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("Get")] |
||||
public async Task<IEnumerable<ICatTipoUnidad>> GetAll() |
||||
{ |
||||
var entrada = await _Repo.GetAll(); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpDelete("Delete/{id}")] |
||||
public async Task<IActionResult> Delete(int id) |
||||
{ |
||||
await _Repo.Delete(id); |
||||
return new OkObjectResult(new { respuesta = "Se elimino el registro" }); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,42 @@ |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using Microsoft.AspNetCore.Mvc; |
||||
using Microsoft.AspNetCore.Authorization; |
||||
|
||||
namespace AOLBackend.Controllers.Catalogos |
||||
{ |
||||
[Authorize] |
||||
[ApiController] |
||||
[Route("api/Catalogos/[controller]")]
|
||||
public class CatUbicacionesController : ControllerBase |
||||
{ |
||||
private readonly ICatUbicacionesRepository _Repo; |
||||
public CatUbicacionesController(ICatUbicacionesRepository Repo) |
||||
{ |
||||
_Repo = Repo; |
||||
} |
||||
|
||||
[HttpPost] |
||||
[Route("Append")] |
||||
public async Task<ICatUbicaciones> Append([FromBody] ICatUbicaciones data) |
||||
{ |
||||
var entrada = await _Repo.Append(data); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("Get")] |
||||
public async Task<IEnumerable<ICatUbicaciones>> GetAll() |
||||
{ |
||||
var entrada = await _Repo.GetAll(); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpDelete("Delete/{id}")] |
||||
public async Task<IActionResult> Delete(int id) |
||||
{ |
||||
await _Repo.Delete(id); |
||||
return new OkObjectResult(new { respuesta = "Se elimino el registro" }); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,90 @@ |
||||
using AOLBackend.Contracts.Operaciones; |
||||
using AOLBackend.DTO.Operaciones; |
||||
using Microsoft.AspNetCore.Mvc; |
||||
using Microsoft.AspNetCore.Authorization; |
||||
|
||||
namespace AOLBackend.Controllers.Operaciones |
||||
{ |
||||
[Authorize] |
||||
[ApiController] |
||||
[Route("api/Operaciones/[controller]")]
|
||||
public class OpViajesController : ControllerBase |
||||
{ |
||||
private readonly IOpViajesRepository _Repo; |
||||
|
||||
public OpViajesController(IOpViajesRepository Repo) |
||||
{ |
||||
_Repo = Repo; |
||||
} |
||||
|
||||
[HttpPost] |
||||
[Route("Append")] |
||||
public async Task<DTOOpViajes> Append([FromBody] DTOOpViajes data) |
||||
{ |
||||
var entrada = await _Repo.Append(data); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpPost] |
||||
[Route("AppendService")] |
||||
public async Task<IEnumerable<DTOOpViajesServicios>> Append([FromBody] DTOOpViajesServicios data) |
||||
{ |
||||
var entrada = await _Repo.AppendServicio(data); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("Get")] |
||||
public async Task<IEnumerable<DTOOpViajes>> GetAll() |
||||
{ |
||||
var entrada = await _Repo.GetAll(); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("GetAllServices")] |
||||
public async Task<IEnumerable<DTOOpViajesServicios>> GetAllServices(int Status) |
||||
{ |
||||
var entrada = await _Repo.GetAllServices(Status); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("GetLastTrailerBox")] |
||||
public async Task<DTOUltimaCaja> GetLastTrailerBox(int idViaje) |
||||
{ |
||||
var entrada = await _Repo.GetLastTrailerBox(idViaje); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("GetStatusSecuence")] |
||||
public async Task<IEnumerable<DTOOpViajesEstatusSecuencia>> GetStatusSecuence() |
||||
{ |
||||
var entrada = await _Repo.GetStatusSecuence(); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpPut("ChangeTripStatus/{id}")] |
||||
public async Task<DTOResultTripStatus> Update2(int id, [FromBody] DTOChangeTripStatus data) |
||||
{ |
||||
var entrada = await _Repo.ChangeTripStatus(data); |
||||
return entrada; |
||||
} |
||||
|
||||
[HttpDelete("Delete/{id}")] |
||||
public async Task<IActionResult> Delete(int id) |
||||
{ |
||||
await _Repo.Delete(id); |
||||
return new OkObjectResult(new { respuesta = "Se elimino el registro" }); |
||||
} |
||||
|
||||
[HttpDelete("DeleteService/{id}")] |
||||
public async Task<IActionResult> DeleteService(int id) |
||||
{ |
||||
await _Repo.DeleteService(id); |
||||
return new OkObjectResult(new { respuesta = "Se elimino el registro" }); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,148 @@ |
||||
using AOLBackend.Contracts.Utils; |
||||
using AOLBackend.Models.Utils; |
||||
using Microsoft.AspNetCore.Mvc; |
||||
|
||||
namespace AOLBackend.Controllers.Utils |
||||
{ |
||||
[ApiController] |
||||
[Route("api/[controller]")]
|
||||
public class FileManagerController : ControllerBase |
||||
{ |
||||
|
||||
private readonly IFileManagerRepository _Repo; |
||||
private readonly IFilePaths4ProcessRepository _RepoRelativePath; |
||||
private readonly IConfiguration _config; |
||||
private readonly string RootPathCorresponsales; |
||||
public FileManagerController(IFileManagerRepository Repo, |
||||
IFilePaths4ProcessRepository RepoRelativePath, |
||||
IConfiguration config) |
||||
{ |
||||
_config = config; |
||||
_Repo = Repo; |
||||
_RepoRelativePath = RepoRelativePath; |
||||
RootPathCorresponsales = _config.GetValue<string>("AllFiles"); |
||||
} |
||||
|
||||
[Route("GetFileInfoByProcess")] |
||||
[HttpGet] |
||||
public async Task<FileManager> GetFileInfoByProcess([FromQuery] int id, int Proceso) |
||||
{ |
||||
FileManager data = new FileManager(); |
||||
data = await _Repo.getFileByProcess(id, Proceso); |
||||
return data; |
||||
} |
||||
|
||||
[Route("GetFileInfoById")] |
||||
[HttpGet] |
||||
public async Task<FileManager> GetFileInfoByProcess([FromQuery] int id) |
||||
{ |
||||
FileManager data = new FileManager(); |
||||
data = await _Repo.getFileById(id); |
||||
return data; |
||||
} |
||||
|
||||
[Route("AppendFileByProcess")] |
||||
[HttpPost] |
||||
public async Task<FileManager> AppendFileByProcess(IFormFile file, int IdUsuario, int Proceso, string Tags, int crud) |
||||
{ |
||||
DateTime time = DateTime.Now; |
||||
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso); |
||||
string fullPath = ""; |
||||
fullPath = RootPathCorresponsales + RelativePath.Path; |
||||
string fileMime = file.FileName.Substring(file.FileName.Length - 4); |
||||
string newFileName = file.FileName.Replace(fileMime, "") + "_" + time.ToString("yyyy_MM_dd_HH_mm_ss") + fileMime; |
||||
FileManager data = new FileManager(); |
||||
data.id = 0; |
||||
data.IdUsuario = IdUsuario; |
||||
data.NombreArchivo = newFileName; |
||||
data.Proceso = Proceso; |
||||
data.FechaRegistro = ""; |
||||
data.Tags = Tags; |
||||
data.Activo = 1; |
||||
long fileLength = 0; |
||||
if (@crud == 1) |
||||
{ |
||||
if (file.Length > 0) |
||||
{ |
||||
var filePath = fullPath + newFileName; |
||||
using (var stream = System.IO.File.Create(filePath)) |
||||
{ |
||||
await file.CopyToAsync(stream); |
||||
} |
||||
fileLength = new System.IO.FileInfo(filePath).Length / 1024; |
||||
data.Size = fileLength; |
||||
if (fileLength > 0) |
||||
{ |
||||
return await _Repo.FileManager(data); |
||||
} |
||||
} |
||||
} |
||||
return data; |
||||
} |
||||
|
||||
|
||||
[Route("getFile")] |
||||
[HttpGet, DisableRequestSizeLimit] |
||||
public async Task<IActionResult> getFileFromFileManager([FromQuery] long id, int Proceso) |
||||
{ |
||||
Boolean ExisteEnDisco = false; |
||||
FileManager recFound = await _Repo.getFileByProcess(id, Proceso); |
||||
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso); |
||||
string fullPath = ""; |
||||
fullPath = RootPathCorresponsales + RelativePath.Path; |
||||
if (!String.IsNullOrEmpty(recFound.NombreArchivo)) |
||||
{ |
||||
try |
||||
{ |
||||
if (System.IO.File.Exists(Path.Combine(fullPath, recFound.NombreArchivo))) |
||||
{ |
||||
ExisteEnDisco = true; |
||||
} |
||||
else return BadRequest(new { respuesta = "Ese archivo no existe" }); |
||||
} |
||||
catch (IOException ex) |
||||
{ |
||||
return BadRequest(new { respuesta = "Ese archivo no existe" + ex.ToString() }); |
||||
} |
||||
if (ExisteEnDisco) |
||||
{ |
||||
string fileMime = recFound.NombreArchivo.Substring(recFound.NombreArchivo.Length - 3).ToLower(); |
||||
var mime = "application/" + fileMime.ToLower(); |
||||
string targetFile = fullPath + recFound.NombreArchivo; |
||||
if (System.IO.File.Exists(targetFile)) |
||||
{ |
||||
byte[] pdfBytes = System.IO.File.ReadAllBytes(targetFile); |
||||
MemoryStream ms = new MemoryStream(pdfBytes); |
||||
return new FileStreamResult(ms, mime); |
||||
} |
||||
} |
||||
} |
||||
return BadRequest(new { respuesta = "Ese archivo no existe" }); |
||||
} |
||||
|
||||
[HttpDelete("DeleteById/{id}")] |
||||
public async Task<IActionResult> DeleteByProcess(long id) |
||||
{ |
||||
FileManager Found = await _Repo.getFileById(id); |
||||
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Found.Proceso); |
||||
string fullPath = ""; |
||||
fullPath = RootPathCorresponsales + RelativePath.Path; |
||||
try |
||||
{ |
||||
if (System.IO.File.Exists(Path.Combine(fullPath, Found.NombreArchivo))) |
||||
{ |
||||
System.IO.File.Delete(Path.Combine(fullPath, Found.NombreArchivo)); |
||||
await _Repo.deleteFileByProcess(Found.id, Found.Proceso); |
||||
} |
||||
else return new OkObjectResult(new { respuesta = "Ese archivo no existe" }); |
||||
} |
||||
catch (IOException ex) |
||||
{ |
||||
return new OkObjectResult(new { respuesta = "Ocurrio un error al intentar eliminar el registro: " + ex.ToString() }); |
||||
} |
||||
return new OkObjectResult(new { respuesta = "Se elimino el registro" }); |
||||
} |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,56 @@ |
||||
using Microsoft.AspNetCore.Mvc; |
||||
using AOLBackend.Services.MFileManager; |
||||
using AOLBackend.Contracts.Utils; |
||||
using AOLBackend.Models.Utils; |
||||
|
||||
namespace AOLBackend.Controllers.Utils |
||||
{ |
||||
[Route("api/Utils/[controller]")]
|
||||
public class MFileManagerController : Controller |
||||
{ |
||||
private readonly IFileManagerRepository _Repo; |
||||
private readonly IConfiguration _config; |
||||
private readonly IFilePaths4ProcessRepository _RepoRelativePath; |
||||
private readonly string RootPath; |
||||
|
||||
public MFileManagerController(IConfiguration config, IFilePaths4ProcessRepository RepoRelativePath, IFileManagerRepository Repo) |
||||
{ |
||||
_config = config; |
||||
_RepoRelativePath = RepoRelativePath; |
||||
_Repo = Repo; |
||||
RootPath = _config.GetValue<string>("AllFiles"); |
||||
} |
||||
|
||||
[HttpGet] |
||||
[Route("GetFilesFromLog")] |
||||
public async Task<List<FileManager>> GetFilesFromLog(int Tags, int Proceso) |
||||
{ |
||||
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso); |
||||
SvcMFileManager FM = new SvcMFileManager(_config, _Repo, RootPath + RelativePath.Path + "\\"); |
||||
return await FM.GetFilesFromLog(Tags, Proceso); |
||||
} |
||||
|
||||
|
||||
[HttpGet] |
||||
[Route("GetFileContentById")] |
||||
public async Task<IActionResult> GetFileContentById(long id, int Proceso) |
||||
{ |
||||
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso); |
||||
SvcMFileManager FM = new SvcMFileManager(_config, _Repo, RootPath + RelativePath.Path); |
||||
return await FM.getFileContentById(id); |
||||
} |
||||
|
||||
|
||||
[HttpPost] |
||||
[Route("Append")] |
||||
public async Task<List<FileManager>> Append(List<IFormFile> FileList, int Tags, int Proceso, int Usuario) |
||||
{ |
||||
List<string> data = new List<string>(); |
||||
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso); |
||||
SvcMFileManager FM = new SvcMFileManager(_config, _Repo, RootPath + RelativePath.Path + "\\"); |
||||
List<string> filePaths = await FM.SaveFile2DiskList(FileList); |
||||
var fileData = await FM.SaveFileLog(filePaths, Tags, Proceso, Usuario); |
||||
return fileData; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,33 @@ |
||||
using Microsoft.AspNetCore.Mvc; |
||||
|
||||
namespace AOLBackend.Controllers |
||||
{ |
||||
[ApiController] |
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase |
||||
{ |
||||
private static readonly string[] Summaries = new[] |
||||
{ |
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" |
||||
}; |
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger; |
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger) |
||||
{ |
||||
_logger = logger; |
||||
} |
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")] |
||||
public IEnumerable<WeatherForecast> Get() |
||||
{ |
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast |
||||
{ |
||||
Date = DateTime.Now.AddDays(index), |
||||
TemperatureC = Random.Shared.Next(-20, 55), |
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)] |
||||
}) |
||||
.ToArray(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,24 @@ |
||||
namespace AOLBackend.DTO.Catalogos |
||||
{ |
||||
public class DTOCatRutas |
||||
{ |
||||
public int id { get; set; } |
||||
public int Cliente { get; set; } = 0; |
||||
public string sCliente { get; set; } = null!; |
||||
public int Servicio { get; set; } = 0; |
||||
public string sServicio { get; set; } = null!; |
||||
public double Precio { get; set; } = 0; |
||||
public int Proveedor { get; set; } = 0; |
||||
public string sProveedor { get; set; } = null!; |
||||
public double Costo { get; set; } = 0; |
||||
public int Origen { get; set; } = 0; |
||||
public string sOrigen { get; set; } = null!; |
||||
public int Destino { get; set; } = 0; |
||||
public string sDestino { get; set; } = null!; |
||||
public int TipoUnidad { get; set; } = 0; |
||||
public string sTipoUnidad { get; set; } = null!; |
||||
public string FCreacion { get; set; } = null!; |
||||
public string FActualizacion { get; set; } = null!; |
||||
public Byte Activo { get; set; } = 0!; |
||||
} |
||||
} |
@ -0,0 +1,8 @@ |
||||
namespace AOLBackend.DTO.Operaciones |
||||
{ |
||||
public class DTOChangeTripStatus |
||||
{ |
||||
public int IdViaje { get; set; } = 0; |
||||
public int IdEstatus { get; set; } = 0; |
||||
} |
||||
} |
@ -0,0 +1,26 @@ |
||||
namespace AOLBackend.DTO.Operaciones |
||||
{ |
||||
public class DTOOpViajes |
||||
{ |
||||
public int id { get; set; } = 0; |
||||
public string FAlta { get; set; } = null!; |
||||
public int Usuario { get; set; } = 0; |
||||
public string RefAgenciaAduanal { get; set; } = null!; |
||||
public int Cliente { get; set; } = 0; |
||||
public string? sCliente { get; set; } = null!; |
||||
public byte TipoUnidad { get; set; } = 0; |
||||
public string? sTipoUnidad { get; set; } = null!; |
||||
public string NoCaja { get; set; } = null!; |
||||
public string PickUpNumber { get; set; } = null!; |
||||
public int Origen { get; set; } = 0; |
||||
public string? sOrigen { get; set; } = null!; |
||||
public int Destino { get; set; } = 0; |
||||
public string? sDestino { get; set; } = null!; |
||||
public byte Hazmat { get; set; } = 0; |
||||
public byte TipoOperacion { get; set; } = 1; |
||||
public string sTipoOperacion { get; set; } = null!; |
||||
public string Pedimento { get; set; } = null!; |
||||
public int Status { get; set; } = 0; |
||||
public int Activo { get; set; } = 0; |
||||
} |
||||
} |
@ -0,0 +1,14 @@ |
||||
namespace AOLBackend.DTO.Operaciones |
||||
{ |
||||
public class DTOOpViajesEstatusSecuencia |
||||
{ |
||||
public int id { get; set; } = 0; |
||||
public byte TipoOperacion { get; set; } = 0; |
||||
public string sTipoOperacion { get; set; } = null!; |
||||
public byte Estatus { get; set; } = 0; |
||||
public string sEstatus { get; set; } = null!; |
||||
public byte Secuencia { get; set; } = 0; |
||||
public byte Activo { get; set; } = 0; |
||||
|
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
namespace AOLBackend.DTO.Operaciones |
||||
{ |
||||
public class DTOOpViajesServicios |
||||
{ |
||||
public int id { get; set; } = 0; |
||||
public int IdViaje { get; set; } = 0; |
||||
public int IdServicio { get; set; } = 0; |
||||
public string? sServicio { get; set; } = null!; |
||||
public int Aduana { get; set; } = 0; |
||||
public string Comentarios { get; set; } = null!; |
||||
public int IdProveedor { get; set; } = 0; |
||||
public string sProveedor { get; set; } = null!; |
||||
public string NoCaja { get; set; } = null!; |
||||
public byte Activo { get; set; } = 1; |
||||
public string Cita { get; set; } = null!; |
||||
} |
||||
} |
@ -0,0 +1,8 @@ |
||||
namespace AOLBackend.DTO.Operaciones |
||||
{ |
||||
public class DTOResultTripStatus |
||||
{ |
||||
public int IdViaje { get; set; } = 0; |
||||
public int Secuencia { get; set; } = 0; |
||||
} |
||||
} |
@ -0,0 +1,7 @@ |
||||
namespace AOLBackend.DTO.Operaciones |
||||
{ |
||||
public class DTOUltimaCaja |
||||
{ |
||||
public string UltimaCaja { get; set; } = null!; |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
namespace AOLBackend.DTO.Usuario |
||||
{ |
||||
public class DTOUsuarioSendEmail |
||||
{ |
||||
public string Usuario { get; set; } = null!; |
||||
public string Nombre { get; set; } = null!; |
||||
public string Correo { get; set; } = null!; |
||||
|
||||
} |
||||
} |
@ -0,0 +1,9 @@ |
||||
namespace AOLBackend.Models.Catalogos |
||||
{ |
||||
public class ICatClientes |
||||
{ |
||||
public int id { get; set; } = 0; |
||||
public string Cliente { get; set; } = null!; |
||||
public Byte Activo { get; set; } = 0!; |
||||
} |
||||
} |
@ -0,0 +1,9 @@ |
||||
namespace AOLBackend.Models.Catalogos |
||||
{ |
||||
public class ICatProveedores |
||||
{ |
||||
public int id { get; set; } |
||||
public string Proveedor { get; set; } = null!; |
||||
public Byte Activo { get; set; } = 0!; |
||||
} |
||||
} |
@ -0,0 +1,18 @@ |
||||
namespace AOLBackend.Models.Catalogos |
||||
{ |
||||
public class ICatRutas |
||||
{ |
||||
public int id { get; set; } |
||||
public int Cliente { get; set; } = 0; |
||||
public int Servicio { get; set; } = 0; |
||||
public double Precio { get; set; } = 0; |
||||
public int Proveedor { get; set; } = 0; |
||||
public double Costo { get; set; } = 0; |
||||
public int Origen { get; set; } = 0; |
||||
public int Destino { get; set; } = 0; |
||||
public int TipoUnidad { get; set; } = 0; |
||||
public string? FCreacion { get; set; } = null!; |
||||
public string? FActualizacion { get; set; } = null!; |
||||
public Byte Activo { get; set; } = 0!; |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
|
||||
namespace AOLBackend.Models.Catalogos |
||||
{ |
||||
public class ICatServicios |
||||
{ |
||||
public int id { get; set; } |
||||
public string Servicio { get; set; } = null!; |
||||
public Byte Activo { get; set; } = 0!; |
||||
} |
||||
} |
@ -0,0 +1,9 @@ |
||||
namespace AOLBackend.Models.Catalogos |
||||
{ |
||||
public class ICatTipoUnidad |
||||
{ |
||||
public int id { get; set; } = 0!; |
||||
public string TipoUnidad { get; set; } = null!; |
||||
public Byte Activo { get; set; } = 0!; |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
namespace AOLBackend.Models.Catalogos |
||||
{ |
||||
public class ICatUbicaciones |
||||
{ |
||||
public int id { get; set; } |
||||
public string Ubicacion { get; set; } = null!; |
||||
public Byte Clasificacion { get; set; } = 0!; |
||||
public Byte Activo { get; set; } = 0!; |
||||
} |
||||
} |
@ -0,0 +1,29 @@ |
||||
namespace AOLBackend.Models.Operaciones |
||||
{ |
||||
public class IOpViajes |
||||
{ |
||||
public int id { get; set; } = 0; |
||||
public string FAlta { get; set; } = null!; |
||||
public int Usuario { get; set; } = 0; |
||||
public string FCruce { get; set; } = null!; |
||||
public string RefAgenciaAduanal { get; set; } = null!; |
||||
public int Cliente { get; set; } = 0; |
||||
public int Proveedor { get; set; } = 0; |
||||
public byte Hazmat { get; set; } = 0; |
||||
public byte TipoUnidad { get; set; } = 0; |
||||
public string NoCaja { get; set; } = null!; |
||||
public string PickUpNumber { get; set; } = null!; |
||||
public int Origen { get; set; } = 0; |
||||
public int Destino { get; set; } = 0; |
||||
public string FacturaProveedor { get; set; } = null!; |
||||
public string FacturaAlphaOmega { get; set; } = null!; |
||||
public string FPagoFactura { get; set; } = null!; |
||||
public byte MetodoPago { get; set; } = 0; |
||||
public string FPagoProveedor { get; set; } = null!; |
||||
public int NoChequeAOL { get; set; } = 0; |
||||
public int FacturarA { get; set; } = 0; |
||||
public string FEntrega { get; set; } = null!; |
||||
public int Status { get; set; } = 0; |
||||
public int Activo { get; set; } = 0; |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
namespace AOLBackend.Models.Operaciones |
||||
{ |
||||
public class IOpViajesServicios |
||||
{ |
||||
public int id { get; set; } = 0; |
||||
public int IdViaje { get; set; } = 0; |
||||
public int IdServicio { get; set; } = 0; |
||||
public byte Activo { get; set; } = 1; |
||||
} |
||||
} |
@ -0,0 +1,14 @@ |
||||
namespace AOLBackend.Models.Utils |
||||
{ |
||||
public class FileManager |
||||
{ |
||||
public long id { get; set; } = 0!; |
||||
public int IdUsuario { get; set; } = 0!; |
||||
public int Proceso { get; set; } = 0!; |
||||
public string NombreArchivo { get; set; } = null!; |
||||
public string FechaRegistro { get; set; } = null!; |
||||
public string Tags { get; set; } = null!; |
||||
public long Size { get; set; } = 0!; |
||||
public byte Activo { get; set; } = 0!; |
||||
} |
||||
} |
@ -0,0 +1,7 @@ |
||||
namespace AOLBackend.Models.Utils |
||||
{ |
||||
public class FilePaths4Process |
||||
{ |
||||
public string Path { set; get; } = string.Empty; |
||||
} |
||||
} |
@ -0,0 +1,84 @@ |
||||
using AOLBackend.Context; |
||||
using AOLBackend.Contracts; |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Contracts.Operaciones; |
||||
using AOLBackend.Contracts.Utils; |
||||
|
||||
using AOLBackend.Repository; |
||||
using AOLBackend.Repository.Catalogos; |
||||
using AOLBackend.Repository.Operaciones; |
||||
using AOLBackend.Repository.Utils; |
||||
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer; |
||||
using Microsoft.IdentityModel.Tokens; |
||||
using System.Text; |
||||
|
||||
var builder = WebApplication.CreateBuilder(args); |
||||
builder.Services.AddSingleton<DapperContext>(); |
||||
builder.Services.AddScoped<IUsuarioRepository, UsuariosRepository>(); |
||||
builder.Services.AddScoped<IMenuRepository, MenuRepository>(); |
||||
|
||||
// Catalogos |
||||
builder.Services.AddScoped<ICatClientesRepository, CatClientesRepository>(); |
||||
builder.Services.AddScoped<ICatProveedoresRepository, CatProveedoresRepository>(); |
||||
builder.Services.AddScoped<ICatUbicacionesRepository, CatUbicacionesRepository>(); |
||||
builder.Services.AddScoped<ICatTipoUnidadRepository, CatTipoUnidadRepository>(); |
||||
builder.Services.AddScoped<ICatServiciosRepository, CatServiciosRepository>(); |
||||
builder.Services.AddScoped<ICatRutasRepository, CatRutasRepository>(); |
||||
|
||||
//Operaciones |
||||
builder.Services.AddScoped<IOpViajesRepository, OpViajesRepository>(); |
||||
|
||||
//Utilerias |
||||
builder.Services.AddScoped<IFileManagerRepository, FileManagerRepository>(); |
||||
builder.Services.AddScoped<IFilePaths4ProcessRepository, FilePaths4ProcessRepository>(); |
||||
|
||||
builder.Services.AddControllers(); |
||||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options => |
||||
{ |
||||
options.RequireHttpsMetadata = false; |
||||
options.SaveToken = true; |
||||
options.TokenValidationParameters = new TokenValidationParameters() |
||||
{ |
||||
ValidateIssuer = true, |
||||
ValidateAudience = true, |
||||
ValidAudience = builder.Configuration["Jwt:Audience"], |
||||
ValidIssuer = builder.Configuration["Jwt:Issuer"], |
||||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Jwt:Key"])) |
||||
}; |
||||
}); |
||||
builder.Services.AddEndpointsApiExplorer(); |
||||
builder.Services.AddSwaggerGen(); |
||||
|
||||
//services cors |
||||
builder.Services.AddCors(p => p.AddPolicy("corsapp", builder => |
||||
{ |
||||
//builder.WithOrigins("*").AllowAnyMethod().AllowAnyHeader(); |
||||
|
||||
builder.WithOrigins("http://localhost:3000", |
||||
"http://localhost:7001", |
||||
"http://localhost:5000", |
||||
"https://localhost:5001", |
||||
"https://alphaomega.com.mx", |
||||
"https://www.alphaomega.com.mx", |
||||
"https://74.208.165.122", |
||||
"https://www.alphaomega.com.mx:443", |
||||
"https://74.208.165.122:443", |
||||
"http://localhost", |
||||
"http://74.208.165.122:5000").AllowAnyMethod().AllowAnyHeader(); |
||||
})); |
||||
|
||||
var app = builder.Build(); |
||||
|
||||
if (app.Environment.IsDevelopment()) |
||||
{ |
||||
app.UseSwagger(); |
||||
app.UseSwaggerUI(); |
||||
} |
||||
|
||||
app.UseHttpsRedirection(); |
||||
app.UseAuthentication(); |
||||
app.UseCors("corsapp"); |
||||
app.UseAuthorization(); |
||||
app.MapControllers(); |
||||
app.Run(); |
@ -0,0 +1,47 @@ |
||||
using AOLBackend.Context; |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using Dapper; |
||||
using System.Data; |
||||
|
||||
namespace AOLBackend.Repository.Catalogos |
||||
{ |
||||
public class CatClientesRepository : ICatClientesRepository |
||||
{ |
||||
private readonly DapperContext _context; |
||||
private readonly IConfiguration _config; |
||||
public CatClientesRepository(DapperContext context, IConfiguration config) |
||||
{ |
||||
_context = context; |
||||
_config = config; |
||||
} |
||||
|
||||
public async Task<ICatClientes> Append(ICatClientes data) |
||||
{ |
||||
var query = "CatClientes_Append"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatClientes>(query, new |
||||
{ |
||||
mid = data.id, |
||||
mCliente = data.Cliente, |
||||
}, commandType: CommandType.StoredProcedure); |
||||
return entrada.First(); |
||||
} |
||||
public async Task<IEnumerable<ICatClientes>> GetAll() |
||||
{ |
||||
var query = "CatClientes_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatClientes>(query, new { }, commandType: CommandType.StoredProcedure); |
||||
return entrada; |
||||
} |
||||
|
||||
public async Task<Boolean> Delete(int id) |
||||
{ |
||||
var query = "CatClientes_Delete"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatClientes>(query, new { mid=id }, commandType: CommandType.StoredProcedure); |
||||
return true; |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,46 @@ |
||||
using AOLBackend.Context; |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using Dapper; |
||||
using System.Data; |
||||
|
||||
namespace AOLBackend.Repository.Catalogos |
||||
{ |
||||
public class CatProveedoresRepository : ICatProveedoresRepository |
||||
{ |
||||
private readonly DapperContext _context; |
||||
private readonly IConfiguration _config; |
||||
public CatProveedoresRepository(DapperContext context, IConfiguration config) |
||||
{ |
||||
_context = context; |
||||
_config = config; |
||||
} |
||||
|
||||
public async Task<ICatProveedores> Append(ICatProveedores data) |
||||
{ |
||||
var query = "CatProveedores_Append"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatProveedores>(query, new |
||||
{ |
||||
mid = data.id, |
||||
mProveedor = data.Proveedor, |
||||
}, commandType: CommandType.StoredProcedure); |
||||
return entrada.First(); |
||||
} |
||||
public async Task<IEnumerable<ICatProveedores>> GetAll() |
||||
{ |
||||
var query = "CatProveedores_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatProveedores>(query, new { }, commandType: CommandType.StoredProcedure); |
||||
return entrada; |
||||
} |
||||
|
||||
public async Task<Boolean> Delete(int id) |
||||
{ |
||||
var query = "CatProveedores_Delete"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatProveedores>(query, new { mid=id }, commandType: CommandType.StoredProcedure); |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,55 @@ |
||||
using AOLBackend.Context; |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using AOLBackend.DTO.Catalogos; |
||||
using Dapper; |
||||
using System.Data; |
||||
|
||||
namespace AOLBackend.Repository.Catalogos |
||||
{ |
||||
public class CatRutasRepository : ICatRutasRepository |
||||
{ |
||||
private readonly DapperContext _context; |
||||
private readonly IConfiguration _config; |
||||
public CatRutasRepository(DapperContext context, IConfiguration config) |
||||
{ |
||||
_context = context; |
||||
_config = config; |
||||
} |
||||
|
||||
public async Task<ICatRutas> Append(ICatRutas data) |
||||
{ |
||||
var query = "CatRutas_Append"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatRutas>(query, new |
||||
{ |
||||
mid = data.id, |
||||
mCliente = data.Cliente, |
||||
mServicio = data.Servicio, |
||||
mPrecio = data.Precio, |
||||
mProveedor = data.Proveedor, |
||||
mCosto = data.Costo, |
||||
mOrigen = data.Origen, |
||||
mDestino = data.Destino, |
||||
mTipoUnidad = data.TipoUnidad, |
||||
mActivo = data.Activo |
||||
}, commandType: CommandType.StoredProcedure); |
||||
return entrada.First(); |
||||
} |
||||
public async Task<IEnumerable<DTOCatRutas>> GetAll() |
||||
{ |
||||
var query = "CatRutas_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<DTOCatRutas>(query, new { }, commandType: CommandType.StoredProcedure); |
||||
return entrada; |
||||
} |
||||
|
||||
public async Task<Boolean> Delete(int mid) |
||||
{ |
||||
var query = "CatRutas_Delete"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatRutas>(query, new { mid }, commandType: CommandType.StoredProcedure); |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,46 @@ |
||||
using AOLBackend.Context; |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using Dapper; |
||||
using System.Data; |
||||
|
||||
namespace AOLBackend.Repository.Catalogos |
||||
{ |
||||
public class CatServiciosRepository : ICatServiciosRepository |
||||
{ |
||||
private readonly DapperContext _context; |
||||
private readonly IConfiguration _config; |
||||
public CatServiciosRepository(DapperContext context, IConfiguration config) |
||||
{ |
||||
_context = context; |
||||
_config = config; |
||||
} |
||||
|
||||
public async Task<ICatServicios> Append(ICatServicios data) |
||||
{ |
||||
var query = "CatServicios_Append"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatServicios>(query, new |
||||
{ |
||||
mid = data.id, |
||||
mServicio = data.Servicio |
||||
}, commandType: CommandType.StoredProcedure); |
||||
return entrada.First(); |
||||
} |
||||
public async Task<IEnumerable<ICatServicios>> GetAll() |
||||
{ |
||||
var query = "CatServicios_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatServicios>(query, new { }, commandType: CommandType.StoredProcedure); |
||||
return entrada; |
||||
} |
||||
|
||||
public async Task<Boolean> Delete(int id) |
||||
{ |
||||
var query = "CatServicios_Delete"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatServicios>(query, new { mid= @id }, commandType: CommandType.StoredProcedure); |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,46 @@ |
||||
using AOLBackend.Context; |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using Dapper; |
||||
using System.Data; |
||||
|
||||
namespace AOLBackend.Repository.Catalogos |
||||
{ |
||||
public class CatTipoUnidadRepository : ICatTipoUnidadRepository |
||||
{ |
||||
private readonly DapperContext _context; |
||||
private readonly IConfiguration _config; |
||||
public CatTipoUnidadRepository(DapperContext context, IConfiguration config) |
||||
{ |
||||
_context = context; |
||||
_config = config; |
||||
} |
||||
|
||||
public async Task<ICatTipoUnidad> Append(ICatTipoUnidad data) |
||||
{ |
||||
var query = "CatTipoUnidad_Append"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatTipoUnidad>(query, new |
||||
{ |
||||
mid = data.id, |
||||
mTipoUnidad = data.TipoUnidad, |
||||
}, commandType: CommandType.StoredProcedure); |
||||
return entrada.First(); |
||||
} |
||||
public async Task<IEnumerable<ICatTipoUnidad>> GetAll() |
||||
{ |
||||
var query = "CatTipoUnidad_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatTipoUnidad>(query, new { }, commandType: CommandType.StoredProcedure); |
||||
return entrada; |
||||
} |
||||
|
||||
public async Task<Boolean> Delete(int mid) |
||||
{ |
||||
var query = "CatTipoUnidad_Delete"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatTipoUnidad>(query, new { mid }, commandType: CommandType.StoredProcedure); |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,48 @@ |
||||
using AOLBackend.Context; |
||||
using AOLBackend.Contracts.Catalogos; |
||||
using AOLBackend.Models.Catalogos; |
||||
using Dapper; |
||||
using System.Data; |
||||
|
||||
namespace AOLBackend.Repository.Catalogos |
||||
{ |
||||
public class CatUbicacionesRepository : ICatUbicacionesRepository |
||||
{ |
||||
private readonly DapperContext _context; |
||||
private readonly IConfiguration _config; |
||||
public CatUbicacionesRepository(DapperContext context, IConfiguration config) |
||||
{ |
||||
_context = context; |
||||
_config = config; |
||||
} |
||||
|
||||
public async Task<ICatUbicaciones> Append(ICatUbicaciones data) |
||||
{ |
||||
var query = "CatUbicaciones_Append"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatUbicaciones>(query, new |
||||
{ |
||||
mid = data.id, |
||||
mUbicacion = data.Ubicacion, |
||||
mClasificacion = data.Clasificacion |
||||
}, commandType: CommandType.StoredProcedure); |
||||
return entrada.First(); |
||||
} |
||||
public async Task<IEnumerable<ICatUbicaciones>> GetAll() |
||||
{ |
||||
var query = "CatUbicaciones_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatUbicaciones>(query, new { }, commandType: CommandType.StoredProcedure); |
||||
return entrada; |
||||
} |
||||
|
||||
public async Task<Boolean> Delete(int id) |
||||
{ |
||||
var query = "CatUbicaciones_Delete"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<ICatUbicaciones>(query, new { mid =id }, commandType: CommandType.StoredProcedure); |
||||
return true; |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,110 @@ |
||||
using AOLBackend.Context; |
||||
using AOLBackend.Contracts.Operaciones; |
||||
using AOLBackend.DTO.Operaciones; |
||||
using Dapper; |
||||
using System.Data; |
||||
|
||||
namespace AOLBackend.Repository.Operaciones |
||||
{ |
||||
public class OpViajesRepository : IOpViajesRepository |
||||
{ |
||||
private readonly DapperContext _context; |
||||
private readonly IConfiguration _config; |
||||
public OpViajesRepository(DapperContext context, IConfiguration config) |
||||
{ |
||||
_context = context; |
||||
_config = config; |
||||
} |
||||
public async Task<DTOOpViajes> Append(DTOOpViajes data) |
||||
{ |
||||
var query = "Operaciones_Viajes_Append"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<DTOOpViajes>(query, new |
||||
{ |
||||
mid = data.id, |
||||
mUsuario = data.Usuario, |
||||
mRefAgenciaAduanal = data.RefAgenciaAduanal, |
||||
mCliente = data.Cliente, |
||||
mTipoUnidad = data.TipoUnidad, |
||||
mNoCaja = data.NoCaja, |
||||
mPickUpNumber = data.PickUpNumber, |
||||
mOrigen = data.Origen, |
||||
mDestino = data.Destino, |
||||
mHazmat = data.Hazmat, |
||||
mTipoOperacion = data.TipoOperacion, |
||||
mPedimento = data.Pedimento, |
||||
}, commandType: CommandType.StoredProcedure); |
||||
return entrada.First(); |
||||
} |
||||
public async Task<IEnumerable<DTOOpViajesServicios>> AppendServicio(DTOOpViajesServicios data) |
||||
{ |
||||
var query = "Operaciones_Viajes_Servicios_Append"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<DTOOpViajesServicios>(query, new |
||||
{ |
||||
mid = data.id, |
||||
mIdViaje = data.IdViaje, |
||||
mIdServicio = data.IdServicio, |
||||
mAduana = data.Aduana, |
||||
mComentarios = data.Comentarios, |
||||
mIdProveedor = data.IdProveedor, |
||||
mNoCaja = data.NoCaja, |
||||
mCita = data.Cita |
||||
}, commandType: CommandType.StoredProcedure); |
||||
return entrada.ToList(); |
||||
} |
||||
public async Task<IEnumerable<DTOOpViajes>> GetAll() |
||||
{ |
||||
var query = "Operaciones_Viajes_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<DTOOpViajes>(query, new { }, commandType: CommandType.StoredProcedure); |
||||
return entrada; |
||||
} |
||||
public async Task<IEnumerable<DTOOpViajesServicios>> GetAllServices(int mStatus ) |
||||
{ |
||||
var query = "Operaciones_Viajes_Servicios_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<DTOOpViajesServicios>(query, new { mStatus }, commandType: CommandType.StoredProcedure); |
||||
return entrada; |
||||
} |
||||
public async Task<DTOUltimaCaja> GetLastTrailerBox(int mIdViaje) |
||||
{ |
||||
var query = "Operaciones_Viajes_GetLastTrailerBox"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<DTOUltimaCaja>(query, new { mIdViaje }, commandType: CommandType.StoredProcedure); |
||||
return entrada.First(); |
||||
} |
||||
public async Task<IEnumerable<DTOOpViajesEstatusSecuencia>> GetStatusSecuence() |
||||
{ |
||||
var query = "Operaciones_Viajes_Estatus_Secuencia_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<DTOOpViajesEstatusSecuencia>(query, new { }, commandType: CommandType.StoredProcedure); |
||||
return entrada; |
||||
} |
||||
public async Task<DTOResultTripStatus> ChangeTripStatus(DTOChangeTripStatus data) |
||||
{ |
||||
var query = "Operaciones_Viajes_ChangeStatus"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<DTOResultTripStatus>(query, new |
||||
{ |
||||
mIdViaje = data.IdViaje, |
||||
mSecuencia = data.IdEstatus |
||||
}, commandType: CommandType.StoredProcedure); |
||||
return entrada.First(); |
||||
} |
||||
public async Task<Boolean> Delete(int mid) |
||||
{ |
||||
var query = "Operaciones_Viajes_Delete"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<DTOOpViajes>(query, new { mid }, commandType: CommandType.StoredProcedure); |
||||
return true; |
||||
} |
||||
public async Task<Boolean> DeleteService(int mid) |
||||
{ |
||||
var query = "Operaciones_Viajes_Servicios_Delete"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<DTOOpViajes>(query, new { mid }, commandType: CommandType.StoredProcedure); |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,89 @@ |
||||
using Dapper; |
||||
using AOLBackend.Context; |
||||
using AOLBackend.Contracts.Utils; |
||||
using AOLBackend.Models.Utils; |
||||
using System.Data; |
||||
|
||||
namespace AOLBackend.Repository.Utils |
||||
{ |
||||
public class FileManagerRepository : IFileManagerRepository |
||||
{ |
||||
private readonly DapperContext _context; |
||||
public FileManagerRepository(DapperContext context) { _context = context; } |
||||
|
||||
public async Task<FileManager> FileManager(FileManager data) |
||||
{ |
||||
var query = "Utils_FileManager_Append"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<FileManager>(query, new |
||||
{ |
||||
mid = 0, |
||||
mIdUsuario = data.IdUsuario, |
||||
mProceso = data.Proceso, |
||||
mNombreArchivo = data.NombreArchivo, |
||||
mTags = data.Tags, |
||||
mSize = data.Size |
||||
}, |
||||
commandType: CommandType.StoredProcedure); |
||||
return entrada.First(); |
||||
} |
||||
|
||||
public async Task<FileManager> getFileByProcess(long id, int Proceso) |
||||
{ |
||||
var query = "Utils_FileManager_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<FileManager>(query, new |
||||
{ |
||||
mid = 0, |
||||
mProceso = Proceso, |
||||
mNombreArchivo = "", |
||||
mTags = id, |
||||
}, |
||||
commandType: CommandType.StoredProcedure); |
||||
return entrada.FirstOrDefault(new FileManager { id = id, Proceso = Proceso, NombreArchivo = "", Tags = "", Size = 0 }); |
||||
} |
||||
|
||||
public async Task<FileManager> getFileById(long id) |
||||
{ |
||||
var query = "Utils_FileManager_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<FileManager>(query, new |
||||
{ |
||||
mid = id, |
||||
mProceso = 0, |
||||
mNombreArchivo = "", |
||||
mTags = id, |
||||
}, |
||||
commandType: CommandType.StoredProcedure); |
||||
return entrada.FirstOrDefault(new FileManager { id = id, Proceso = 0, NombreArchivo = "", Tags = "", Size = 0 }); |
||||
} |
||||
|
||||
public async Task<List<FileManager>> getAllFilesByProcess(long Tags, int Proceso) |
||||
{ |
||||
var query = "Utils_FileManager_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<FileManager>(query, new |
||||
{ |
||||
mid = 0, |
||||
mProceso = Proceso, |
||||
mNombreArchivo = "", |
||||
mTags = Tags, |
||||
}, |
||||
commandType: CommandType.StoredProcedure); |
||||
return entrada.ToList(); |
||||
} |
||||
|
||||
public async Task<Boolean> deleteFileByProcess(long id, int Proceso) |
||||
{ |
||||
var query = "Utils_FileManager_Delete"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<FileManager>(query, new |
||||
{ |
||||
mid = id, |
||||
mProceso = Proceso, |
||||
}, |
||||
commandType: CommandType.StoredProcedure); |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,26 @@ |
||||
using Dapper; |
||||
using AOLBackend.Contracts.Utils; |
||||
using AOLBackend.Context; |
||||
using AOLBackend.Models.Utils; |
||||
using System.Data; |
||||
|
||||
namespace AOLBackend.Repository.Utils |
||||
{ |
||||
public class FilePaths4ProcessRepository : IFilePaths4ProcessRepository |
||||
{ |
||||
private readonly DapperContext _context; |
||||
public FilePaths4ProcessRepository(DapperContext context) { _context = context; } |
||||
|
||||
public async Task<FilePaths4Process> getPaths4ProcessById(long id) |
||||
{ |
||||
var query = "Utils_FileManager_RootPath_Get"; |
||||
using var connection = _context.CreateConnection(); |
||||
var entrada = await connection.QueryAsync<FilePaths4Process>(query, new |
||||
{ |
||||
mid = id, |
||||
}, |
||||
commandType: CommandType.StoredProcedure); |
||||
return entrada.First(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,61 @@ |
||||
using System.Net.Mail; |
||||
using System.Net; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
//using EASendMail; |
||||
|
||||
namespace AOLBackend.Services.EmailSender |
||||
{ |
||||
public class EmailSender |
||||
{ |
||||
private IConfiguration _config; |
||||
|
||||
public EmailSender(IConfiguration config) |
||||
{ |
||||
_config = config; |
||||
} |
||||
public String SrvSendEmail(string htmlContent, string Subject, string toEmail) |
||||
{ |
||||
string EmailServer = _config.GetValue<string>("EmailServer"); |
||||
string EmailAccount = _config.GetValue<string>("EmailAccount"); |
||||
string[] Email = EmailAccount.Split('@'); |
||||
int EmailPort = Convert.ToInt32(_config.GetValue<string>("EmailPort")); |
||||
string EmailPassword = _config.GetValue<string>("EmailPassword"); |
||||
string EmailUser = Email[0]; |
||||
string EmailDomain = Email[1].Replace("@", ""); |
||||
DateTime now = DateTime.Now; |
||||
try |
||||
{ |
||||
using (var smtp = new SmtpClient(EmailServer, EmailPort)) |
||||
{ |
||||
smtp.UseDefaultCredentials = false; |
||||
smtp.Credentials = new NetworkCredential(EmailAccount, EmailPassword); |
||||
smtp.Host = EmailServer; |
||||
var correo = new MailMessage(EmailAccount, toEmail); |
||||
correo.From = new MailAddress("<" + EmailAccount + ">", "<" + EmailUser + ">"); |
||||
correo.Sender = new MailAddress("<" + EmailAccount + ">", "<" + EmailUser + ">"); |
||||
correo.Headers.Add("Message-Id", String.Concat("<", now.ToString("yyMMdd"), ".", now.ToString("HHmmss"), "@alphaomega.com.mx>")); |
||||
correo.To.Add(toEmail); |
||||
correo.Subject = Subject; |
||||
correo.Body = "htmlContent"; |
||||
correo.BodyEncoding = System.Text.Encoding.UTF8; |
||||
correo.SubjectEncoding = System.Text.Encoding.Default; |
||||
correo.IsBodyHtml = true; |
||||
smtp.Send(correo); |
||||
return "Message Sent Succesfully"; |
||||
} |
||||
} |
||||
catch (Exception ex) |
||||
{ |
||||
return ex.ToString(); |
||||
} |
||||
} |
||||
|
||||
|
||||
public String SrvSendEmail2(string htmlContent, string Subject, string toEmail) |
||||
{ |
||||
return ""; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,106 @@ |
||||
using AOLBackend.Models.Utils; |
||||
using AOLBackend.Contracts.Utils; |
||||
using Microsoft.AspNetCore.Mvc; |
||||
|
||||
namespace AOLBackend.Services.MFileManager |
||||
{ |
||||
public class SvcMFileManager |
||||
{ |
||||
private readonly IFileManagerRepository _Repo; |
||||
private readonly IConfiguration _config; |
||||
// private readonly IFilePaths4ProcessRepository _RepoRelativePath; |
||||
private readonly string rootPath; |
||||
|
||||
public SvcMFileManager(IConfiguration config, IFileManagerRepository Repo, string _rootPath) |
||||
{ |
||||
_config = config; |
||||
_Repo = Repo; |
||||
rootPath = _rootPath; |
||||
} |
||||
|
||||
public async Task<List<FileManager>> GetFilesFromLog(int Tags, int Proceso) |
||||
{ |
||||
return await _Repo.getAllFilesByProcess(Tags, Proceso); |
||||
} |
||||
|
||||
public async Task<IActionResult> getFileContentById(long id) |
||||
{ |
||||
Boolean ExisteEnDisco = false; |
||||
byte[] emptyFile = System.IO.File.ReadAllBytes("c:\\downs\\empty.png"); |
||||
//byte[] emptyFile = System.IO.File.ReadAllBytes("D:\\data\\empty.png"); |
||||
MemoryStream emptyms = new MemoryStream(emptyFile); |
||||
FileManager recFound = await _Repo.getFileById(id); |
||||
if (!String.IsNullOrEmpty(recFound.NombreArchivo)) |
||||
{ |
||||
try |
||||
{ |
||||
if (System.IO.File.Exists(Path.Combine(rootPath, recFound.NombreArchivo))) |
||||
{ |
||||
ExisteEnDisco = true; |
||||
} |
||||
else |
||||
{ |
||||
return new FileStreamResult(emptyms, "image/png"); |
||||
} |
||||
} |
||||
catch (IOException ex) |
||||
{ |
||||
return new FileStreamResult(emptyms, "image/png"); |
||||
} |
||||
if (ExisteEnDisco) |
||||
{ |
||||
string fileMime = recFound.NombreArchivo.Substring(recFound.NombreArchivo.Length - 3).ToLower(); |
||||
var mime = "application/" + fileMime.ToLower(); |
||||
string targetFile = rootPath + "\\" + recFound.NombreArchivo; |
||||
if (System.IO.File.Exists(targetFile)) |
||||
{ |
||||
byte[] pdfBytes = System.IO.File.ReadAllBytes(targetFile); |
||||
MemoryStream ms = new MemoryStream(pdfBytes); |
||||
return new FileStreamResult(ms, mime); |
||||
} |
||||
} |
||||
} |
||||
return new FileStreamResult(emptyms, "image/png"); |
||||
} |
||||
|
||||
public async Task<List<string>> SaveFile2DiskList(List<IFormFile> FileList) |
||||
{ |
||||
DateTime time = DateTime.Now; |
||||
var filePaths = new List<string>(); |
||||
FileManager data = new FileManager(); |
||||
foreach (var file in FileList) |
||||
{ |
||||
string fileMime = file.FileName.Substring(file.FileName.Length - 4); |
||||
string newFileName = file.FileName.Replace(fileMime, "") + "_" + time.ToString("yyyy_MM_dd_HH_mm_ss") + fileMime; |
||||
if (file.Length > 0) |
||||
{ |
||||
var filePath = rootPath + newFileName; |
||||
using (var stream = System.IO.File.Create(filePath)) |
||||
{ |
||||
await file.CopyToAsync(stream); |
||||
filePaths.Add(newFileName); |
||||
} |
||||
} |
||||
} |
||||
return filePaths; |
||||
} |
||||
|
||||
public async Task<List<FileManager>> SaveFileLog(List<string> files, int Tags, int Proceso, int Usuario) |
||||
{ |
||||
List<FileManager> resultados = new List<FileManager>(); |
||||
foreach (string file in files) |
||||
{ |
||||
FileManager data = new FileManager(); |
||||
long fileLength = new System.IO.FileInfo(rootPath + file).Length / 1024; |
||||
data.id = 0; |
||||
data.IdUsuario = Usuario; |
||||
data.Proceso = Proceso; |
||||
data.NombreArchivo = file; |
||||
data.Tags = Tags.ToString(); |
||||
data.Size = fileLength; |
||||
await _Repo.FileManager(data); |
||||
} |
||||
return await _Repo.getAllFilesByProcess(Tags, Proceso); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,13 @@ |
||||
namespace AOLBackend |
||||
{ |
||||
public class WeatherForecast |
||||
{ |
||||
public DateTime Date { get; set; } |
||||
|
||||
public int TemperatureC { get; set; } |
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); |
||||
|
||||
public string? Summary { get; set; } |
||||
} |
||||
} |
@ -0,0 +1,18 @@ |
||||
{ |
||||
"ConnectionStrings": { |
||||
"SqlConnection": "server=.; database=AOL; Integrated Security=true;TrustServerCertificate=True;", |
||||
"MySQLConnection": "Server=localhost; User ID=root; Password=toor1234.; Database=AOL" |
||||
}, |
||||
"Logging": { |
||||
"LogLevel": { |
||||
"Default": "Information", |
||||
"Microsoft.AspNetCore": "Warning" |
||||
} |
||||
}, |
||||
"pathArchivoElectronico": "C:\\downs\\ArchivoElectronicoSIR\\www.gemcousa.com\\SIR-GEMCO\\DOCS-SIR\\", |
||||
"pathTemp": "C:\\downs\\temp\\", |
||||
"pathFotosBodega": "c:\\data\\Bodega\\Fotos\\", |
||||
"pathZipCorresponsales": "C:\\data\\", |
||||
"CorresponsalesFilePath": "C:\\data\\", |
||||
"Allfiles": "C:\\data\\AOL\\" |
||||
} |
@ -0,0 +1,37 @@ |
||||
{ |
||||
"ConnectionStrings": { |
||||
"SqlConnection": "server=localhost; database=AOL; User Id=sa;Password=toor1234;Encrypt=False;", |
||||
"Mysql": "Server=127.0.0.1;Database=aol;Uid=root;Pwd=Chispa10192;" |
||||
|
||||
}, |
||||
"DefaultUser": { |
||||
"Password": "Bienvenido123!" |
||||
}, |
||||
"Logging": { |
||||
"LogLevel": { |
||||
"Default": "Information", |
||||
"Microsoft.AspNetCore": "Warning" |
||||
} |
||||
}, |
||||
"AllowedHosts": "*", |
||||
"Jwt": { |
||||
"Key": "GFE1j5KLolZHDK9iKw5xK17Rz4ty7BlbXgnjPL6dNwVCCNQWU8uRGVyZmAZPWZMs4XX0phFMS849p25Lrwsn31Bi4J7GT2HQ9xeWlJLarJPDyoRZZvChpovwgrquQ9Pd", |
||||
"Issuer": "JWTAuthenticationServer", |
||||
"Audience": "JWTServicePostmanClient", |
||||
"Subject": "JWTServiceAccessToken", |
||||
"ExpirationHours": 4, |
||||
"ExpirationMinutes": 1 |
||||
}, |
||||
"EmailServer": "alphaomega-com-mx.mail.protection.outlook.com", |
||||
"EmailPort": "25", |
||||
"EmailUser": "noreply", |
||||
"EmailDomian": "alphaomega.com.mx", |
||||
"EmailAccount": "noreply@alphaomega.com.mx", |
||||
"EmailPassword": "Al%G22a3", |
||||
"pathArchivoElectronico": "D:\\data\\ArchivoElectronicoSIR\\www.gemcousa.com\\SIR-GEMCO\\DOCS-SIR\\", |
||||
"pathTemp": "D:\\data\\temp\\", |
||||
"pathFotosBodega": "D:\\data\\Bodega\\Fotos\\", |
||||
"pathZipCorresponsales": "D:\\data\\Corresponsales\\Zips\\", |
||||
"CorresponsalesFilePath": "D:\\data\\Corresponsales\\", |
||||
"AllFiles": "D:\\data\\AOL\\" |
||||
} |
Loading…
Reference in new issue