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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user