53 lines
2.0 KiB
C#
53 lines
2.0 KiB
C#
using Microsoft.Extensions.Configuration;
|
|||
|
|
using Net.Business.Entities;
|
||
|
|
using Net.Business.Entities.ServicesLayer;
|
||
|
|
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_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());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|