Se agrega catalogo de clientes

develop
Al Garcia 2 years ago
parent f6585bdea4
commit a14c5fd212
  1. 400
      .gitignore
  2. BIN
      .vs/AOLBackend/DesignTimeBuild/.dtbcache.v2
  3. BIN
      .vs/AOLBackend/FileContentIndex/635a8ac5-26f8-4655-b28a-b3d233f0e011.vsidx
  4. BIN
      .vs/AOLBackend/FileContentIndex/e0d51d11-d39d-4042-bc60-6530b9b12e45.vsidx
  5. BIN
      .vs/AOLBackend/FileContentIndex/f11c721e-7551-48be-be97-96c2b0308372.vsidx
  6. BIN
      .vs/AOLBackend/v17/.futdcache.v1
  7. BIN
      .vs/AOLBackend/v17/.suo
  8. BIN
      .vs/ProjectEvaluation/aolbackend.metadata.v2
  9. BIN
      .vs/ProjectEvaluation/aolbackend.projects.v2
  10. 36
      .vscode/launch.json
  11. 41
      .vscode/tasks.json
  12. 11
      Contracts/Catalogos/ICatClientesRepository.cs
  13. 44
      Controllers/Catalogos/CatClientesController.cs
  14. 9
      Models/Catalogos/ICatClientes.cs
  15. 9
      Models/Catalogos/ICatProveedores.cs
  16. 9
      Models/Catalogos/IOrigenDestino.cs
  17. 4
      Program.cs
  18. 50
      Repository/Catalogos/CatClientesRepository.cs
  19. 6
      Repository/UsuariosRepository.cs
  20. BIN
      bin/Debug/net6.0/AOLBackend.dll
  21. BIN
      bin/Debug/net6.0/AOLBackend.pdb
  22. 2
      obj/Debug/net6.0/AOLBackend.csproj.CoreCompileInputs.cache
  23. BIN
      obj/Debug/net6.0/AOLBackend.dll
  24. BIN
      obj/Debug/net6.0/AOLBackend.pdb
  25. BIN
      obj/Debug/net6.0/ref/AOLBackend.dll
  26. BIN
      obj/Debug/net6.0/refint/AOLBackend.dll
  27. 16
      obj/staticwebassets.pack.sentinel

400
.gitignore vendored

@ -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

Binary file not shown.

Binary file not shown.

@ -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:7000/swagger/index.html"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

41
.vscode/tasks.json vendored

@ -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,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,44 @@
using AOLBackend.Contracts.Catalogos;
using AOLBackend.DTO;
using AOLBackend.DTO.Usuario;
using AOLBackend.Models.Catalogos;
using Microsoft.AspNetCore.Mvc;
namespace AOLBackend.Controllers.Catalogos
{
[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,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,9 @@
namespace AOLBackend.Models.Catalogos
{
public class IOrigenDestino
{
public int Id { get; set; }
public string Ubicacion { get; set; } = null!;
public Byte Activo { get; set; } = 0!;
}
}

@ -1,6 +1,8 @@
using AOLBackend.Context;
using AOLBackend.Contracts;
using AOLBackend.Contracts.Catalogos;
using AOLBackend.Repository;
using AOLBackend.Repository.Catalogos;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using System.Text;
@ -8,7 +10,7 @@ using System.Text;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<DapperContext>();
builder.Services.AddScoped<IUsuarioRepository, UsuariosRepository>();
builder.Services.AddScoped<IMenuRepository, MenuRepository>();
builder.Services.AddScoped<ICatClientesRepository, CatClientesRepository>();
builder.Services.AddControllers();
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options =>

@ -0,0 +1,50 @@
using AOLBackend.Context;
using AOLBackend.Contracts.Catalogos;
using AOLBackend.DTO;
using AOLBackend.DTO.Usuario;
using AOLBackend.Models.Catalogos;
using AOLBackend.Services.Tools;
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 = "[Catalogo.CatClientes.Append]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<ICatClientes>(query, new
{
@id = data.id,
@Cliente = data.Cliente,
}, commandType: CommandType.StoredProcedure);
return entrada.First();
}
public async Task<IEnumerable<ICatClientes>> GetAll()
{
var query = "[Catalogo.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 = "[Catalogo.CatClientes.Delete]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<ICatClientes>(query, new { @id }, commandType: CommandType.StoredProcedure);
return true;
}
}
}

@ -64,9 +64,9 @@ namespace AOLBackend.Repository
@HashContrasena = passwordCrypto,
}, commandType: CommandType.StoredProcedure);
IUsuarios userFound = usuarios.First();
if (userFound == null) return userFound;
if (userFound == null) return userFound!;
var hashed = CryptDecrypt.Decrypt(userFound.Contrasena);
if (hashed != user.Contrasena) return null;
if (hashed != user.Contrasena) return null!;
return userFound;
}
}
@ -93,7 +93,7 @@ namespace AOLBackend.Repository
@Contrasena = user.Contrasena,
@HashContrasena = CryptDecrypt.Encrypt(user.Contrasena),
}, commandType: CommandType.StoredProcedure);
if (usuarios.Count() == 0) return null;
if (usuarios.Count() == 0) return null!;
var userFound = usuarios.First();
return userFound;
}

Binary file not shown.

Binary file not shown.

@ -1 +1 @@
dc389e70f51037c3ad713438898afdabc9e24613
5c4d83d23e299243135bbd3e0f354dc85d91df62

Binary file not shown.

Binary file not shown.

@ -20,3 +20,19 @@
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0
2.0

Loading…
Cancel
Save