git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C18
This commit is contained in:
parent
b1f0cb1687
commit
85bf374d2d
7 changed files with 158 additions and 52 deletions
|
|
@ -182,6 +182,7 @@
|
||||||
<Compile Include="App_Start\RouteConfig.cs" />
|
<Compile Include="App_Start\RouteConfig.cs" />
|
||||||
<Compile Include="App_Start\Startup.Auth.cs" />
|
<Compile Include="App_Start\Startup.Auth.cs" />
|
||||||
<Compile Include="App_Start\WebApiConfig.cs" />
|
<Compile Include="App_Start\WebApiConfig.cs" />
|
||||||
|
<Compile Include="ControllersWebApi\Matenimimento\EmisorAPIController.cs" />
|
||||||
<Compile Include="Controllers\AccountController.cs" />
|
<Compile Include="Controllers\AccountController.cs" />
|
||||||
<Compile Include="Controllers\BaseController.cs" />
|
<Compile Include="Controllers\BaseController.cs" />
|
||||||
<Compile Include="Controllers\Catalogos\CatalogosController.cs" />
|
<Compile Include="Controllers\Catalogos\CatalogosController.cs" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
using AYA.SlnSinortModel.DAL.Sinort;
|
||||||
|
using AYA.SlnSinortModel.Entidades;
|
||||||
|
using AYA.SlnSinortModel.Synort;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Http;
|
||||||
|
|
||||||
|
namespace AYA.SlnSinort.ControllersWebApi.Matenimimento
|
||||||
|
{
|
||||||
|
public class EmisorAPIController : ApiController
|
||||||
|
{
|
||||||
|
#region Emisor
|
||||||
|
[HttpGet]
|
||||||
|
public List<Emisor> ObtenerEmisor()
|
||||||
|
{
|
||||||
|
List<Emisor> respuesta = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
respuesta = new EmisorDAL().ObtenerEmisor();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
return respuesta;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public BaseJson InsertarActualizarEmisor(Emisor model)
|
||||||
|
{
|
||||||
|
BaseJson respuesta = new BaseJson();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
respuesta = new EmisorDAL().InsertarActualizarEmisor(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
return respuesta;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -48,7 +48,7 @@ this.getDataModel = function () {
|
||||||
this.obtenerItems = function () {
|
this.obtenerItems = function () {
|
||||||
|
|
||||||
|
|
||||||
var uri = CatalogosWCF + '/api/ObtenerEmisor';
|
var uri = server + 'api/EmisorAPI/ObtenerEmisor';
|
||||||
|
|
||||||
var DTO = JSON.stringify(Item);
|
var DTO = JSON.stringify(Item);
|
||||||
STARTREQUEST();
|
STARTREQUEST();
|
||||||
|
|
@ -66,7 +66,7 @@ this.obtenerItems = function () {
|
||||||
$('#TableItems').TableInit(0, false, true, true, false, null, null);
|
$('#TableItems').TableInit(0, false, true, true, false, null, null);
|
||||||
|
|
||||||
var TableItems = $('#TableItems').DataTable();
|
var TableItems = $('#TableItems').DataTable();
|
||||||
var lista = data.d;
|
var lista = data;
|
||||||
|
|
||||||
$.each(lista, function (key, item) {
|
$.each(lista, function (key, item) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
var CatalogosWCF = $("#hiddenSinortCatalogosWCF").val();
|
var CatalogosWCF = $("#hiddenSinortCatalogosWCF").val();
|
||||||
var SinortWCF = $("#hiddenSinortWCF").val();
|
var SinortWCF = $("#hiddenSinortWCF").val();
|
||||||
var server = "http://" + location.host + "/AYA.SlnSynor.WCF/";
|
var server = "http://" + location.host + "/AYA.SlnSynor/";
|
||||||
|
|
||||||
function Mensajes(mensaje) {
|
function Mensajes(mensaje) {
|
||||||
if (mensaje.CodigoRespuesta === "1") {
|
if (mensaje.CodigoRespuesta === "1") {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
|
|
||||||
#region InsertarActualizar
|
#region InsertarActualizar
|
||||||
|
|
||||||
public BaseJson InsertarActualizarCliente(Emisor model)
|
public BaseJson InsertarActualizarEmisor(Emisor model)
|
||||||
{
|
{
|
||||||
Emisor Actual = new Emisor();
|
Emisor Actual = new Emisor();
|
||||||
BaseJson Respuesta = new BaseJson();
|
BaseJson Respuesta = new BaseJson();
|
||||||
|
|
@ -111,43 +111,43 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BaseJson ModificarEstadoEmisorPN(Emisor model)
|
//public BaseJson ModificarEstadoEmisorPN(Emisor model)
|
||||||
{
|
//{
|
||||||
BaseJson Respuesta = new BaseJson();
|
// BaseJson Respuesta = new BaseJson();
|
||||||
Emisor Actual = new Emisor();
|
// Emisor Actual = new Emisor();
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
using (SinortContex Conn = new SinortContex())
|
// using (SinortContex Conn = new SinortContex())
|
||||||
{
|
// {
|
||||||
Emisor _model = Conn.Emisor.Where(x => x.IdEmisor == model.IdEmisor).FirstOrDefault();
|
// Emisor _model = Conn.Emisor.Where(x => x.IdEmisor == model.IdEmisor).FirstOrDefault();
|
||||||
if (_model != null)
|
// if (_model != null)
|
||||||
{
|
// {
|
||||||
_model.Estado = model.Estado;
|
// _model.Estado = model.Estado;
|
||||||
_model.UsuarioModificacion = "jnunez";
|
// _model.UsuarioModificacion = "jnunez";
|
||||||
_model.FechaModificacion = DateTime.Now;
|
// _model.FechaModificacion = DateTime.Now;
|
||||||
Conn.SaveChanges();
|
// Conn.SaveChanges();
|
||||||
Respuesta.CodigoRespuesta = Constantes.TipoCodigoRespuesta.EXITOSO.ToString();
|
// Respuesta.CodigoRespuesta = Constantes.TipoCodigoRespuesta.EXITOSO.ToString();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
catch (DbEntityValidationException ex)
|
// catch (DbEntityValidationException ex)
|
||||||
{
|
// {
|
||||||
//logger.Error(exs);
|
// //logger.Error(exs);
|
||||||
Respuesta.CodigoRespuesta = Constantes.TipoCodigoRespuesta.ERROR.ToString();
|
// Respuesta.CodigoRespuesta = Constantes.TipoCodigoRespuesta.ERROR.ToString();
|
||||||
}
|
// }
|
||||||
catch (Exception ex)
|
// catch (Exception ex)
|
||||||
{
|
// {
|
||||||
//logger.Error(ex);
|
// //logger.Error(ex);
|
||||||
Respuesta.CodigoRespuesta = Constantes.TipoCodigoRespuesta.ERROR.ToString();
|
// Respuesta.CodigoRespuesta = Constantes.TipoCodigoRespuesta.ERROR.ToString();
|
||||||
}
|
// }
|
||||||
finally
|
// finally
|
||||||
{
|
// {
|
||||||
Actual = null;
|
// Actual = null;
|
||||||
}
|
// }
|
||||||
return Respuesta;
|
// return Respuesta;
|
||||||
|
|
||||||
|
|
||||||
}
|
//}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ namespace AYA.SlnSinortModel.Sinort.Partial
|
||||||
private bool WasCommitted = false;
|
private bool WasCommitted = false;
|
||||||
private bool disposed = false;
|
private bool disposed = false;
|
||||||
public Contex()
|
public Contex()
|
||||||
: base("data source=192.168.1.37;initial catalog=SinortAyA;persist security info=True;user id=sinort;password=sinort2018;MultipleActiveResultSets=True;App=EntityFramework")
|
: base(new Atesa.Utilitarios.ObtieneParametros().GetValueKeyRegedit("SinortAyAConnectionString", false))
|
||||||
{
|
{
|
||||||
var instacia = System.Data.Entity.SqlServer.SqlProviderServices.Instance;
|
|
||||||
Database.SetInitializer<Contex>(null);
|
Database.SetInitializer<Contex>(null);
|
||||||
Configuration.ProxyCreationEnabled = false;
|
Configuration.ProxyCreationEnabled = false;
|
||||||
Configuration.LazyLoadingEnabled = true;
|
Configuration.LazyLoadingEnabled = true;
|
||||||
|
|
|
||||||
|
|
@ -10,24 +10,77 @@ namespace Atesa.Utilitarios
|
||||||
public class ObtieneParametros
|
public class ObtieneParametros
|
||||||
{
|
{
|
||||||
|
|
||||||
public string GetValueKeyRegedit(string SubKey, string Key, bool Decrypt)
|
private string key = @"SOFTWARE\\Parametros";
|
||||||
|
|
||||||
|
public void AddValueKeyRegedit(string KeyStringName, string KeyStringValue, bool Encrypt)
|
||||||
{
|
{
|
||||||
string Respuesta = string.Empty;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (RegistryKey RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE"))
|
RegistryKey key2 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32).OpenSubKey(this.key, true);
|
||||||
|
if (key2 != null)
|
||||||
{
|
{
|
||||||
RegistryKey SubRegistryKey = RegistryKey.OpenSubKey(SubKey);
|
if (Encrypt)
|
||||||
Respuesta = SubRegistryKey.GetValue(Key, "Value", RegistryValueOptions.DoNotExpandEnvironmentNames).ToString();
|
{
|
||||||
}
|
//key2.SetValue(KeyStringName, new Crypt().EncryptString(KeyStringValue), RegistryValueKind.String);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
key2.SetValue(KeyStringName, KeyStringValue, RegistryValueKind.String);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch
|
||||||
{
|
{
|
||||||
|
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
return Respuesta;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dictionary<string, object> GetRegistrySubKeys()
|
||||||
|
{
|
||||||
|
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
||||||
|
using (RegistryKey key2 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32).OpenSubKey(this.key))
|
||||||
|
{
|
||||||
|
if (key2 == null)
|
||||||
|
{
|
||||||
|
return dictionary;
|
||||||
|
}
|
||||||
|
string[] valueNames = key2.GetValueNames();
|
||||||
|
foreach (string str in valueNames)
|
||||||
|
{
|
||||||
|
object obj2 = key2.GetValue(str);
|
||||||
|
dictionary.Add(str, obj2);
|
||||||
|
}
|
||||||
|
key2.Close();
|
||||||
|
}
|
||||||
|
return dictionary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetValueKeyRegedit(string KeyStringName, bool Decrypt)
|
||||||
|
{
|
||||||
|
string str = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RegistryKey key2 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32).OpenSubKey(this.key, false);
|
||||||
|
if (key2 == null)
|
||||||
|
{
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
if (Decrypt)
|
||||||
|
{
|
||||||
|
//str = new Crypt().DecryptString(Convert.ToString(key2.GetValue(KeyStringName)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str = Convert.ToString(key2.GetValue(KeyStringName));
|
||||||
|
}
|
||||||
|
key2.Close();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue