Commit inicial: ITCA_API_SAP_WMS (.NET Core 3.1)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
2b82744eb8
168 files changed
+11066
No files matched your search
@@ -0,0 +1,78 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Connection;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.Constantes;
|
||||
using Net.CrossCotting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer
|
||||
{
|
||||
public class BusinessPartnersRepository : IBusinessPartnersRepository
|
||||
{
|
||||
#region Variables Globales
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
private readonly IConnectionSQL _context;
|
||||
#endregion
|
||||
|
||||
public BusinessPartnersRepository(IHttpClientFactory clientFactory, IConfiguration configuration, IConnectionSQL context)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
_context = context;
|
||||
}
|
||||
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BusinessPartners>> GetBusinessPartnersByFilter(FE_BusinessPartners entidad)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BusinessPartners> resultadoTransaccion = new ResultadoTransaccion<BE_BusinessPartners>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
string select = "select= CardCode, CardName,CardType, FederalTaxID,Address,EmailAddress,Phone1";
|
||||
|
||||
entidad.CardCode = string.IsNullOrEmpty(entidad.CardCode) ? string.Empty : entidad.CardCode;
|
||||
entidad.CardName = string.IsNullOrEmpty(entidad.CardName) ? string.Empty : entidad.CardName;
|
||||
entidad.FederalTaxID = string.IsNullOrEmpty(entidad.FederalTaxID) ? string.Empty : entidad.FederalTaxID;
|
||||
|
||||
string cadena = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(entidad.CardCode))
|
||||
{
|
||||
cadena = string.Format("{0}?$filter = Valid eq 'tYES' and CardCode eq '{1}' &${2}", StoreProcedure.SP_SERVICES_LAYER_BUSINESSPARTNERS, entidad.CardCode, select);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(entidad.CardName))
|
||||
{
|
||||
cadena = string.Format("{0}?$filter = Valid eq 'tYES' and CardName eq '{1}' &${2}", StoreProcedure.SP_SERVICES_LAYER_BUSINESSPARTNERS, entidad.CardName, select);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(entidad.FederalTaxID))
|
||||
{
|
||||
cadena = string.Format("{0}?$filter = Valid eq 'tYES' and FederalTaxID eq '{1}' &${2}", StoreProcedure.SP_SERVICES_LAYER_BUSINESSPARTNERS, entidad.FederalTaxID, select);
|
||||
}
|
||||
|
||||
int maxpagesize = 0;
|
||||
List<BE_BusinessPartners> objectList = await _connectServiceLayer.GetAsync<BE_BusinessPartners>(cadena, maxpagesize);
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, 0, "Se Listo correctamento...!!!", objectList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer
|
||||
{
|
||||
public interface IBusinessPartnersRepository
|
||||
{
|
||||
Task<BE_ResultadoTransaccion<BE_BusinessPartners>> GetBusinessPartnersByFilter(FE_BusinessPartners entidad);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.CreditNotes;
|
||||
using Net.Connection;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.CrossCotting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.CreditNotes
|
||||
{
|
||||
public class CreditNotesRepository : ICreditNotesRepository
|
||||
{
|
||||
|
||||
#region Variables Globales
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
private readonly IConnectionSQL _context;
|
||||
#endregion
|
||||
|
||||
public CreditNotesRepository(IHttpClientFactory clientFactory, IConfiguration configuration, IConnectionSQL context)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateCreditNotes(BE_CreditNotesNotes entidad)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
//var cadena = "Drafts";
|
||||
var cadena = "CreditNotes";
|
||||
var data = await _connectServiceLayer.PostAsync<BE_BaseResponseSap>(cadena, entidad);
|
||||
|
||||
if (!data.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, data.Mensaje);
|
||||
}
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> UpdateCreateCreditNotes(dynamic entidad, int DocEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
//var cadena = "Drafts";
|
||||
var cadena = $"CreditNotes({DocEntry})";
|
||||
var data = await _connectServiceLayer.PatchAsyncSBA<BE_BaseResponseSap>(cadena, entidad);
|
||||
if (!data.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, data.Mensaje);
|
||||
}
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.CreditNotes;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.CreditNotes
|
||||
{
|
||||
public interface ICreditNotesRepository
|
||||
{
|
||||
Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateCreditNotes(BE_CreditNotesNotes entidad);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.CreditNotes;
|
||||
using Net.Business.Entities.ServicesLayer.HR;
|
||||
using Net.Business.Entities.ServicesLayer.Invoices;
|
||||
using Net.Connection;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.CrossCotting;
|
||||
using Net.Data.HelperData.HojaRuta;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.GlobalData
|
||||
{
|
||||
public class GlobalDataRepository : IGlobalDataRepository
|
||||
{
|
||||
|
||||
#region Variables Globales
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
private readonly IConnectionSQL _context;
|
||||
#endregion
|
||||
|
||||
public GlobalDataRepository(IHttpClientFactory clientFactory, IConfiguration configuration, IConnectionSQL context)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<ITC_SOLSALMER>> GetSolicitudSalida(int DocEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<ITC_SOLSALMER> resultadoTransaccion = new ResultadoTransaccion<ITC_SOLSALMER>(_metodoName, _aplicacionName);
|
||||
try
|
||||
{
|
||||
|
||||
string cadena = $"ITC_SOLSALMER({DocEntry})";
|
||||
int maxpagesize = 0;
|
||||
List<ITC_SOLSALMER> objectList = await _connectServiceLayer.GetAsync<ITC_SOLSALMER>(cadena, maxpagesize, true);
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, 0, "Se Listo correctamento...!!!", objectList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<ITC_SOLINGMER>> GetSolicitudIngreso(int DocEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<ITC_SOLINGMER> resultadoTransaccion = new ResultadoTransaccion<ITC_SOLINGMER>(_metodoName, _aplicacionName);
|
||||
try
|
||||
{
|
||||
|
||||
string cadena = $"ITC_SOLINGMER({DocEntry})";
|
||||
int maxpagesize = 0;
|
||||
List<ITC_SOLINGMER> objectList = await _connectServiceLayer.GetAsync<ITC_SOLINGMER>(cadena, maxpagesize, true);
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, 0, "Se Listo correctamento...!!!", objectList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.CreditNotes;
|
||||
using Net.Business.Entities.ServicesLayer.HR;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.GlobalData
|
||||
{
|
||||
public interface IGlobalDataRepository
|
||||
{
|
||||
Task<BE_ResultadoTransaccion<ITC_SOLSALMER>> GetSolicitudSalida(int DocEntry);
|
||||
Task<BE_ResultadoTransaccion<ITC_SOLINGMER>> GetSolicitudIngreso(int DocEntry);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.CreditNotes;
|
||||
using Net.Business.Entities.ServicesLayer.HR;
|
||||
using Net.Connection;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.CrossCotting;
|
||||
using Net.Data.HelperData.HojaRuta;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.HR
|
||||
{
|
||||
public class HRRepository : IHRRepository
|
||||
{
|
||||
|
||||
#region Variables Globales
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
private readonly IConnectionSQL _context;
|
||||
#endregion
|
||||
|
||||
public HRRepository(IHttpClientFactory clientFactory, IConfiguration configuration, IConnectionSQL context)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<object>> SetCreateHojaRuta(BE_HojaRutaCreate entidad)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<object> resultadoTransaccion = new ResultadoTransaccion<object>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
int Indice = 1;
|
||||
List<HojaRutaDetailsEntities> detalle = new List<HojaRutaDetailsEntities>();
|
||||
entidad.Detalle.ForEach(item =>
|
||||
{
|
||||
var data = HelperHojaRuta.Get(Convert.ToInt32(item.CodigoInterno));
|
||||
var linea = data.FirstOrDefault();
|
||||
linea.LineId = Indice;
|
||||
detalle.Add(linea);
|
||||
|
||||
Indice++;
|
||||
});
|
||||
|
||||
HojaRutaSAP HojaRuta = new HojaRutaSAP()
|
||||
{
|
||||
ARD_PCK_HJRT_DETCollection = new List<HojaRutaDetailsEntities>(),
|
||||
U_ARD_PHR_PLACA = entidad.PlacaVehiculo,
|
||||
U_ARD_PHR_TERRI = entidad.Territorio,
|
||||
U_ARD_PHR_ZONDIS = entidad.Zona,
|
||||
U_ARD_PHR_FECCRE = entidad.FechaDespacho,
|
||||
U_ARD_PHR_MODTRANSP = entidad.ModalidadTransporte,
|
||||
U_ARD_PHR_NOMDESP = entidad.Despachador,
|
||||
U_ARD_PHR_ESTDESP = "Embarcado",
|
||||
U_ARD_PHR_RUCAGENTRANS = entidad.AgenciaTransporte,
|
||||
U_ARD_PHR_LICCON = entidad.LicenciaConductor,
|
||||
U_MSV_PKH_ORIG = "Y",
|
||||
U_ARD_PHR_CNTDOC = entidad.Detalle.Count()
|
||||
};
|
||||
|
||||
//if(entidad.ModalidadTransporte == "Privado")
|
||||
//{
|
||||
// HojaRuta = new HojaRutaSAP()
|
||||
// {
|
||||
// ARD_PCK_HJRT_DETCollection = new List<HojaRutaDetailsEntities>(),
|
||||
// U_ARD_PHR_PLACA = entidad.PlacaVehiculo,
|
||||
// U_ARD_PHR_TERRI = entidad.Territorio,
|
||||
// U_ARD_PHR_ZONDIS = entidad.Zona,
|
||||
// U_ARD_PHR_FECCRE = entidad.FechaDespacho,
|
||||
// U_ARD_PHR_MODTRANSP = entidad.ModalidadTransporte,
|
||||
// U_ARD_PHR_NOMDESP = entidad.Despachador,
|
||||
// U_ARD_PHR_NOMAGENTRANS = "ARDICORP S.A.C.",
|
||||
// U_ARD_PHR_CODAGENTRANS = "P20136836545",
|
||||
// U_ARD_PHR_RUCAGENTRANS = "20136836545",
|
||||
// U_ARD_PHR_ESTDESP = "Embarcado"
|
||||
// };
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
HojaRuta.ARD_PCK_HJRT_DETCollection = detalle;
|
||||
|
||||
var cadena = "ARD_PHR";
|
||||
var data = await _connectServiceLayer.PostAsync<BE_BaseResponseSap>(cadena, HojaRuta);
|
||||
|
||||
if (!data.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(data.Mensaje.ToString(), entidad);
|
||||
}
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado((int)data.DocEntry, data.DocNum.ToString(), "Se Listo correctamento...!!!", entidad);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(ex.Message, entidad);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> UpdateCreateCreditNotes(dynamic entidad, int DocEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
//var cadena = "Drafts";
|
||||
var cadena = $"CreditNotes({DocEntry})";
|
||||
var data = await _connectServiceLayer.PatchAsyncSBA<BE_BaseResponseSap>(cadena, entidad);
|
||||
if (!data.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, data.Mensaje);
|
||||
}
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.CreditNotes;
|
||||
using Net.Business.Entities.ServicesLayer.HR;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.HR
|
||||
{
|
||||
public interface IHRRepository
|
||||
{
|
||||
Task<BE_ResultadoTransaccion<object>> SetCreateHojaRuta(BE_HojaRutaCreate entidad);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.InventoryGenEntries;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Net.Data.ServicesLayer.InventoryGenEntries
|
||||
{
|
||||
public interface IInventoryGenEntriesRepository
|
||||
{
|
||||
Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateInventoryGenEntries(BE_InventoryGenEntries entidad, bool Drafts = true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.InventoryGenEntries;
|
||||
using Net.Connection;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.CrossCotting;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.InventoryGenEntries
|
||||
{
|
||||
public class InventoryGenEntriesRepository : IInventoryGenEntriesRepository
|
||||
{
|
||||
#region Variables Globales
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
private readonly IConnectionSQL _context;
|
||||
private readonly IHttpClientFactory _clientFactory;
|
||||
private readonly IConfiguration _configuration;
|
||||
#endregion
|
||||
|
||||
|
||||
public InventoryGenEntriesRepository(IHttpClientFactory clientFactory, IConfiguration configuration, IConnectionSQL context)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
|
||||
//Inicializamos los servicios de services layer
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
_context = context;
|
||||
_clientFactory = clientFactory;
|
||||
_configuration = configuration;
|
||||
|
||||
}
|
||||
|
||||
// VENTAS PARA SAP
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateInventoryGenEntries(BE_InventoryGenEntries entidad, bool Draft = true)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = Draft ? "Drafts" : "InventoryGenEntries";
|
||||
var dataResponseInvoice = await _connectServiceLayer.PostAsync<BE_BaseResponseSap>(cadena, entidad);
|
||||
|
||||
if (!dataResponseInvoice.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, dataResponseInvoice.Mensaje);
|
||||
}
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se registró correctamento...!!!", dataResponseInvoice);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.InventoryGenEntries;
|
||||
using Net.Business.Entities.ServicesLayer.InventoryGenExits;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Net.Data.ServicesLayer.InventoryGenExits
|
||||
{
|
||||
public interface IInventoryGenExitsRepository
|
||||
{
|
||||
Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateInventoryGenExits(BE_InventoryGenExits entidad, bool Drafts = true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.InventoryGenEntries;
|
||||
using Net.Business.Entities.ServicesLayer.InventoryGenExits;
|
||||
using Net.Connection;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.CrossCotting;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.InventoryGenExits
|
||||
{
|
||||
public class InventoryGenExitsRepository : IInventoryGenExitsRepository
|
||||
{
|
||||
#region Variables Globales
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
private readonly IConnectionSQL _context;
|
||||
private readonly IHttpClientFactory _clientFactory;
|
||||
private readonly IConfiguration _configuration;
|
||||
#endregion
|
||||
|
||||
|
||||
public InventoryGenExitsRepository(IHttpClientFactory clientFactory, IConfiguration configuration, IConnectionSQL context)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
|
||||
//Inicializamos los servicios de services layer
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
_context = context;
|
||||
_clientFactory = clientFactory;
|
||||
_configuration = configuration;
|
||||
|
||||
}
|
||||
|
||||
// VENTAS PARA SAP
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateInventoryGenExits(BE_InventoryGenExits entidad, bool Drafts = true)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = Drafts ? "Drafts": "InventoryGenExits";
|
||||
var dataResponseInvoice = await _connectServiceLayer.PostAsync<BE_BaseResponseSap>(cadena, entidad);
|
||||
|
||||
if (!dataResponseInvoice.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, dataResponseInvoice.Mensaje);
|
||||
}
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se registró correctamento...!!!", dataResponseInvoice);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.Invoices;
|
||||
using Net.Connection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Net.Data.ServicesLayer
|
||||
{
|
||||
public interface IInvoiceRepository
|
||||
{
|
||||
|
||||
Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateInvoices(BE_Invoices entidad);
|
||||
Task<BE_ResultadoTransaccion<BE_InvoicesConsulta>> GetInvoice(int docEntry);
|
||||
Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> ReOpen(int docEntry);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.Invoices;
|
||||
using Net.Connection;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.Constantes;
|
||||
using Net.CrossCotting;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer
|
||||
{
|
||||
public class InvoiceRepository : IInvoiceRepository
|
||||
{
|
||||
#region Variables Globales
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
private readonly IConnectionSQL _context;
|
||||
private readonly IHttpClientFactory _clientFactory;
|
||||
private readonly IConfiguration _configuration;
|
||||
#endregion
|
||||
|
||||
|
||||
public InvoiceRepository(IHttpClientFactory clientFactory, IConfiguration configuration, IConnectionSQL context)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
|
||||
//Inicializamos los servicios de services layer
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
_context = context;
|
||||
_clientFactory = clientFactory;
|
||||
_configuration = configuration;
|
||||
|
||||
}
|
||||
|
||||
// VENTAS PARA SAP
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateInvoices(BE_Invoices entidad)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = "Invoices";
|
||||
var dataResponseInvoice = await _connectServiceLayer.PostAsync<BE_BaseResponseSap>(cadena, entidad);
|
||||
|
||||
if (!dataResponseInvoice.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, dataResponseInvoice.Mensaje);
|
||||
}
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se registró correctamento...!!!", dataResponseInvoice);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
// GET INVOICES
|
||||
public async Task<BE_ResultadoTransaccion<BE_InvoicesConsulta>> GetInvoice(int docEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_InvoicesConsulta> resultadoTransaccion = new ResultadoTransaccion<BE_InvoicesConsulta>(_metodoName, _aplicacionName);
|
||||
try
|
||||
{
|
||||
|
||||
string cadena = $"Invoices({docEntry})";
|
||||
int maxpagesize = 0;
|
||||
List<BE_InvoicesConsulta> objectList = await _connectServiceLayer.GetAsync<BE_InvoicesConsulta>(cadena, maxpagesize,true);
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, 0, "Se Listo correctamento...!!!", objectList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> ReOpen(int docEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
try
|
||||
{
|
||||
|
||||
string cadena = $"Invoices({docEntry})/Reopen";
|
||||
var dataResponseInvoice = await _connectServiceLayer.PostReOpen<BE_BaseResponseSap>(cadena);
|
||||
|
||||
if (!dataResponseInvoice.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, dataResponseInvoice.Mensaje);
|
||||
}
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se registró correctamento...!!!", dataResponseInvoice);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.PurchaseDeliveryNotes;
|
||||
using Net.Connection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer
|
||||
{
|
||||
public interface IPurchaseDeliveryNotesRepository
|
||||
{
|
||||
Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreatePurchaseDeliveryNotes(BE_PurchaseDeliveryNotes entidad);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.PurchaseDeliveryNotes;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.CrossCotting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer
|
||||
{
|
||||
public class PurchaseDeliveryNotesRepository : IPurchaseDeliveryNotesRepository
|
||||
{
|
||||
#region Variables Globales
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
#endregion
|
||||
|
||||
public PurchaseDeliveryNotesRepository(IHttpClientFactory clientFactory, IConfiguration configuration)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreatePurchaseDeliveryNotes(BE_PurchaseDeliveryNotes entidad)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = "PurchaseDeliveryNotes";
|
||||
var data = await _connectServiceLayer.PostAsync<BE_BaseResponseSap>(cadena, entidad);
|
||||
|
||||
if (!data.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, data.Mensaje);
|
||||
}
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GET INVOICES
|
||||
public async Task<BE_ResultadoTransaccion<BE_PurchaseDeliveryNotes>> GetPurchaseDeliveryNotes(int docEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_PurchaseDeliveryNotes> resultadoTransaccion = new ResultadoTransaccion<BE_PurchaseDeliveryNotes>(_metodoName, _aplicacionName);
|
||||
try
|
||||
{
|
||||
|
||||
string cadena = $"PurchaseDeliveryNotes({docEntry})";
|
||||
int maxpagesize = 0;
|
||||
List<BE_PurchaseDeliveryNotes> objectList = await _connectServiceLayer.GetAsync<BE_PurchaseDeliveryNotes>(cadena, maxpagesize, true);
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, 0, "Se Listo correctamento...!!!", objectList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.PurchaseInvoices;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer
|
||||
{
|
||||
public interface IPurchaseInvoicesRepository
|
||||
{
|
||||
Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreatePurchaseInvoices(BE_PurchaseInvoices entidad);
|
||||
Task<BE_ResultadoTransaccion<BE_PurchaseInvoices>> GetPurchaseInvoices(int DocEntry);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.PurchaseInvoices;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.CrossCotting;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer
|
||||
{
|
||||
public class PurchaseInvoicesRepository: IPurchaseInvoicesRepository
|
||||
{
|
||||
#region Variables Globales
|
||||
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
|
||||
#endregion
|
||||
|
||||
public PurchaseInvoicesRepository(IHttpClientFactory clientFactory, IConfiguration configuration)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreatePurchaseInvoices(BE_PurchaseInvoices entidad)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = "PurchaseInvoices";
|
||||
var data = await _connectServiceLayer.PostAsync<BE_BaseResponseSap>(cadena, entidad);
|
||||
|
||||
if (!data.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, data.Mensaje);
|
||||
}
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_PurchaseInvoices>> GetPurchaseInvoices(int DocEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_PurchaseInvoices> resultadoTransaccion = new ResultadoTransaccion<BE_PurchaseInvoices>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = $"PurchaseInvoices({DocEntry})";
|
||||
var data = await _connectServiceLayer.GetAsync<BE_PurchaseInvoices>(cadena, 0, true);
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, 0, "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.PurchaseInvoices;
|
||||
using Net.Business.Entities.ServicesLayer.PurchaseOrders;
|
||||
using Net.Connection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer
|
||||
{
|
||||
public interface IPurchaseOrdersRepository
|
||||
{
|
||||
Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreatePurchaseInvoices(BE_PurchaseInvoices entidad);
|
||||
Task<BE_ResultadoTransaccion<BE_PurchaseOrders>> GetPurchaseInvoices(int DocEntry);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.PurchaseInvoices;
|
||||
using Net.Business.Entities.ServicesLayer.PurchaseOrders;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.CrossCotting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer
|
||||
{
|
||||
public class PurchaseOrdersRepository : IPurchaseOrdersRepository
|
||||
{
|
||||
#region Variables Globales
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
#endregion
|
||||
|
||||
public PurchaseOrdersRepository(IHttpClientFactory clientFactory, IConfiguration configuration)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreatePurchaseInvoices(BE_PurchaseInvoices entidad)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = "PurchaseInvoices";
|
||||
var data = await _connectServiceLayer.PostAsync<BE_BaseResponseSap>(cadena, entidad);
|
||||
|
||||
if (!data.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, data.Mensaje);
|
||||
}
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_PurchaseOrders>> GetPurchaseInvoices(int DocEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_PurchaseOrders> resultadoTransaccion = new ResultadoTransaccion<BE_PurchaseOrders>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = $"PurchaseOrders({DocEntry})";
|
||||
var data = await _connectServiceLayer.GetAsync<BE_PurchaseOrders>(cadena, 0, true);
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, 0, "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.ReturnRequest;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.ReturnRequest
|
||||
{
|
||||
public interface IReturnRequestRepository
|
||||
{
|
||||
Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateReturnRequest(BE_ReturnRequest entidad);
|
||||
Task<BE_ResultadoTransaccion<BE_ReturnRequest>> GetRequestReturn(int DocEntry);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer.PurchaseInvoices;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.ReturnRequest;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.CrossCotting;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.ReturnRequest
|
||||
{
|
||||
public class ReturnRequestRepository: IReturnRequestRepository
|
||||
{
|
||||
#region Variables Globales
|
||||
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
|
||||
#endregion
|
||||
|
||||
public ReturnRequestRepository(IHttpClientFactory clientFactory, IConfiguration configuration)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateReturnRequest(BE_ReturnRequest entidad)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = "ReturnRequest";
|
||||
var data = await _connectServiceLayer.PostAsync<BE_BaseResponseSap>(cadena, entidad);
|
||||
|
||||
if (!data.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, data.Mensaje);
|
||||
}
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_ReturnRequest>> GetRequestReturn(int DocEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_ReturnRequest> resultadoTransaccion = new ResultadoTransaccion<BE_ReturnRequest>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = $"ReturnRequest({DocEntry})";
|
||||
var data = await _connectServiceLayer.GetAsync<BE_ReturnRequest>(cadena, 0, true);
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, 0, "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.StockTransfer
|
||||
{
|
||||
public interface IStockTransferRepository
|
||||
{
|
||||
Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> StockTransfer(dynamic entidad);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.CrossCotting;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer.StockTransfer
|
||||
{
|
||||
public class StockTransferRepository: IStockTransferRepository
|
||||
{
|
||||
#region Variables Globales
|
||||
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
|
||||
#endregion
|
||||
|
||||
public StockTransferRepository(IHttpClientFactory clientFactory, IConfiguration configuration)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> StockTransfer(dynamic entidad)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = "StockTransfers";
|
||||
var data = await _connectServiceLayer.PostAsync<BE_BaseResponseSap>(cadena, entidad);
|
||||
|
||||
if (!data.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, data.Mensaje);
|
||||
}
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> CloseInventoryTransferRequest(int DocEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = $"InventoryTransferRequests({DocEntry})/Close";
|
||||
var data = await _connectServiceLayer.PostClose<BE_BaseResponseSap>(cadena);
|
||||
|
||||
if (!data.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, data.Mensaje);
|
||||
}
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> GetInventoryTransferRequest(int DocEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = $"InventoryTransferRequests({DocEntry})";
|
||||
var data = await _connectServiceLayer.GetAsync<BE_BaseResponseSap>(cadena, 0, true);
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, 0, "Se Listo correctamento...!!!", data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user