informes inventarios y otros
parent
54ff6326bd
commit
52b0dd99a9
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 14
|
||||||
|
VisualStudioVersion = 14.0.25420.1
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exferia_HotelPuntoVenta", "Exferia_HotelPuntoVenta\Exferia_HotelPuntoVenta.csproj", "{FCF4AD3B-19B9-468F-902E-3FAFED10ABFA}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{344B97CD-5DA3-4077-8036-30609186C2AB}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{FCF4AD3B-19B9-468F-902E-3FAFED10ABFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FCF4AD3B-19B9-468F-902E-3FAFED10ABFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FCF4AD3B-19B9-468F-902E-3FAFED10ABFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FCF4AD3B-19B9-468F-902E-3FAFED10ABFA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{344B97CD-5DA3-4077-8036-30609186C2AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{344B97CD-5DA3-4077-8036-30609186C2AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{344B97CD-5DA3-4077-8036-30609186C2AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{344B97CD-5DA3-4077-8036-30609186C2AB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
|
|
@ -0,0 +1,157 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPVH_Liquidaciones_Listado_Modelo : HPVH_Liquidaciones
|
||||||
|
{
|
||||||
|
public INTERNO_HPVH_Liquidaciones_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
#region Terminal
|
||||||
|
public string Terminal_Codigo { get; set; }
|
||||||
|
public string Terminal_Descripcion { get; set; }
|
||||||
|
public DateTime? Terminal_FechaBorrado { get; set; }
|
||||||
|
public string Terminal
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Terminal_Codigo != null && Terminal_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Terminal_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Terminal_Descripcion != null && Terminal_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Terminal_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Camarero_Inicial
|
||||||
|
public string Camarero_Inicial_Codigo { get; set; }
|
||||||
|
public string Camarero_Inicial_Descripcion { get; set; }
|
||||||
|
public DateTime? Camarero_Inicial_FechaBorrado { get; set; }
|
||||||
|
public string Camarero_Inicial
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Camarero_Inicial_Codigo != null && Camarero_Inicial_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Camarero_Inicial_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Camarero_Inicial_Descripcion != null && Camarero_Inicial_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Camarero_Inicial_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Camarero_Final
|
||||||
|
public string Camarero_Final_Codigo { get; set; }
|
||||||
|
public string Camarero_Final_Descripcion { get; set; }
|
||||||
|
public DateTime? Camarero_Final_FechaBorrado { get; set; }
|
||||||
|
public string Camarero_Final
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Camarero_Final_Codigo != null && Camarero_Final_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Camarero_Final_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Camarero_Final_Descripcion != null && Camarero_Final_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Camarero_Final_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Ejercicio
|
||||||
|
public GEN_EjerciciosActivos_Empresa Ejercicios_Empresa { get; set; }
|
||||||
|
public long idEjercicio
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Aux = -1;
|
||||||
|
|
||||||
|
if (Ejercicios_Empresa != null)
|
||||||
|
{
|
||||||
|
lng_Aux = Ejercicios_Empresa.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lng_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string Ejercicio
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Ejercicios_Empresa != null)
|
||||||
|
{
|
||||||
|
str_Aux = Ejercicios_Empresa.anioControl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo: HPV_AgrupacionesClientesCabeceras
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public bool Seleccionar { get; set; }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo: HPV_AgrupacionesPLVCabeceras
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public bool Seleccionar { get; set; }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo : HPV_AgrupacionesTerminales
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Seleccionar { get; set; }
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
using Exferia_Aplicacion.Modelos_Informes;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_AgrupacionesTerminales_Modelo : HPV_AgrupacionesTerminales
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_AgrupacionesTerminales_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public List<HPV_Terminales> Terminales { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_CamarerosPerfiles_Listado_Modelo : HPV_CamarerosPerfiles
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_CamarerosPerfiles_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,134 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Camareros_Listado_Modelo : HPV_Camareros
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Camareros_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Empleado
|
||||||
|
public string Empleado_Codigo { get; set; }
|
||||||
|
public string Empleado_Descripcion { get; set; }
|
||||||
|
public DateTime? Empleado_FechaBorrado { get; set; }
|
||||||
|
public string Empleado
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empleado_Codigo != null && Empleado_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empleado_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empleado_Descripcion != null && Empleado_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empleado_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//CamareroPerfil
|
||||||
|
public string CamareroPerfil_Codigo { get; set; }
|
||||||
|
public string CamareroPerfil_Descripcion { get; set; }
|
||||||
|
public DateTime? CamareroPerfil_FechaBorrado { get; set; }
|
||||||
|
public string CamareroPerfil
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (CamareroPerfil_Codigo != null && CamareroPerfil_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + CamareroPerfil_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (CamareroPerfil_Descripcion != null && CamareroPerfil_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += CamareroPerfil_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Proveedor
|
||||||
|
public string Proveedor_Codigo { get; set; }
|
||||||
|
public string Proveedor_Descripcion { get; set; }
|
||||||
|
public DateTime? Proveedor_FechaBorrado { get; set; }
|
||||||
|
public string Proveedor
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Proveedor_Codigo != null && Proveedor_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Proveedor_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Proveedor_Descripcion != null && Proveedor_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Proveedor_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_CaracteristicasTipos_Listado_Modelo : HPV_CaracteristicasTipos
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_CaracteristicasTipos_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Caracteristicas_Listado_Modelo : HPV_Caracteristicas
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Caracteristicas_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Seleccionar { get; set; }
|
||||||
|
public int Agrupado { get; set; }
|
||||||
|
|
||||||
|
//CaracteristicaTipo
|
||||||
|
public string CaracteristicaTipo_Codigo { get; set; }
|
||||||
|
public string CaracteristicaTipo_Descripcion { get; set; }
|
||||||
|
public DateTime? CaracteristicaTipo_FechaBorrado { get; set; }
|
||||||
|
public string CaracteristicaTipo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (CaracteristicaTipo_Codigo != null && CaracteristicaTipo_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + CaracteristicaTipo_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (CaracteristicaTipo_Descripcion != null && CaracteristicaTipo_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += CaracteristicaTipo_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,278 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Clientes_Listado_Modelo : HPV_Clientes
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Clientes_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public bool Seleccionar { get; set; }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SeccionMenu_Descripcion { get; set; }
|
||||||
|
|
||||||
|
//ImpuestoCabecera
|
||||||
|
public string ImpuestoCabecera_Codigo { get; set; }
|
||||||
|
public string ImpuestoCabecera_Descripcion { get; set; }
|
||||||
|
public DateTime? ImpuestoCabecera_FechaBorrado { get; set; }
|
||||||
|
public string ImpuestoCabecera
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (ImpuestoCabecera_Codigo != null && ImpuestoCabecera_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + ImpuestoCabecera_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (ImpuestoCabecera_Descripcion != null && ImpuestoCabecera_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += ImpuestoCabecera_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region DIRECCION FACTURACION
|
||||||
|
public GEN_Direcciones DireccionFacturacion { get; set; }
|
||||||
|
public string DireccionFacturacion_NombreVia
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
if (DireccionFacturacion != null)
|
||||||
|
{
|
||||||
|
str_Aux = DireccionFacturacion.nombreVia;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string DireccionFacturacion_CodigoPostal
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
if (DireccionFacturacion != null)
|
||||||
|
{
|
||||||
|
str_Aux = DireccionFacturacion.codigoPostal;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Pais
|
||||||
|
public long DireccionFacturacion_IdPais
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Aux = -1;
|
||||||
|
|
||||||
|
if (DireccionFacturacion != null)
|
||||||
|
{
|
||||||
|
lng_Aux = DireccionFacturacion.idPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lng_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string DireccionFacturacion_Pais
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
if (DireccionFacturacion != null && DireccionFacturacion.GEN_Paises != null)
|
||||||
|
{
|
||||||
|
//Codigo
|
||||||
|
if (DireccionFacturacion.GEN_Paises.codigo_ISO2D != null && DireccionFacturacion.GEN_Paises.codigo_ISO2D.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + DireccionFacturacion.GEN_Paises.codigo_ISO2D + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (DireccionFacturacion.GEN_Paises.descripcion != null && DireccionFacturacion.GEN_Paises.descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += DireccionFacturacion.GEN_Paises.descripcion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Provincia
|
||||||
|
public long DireccionFacturacion_IdProvincia
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Aux = -1;
|
||||||
|
|
||||||
|
if (DireccionFacturacion != null)
|
||||||
|
{
|
||||||
|
lng_Aux = DireccionFacturacion.idProvincia;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lng_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string DireccionFacturacion_Provincia
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
if (DireccionFacturacion != null && DireccionFacturacion.GEN_Provincias != null)
|
||||||
|
{
|
||||||
|
//Codigo
|
||||||
|
if (DireccionFacturacion.GEN_Provincias.codigo != null && DireccionFacturacion.GEN_Provincias.codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + DireccionFacturacion.GEN_Provincias.codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (DireccionFacturacion.GEN_Provincias.descripcion != null && DireccionFacturacion.GEN_Provincias.descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += DireccionFacturacion.GEN_Provincias.descripcion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Municipio
|
||||||
|
public long DireccionFacturacion_IdMunicipio
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Aux = -1;
|
||||||
|
|
||||||
|
if (DireccionFacturacion != null && DireccionFacturacion.idMunicipio != null)
|
||||||
|
{
|
||||||
|
lng_Aux = DireccionFacturacion.idMunicipio.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lng_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string DireccionFacturacion_Municipio
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
if (DireccionFacturacion != null && DireccionFacturacion.GEN_Municipios != null)
|
||||||
|
{
|
||||||
|
//Codigo
|
||||||
|
if (DireccionFacturacion.GEN_Municipios.codigoINE != null && DireccionFacturacion.GEN_Municipios.codigoINE.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + DireccionFacturacion.GEN_Municipios.codigoINE + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (DireccionFacturacion.GEN_Municipios.descripcion != null && DireccionFacturacion.GEN_Municipios.descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += DireccionFacturacion.GEN_Municipios.descripcion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Poblacion
|
||||||
|
public long DireccionFacturacion_IdPoblacion
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Aux = -1;
|
||||||
|
|
||||||
|
if (DireccionFacturacion != null && DireccionFacturacion.idPoblacion != null)
|
||||||
|
{
|
||||||
|
lng_Aux = DireccionFacturacion.idPoblacion.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lng_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string DireccionFacturacion_Poblacion
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
if (DireccionFacturacion != null && DireccionFacturacion.GEN_Poblaciones != null)
|
||||||
|
{
|
||||||
|
//Codigo
|
||||||
|
if (DireccionFacturacion.GEN_Poblaciones.codigo != null && DireccionFacturacion.GEN_Poblaciones.codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + DireccionFacturacion.GEN_Poblaciones.codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (DireccionFacturacion.GEN_Poblaciones.descripcion != null && DireccionFacturacion.GEN_Poblaciones.descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += DireccionFacturacion.GEN_Poblaciones.descripcion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Impresoras_Listado_Modelo : HPV_Impresoras
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Impresoras_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Seleccionar { get; set; }
|
||||||
|
public bool Pordefecto { get; set; }
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Ingredientes_Listado_Modelo : HPV_Ingredientes
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Ingredientes_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Seleccionar { get; set; }
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Ingredientes_Modelo : HPV_Ingredientes
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Ingredientes_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public List<HPV_Caracteristicas> Caracteristicas { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Mesas_Listado_Modelo : HPV_Mesas
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Mesas_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_PLV_Listado_Modelo : HPV_PLV
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_PLV_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public bool Seleccionar { get; set; }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SeccionMenu_Descripcion { get; set; }
|
||||||
|
|
||||||
|
//ImpuestoTipo
|
||||||
|
public string ImpuestoTipo_Codigo { get; set; }
|
||||||
|
public string ImpuestoTipo_Descripcion { get; set; }
|
||||||
|
public DateTime? ImpuestoTipo_FechaBorrado { get; set; }
|
||||||
|
public string ImpuestoTipo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (ImpuestoTipo_Codigo != null && ImpuestoTipo_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + ImpuestoTipo_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (ImpuestoTipo_Descripcion != null && ImpuestoTipo_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += ImpuestoTipo_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Perfiles_Listado_Modelo : HPV_Perfiles
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Perfiles_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//AgrupacionPLVCabecera
|
||||||
|
public string AgrupacionPLVCabecera_Codigo { get; set; }
|
||||||
|
public string AgrupacionPLVCabecera_Descripcion { get; set; }
|
||||||
|
public DateTime? AgrupacionPLVCabecera_FechaBorrado { get; set; }
|
||||||
|
public string AgrupacionPLVCabecera
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (AgrupacionPLVCabecera_Codigo != null && AgrupacionPLVCabecera_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + AgrupacionPLVCabecera_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (AgrupacionPLVCabecera_Descripcion != null && AgrupacionPLVCabecera_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += AgrupacionPLVCabecera_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_PuntosBarra_Listado_Modelo : HPV_PuntosBarra
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_PuntosBarra_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Salas_Listado_Modelo : HPV_Salas
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Salas_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Pordefecto { get; set; }
|
||||||
|
public bool Seleccionar { get; set; }
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
using Exferia_Aplicacion.Modelos_Informes;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Salas_Modelo : HPV_Salas
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Salas_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public List<INTERNO_HPV_Mesas_Listado_Modelo> Mesas { get; set; }
|
||||||
|
public List<INTERNO_HPV_PuntosBarra_Listado_Modelo> PuntosBarra { get; set; }
|
||||||
|
public List<HPV_Terminales> Terminales { get; set; }
|
||||||
|
public List<HPV_Impresoras> Impresoras { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_SeccionesMenu_Listado_Modelo : HPV_SeccionesMenu
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_SeccionesMenu_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,145 @@
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Tarifas_Listado_Modelo : HPV_Tarifas
|
||||||
|
{
|
||||||
|
#region Cliente/Agrupacion cliente
|
||||||
|
//Cliente
|
||||||
|
public string Cliente_Codigo { get; set; }
|
||||||
|
public string Cliente_Descripcion { get; set; }
|
||||||
|
public DateTime? Cliente_FechaBorrado { get; set; }
|
||||||
|
|
||||||
|
//AgrupacionCliente
|
||||||
|
public string AgrupacionCliente_Codigo { get; set; }
|
||||||
|
public string AgrupacionCliente_Descripcion { get; set; }
|
||||||
|
public DateTime? AgrupacionCliente_FechaBorrado { get; set; }
|
||||||
|
public IEnumerable<long> AgrupacionCliente_IdsClientesAgrupados { get; set; }
|
||||||
|
|
||||||
|
//Campo a mostrar el el Grid
|
||||||
|
public string Cliente_AgrupacionCliente
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
if (idCliente != null)
|
||||||
|
{
|
||||||
|
//Codigo
|
||||||
|
if (Cliente_Codigo != null && Cliente_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Cliente_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Cliente_Descripcion != null && Cliente_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Cliente_Descripcion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Codigo
|
||||||
|
if (AgrupacionCliente_Codigo != null && AgrupacionCliente_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + AgrupacionCliente_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (AgrupacionCliente_Descripcion != null && AgrupacionCliente_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += AgrupacionCliente_Descripcion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region PLV/Agrupacion PLV
|
||||||
|
//PLV
|
||||||
|
public string PLV_Codigo { get; set; }
|
||||||
|
public string PLV_Descripcion { get; set; }
|
||||||
|
public DateTime? PLV_FechaBorrado { get; set; }
|
||||||
|
|
||||||
|
//AgrupacionPLV
|
||||||
|
public string AgrupacionPLV_Codigo { get; set; }
|
||||||
|
public string AgrupacionPLV_Descripcion { get; set; }
|
||||||
|
public DateTime? AgrupacionPLV_FechaBorrado { get; set; }
|
||||||
|
public IEnumerable<long> AgrupacionPLV_IdsPLVAgrupados { get; set; }
|
||||||
|
|
||||||
|
public string PLV_AgrupacionPLV
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
if (idPLV != null)
|
||||||
|
{
|
||||||
|
//Codigo
|
||||||
|
if (PLV_Codigo != null && PLV_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + PLV_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (PLV_Descripcion != null && PLV_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += PLV_Descripcion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Codigo
|
||||||
|
if (AgrupacionPLV_Codigo != null && AgrupacionPLV_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + AgrupacionPLV_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (AgrupacionPLV_Descripcion != null && AgrupacionPLV_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += AgrupacionPLV_Descripcion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,188 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Terminales_Listado_Modelo : HPV_Terminales
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Terminales_Listado_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public long codigo_Long
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_Codigo = 0;
|
||||||
|
if (Funciones.IsNumeric(codigo))
|
||||||
|
{
|
||||||
|
lng_Codigo = long.Parse(codigo);
|
||||||
|
}
|
||||||
|
return lng_Codigo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Pordefecto { get; set; }
|
||||||
|
public bool Seleccionar { get; set; }
|
||||||
|
|
||||||
|
//Perfil
|
||||||
|
public string Perfil_Codigo { get; set; }
|
||||||
|
public string Perfil_Descripcion { get; set; }
|
||||||
|
public DateTime? Perfil_FechaBorrado { get; set; }
|
||||||
|
public string Perfil
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Perfil_Codigo != null && Perfil_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Perfil_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Perfil_Descripcion != null && Perfil_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Perfil_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
public string Empresa_Codigo { get; set; }
|
||||||
|
public string Empresa_Descripcion { get; set; }
|
||||||
|
public DateTime? Empresa_FechaBorrado { get; set; }
|
||||||
|
public string Empresa
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
if (Empresa_Codigo != null && Empresa_Codigo.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux = "(" + Empresa_Codigo + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
if (Empresa_Descripcion != null && Empresa_Descripcion.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
str_Aux += Empresa_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Sincronizacion Tipo
|
||||||
|
public string SincronizacionTipo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
|
||||||
|
if (sincronizacion_Tipo != null && sincronizacion_Tipo.Length > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
//Automatico
|
||||||
|
if (sincronizacion_Tipo.Substring(0, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Automática | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Boton
|
||||||
|
if (sincronizacion_Tipo.Length > 1 && sincronizacion_Tipo.Substring(1, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Botón | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Por Tiempo
|
||||||
|
if (sincronizacion_Tipo.Length > 2 && sincronizacion_Tipo.Substring(2, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Por tiempo | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Por Eventos
|
||||||
|
if (sincronizacion_Tipo.Length > 3 && sincronizacion_Tipo.Substring(3, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Por eventos | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Por Socket
|
||||||
|
if (sincronizacion_Tipo.Length > 4 && sincronizacion_Tipo.Substring(4, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Por socket | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Sincronizacion Eventos
|
||||||
|
public string SincronizacionEventos
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string str_Aux = "";
|
||||||
|
|
||||||
|
if (sincronizacion_Eventos != null && sincronizacion_Eventos.Length > 0)
|
||||||
|
{
|
||||||
|
// Apertura de liquidación
|
||||||
|
if (sincronizacion_Eventos.Length > 0 && sincronizacion_Eventos.Substring(0, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Apertura de liquidación | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Cierre de liquidación
|
||||||
|
if (sincronizacion_Eventos.Length > 1 && sincronizacion_Eventos.Substring(1, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Cierre de liquidación | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Gastos
|
||||||
|
if (sincronizacion_Eventos.Length > 2 && sincronizacion_Eventos.Substring(2, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Gastos | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Ticket aparcado
|
||||||
|
if (sincronizacion_Eventos.Length > 3 && sincronizacion_Eventos.Substring(3, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Ticket aparcado | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Ticket anulado
|
||||||
|
if (sincronizacion_Eventos.Length > 4 && sincronizacion_Eventos.Substring(4, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Ticket anulado | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Ticket cancelado
|
||||||
|
if (sincronizacion_Eventos.Length > 5 && sincronizacion_Eventos.Substring(5, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Ticket cancelado | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Ticket cobrado
|
||||||
|
if (sincronizacion_Eventos.Length > 6 && sincronizacion_Eventos.Substring(6, 1) == "1")
|
||||||
|
{
|
||||||
|
str_Aux += "Ticket cobrado | ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_Aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._0_Modelos
|
||||||
|
{
|
||||||
|
public class INTERNO_HPV_Terminales_Modelo : HPV_Terminales
|
||||||
|
{
|
||||||
|
public INTERNO_HPV_Terminales_Modelo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public List<HPV_Salas> Salas { get; set; }
|
||||||
|
public List<HPV_AgrupacionesTerminales> AgrupacionesTerminales { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,822 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using Exferia_Aplicacion.Modelos_MantenimientoAgrupacionesCabecera;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Transactions;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_AgrupacionesClientesCabeceras_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listado
|
||||||
|
private List<INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo> g_lst_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo = null;
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_AUX = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesClientesCabeceras).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo != null) && (g_lst_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_AUX = g_lst_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_AUX;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_AUX = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesClientesCabeceras).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo != null) && (g_lst_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_AUX = g_lst_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_AUX;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.id) + " = " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.codigo) + " = " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.descripcion) + " = " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.sinRepeticion) + " = " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.sinRepeticion) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesClientesCabeceras) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_AgrupacionesClientesCabeceras) + "." + (nameof(HPV_AgrupacionesClientesCabeceras.id) + "=@id") : "1 = 1");
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id", _lng_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo g_mdl_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_AUX = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesClientesCabeceras).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_AUX = g_mdl_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_AUX;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_AUX = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Conuslta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesClientesCabeceras).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_AUX = g_mdl_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(Obtener_F3_PorId), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_AUX;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.id) + " = " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.codigo) + " = " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.descripcion) + " = " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesClientesCabeceras) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.fechaBorrado) + " IS NULL AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_AgrupacionesClientesCabeceras.codigo)))
|
||||||
|
? (nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Descripcion
|
||||||
|
: (nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.descripcion) + "=@Filtro")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@Filtro", _str_Filtro)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
|
||||||
|
#region Obtener Simple
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
|
||||||
|
private static int g_int_TotalHilos_Obtener = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Obtener = new bool[g_int_TotalHilos_Obtener];
|
||||||
|
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.id) + " = " + nameof(HPV_AgrupacionesClientesCabeceras.id) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.codigo) + " = " + nameof(HPV_AgrupacionesClientesCabeceras.codigo) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.descripcion) + " = " + nameof(HPV_AgrupacionesClientesCabeceras.descripcion) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.sinRepeticiones) + " = " + nameof(HPV_AgrupacionesClientesCabeceras.sinRepeticion) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.fechaBorrado) + " = " + nameof(HPV_AgrupacionesClientesCabeceras.fechaBorrado) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.idEmpresa) + " = " + nameof(HPV_AgrupacionesClientesCabeceras.idEmpresa) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesClientesCabeceras) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesClientesCabeceras.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<INTERNO_MantenimientoAgrupacionesCabecera_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
#region Rellenar Tablas Relacionadas
|
||||||
|
if (g_dnm_Modelo_Obtener != null)
|
||||||
|
{
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Obtener; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_AgrupacionesClientesLineas ##########################################################################################
|
||||||
|
ThreadStart obj_ThreadStart_LINEAS = new ThreadStart(Obtener_AgrupacionesClientesLineas_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_LINEAS = new Thread(obj_ThreadStart_LINEAS);
|
||||||
|
obj_Thread_LINEAS.Start();
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Obtener)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_AgrupacionesClientesLineas_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_AgrupacionesClientesLineas_Datos obj_HPV_AgrupacionesClientesLineas_Datos = new HPV_AgrupacionesClientesLineas_Datos();
|
||||||
|
g_dnm_Modelo_Obtener.AgrupacionesLineas = obj_HPV_AgrupacionesClientesLineas_Datos.Obtener_HPV_AgrupacionesClientesLineas_PorCabecera(g_dnm_Modelo_Obtener.id);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_AgrupacionesClientesCabeceras g_mdl_HPV_AgrupacionesClientesCabeceras = null;
|
||||||
|
public HPV_AgrupacionesClientesCabeceras Obtener_Modelo_Por_Id(long _lng_id,
|
||||||
|
bool _bol_Cargar_AgrupacionClienteLineas)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesClientesCabeceras) + "." + nameof(HPV_AgrupacionesClientesCabeceras.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros,
|
||||||
|
_bol_Cargar_AgrupacionClienteLineas);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_AgrupacionesClientesCabeceras;
|
||||||
|
}
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private static int g_int_TotalHilos_Modelo = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Modelo = new bool[g_int_TotalHilos_Modelo];
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros,
|
||||||
|
bool _bol_Cargar_AgrupacionClienteLineas)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_AgrupacionesClientesCabeceras = obj_Exferia_Entities.Database.SqlQuery<HPV_AgrupacionesClientesCabeceras>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_mdl_HPV_AgrupacionesClientesCabeceras != null)
|
||||||
|
{
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Modelo; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//MAE_AgrupacionesClientesLineas ##########################################################################################
|
||||||
|
if (_bol_Cargar_AgrupacionClienteLineas)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_AGRUPACONESCLIENTESLINEAS = new ThreadStart(Obtener_AgrupacionesClientesLineas_Modelo);
|
||||||
|
Thread obj_Thread_AGRUPACONESCLIENTESLINEAS = new Thread(obj_ThreadStart_AGRUPACONESCLIENTESLINEAS);
|
||||||
|
obj_Thread_AGRUPACONESCLIENTESLINEAS.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Modelo)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_AgrupacionesClientesLineas_Modelo()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_AgrupacionesClientesLineas_Datos obj_HPV_AgrupacionesClientesLineas_Datos = new HPV_AgrupacionesClientesLineas_Datos();
|
||||||
|
g_mdl_HPV_AgrupacionesClientesCabeceras.HPV_AgrupacionesClientesLineas = obj_HPV_AgrupacionesClientesLineas_Datos.Obtener_HPV_AgrupacionesClientesLineas_PorCabecera(g_dnm_Modelo_Obtener.id);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Modelos Listado
|
||||||
|
private List<HPV_AgrupacionesClientesCabeceras> g_lst_HPV_AgrupacionesClientesCabeceras = null;
|
||||||
|
public List<HPV_AgrupacionesClientesCabeceras> Obtener_ModeloListado_Por_Ids(List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_lst_ids != null && _lst_ids.Count > 0)
|
||||||
|
{
|
||||||
|
string str_Filtro_IDS = Funciones.Formar_ContenidoIN_ParaConsultaWhere(nameof(HPV_AgrupacionesClientesCabeceras),
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.id),
|
||||||
|
G_ENUM_FORMARCONTENIDOIN_CONDICIONANTES.NADA,
|
||||||
|
_lst_ids);
|
||||||
|
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + str_Filtro_IDS;
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
new object[] { });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(Obtener_ModeloListado_Por_Ids), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_AgrupacionesClientesCabeceras;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejercutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el listado
|
||||||
|
g_lst_HPV_AgrupacionesClientesCabeceras = obj_Exferia_Entities.Database.SqlQuery<HPV_AgrupacionesClientesCabeceras>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.id) + " , " +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.codigo) + " , " +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.descripcion) + " , " +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.sinRepeticion) + " , " +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.idEmpresa) + " , " +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesClientesCabeceras);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
INTERNO_MantenimientoAgrupacionesCabecera_Modelo mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo_AGrabar = (INTERNO_MantenimientoAgrupacionesCabecera_Modelo)_mdl_obj;
|
||||||
|
HPV_AgrupacionesClientesCabeceras mdl_HPV_AgrupacionesClientesCabeceras_DatosViejos = new HPV_AgrupacionesClientesCabeceras();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_AgrupacionesClientesCabeceras mdl_HPV_AgrupacionesClientesCabeceras_Final = Obtener_Modelo_Por_Id(mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo_AGrabar.id, false);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_AgrupacionesClientesCabeceras_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_AgrupacionesClientesCabeceras_Final, mdl_HPV_AgrupacionesClientesCabeceras_DatosViejos, false, false);
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_AgrupacionesClientesCabeceras_Final, mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo_AGrabar);
|
||||||
|
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_AgrupacionesClientesCabeceras) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.sinRepeticion) + "=@sinRepeticion," +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_AgrupacionesClientesCabeceras_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_AgrupacionesClientesCabeceras_Final.descripcion),
|
||||||
|
new SqlParameter("@sinRepeticion", mdl_HPV_AgrupacionesClientesCabeceras_Final.sinRepeticion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_AgrupacionesClientesCabeceras_Final.idEmpresa),
|
||||||
|
mdl_HPV_AgrupacionesClientesCabeceras_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_AgrupacionesClientesCabeceras_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_HPV_AgrupacionesClientesCabeceras_Final.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo_AGrabar.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_AgrupacionesClientesCabeceras_Final = new HPV_AgrupacionesClientesCabeceras();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_AgrupacionesClientesCabeceras_Final, mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo_AGrabar);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_AgrupacionesClientesCabeceras) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.codigo) + "," +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.descripcion) + "," +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.sinRepeticion) + "," +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.idEmpresa) + "," +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.fechaBorrado) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_AgrupacionesClientesCabeceras.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@sinRepeticion," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado" +
|
||||||
|
" ) ";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_AgrupacionesClientesCabeceras_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_AgrupacionesClientesCabeceras_Final.descripcion),
|
||||||
|
new SqlParameter("@sinRepeticion", mdl_HPV_AgrupacionesClientesCabeceras_Final.sinRepeticion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_AgrupacionesClientesCabeceras_Final.idEmpresa),
|
||||||
|
mdl_HPV_AgrupacionesClientesCabeceras_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_AgrupacionesClientesCabeceras_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value)
|
||||||
|
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_AgrupacionesClientesCabeceras), mdl_HPV_AgrupacionesClientesCabeceras_DatosViejos, mdl_HPV_AgrupacionesClientesCabeceras_Final, mdl_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Finalizar transaccion
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
private void Cargar_DatosModelo(HPV_AgrupacionesClientesCabeceras _mdl_HPV_AgrupacionesClientesCabeceras, INTERNO_MantenimientoAgrupacionesCabecera_Modelo _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo)
|
||||||
|
{
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
_mdl_HPV_AgrupacionesClientesCabeceras.id = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.id;
|
||||||
|
_mdl_HPV_AgrupacionesClientesCabeceras.codigo = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.codigo;
|
||||||
|
_mdl_HPV_AgrupacionesClientesCabeceras.descripcion = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.descripcion;
|
||||||
|
_mdl_HPV_AgrupacionesClientesCabeceras.idEmpresa = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.idEmpresa;
|
||||||
|
_mdl_HPV_AgrupacionesClientesCabeceras.fechaBorrado = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.fechaBorrado;
|
||||||
|
_mdl_HPV_AgrupacionesClientesCabeceras.sinRepeticion = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.sinRepeticiones;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_AgrupacionesClientesCabeceras mdl_HPV_AgrupacionesClientesCabeceras_Final = Obtener_Modelo_Por_Id(_lng_id, false);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_AgrupacionesClientesCabeceras_Final != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
DateTime dtt_FechaActual = DateTime.Now;
|
||||||
|
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_AgrupacionesClientesCabeceras) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_AgrupacionesClientesCabeceras.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", dtt_FechaActual),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Actualizar la fechaBorrado en Lineas
|
||||||
|
#region UPDATE LINEAS
|
||||||
|
string str_SQL_Update_Lineas = " UPDATE " + nameof(MAE_AgrupacionesClientesLineas) +
|
||||||
|
" SET " +
|
||||||
|
nameof(MAE_AgrupacionesClientesLineas.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(MAE_AgrupacionesClientesLineas.idAgrupacionClienteCabecera) + "=@idAgrupacionClienteCabecera";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update_Lineas = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", dtt_FechaActual),
|
||||||
|
new SqlParameter("@idAgrupacionClienteCabecera", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update Lineas
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update_Lineas, arr_Parametros_Update_Lineas);
|
||||||
|
|
||||||
|
//Grabar un registro de trazabilidad con los datos de la transaccion realizada
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_AgrupacionesClientesCabeceras), null, mdl_HPV_AgrupacionesClientesCabeceras_Final, Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Devolver tambien el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesClientesCabeceras_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,841 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using Exferia_Aplicacion.Modelos_MantenimientoAgrupacionesCabecera;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Transactions;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_AgrupacionesPLVCabeceras_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listado
|
||||||
|
private List<INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo> g_lst_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo = null;
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_AUX = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesPLVCabeceras).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo != null) && (g_lst_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_AUX = g_lst_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_AUX;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_AUX = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesPLVCabeceras).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo != null) && (g_lst_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_AUX = g_lst_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_AUX;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.id) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.codigo) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.descripcion) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.sinRepeticion) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.sinRepeticion) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesPLVCabeceras) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_AgrupacionesPLVCabeceras) + "." + (nameof(HPV_AgrupacionesPLVCabeceras.id) + "=@id") : "1 = 1");
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id", _lng_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo g_mdl_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_AUX = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesPLVCabeceras).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_AUX = g_mdl_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_AUX;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_AUX = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Conuslta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesPLVCabeceras).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_AUX = g_mdl_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(Obtener_F3_PorId), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_AUX;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.id) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.codigo) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.descripcion) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesPLVCabeceras) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.fechaBorrado) + " IS NULL AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_AgrupacionesPLVCabeceras.codigo)))
|
||||||
|
? (nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Descripcion
|
||||||
|
: (nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.descripcion) + "=@Filtro")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@Filtro", _str_Filtro)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
|
||||||
|
#region Obtener Simple
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
|
||||||
|
private static int g_int_TotalHilos_Obtener = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Obtener = new bool[g_int_TotalHilos_Obtener];
|
||||||
|
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.id) + " = " + nameof(HPV_AgrupacionesPLVCabeceras.id) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.codigo) + " = " + nameof(HPV_AgrupacionesPLVCabeceras.codigo) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.descripcion) + " = " + nameof(HPV_AgrupacionesPLVCabeceras.descripcion) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.sinRepeticiones) + " = " + nameof(HPV_AgrupacionesPLVCabeceras.sinRepeticion) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.fechaBorrado) + " = " + nameof(HPV_AgrupacionesPLVCabeceras.fechaBorrado) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesCabecera_Modelo.idEmpresa) + " = " + nameof(HPV_AgrupacionesPLVCabeceras.idEmpresa) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesPLVCabeceras) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesPLVCabeceras.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<INTERNO_MantenimientoAgrupacionesCabecera_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
#region Rellenar Tablas Relacionadas
|
||||||
|
if (g_dnm_Modelo_Obtener != null)
|
||||||
|
{
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Obtener; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_AgrupacionesPLVLineas ##########################################################################################
|
||||||
|
ThreadStart obj_ThreadStart_LINEAS = new ThreadStart(Obtener_AgrupacionesPLVLineas_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_LINEAS = new Thread(obj_ThreadStart_LINEAS);
|
||||||
|
obj_Thread_LINEAS.Start();
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Obtener)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_AgrupacionesPLVLineas_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_AgrupacionesPLVLineas_Datos obj_HPV_AgrupacionesPLVLineas_Datos = new HPV_AgrupacionesPLVLineas_Datos();
|
||||||
|
g_dnm_Modelo_Obtener.AgrupacionesLineas = obj_HPV_AgrupacionesPLVLineas_Datos.Obtener_HPV_AgrupacionesPLVLineas_PorCabecera(g_dnm_Modelo_Obtener.id);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_AgrupacionesPLVCabeceras g_mdl_HPV_AgrupacionesPLVCabeceras = null;
|
||||||
|
public HPV_AgrupacionesPLVCabeceras Obtener_Modelo_Por_Id(long _lng_id,
|
||||||
|
bool _bol_Cargar_AgrupacionPLVLineas)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros,
|
||||||
|
_bol_Cargar_AgrupacionPLVLineas);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_AgrupacionesPLVCabeceras;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private static int g_int_TotalHilos_Modelo = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Modelo = new bool[g_int_TotalHilos_Modelo];
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros,
|
||||||
|
bool _bol_Cargar_AgrupacionPLVLineas)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_AgrupacionesPLVCabeceras = obj_Exferia_Entities.Database.SqlQuery<HPV_AgrupacionesPLVCabeceras>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_mdl_HPV_AgrupacionesPLVCabeceras != null)
|
||||||
|
{
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Modelo; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_AgrupacionesPLVLineas ##########################################################################################
|
||||||
|
if (_bol_Cargar_AgrupacionPLVLineas)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_AGRUPACONESPLVLINEAS = new ThreadStart(Obtener_AgrupacionesPLVLineas_Modelo);
|
||||||
|
Thread obj_Thread_AGRUPACONESPLVLINEAS = new Thread(obj_ThreadStart_AGRUPACONESPLVLINEAS);
|
||||||
|
obj_Thread_AGRUPACONESPLVLINEAS.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Modelo)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_AgrupacionesPLVLineas_Modelo()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_AgrupacionesPLVLineas_Datos obj_HPV_AgrupacionesPLVLineas_Datos = new HPV_AgrupacionesPLVLineas_Datos();
|
||||||
|
g_mdl_HPV_AgrupacionesPLVCabeceras.HPV_AgrupacionesPLVLineas = obj_HPV_AgrupacionesPLVLineas_Datos.Obtener_HPV_AgrupacionesPLVLineas_PorCabecera(g_dnm_Modelo_Obtener.id);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_AgrupacionesPLVCabeceras> g_lst_HPV_AgrupacionesPLVCabeceras = null;
|
||||||
|
|
||||||
|
public List<HPV_AgrupacionesPLVCabeceras> Obtener_ModeloListado_Por_Ids(List<long> _lst_Ids)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_lst_Ids != null && _lst_Ids.Count > 0)
|
||||||
|
{
|
||||||
|
string str_Filtro_IDS = Funciones.Formar_ContenidoIN_ParaConsultaWhere(nameof(HPV_AgrupacionesPLVCabeceras),
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.id),
|
||||||
|
G_ENUM_FORMARCONTENIDOIN_CONDICIONANTES.NADA,
|
||||||
|
_lst_Ids);
|
||||||
|
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + str_Filtro_IDS;
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
new object[] { });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(Obtener_ModeloListado_Por_Ids), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_AgrupacionesPLVCabeceras;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_AgrupacionesPLVCabeceras = obj_Exferia_Entities.Database.SqlQuery<HPV_AgrupacionesPLVCabeceras>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.id) + " , " +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.codigo) + " , " +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.descripcion) + " , " +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.sinRepeticion) + " , " +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.idEmpresa) + " , " +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesPLVCabeceras);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
INTERNO_MantenimientoAgrupacionesCabecera_Modelo mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo_AGrabar = (INTERNO_MantenimientoAgrupacionesCabecera_Modelo)_mdl_obj;
|
||||||
|
HPV_AgrupacionesPLVCabeceras mdl_HPV_AgrupacionesPLVCabeceras_DatosViejos = new HPV_AgrupacionesPLVCabeceras();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_AgrupacionesPLVCabeceras mdl_HPV_AgrupacionesPLVCabeceras_Final = Obtener_Modelo_Por_Id(mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo_AGrabar.id, false);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_AgrupacionesPLVCabeceras_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_AgrupacionesPLVCabeceras_Final, mdl_HPV_AgrupacionesPLVCabeceras_DatosViejos, false, false);
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_AgrupacionesPLVCabeceras_Final, mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo_AGrabar);
|
||||||
|
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_AgrupacionesPLVCabeceras) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.sinRepeticion) + "=@sinRepeticion," +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_AgrupacionesPLVCabeceras_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_AgrupacionesPLVCabeceras_Final.descripcion),
|
||||||
|
new SqlParameter("@sinRepeticion", mdl_HPV_AgrupacionesPLVCabeceras_Final.sinRepeticion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_AgrupacionesPLVCabeceras_Final.idEmpresa),
|
||||||
|
mdl_HPV_AgrupacionesPLVCabeceras_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_AgrupacionesPLVCabeceras_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_HPV_AgrupacionesPLVCabeceras_Final.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo_AGrabar.id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_AgrupacionesPLVCabeceras_Final = new HPV_AgrupacionesPLVCabeceras();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_AgrupacionesPLVCabeceras_Final, mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo_AGrabar);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_AgrupacionesPLVCabeceras) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.codigo) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.descripcion) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.sinRepeticion) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.idEmpresa) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.fechaBorrado) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_AgrupacionesPLVCabeceras.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@sinRepeticion," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado" +
|
||||||
|
" ) ";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_AgrupacionesPLVCabeceras_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_AgrupacionesPLVCabeceras_Final.descripcion),
|
||||||
|
new SqlParameter("@sinRepeticion", mdl_HPV_AgrupacionesPLVCabeceras_Final.sinRepeticion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_AgrupacionesPLVCabeceras_Final.idEmpresa),
|
||||||
|
mdl_HPV_AgrupacionesPLVCabeceras_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_AgrupacionesPLVCabeceras_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value)
|
||||||
|
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_AgrupacionesPLVCabeceras), mdl_HPV_AgrupacionesPLVCabeceras_DatosViejos, mdl_HPV_AgrupacionesPLVCabeceras_Final, mdl_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Finalizar transaccion
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
private void Cargar_DatosModelo(HPV_AgrupacionesPLVCabeceras _mdl_HPV_AgrupacionesPLVCabeceras, INTERNO_MantenimientoAgrupacionesCabecera_Modelo _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo)
|
||||||
|
{
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
_mdl_HPV_AgrupacionesPLVCabeceras.id = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.id;
|
||||||
|
_mdl_HPV_AgrupacionesPLVCabeceras.codigo = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.codigo;
|
||||||
|
_mdl_HPV_AgrupacionesPLVCabeceras.descripcion = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.descripcion;
|
||||||
|
_mdl_HPV_AgrupacionesPLVCabeceras.idEmpresa = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.idEmpresa;
|
||||||
|
_mdl_HPV_AgrupacionesPLVCabeceras.fechaBorrado = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.fechaBorrado;
|
||||||
|
_mdl_HPV_AgrupacionesPLVCabeceras.sinRepeticion = _mdl_INTERNO_MantenimientoAgrupacionesCabecera_Modelo.sinRepeticiones;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Comprobar si existe en algun perfil de Terminal antes de borrar
|
||||||
|
HPV_Perfiles_Datos obj_HPV_Perfiles_Datos = new HPV_Perfiles_Datos();
|
||||||
|
bool bol_Existe_EnPerfiles= obj_HPV_Perfiles_Datos.Existe_PorAgrupacionPLVCabecera(_lng_id, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
if (bol_Existe_EnPerfiles)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_AGRUPACIONESPLVCABECERA_VALIDACION_EXISTERELACION_PERFILES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_AgrupacionesPLVCabeceras mdl_HPV_AgrupacionesPLVCabeceras_Final = Obtener_Modelo_Por_Id(_lng_id, false);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_AgrupacionesPLVCabeceras_Final != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
DateTime dtt_FechaActual = DateTime.Now;
|
||||||
|
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_AgrupacionesPLVCabeceras) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_AgrupacionesPLVCabeceras.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", dtt_FechaActual),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Actualizar la fechaBorrado en Lineas
|
||||||
|
#region UPDATE LINEAS
|
||||||
|
string str_SQL_Update_Lineas = " UPDATE " + nameof(HPV_AgrupacionesPLVLineas) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineas.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineas.idAgrupacionPLVCabecera) + "=@idAgrupacionPLVCabecera";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update_Lineas = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", dtt_FechaActual),
|
||||||
|
new SqlParameter("@idAgrupacionPLVCabecera", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update Lineas
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update_Lineas, arr_Parametros_Update_Lineas);
|
||||||
|
|
||||||
|
//Grabar un registro de trazabilidad con los datos de la transaccion realizada
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_AgrupacionesPLVCabeceras), null, mdl_HPV_AgrupacionesPLVCabeceras_Final, Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Devolver tambien el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVCabeceras_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Finalizar transaccion
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,379 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Modelos_MantenimientoAgrupacionesCabecera;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_General;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_AgrupacionesPLVLineasFotos_Datos
|
||||||
|
{
|
||||||
|
#region Obtener
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
|
||||||
|
public dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.id) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.idAgrupacionPLVLinea) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.foto) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesPLVLineasFotos) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesPLVLineasFotos.idAgrupacionPLVLinea) + "=@idAgrupacionPLVLinea ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idAgrupacionPLVLinea", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<HPV_AgrupacionesPLVLineasFotos>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVLineasFotos_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo Obtener_FotoModelo_Por_IdAgrupacionPLVLinea(long _lng_idAgrupacionPLVLinea)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo mdl_INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo.id) + " = " + nameof(HPV_AgrupacionesPLVLineasFotos.id) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo.idPadre) + " = " + nameof(HPV_AgrupacionesPLVLineasFotos.idAgrupacionPLVLinea) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo.imagen) + " = " + nameof(HPV_AgrupacionesPLVLineasFotos.foto) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesPLVLineasFotos) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesPLVLineasFotos.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.idAgrupacionPLVLinea) + "=@idAgrupacionPLVLinea ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idAgrupacionPLVLinea", _lng_idAgrupacionPLVLinea)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
mdl_INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo = obj_Exferia_Entities.Database.SqlQuery<INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVLineasFotos_Datos) + "/" + nameof(Obtener_FotoModelo_Por_IdAgrupacionPLVLinea), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_AgrupacionesPLVLineasFotos g_mdl_HPV_AgrupacionesPLVLineasFotos = null;
|
||||||
|
public HPV_AgrupacionesPLVLineasFotos Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesPLVLineasFotos) + "." + nameof(HPV_AgrupacionesPLVLineasFotos.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVLineasFotos_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_AgrupacionesPLVLineasFotos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_mdl_HPV_AgrupacionesPLVLineasFotos = obj_Exferia_Entities.Database.SqlQuery<HPV_AgrupacionesPLVLineasFotos>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVLineasFotos_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.id) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.idAgrupacionPLVLinea) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.foto) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesPLVLineasFotos);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
// Se utiliza la transaccion por la llamada al procedimiento de almacenado
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo mdl_INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo_AGrabar = (INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo)_mdl_obj;
|
||||||
|
HPV_AgrupacionesPLVLineasFotos mdl_HPV_AgrupacionesPLVLineasFotos_DatosViejos = new HPV_AgrupacionesPLVLineasFotos();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_AgrupacionesPLVLineasFotos mdl_HPV_AgrupacionesPLVLineasFotos_Final = Obtener_Modelo_Por_Id(mdl_INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_AgrupacionesPLVLineasFotos_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_AgrupacionesPLVLineasFotos_Final, mdl_HPV_AgrupacionesPLVLineasFotos_DatosViejos, false, false);
|
||||||
|
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
mdl_HPV_AgrupacionesPLVLineasFotos_Final.idAgrupacionPLVLinea = mdl_INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo_AGrabar.idPadre;
|
||||||
|
mdl_HPV_AgrupacionesPLVLineasFotos_Final.foto = mdl_INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo_AGrabar.imagen;
|
||||||
|
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_AgrupacionesPLVLineasFotos) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.idAgrupacionPLVLinea) + "=@idAgrupacionPLVLinea," +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.foto) + "=@foto," +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.fechaBorrado) + "=@fechaBorrado" +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.id) + "=@id";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
SqlParameter obj_SqlParameter_imagen = new SqlParameter("@foto", SqlDbType.Binary);
|
||||||
|
if (mdl_HPV_AgrupacionesPLVLineasFotos_Final.foto != null)
|
||||||
|
{ obj_SqlParameter_imagen.Value = mdl_HPV_AgrupacionesPLVLineasFotos_Final.foto; }
|
||||||
|
else
|
||||||
|
{ obj_SqlParameter_imagen.Value = DBNull.Value; }
|
||||||
|
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idAgrupacionPLVLinea", mdl_HPV_AgrupacionesPLVLineasFotos_Final.idAgrupacionPLVLinea),
|
||||||
|
obj_SqlParameter_imagen,
|
||||||
|
mdl_HPV_AgrupacionesPLVLineasFotos_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_AgrupacionesPLVLineasFotos_Final.fechaBorrado)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_HPV_AgrupacionesPLVLineasFotos_Final.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = mdl_INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo_AGrabar.id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_AgrupacionesPLVLineasFotos_Final = new HPV_AgrupacionesPLVLineasFotos();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
// Cargar los Datos del Modelo
|
||||||
|
mdl_HPV_AgrupacionesPLVLineasFotos_Final.id = -1;
|
||||||
|
mdl_HPV_AgrupacionesPLVLineasFotos_Final.idAgrupacionPLVLinea = mdl_INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo_AGrabar.idPadre;
|
||||||
|
mdl_HPV_AgrupacionesPLVLineasFotos_Final.foto = mdl_INTERNO_MantenimientoAgrupacionesLineaFoto_Modelo_AGrabar.imagen;
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_AgrupacionesPLVLineasFotos) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.idAgrupacionPLVLinea) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.foto) + "," +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.fechaBorrado) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_AgrupacionesPLVLineasFotos.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@idAgrupacionPLVLinea," +
|
||||||
|
"@foto," +
|
||||||
|
"@fechaBorrado" +
|
||||||
|
" ) ";
|
||||||
|
//Parametros
|
||||||
|
SqlParameter obj_SqlParameter_imagen = new SqlParameter("@foto", SqlDbType.Binary);
|
||||||
|
if (mdl_HPV_AgrupacionesPLVLineasFotos_Final.foto != null)
|
||||||
|
{ obj_SqlParameter_imagen.Value = mdl_HPV_AgrupacionesPLVLineasFotos_Final.foto; }
|
||||||
|
else
|
||||||
|
{ obj_SqlParameter_imagen.Value = DBNull.Value; }
|
||||||
|
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idAgrupacionPLVLinea", mdl_HPV_AgrupacionesPLVLineasFotos_Final.idAgrupacionPLVLinea),
|
||||||
|
obj_SqlParameter_imagen,
|
||||||
|
mdl_HPV_AgrupacionesPLVLineasFotos_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_AgrupacionesPLVLineasFotos_Final.fechaBorrado)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_AgrupacionesPLVLineasFotos), mdl_HPV_AgrupacionesPLVLineasFotos_DatosViejos, mdl_HPV_AgrupacionesPLVLineasFotos_Final, mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVLineasFotos_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_AgrupacionesPLVLineasFotos mdl_HPV_AgrupacionesPLVLineasFotos_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_AgrupacionesPLVLineasFotos_Final != null)
|
||||||
|
{
|
||||||
|
#region Delete
|
||||||
|
string str_SQL_Delete = " DELETE FROM " + nameof(HPV_AgrupacionesPLVLineasFotos) +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineasFotos.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Delete = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Delete
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Delete, arr_Parametros_Delete);
|
||||||
|
|
||||||
|
//Devolver tambien el objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = mdl_HPV_AgrupacionesPLVLineasFotos_Final.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVLineasFotos_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,107 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_AgrupacionesPLVLineas_Impresoras_Datos
|
||||||
|
{
|
||||||
|
#region Obtener
|
||||||
|
public List<long> Obtener_Listado_idImpresora_PoridAGrupacionArticuloLinea(long _lng_idAgrupacionPLVLinea)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
List<long> lst_idImpresora = new List<long>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .........................................................
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_AgrupacionesPLVLineas_Impresoras) + "." + nameof(HPV_AgrupacionesPLVLineas_Impresoras.idImpresora) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesPLVLineas_Impresoras) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesPLVLineas_Impresoras.idAgrupacionPLVLinea) + "=@idAgrupacionPLVLinea ";
|
||||||
|
// .....................................................................
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idAgrupacionPLVLinea", _lng_idAgrupacionPLVLinea)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
lst_idImpresora = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL, arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVLineas_Impresoras_Datos) + "/" + nameof(Obtener_Listado_idImpresora_PoridAGrupacionArticuloLinea), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_idImpresora;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idAgrupacionPLVLinea, List<long> _lst_idImpresoras)
|
||||||
|
{
|
||||||
|
Exferia_Entities dbcontext = null;
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbcontext = new Exferia_Entities();
|
||||||
|
dbcontext.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar_ComoImpresora = " DELETE FROM " + nameof(HPV_AgrupacionesPLVLineas_Impresoras) + " WHERE " + nameof(HPV_AgrupacionesPLVLineas_Impresoras.idAgrupacionPLVLinea) + "=" + _lng_idAgrupacionPLVLinea;
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Borrar_ComoImpresora);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_lst_idImpresoras != null & _lst_idImpresoras.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (long lng_id in _lst_idImpresoras)
|
||||||
|
{
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_AgrupacionesPLVLineas_Impresoras) + " (" + nameof(HPV_AgrupacionesPLVLineas_Impresoras.idAgrupacionPLVLinea) + "," + nameof(HPV_AgrupacionesPLVLineas_Impresoras.idImpresora) + "," + nameof(HPV_AgrupacionesPLVLineas_Impresoras.observaciones) + ") values (" + _lng_idAgrupacionPLVLinea + "," + lng_id + ",'')";
|
||||||
|
}
|
||||||
|
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesPLVLineas_Impresoras_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dbcontext.Database.Connection.Close();
|
||||||
|
dbcontext.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,793 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_AgrupacionesTerminales_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listados
|
||||||
|
private List<INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo> g_lst_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo = new List<INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo>();
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_HPV = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesTerminales).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
if ((g_lst_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo != null) && (g_lst_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_HPV = g_lst_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return lst_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesTerminales).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo != null) && (g_lst_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_HPV = g_lst_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.id) + " = " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.codigo) + " = " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.descripcion) + " = " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.descripcion) + "," +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Empresa_Codigo) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Empresa_Descripcion) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Empresa_FechaBorrado) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.fechaBorrado)
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Empresa_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Empresa_Descripcion) + "= '', " +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Empresa_FechaBorrado) + " = NULL "
|
||||||
|
)
|
||||||
|
)+
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesTerminales) +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(GEN_Empresas) + " ON " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idEmpresa) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_AgrupacionesTerminales) + "." + (nameof(HPV_AgrupacionesTerminales.id) + "=@id") : "1 = 1");
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id", _lng_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo g_mdl_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesTerminales).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Conuslta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_AgrupacionesTerminales).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Obtener_F3_PorId), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.id) + " = " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.codigo) + " = " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.descripcion) + " = " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesTerminales) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.fechaBorrado) + " IS null AND " +
|
||||||
|
//Empresa
|
||||||
|
" ( " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_AgrupacionesTerminales.codigo)))
|
||||||
|
? (nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Descripcion
|
||||||
|
: (nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.descripcion) + "=@Filtro")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id", _lng_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
|
||||||
|
#region Obtener Simple
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
|
||||||
|
private static int g_int_TotalHilos_Obtener = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Obtener = new bool[g_int_TotalHilos_Obtener];
|
||||||
|
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Modelo.id) + " = " + nameof(HPV_AgrupacionesTerminales.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Modelo.codigo) + " = " + nameof(HPV_AgrupacionesTerminales.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Modelo.descripcion) + " = " + nameof(HPV_AgrupacionesTerminales.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Modelo.fechaBorrado) + " = " + nameof(HPV_AgrupacionesTerminales.fechaBorrado) + "," +
|
||||||
|
nameof(INTERNO_HPV_AgrupacionesTerminales_Modelo.idEmpresa) + " = " + nameof(HPV_AgrupacionesTerminales.idEmpresa) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesTerminales) +
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesTerminales.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_AgrupacionesTerminales_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
#region Rellenar Tablas Relacionadas
|
||||||
|
if (g_dnm_Modelo_Obtener != null)
|
||||||
|
{
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Obtener; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_Terminales ##########################################################################################
|
||||||
|
ThreadStart obj_ThreadStart_TERMINALES = new ThreadStart(Obtener_Terminales_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_TERMINALES = new Thread(obj_ThreadStart_TERMINALES);
|
||||||
|
obj_Thread_TERMINALES.Start();
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Obtener)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_Terminales_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_Terminales_Datos obj_HPV_Terminales_Datos = new HPV_Terminales_Datos();
|
||||||
|
g_dnm_Modelo_Obtener.Terminales = obj_HPV_Terminales_Datos.Obtener_ModeloListado_Por_IdAgrupacionTerminal(g_dnm_Modelo_Obtener.id);
|
||||||
|
}
|
||||||
|
catch(Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_AgrupacionesTerminales g_mdl_HPV_AgrupacionesTerminales = null;
|
||||||
|
public HPV_AgrupacionesTerminales Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_AgrupacionesTerminales;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_AgrupacionesTerminales = obj_Exferia_Entities.Database.SqlQuery<HPV_AgrupacionesTerminales>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_AgrupacionesTerminales> g_lst_HPV_AgrupacionesTerminales = null;
|
||||||
|
|
||||||
|
public List<HPV_AgrupacionesTerminales> Obtener_ModeloListado_Por_IdEmpresa(long _lng_idEmpresa)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.idEmpresa) + "=@idEmpresa ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idEmpresa", _lng_idEmpresa)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdEmpresa), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_AgrupacionesTerminales;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HPV_AgrupacionesTerminales> Obtener_ModeloListado_Por_IdTerminal(long _lng_idTerminal)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//INNER JOIN
|
||||||
|
" INNER JOIN " + nameof(HPV_Terminales_AgrupacionesTerminales) + " ON " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.id) + " = " + nameof(HPV_Terminales_AgrupacionesTerminales) + "." + nameof(HPV_Terminales_AgrupacionesTerminales.idAgrupacionTerminal) +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_AgrupacionesTerminales) + "." + nameof(HPV_AgrupacionesTerminales.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Terminales_AgrupacionesTerminales) + "." + nameof(HPV_Terminales_AgrupacionesTerminales.idTerminal) + "=@idTerminal ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idTerminal", _lng_idTerminal)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdEmpresa), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_AgrupacionesTerminales;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_AgrupacionesTerminales = obj_Exferia_Entities.Database.SqlQuery<HPV_AgrupacionesTerminales>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.id) + "," +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.codigo) + "," +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.descripcion) + "," +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.idEmpresa) + "," +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_AgrupacionesTerminales);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
HPV_AgrupacionesTerminales mdl_HPV_AgrupacionesTerminales_AGrabar = (HPV_AgrupacionesTerminales)_mdl_obj;
|
||||||
|
HPV_AgrupacionesTerminales mdl_HPV_AgrupacionesTerminales_DatosViejos = new HPV_AgrupacionesTerminales();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_AgrupacionesTerminales mdl_HPV_AgrupacionesTerminales_Final = Obtener_Modelo_Por_Id(mdl_HPV_AgrupacionesTerminales_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_AgrupacionesTerminales_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_AgrupacionesTerminales_Final, mdl_HPV_AgrupacionesTerminales_DatosViejos, false, false);
|
||||||
|
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_AgrupacionesTerminales_AGrabar, mdl_HPV_AgrupacionesTerminales_Final, false, false);
|
||||||
|
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_AgrupacionesTerminales) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_AgrupacionesTerminales_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_AgrupacionesTerminales_Final.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_AgrupacionesTerminales_Final.idEmpresa),
|
||||||
|
mdl_HPV_AgrupacionesTerminales_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_AgrupacionesTerminales_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_HPV_AgrupacionesTerminales_Final.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = mdl_HPV_AgrupacionesTerminales_Final.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_AgrupacionesTerminales_Final = new HPV_AgrupacionesTerminales();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
// Cargar los Datos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_AgrupacionesTerminales_AGrabar, mdl_HPV_AgrupacionesTerminales_Final, false, false);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_AgrupacionesTerminales) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.codigo) + "," +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.descripcion) + "," +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.idEmpresa) + "," +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.fechaBorrado) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_AgrupacionesTerminales.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado" +
|
||||||
|
" ) ";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_AgrupacionesTerminales_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_AgrupacionesTerminales_Final.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_AgrupacionesTerminales_Final.idEmpresa),
|
||||||
|
mdl_HPV_AgrupacionesTerminales_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_AgrupacionesTerminales_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value)
|
||||||
|
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_AgrupacionesTerminales), mdl_HPV_AgrupacionesTerminales_DatosViejos, mdl_HPV_AgrupacionesTerminales_Final, mdl_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = mdl_HPV_AgrupacionesTerminales_Final;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_AgrupacionesTerminales mdl_HPV_AgrupacionesTerminales_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_AgrupacionesTerminales_Final != null)
|
||||||
|
{
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_AgrupacionesTerminales) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_AgrupacionesTerminales.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_AgrupacionesTerminales), null, mdl_HPV_AgrupacionesTerminales_Final, G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_AgrupacionesTerminales_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Finalizar transaccion
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,636 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Exferia_General;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_CamarerosPerfiles_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listado
|
||||||
|
private List<INTERNO_HPV_CamarerosPerfiles_Listado_Modelo> g_lst_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo = null;
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_HPV = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_CamarerosPerfiles).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
if ((g_lst_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo != null) && (g_lst_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_HPV = g_lst_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_CamarerosPerfiles).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo != null) && (g_lst_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_HPV = g_lst_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.id) + " = " + nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.codigo) + " = " + nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.descripcion) + " = " + nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_CamarerosPerfiles) +
|
||||||
|
" WHERE " + nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.fechaBorrado) + " IS null AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_CamarerosPerfiles) + "." + (nameof(HPV_CamarerosPerfiles.id) + "=@id") : "1 = 1");
|
||||||
|
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_CamarerosPerfiles_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_CamarerosPerfiles_Listado_Modelo g_mdl_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_CamarerosPerfiles).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Conuslta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_CamarerosPerfiles).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Datos) + "/" + nameof(Obtener_F3_PorId), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.id) + " = " + nameof(HPV_CamarerosPerfiles.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.codigo) + " = " + nameof(HPV_CamarerosPerfiles.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.descripcion) + " = " + nameof(HPV_CamarerosPerfiles.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_CamarerosPerfiles) +
|
||||||
|
" WHERE " + nameof(HPV_CamarerosPerfiles.fechaBorrado) + " IS null AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_CamarerosPerfiles.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_CamarerosPerfiles.codigo)))
|
||||||
|
? (nameof(HPV_CamarerosPerfiles.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Descripcion
|
||||||
|
: (nameof(HPV_CamarerosPerfiles.descripcion) + "=@Filtro")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@Filtro", _str_Filtro)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_CamarerosPerfiles_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_CamarerosPerfiles_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
|
||||||
|
#region Obtener Simple
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
|
||||||
|
private static int g_int_TotalHilos_Obtener = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Obtener = new bool[g_int_TotalHilos_Obtener];
|
||||||
|
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.id) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.codigo) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.descripcion) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_CamarerosPerfiles) +
|
||||||
|
" WHERE " + nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<HPV_CamarerosPerfiles>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_dnm_Modelo_Obtener != null)
|
||||||
|
{
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Obtener; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_CamarerosPerfiles_Permisos ##########################################################################################
|
||||||
|
ThreadStart obj_ThreadStart_PERMISOS = new ThreadStart(Obtener_Permisos_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_PERMISOS = new Thread(obj_ThreadStart_PERMISOS);
|
||||||
|
obj_Thread_PERMISOS.Start();
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Obtener)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_Permisos_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_CamarerosPerfiles_Permisos_Datos obj_HPV_CamarerosPerfiles_Permisos_Datos = new HPV_CamarerosPerfiles_Permisos_Datos();
|
||||||
|
g_dnm_Modelo_Obtener.HPV_CamarerosPerfiles_Permisos = obj_HPV_CamarerosPerfiles_Permisos_Datos.Obtener_ModeloListado_Por_IdCamareroPerfil(g_dnm_Modelo_Obtener.id);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_CamarerosPerfiles g_mdl_HPV_CamarerosPerfiles = null;
|
||||||
|
public HPV_CamarerosPerfiles Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_CamarerosPerfiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_CamarerosPerfiles = obj_Exferia_Entities.Database.SqlQuery<HPV_CamarerosPerfiles>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.id) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.codigo) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.descripcion) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_CamarerosPerfiles);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
HPV_CamarerosPerfiles mdl_HPV_CamarerosPerfiles_AGrabar = (HPV_CamarerosPerfiles)_mdl_obj;
|
||||||
|
HPV_CamarerosPerfiles mdl_HPV_CamarerosPerfiles_DatosViejos = new HPV_CamarerosPerfiles();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_CamarerosPerfiles mdl_HPV_CamarerosPerfiles_Final = Obtener_Modelo_Por_Id(mdl_HPV_CamarerosPerfiles_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_CamarerosPerfiles_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_CamarerosPerfiles_Final, mdl_HPV_CamarerosPerfiles_DatosViejos, false, false);
|
||||||
|
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_CamarerosPerfiles_AGrabar, mdl_HPV_CamarerosPerfiles_Final, false, false);
|
||||||
|
|
||||||
|
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_CamarerosPerfiles) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_CamarerosPerfiles.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_CamarerosPerfiles.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_CamarerosPerfiles.fechaBorrado) + "=@fechaBorrado" +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_CamarerosPerfiles.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_CamarerosPerfiles_AGrabar.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_CamarerosPerfiles_AGrabar.descripcion),
|
||||||
|
mdl_HPV_CamarerosPerfiles_AGrabar.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_CamarerosPerfiles_AGrabar.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_HPV_CamarerosPerfiles_AGrabar.id)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = mdl_HPV_CamarerosPerfiles_AGrabar.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_CamarerosPerfiles_Final = new HPV_CamarerosPerfiles();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
// Cargar los Datos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_CamarerosPerfiles_AGrabar, mdl_HPV_CamarerosPerfiles_Final, true, true);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_CamarerosPerfiles) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_CamarerosPerfiles.codigo) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles.descripcion) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles.fechaBorrado) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_CamarerosPerfiles.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@fechaBorrado" +
|
||||||
|
" ) ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_CamarerosPerfiles_AGrabar.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_CamarerosPerfiles_AGrabar.descripcion),
|
||||||
|
mdl_HPV_CamarerosPerfiles_AGrabar.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_CamarerosPerfiles_AGrabar.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_CamarerosPerfiles), mdl_HPV_CamarerosPerfiles_DatosViejos, mdl_HPV_CamarerosPerfiles_Final, mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = mdl_HPV_CamarerosPerfiles_Final;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_CamarerosPerfiles mdl_HPV_CamarerosPerfiles_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_CamarerosPerfiles_Final != null)
|
||||||
|
{
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_CamarerosPerfiles) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_CamarerosPerfiles.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_CamarerosPerfiles.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_CamarerosPerfiles), null, mdl_HPV_CamarerosPerfiles_Final, Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,162 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Exferia_General;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_CamarerosPerfiles_Permisos_Datos
|
||||||
|
{
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_CamarerosPerfiles_Permisos> g_lst_HPV_CamarerosPerfiles_Permisos = null;
|
||||||
|
|
||||||
|
public List<HPV_CamarerosPerfiles_Permisos> Obtener_ModeloListado_Por_IdCamareroPerfil(long _lng_idCamareroPerfil)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_CamarerosPerfiles_Permisos) + "." + nameof(HPV_CamarerosPerfiles_Permisos.idCamareroPerfil) + "=@idCamareroPerfil ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idCamareroPerfil", _lng_idCamareroPerfil)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Permisos_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdCamareroPerfil), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_CamarerosPerfiles_Permisos;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_CamarerosPerfiles_Permisos = obj_Exferia_Entities.Database.SqlQuery<HPV_CamarerosPerfiles_Permisos>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Permisos_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_CamarerosPerfiles_Permisos) + "." + nameof(HPV_CamarerosPerfiles_Permisos.idCamareroPerfil) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles_Permisos) + "." + nameof(HPV_CamarerosPerfiles_Permisos.permiso) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles_Permisos) + "." + nameof(HPV_CamarerosPerfiles_Permisos.observaciones) +
|
||||||
|
" FROM " + nameof(HPV_CamarerosPerfiles_Permisos);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idCamareroPerfil,List<long> _lst_Permisos)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar = " DELETE FROM " + nameof(HPV_CamarerosPerfiles_Permisos) + " WHERE " + nameof(HPV_CamarerosPerfiles_Permisos.idCamareroPerfil) + "=" + _lng_idCamareroPerfil;
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Borrar);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_lst_Permisos != null & _lst_Permisos.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (long lng_Permiso in _lst_Permisos)
|
||||||
|
{
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_CamarerosPerfiles_Permisos) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_CamarerosPerfiles_Permisos.idCamareroPerfil) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles_Permisos.permiso) + "," +
|
||||||
|
nameof(HPV_CamarerosPerfiles_Permisos.observaciones) + ") " +
|
||||||
|
" VALUES " +
|
||||||
|
" (" +
|
||||||
|
_lng_idCamareroPerfil + "," +
|
||||||
|
lng_Permiso + ","+
|
||||||
|
"''" +
|
||||||
|
")";
|
||||||
|
}
|
||||||
|
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CamarerosPerfiles_Permisos_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,974 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Data;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Camareros_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listados
|
||||||
|
private List<INTERNO_HPV_Camareros_Listado_Modelo> g_lst_INTERNO_HPV_Camareros_Listado_Modelo = null;
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_HPV = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Camareros).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
if ((g_lst_INTERNO_HPV_Camareros_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Camareros_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_HPV = g_lst_INTERNO_HPV_Camareros_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Camareros_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Camareros).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_Camareros_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Camareros_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_HPV = g_lst_INTERNO_HPV_Camareros_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Camareros_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionas);
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.id) + " = " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.codigo) + " = " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.nombre) + " = " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.nombre) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.fechaAlta) + " = " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.fechaAlta) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.fechaBaja) + " = " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.fechaBaja) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.validacion_Nombre) + " = " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.validacion_Nombre) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.validacion_Nombre) + " = " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.validacion_Nombre) + "," +
|
||||||
|
//ids
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.idEmpleado) + " = " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idEmpleado) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.idProveedor) + " = " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idProveedor) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.idEmpresa) + " = " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idEmpresa) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.idCamareroPerfil) + " = " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idCamareroPerfil) + "," +
|
||||||
|
//Empleado
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empleado)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empleado_Codigo) + " = " + nameof(MAE_Empleados) + "." + nameof(MAE_Empleados.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empleado_Descripcion) + " = " + nameof(MAE_Empleados) + "." + nameof(MAE_Empleados.nombre) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empleado_FechaBorrado) + " = " + nameof(MAE_Empleados) + "." + nameof(MAE_Empleados.fechaBorrado) + ","
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empleado_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empleado_Descripcion) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empleado_FechaBorrado) + " = NULL ,"
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
//Proveedor
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Camareros_Listado_Modelo.Proveedor)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Proveedor_Codigo) + " = " + nameof(MAE_Proveedores) + "." + nameof(MAE_Proveedores.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Proveedor_Descripcion) + " = " + nameof(MAE_Proveedores) + "." + nameof(MAE_Proveedores.razonSocial) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Proveedor_FechaBorrado) + " = " + nameof(MAE_Proveedores) + "." + nameof(MAE_Proveedores.fechaBorrado) + ","
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Proveedor_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Proveedor_Descripcion) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Proveedor_FechaBorrado) + " = NULL,"
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empresa_Codigo) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empresa_Descripcion) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empresa_FechaBorrado) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.fechaBorrado) + ","
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empresa_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empresa_Descripcion) + "= '', " +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empresa_FechaBorrado) + " = NULL ,"
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
//CamareroPerfil
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Camareros_Listado_Modelo.CamareroPerfil)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.CamareroPerfil_Codigo) + " = " + nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.CamareroPerfil_Descripcion) + " = " + nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.CamareroPerfil_FechaBorrado) + " = " + nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.fechaBorrado)
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.CamareroPerfil_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.CamareroPerfil_Descripcion) + "= '', " +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.CamareroPerfil_FechaBorrado) + " = NULL "
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
" FROM " + nameof(HPV_Camareros) +
|
||||||
|
//Empleado
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empleado)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(MAE_Empleados) + " ON " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idEmpleado) + " = " + nameof(MAE_Empleados) + "." + nameof(MAE_Empleados.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
//Proveedor
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Camareros_Listado_Modelo.Proveedor)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(MAE_Proveedores) + " ON " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idProveedor) + " = " + nameof(MAE_Proveedores) + "." + nameof(MAE_Proveedores.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Camareros_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(GEN_Empresas) + " ON " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idEmpresa) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
//CamareroPerfil
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Camareros_Listado_Modelo.CamareroPerfil)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(HPV_CamarerosPerfiles) + " ON " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idCamareroPerfil) + " = " + nameof(HPV_CamarerosPerfiles) + "." + nameof(HPV_CamarerosPerfiles.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
" WHERE " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idEmpresa) + "=@idEmpresa " +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionas != null && _lst_idEmpresasRelacionas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_Camareros) + "." + (nameof(HPV_Camareros.id) + "=@id") : "1 = 1");
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id", _lng_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_Camareros_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Camareros_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Camareros_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_Camareros_Listado_Modelo g_mdl_INTERNO_HPV_Camareros_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Camareros).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Camareros_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_Camareros_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Camareros_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Conuslta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Camareros).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Camareros_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_Camareros_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Camareros_Datos) + "/" + nameof(Obtener_F3_PorId), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.id) + " = " + nameof(HPV_Camareros.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.codigo) + " = " + nameof(HPV_Camareros.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Camareros_Listado_Modelo.nombre) + " = " + nameof(HPV_Camareros.nombre) +
|
||||||
|
" FROM " + nameof(HPV_Camareros) +
|
||||||
|
" WHERE " + nameof(HPV_Camareros.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idEmpresa) + "=@idEmpresa " +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_Camareros.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_Camareros.codigo)))
|
||||||
|
? (nameof(HPV_Camareros.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Nombre
|
||||||
|
: (nameof(HPV_Camareros.nombre) + "=@Filtro")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@Filtro", _str_Filtro));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_Camareros_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Camareros_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Camareros_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
|
||||||
|
#region Obtener Simple
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
|
||||||
|
private static int g_int_TotalHilos_Obtener = 4;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Obtener = new bool[g_int_TotalHilos_Obtener];
|
||||||
|
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.id) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idEmpleado) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idProveedor) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.codigo) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.nombre) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.fechaAlta) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.fechaBaja) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.validacion_Nombre) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.validacion_Clave) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.foto) + "," +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.idCamareroPerfil) +
|
||||||
|
" FROM " + nameof(HPV_Camareros) +
|
||||||
|
" WHERE " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<HPV_Camareros>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_dnm_Modelo_Obtener != null)
|
||||||
|
{
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Obtener; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//MAE_Empleados ##########################################################################################
|
||||||
|
if (g_dnm_Modelo_Obtener.idEmpleado != null)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_EMPLEADO = new ThreadStart(Obtener_Empleado_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_MAYOR_EMPLEADO = new Thread(obj_ThreadStart_EMPLEADO);
|
||||||
|
obj_Thread_MAYOR_EMPLEADO.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//MAE_Proveedores ##########################################################################################
|
||||||
|
if (g_dnm_Modelo_Obtener.idProveedor != null)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_PROVEEDOR = new ThreadStart(Obtener_Proveedor_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_MAYOR_PROVEEDOR = new Thread(obj_ThreadStart_PROVEEDOR);
|
||||||
|
obj_Thread_MAYOR_PROVEEDOR.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[1] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//GEN_Empresas ##########################################################################################
|
||||||
|
if (g_dnm_Modelo_Obtener.idEmpresa != null)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_EMPRESA = new ThreadStart(Obtener_Empresa_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_MAYOR_EMPRESA = new Thread(obj_ThreadStart_EMPRESA);
|
||||||
|
obj_Thread_MAYOR_EMPRESA.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[2] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_CamarerosPerfiles ##########################################################################################
|
||||||
|
if (g_dnm_Modelo_Obtener.idCamareroPerfil != null)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_CAMAREROSPERFILES = new ThreadStart(Obtener_CamarerosPerfiles_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_MAYOR_CAMAREROSPERFILES = new Thread(obj_ThreadStart_CAMAREROSPERFILES);
|
||||||
|
obj_Thread_MAYOR_CAMAREROSPERFILES.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[3] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Obtener)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Camareros_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_Empleado_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Cargamos el ensamblado
|
||||||
|
Assembly m_assembly = Assembly.LoadFrom(Variables.G_STR_LIBRERIA_RUTAINICIAL + @"\" + Variables.G_STR_LIBRERIA_MAESTROS + ".dll");
|
||||||
|
//Obtenemos el tipo de la clase
|
||||||
|
Type m_type = m_assembly.GetType(Variables.G_STR_LIBRERIA_MAESTROS + "." + Variables.G_STR_LIBRERIA_DATOSMAESTROS);
|
||||||
|
//creamos la instancia
|
||||||
|
var obj_Clase = Activator.CreateInstance(m_type);
|
||||||
|
//Cargamos el metodo solicitado
|
||||||
|
MethodInfo obj_MethodInfo = obj_Clase.GetType().GetMethod(Variables.G_STR_LIBRERIA_DATOSMAESTROS_PROCEDIMIENTO_MAEEMPLEADOS_OBTENERMODELO_POR_ID, BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
|
||||||
|
//Obtener valores
|
||||||
|
object[] arr_Parametros = { g_dnm_Modelo_Obtener.idEmpleado };
|
||||||
|
//Pasamos los parametros al metodo y lo ejecutamos
|
||||||
|
g_dnm_Modelo_Obtener.MAE_Empleados = (MAE_Empleados)obj_MethodInfo.Invoke(obj_Clase, arr_Parametros);
|
||||||
|
}
|
||||||
|
catch(Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Obtener_Proveedor_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Cargamos el ensamblado
|
||||||
|
Assembly m_assembly = Assembly.LoadFrom(Variables.G_STR_LIBRERIA_RUTAINICIAL + @"\" + Variables.G_STR_LIBRERIA_MAESTROS + ".dll");
|
||||||
|
//Obtenemos el tipo de la clase
|
||||||
|
Type m_type = m_assembly.GetType(Variables.G_STR_LIBRERIA_MAESTROS + "." + Variables.G_STR_LIBRERIA_DATOSMAESTROS);
|
||||||
|
//creamos la instancia
|
||||||
|
var obj_Clase = Activator.CreateInstance(m_type);
|
||||||
|
//Cargamos el metodo solicitado
|
||||||
|
MethodInfo obj_MethodInfo = obj_Clase.GetType().GetMethod(Variables.G_STR_LIBRERIA_DATOSMAESTROS_PROCEDIMIENTO_MAEPROVEEDORES_OBTENERMODELO_POR_ID_AUX1, BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
|
||||||
|
//Obtener valores
|
||||||
|
object[] arr_Parametros = { g_dnm_Modelo_Obtener.idProveedor,true,true, true, true,true,true,true };
|
||||||
|
//Pasamos los parametros al metodo y lo ejecutamos
|
||||||
|
g_dnm_Modelo_Obtener.MAE_Proveedores = (MAE_Proveedores)obj_MethodInfo.Invoke(obj_Clase, arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[1] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Obtener_Empresa_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_dnm_Modelo_Obtener.GEN_Empresas = Datos_Generales.GEN_Empresas_Obtener_Modelo_Por_Id(g_dnm_Modelo_Obtener.idEmpresa);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[2] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Obtener_CamarerosPerfiles_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_CamarerosPerfiles_Datos obj_HPV_CamarerosPerfiles_Datos = new HPV_CamarerosPerfiles_Datos();
|
||||||
|
g_dnm_Modelo_Obtener.HPV_CamarerosPerfiles = obj_HPV_CamarerosPerfiles_Datos.Obtener_Modelo_Por_Id(g_dnm_Modelo_Obtener.idCamareroPerfil);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[3] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_Camareros g_mdl_HPV_Camareros = null;
|
||||||
|
|
||||||
|
public HPV_Camareros Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Camareros) + "." + nameof(HPV_Camareros.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Camareros_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_Camareros;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_Camareros = obj_Exferia_Entities.Database.SqlQuery<HPV_Camareros>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Camareros_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Camareros.id) + "," +
|
||||||
|
nameof(HPV_Camareros.idEmpleado) + "," +
|
||||||
|
nameof(HPV_Camareros.idProveedor) + "," +
|
||||||
|
nameof(HPV_Camareros.codigo) + "," +
|
||||||
|
nameof(HPV_Camareros.nombre) + "," +
|
||||||
|
nameof(HPV_Camareros.fechaAlta) + "," +
|
||||||
|
nameof(HPV_Camareros.fechaBaja) + "," +
|
||||||
|
nameof(HPV_Camareros.validacion_Nombre) + "," +
|
||||||
|
nameof(HPV_Camareros.validacion_Clave) + "," +
|
||||||
|
nameof(HPV_Camareros.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Camareros.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_Camareros.foto) + "," +
|
||||||
|
nameof(HPV_Camareros.idCamareroPerfil) +
|
||||||
|
" FROM " + nameof(HPV_Camareros);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
HPV_Camareros mdl_HPV_Camareros_AGrabar = (HPV_Camareros)_mdl_obj;
|
||||||
|
HPV_Camareros mdl_HPV_Camareros_DatosViejos = new HPV_Camareros();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Camareros mdl_HPV_Camareros_Final = Obtener_Modelo_Por_Id(mdl_HPV_Camareros_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_Camareros_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Camareros_Final, mdl_HPV_Camareros_DatosViejos, false, false);
|
||||||
|
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Camareros_AGrabar, mdl_HPV_Camareros_Final, false, false);
|
||||||
|
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Camareros) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Camareros.idEmpleado) + "=@idEmpleado," +
|
||||||
|
nameof(HPV_Camareros.idProveedor) + "=@idProveedor," +
|
||||||
|
nameof(HPV_Camareros.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_Camareros.nombre) + "=@nombre," +
|
||||||
|
nameof(HPV_Camareros.fechaAlta) + "=@fechaAlta," +
|
||||||
|
nameof(HPV_Camareros.fechaBaja) + "=@fechaBaja," +
|
||||||
|
nameof(HPV_Camareros.validacion_Nombre) + "=@validacion_Nombre," +
|
||||||
|
nameof(HPV_Camareros.validacion_Clave) + "=@validacion_Clave," +
|
||||||
|
nameof(HPV_Camareros.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_Camareros.fechaBorrado) + "=@fechaBorrado," +
|
||||||
|
nameof(HPV_Camareros.foto) + "=@foto," +
|
||||||
|
nameof(HPV_Camareros.idCamareroPerfil) + "=@idCamareroPerfil" +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Camareros.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
SqlParameter obj_SqlParameter_imagen = new SqlParameter("@foto", SqlDbType.Binary);
|
||||||
|
if (mdl_HPV_Camareros_Final.foto != null)
|
||||||
|
{ obj_SqlParameter_imagen.Value = mdl_HPV_Camareros_Final.foto; }
|
||||||
|
else
|
||||||
|
{ obj_SqlParameter_imagen.Value = DBNull.Value; }
|
||||||
|
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
mdl_HPV_Camareros_Final.idEmpleado != null
|
||||||
|
? new SqlParameter("@idEmpleado", mdl_HPV_Camareros_Final.idEmpleado.Value)
|
||||||
|
: new SqlParameter("@idEmpleado", DBNull.Value),
|
||||||
|
mdl_HPV_Camareros_Final.idProveedor != null
|
||||||
|
? new SqlParameter("@idProveedor", mdl_HPV_Camareros_Final.idProveedor.Value)
|
||||||
|
: new SqlParameter("@idProveedor", DBNull.Value),
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_Camareros_Final.codigo),
|
||||||
|
new SqlParameter("@nombre", mdl_HPV_Camareros_Final.nombre),
|
||||||
|
new SqlParameter("@fechaAlta", mdl_HPV_Camareros_Final.fechaAlta),
|
||||||
|
mdl_HPV_Camareros_Final.fechaBaja != null
|
||||||
|
? new SqlParameter("@fechaBaja", mdl_HPV_Camareros_Final.fechaBaja.Value)
|
||||||
|
: new SqlParameter("@fechaBaja", DBNull.Value),
|
||||||
|
mdl_HPV_Camareros_Final.validacion_Nombre != null
|
||||||
|
? new SqlParameter("@validacion_Nombre", mdl_HPV_Camareros_Final.validacion_Nombre)
|
||||||
|
: new SqlParameter("@validacion_Nombre", DBNull.Value),
|
||||||
|
mdl_HPV_Camareros_Final.validacion_Clave != null
|
||||||
|
? new SqlParameter("@validacion_Clave", mdl_HPV_Camareros_Final.validacion_Clave)
|
||||||
|
: new SqlParameter("@validacion_Clave", DBNull.Value),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_Camareros_Final.idEmpresa),
|
||||||
|
mdl_HPV_Camareros_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_Camareros_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
obj_SqlParameter_imagen,
|
||||||
|
mdl_HPV_Camareros_Final.idCamareroPerfil!=null
|
||||||
|
? new SqlParameter("@idCamareroPerfil", mdl_HPV_Camareros_Final.idCamareroPerfil.Value)
|
||||||
|
: new SqlParameter("@idCamareroPerfil", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_HPV_Camareros_Final.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = mdl_HPV_Camareros_Final.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_Camareros_Final = new HPV_Camareros();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
// Cargar los Datos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Camareros_AGrabar, mdl_HPV_Camareros_Final, false, false);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_Camareros) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_Camareros.idEmpleado) + "," +
|
||||||
|
nameof(HPV_Camareros.idProveedor) + "," +
|
||||||
|
nameof(HPV_Camareros.codigo) + "," +
|
||||||
|
nameof(HPV_Camareros.nombre) + "," +
|
||||||
|
nameof(HPV_Camareros.fechaAlta) + "," +
|
||||||
|
nameof(HPV_Camareros.fechaBaja) + "," +
|
||||||
|
nameof(HPV_Camareros.validacion_Nombre) + "," +
|
||||||
|
nameof(HPV_Camareros.validacion_Clave) + "," +
|
||||||
|
nameof(HPV_Camareros.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Camareros.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_Camareros.foto) + "," +
|
||||||
|
nameof(HPV_Camareros.idCamareroPerfil) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_Camareros.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@idEmpleado," +
|
||||||
|
"@idProveedor," +
|
||||||
|
"@codigo," +
|
||||||
|
"@nombre," +
|
||||||
|
"@fechaAlta," +
|
||||||
|
"@fechaBaja," +
|
||||||
|
"@validacion_Nombre," +
|
||||||
|
"@validacion_Clave," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado," +
|
||||||
|
"@foto," +
|
||||||
|
"@idCamareroPerfil" +
|
||||||
|
" ) ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
SqlParameter obj_SqlParameter_imagen = new SqlParameter("@foto", SqlDbType.Binary);
|
||||||
|
if (mdl_HPV_Camareros_Final.foto != null)
|
||||||
|
{ obj_SqlParameter_imagen.Value = mdl_HPV_Camareros_Final.foto; }
|
||||||
|
else
|
||||||
|
{ obj_SqlParameter_imagen.Value = DBNull.Value; }
|
||||||
|
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
mdl_HPV_Camareros_Final.idEmpleado != null
|
||||||
|
? new SqlParameter("@idEmpleado", mdl_HPV_Camareros_Final.idEmpleado.Value)
|
||||||
|
: new SqlParameter("@idEmpleado", DBNull.Value),
|
||||||
|
mdl_HPV_Camareros_Final.idProveedor != null
|
||||||
|
? new SqlParameter("@idProveedor", mdl_HPV_Camareros_Final.idProveedor.Value)
|
||||||
|
: new SqlParameter("@idProveedor", DBNull.Value),
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_Camareros_Final.codigo),
|
||||||
|
new SqlParameter("@nombre", mdl_HPV_Camareros_Final.nombre),
|
||||||
|
new SqlParameter("@fechaAlta", mdl_HPV_Camareros_Final.fechaAlta),
|
||||||
|
mdl_HPV_Camareros_Final.fechaBaja != null
|
||||||
|
? new SqlParameter("@fechaBaja", mdl_HPV_Camareros_Final.fechaBaja.Value)
|
||||||
|
: new SqlParameter("@fechaBaja", DBNull.Value),
|
||||||
|
mdl_HPV_Camareros_Final.validacion_Nombre != null
|
||||||
|
? new SqlParameter("@validacion_Nombre", mdl_HPV_Camareros_Final.validacion_Nombre)
|
||||||
|
: new SqlParameter("@validacion_Nombre", DBNull.Value),
|
||||||
|
mdl_HPV_Camareros_Final.validacion_Clave != null
|
||||||
|
? new SqlParameter("@validacion_Clave", mdl_HPV_Camareros_Final.validacion_Clave)
|
||||||
|
: new SqlParameter("@validacion_Clave", DBNull.Value),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_Camareros_Final.idEmpresa),
|
||||||
|
mdl_HPV_Camareros_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_Camareros_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
obj_SqlParameter_imagen,
|
||||||
|
mdl_HPV_Camareros_Final.idCamareroPerfil!=null
|
||||||
|
? new SqlParameter("@idCamareroPerfil", mdl_HPV_Camareros_Final.idCamareroPerfil.Value)
|
||||||
|
: new SqlParameter("@idCamareroPerfil", DBNull.Value)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Camareros), mdl_HPV_Camareros_DatosViejos, mdl_HPV_Camareros_Final, mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = mdl_HPV_Camareros_Final;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Camareros_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Camareros mdl_HPV_Camareros_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_Camareros_Final != null)
|
||||||
|
{
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Camareros) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Camareros.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Camareros.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Camareros), null, mdl_HPV_Camareros_Final, G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Camareros_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,676 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_Aplicacion.Modelos_MantenimientoSimple;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_CaracteristicasTipos_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listado
|
||||||
|
private List<INTERNO_HPV_CaracteristicasTipos_Listado_Modelo> g_lst_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo = null;
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_CaracteristicasTipos).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo != null) && (g_lst_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_HPV = g_lst_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CaracteristicasTipos_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_CaracteristicasTipos).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo != null) && (g_lst_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_HPV = g_lst_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CaracteristicasTipos_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
//Filtros de Opciones
|
||||||
|
//Datos del Padre si los tuviera .........................
|
||||||
|
long lng_Padre_id = -1;
|
||||||
|
string str_Padre_Opcion = "";
|
||||||
|
if (_lst_INTERNO_Filtro_OpcionPadre_Modelo != null && _lst_INTERNO_Filtro_OpcionPadre_Modelo.Count > 0)
|
||||||
|
{
|
||||||
|
lng_Padre_id = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].VALOR;
|
||||||
|
str_Padre_Opcion = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].NOMBRE_CAMPO;
|
||||||
|
}
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.id) + " = " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.codigo) + " = " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.descripcion) + " = " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.descripcion) + "," +
|
||||||
|
//ids
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.idEmpresa) + " = " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.idEmpresa) + "," +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Empresa_Codigo) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Empresa_Descripcion) + " =" + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Empresa_FechaBorrado) + " =" + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.fechaBorrado)
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Empresa_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Empresa_Descripcion) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Empresa_FechaBorrado) + " = NULL "
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
" FROM " + nameof(HPV_CaracteristicasTipos) +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(GEN_Empresas) + " ON " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.idEmpresa) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
" WHERE " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_CaracteristicasTipos) + "." + (nameof(HPV_CaracteristicasTipos.id) + "=@id") : "1 = 1") + " AND " +
|
||||||
|
//Filtro por datos del padre relacionado
|
||||||
|
(
|
||||||
|
!str_Padre_Opcion.Equals("")
|
||||||
|
//Empresa
|
||||||
|
? str_Padre_Opcion.Equals(Variables.G_STR_OPCION_GEN_EMPRESA)
|
||||||
|
? (nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.idEmpresa) + "=@id_Padre")
|
||||||
|
: ("1 = 1")
|
||||||
|
: ("1 = 1")
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id", _lng_id));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id_Padre", lng_Padre_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_CaracteristicasTipos_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CaracteristicasTipos_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_CaracteristicasTipos_Listado_Modelo g_mdl_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_CaracteristicasTipos).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CaracteristicasTipos_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_CaracteristicasTipos).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CaracteristicasTipos_Datos) + "/" + nameof(Obtener_F3_PorId), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionas);
|
||||||
|
|
||||||
|
//Filtros de Opciones
|
||||||
|
//Datos del Padre si los tuviera .........................
|
||||||
|
long lng_Padre_id = -1;
|
||||||
|
string str_Padre_Opcion = "";
|
||||||
|
if (_lst_INTERNO_Filtro_OpcionPadre_Modelo != null && _lst_INTERNO_Filtro_OpcionPadre_Modelo.Count > 0)
|
||||||
|
{
|
||||||
|
lng_Padre_id = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].VALOR;
|
||||||
|
str_Padre_Opcion = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].NOMBRE_CAMPO;
|
||||||
|
}
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.id) + " = " + nameof(HPV_CaracteristicasTipos.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.codigo) + " = " + nameof(HPV_CaracteristicasTipos.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.descripcion) + " = " + nameof(HPV_CaracteristicasTipos.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_CaracteristicasTipos) +
|
||||||
|
" WHERE " + nameof(HPV_CaracteristicasTipos.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionas != null && _lst_idEmpresasRelacionas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_CaracteristicasTipos.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_CaracteristicasTipos.codigo)))
|
||||||
|
? (nameof(HPV_CaracteristicasTipos.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Descripcion
|
||||||
|
: (nameof(HPV_CaracteristicasTipos.descripcion) + "=@Filtro")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
+ " AND " +
|
||||||
|
//Filtro por datos del padre relacionado
|
||||||
|
(
|
||||||
|
!str_Padre_Opcion.Equals("")
|
||||||
|
//Empresa
|
||||||
|
? str_Padre_Opcion.Equals(Variables.G_STR_OPCION_GEN_EMPRESA)
|
||||||
|
? (nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.idEmpresa) + "=@id_Padre")
|
||||||
|
: ("1 = 1")
|
||||||
|
: ("1 = 1")
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@Filtro", _str_Filtro));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id_Padre", lng_Padre_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_CaracteristicasTipos_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_CaracteristicasTipos_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CaracteristicasTipos_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.id) + " = " + nameof(HPV_CaracteristicasTipos.id) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.codigo) + " = " + nameof(HPV_CaracteristicasTipos.codigo) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.descripcion) + " = " + nameof(HPV_CaracteristicasTipos.descripcion) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.fechaBorrado) + " = " + nameof(HPV_CaracteristicasTipos.fechaBorrado) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.idEmpresa) + " = " + nameof(HPV_CaracteristicasTipos.idEmpresa) +
|
||||||
|
" FROM " + nameof(HPV_CaracteristicasTipos) +
|
||||||
|
" WHERE " + nameof(HPV_CaracteristicasTipos.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_CaracteristicasTipos.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<INTERNO_MantenimientoSimple_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CaracteristicasTipos_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_CaracteristicasTipos g_mdl_HPV_CaracteristicasTipos = null;
|
||||||
|
public HPV_CaracteristicasTipos Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CaracteristicasTipos_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_CaracteristicasTipos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_CaracteristicasTipos = obj_Exferia_Entities.Database.SqlQuery<HPV_CaracteristicasTipos>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CaracteristicasTipos_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_CaracteristicasTipos.id) + " , " +
|
||||||
|
nameof(HPV_CaracteristicasTipos.codigo) + " , " +
|
||||||
|
nameof(HPV_CaracteristicasTipos.descripcion) + " , " +
|
||||||
|
nameof(HPV_CaracteristicasTipos.idEmpresa) + " , " +
|
||||||
|
nameof(HPV_CaracteristicasTipos.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_CaracteristicasTipos);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
INTERNO_MantenimientoSimple_Modelo mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar = (INTERNO_MantenimientoSimple_Modelo)_mdl_obj;
|
||||||
|
HPV_CaracteristicasTipos mdl_HPV_CaracteristicasTipos_DatosViejos = new HPV_CaracteristicasTipos();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_CaracteristicasTipos mdl_HPV_CaracteristicasTipos_Final = Obtener_Modelo_Por_Id(mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_CaracteristicasTipos_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_CaracteristicasTipos_Final, mdl_HPV_CaracteristicasTipos_DatosViejos, false, false);
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_CaracteristicasTipos_Final, mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar);
|
||||||
|
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_CaracteristicasTipos) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_CaracteristicasTipos.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_CaracteristicasTipos.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_CaracteristicasTipos.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_CaracteristicasTipos.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_CaracteristicasTipos.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.idEmpresa),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_CaracteristicasTipos_Final = new HPV_CaracteristicasTipos();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_CaracteristicasTipos_Final, mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_CaracteristicasTipos) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_CaracteristicasTipos.codigo) + "," +
|
||||||
|
nameof(HPV_CaracteristicasTipos.descripcion) + "," +
|
||||||
|
nameof(HPV_CaracteristicasTipos.idEmpresa) + "," +
|
||||||
|
nameof(HPV_CaracteristicasTipos.fechaBorrado) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_CaracteristicasTipos.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado" +
|
||||||
|
" ) ";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.idEmpresa),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value)
|
||||||
|
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_CaracteristicasTipos), mdl_HPV_CaracteristicasTipos_DatosViejos, mdl_HPV_CaracteristicasTipos_Final, mdl_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CaracteristicasTipos_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Finalizar transaccion
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Cargar_DatosModelo(HPV_CaracteristicasTipos _mdl_HPV_CaracteristicasTipos, INTERNO_MantenimientoSimple_Modelo _mdl_INTERNO_MantenimientoSimple_Modelo)
|
||||||
|
{
|
||||||
|
//Cargar los datos Nuevos del Modelo
|
||||||
|
_mdl_HPV_CaracteristicasTipos.id = _mdl_INTERNO_MantenimientoSimple_Modelo.id;
|
||||||
|
_mdl_HPV_CaracteristicasTipos.codigo = _mdl_INTERNO_MantenimientoSimple_Modelo.codigo;
|
||||||
|
_mdl_HPV_CaracteristicasTipos.descripcion = _mdl_INTERNO_MantenimientoSimple_Modelo.descripcion;
|
||||||
|
_mdl_HPV_CaracteristicasTipos.idEmpresa = _mdl_INTERNO_MantenimientoSimple_Modelo.idEmpresa;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_CaracteristicasTipos mdl_HPV_CaracteristicasTipos_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_CaracteristicasTipos_Final != null)
|
||||||
|
{
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_CaracteristicasTipos) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_CaracteristicasTipos.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_CaracteristicasTipos.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Grabar un registro de trazabilidad con los datos de la trasaccion realizada
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_CaracteristicasTipos), null, mdl_HPV_CaracteristicasTipos_Final, Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Devolver tambien el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_CaracteristicasTipos_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,828 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_Aplicacion.Modelos_MantenimientoSimple;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Caracteristicas_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listado
|
||||||
|
private List<INTERNO_HPV_Caracteristicas_Listado_Modelo> g_lst_INTERNO_HPV_Caracteristicas_Listado_Modelo = null;
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Caracteristicas).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_Caracteristicas_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Caracteristicas_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_HPV = g_lst_INTERNO_HPV_Caracteristicas_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Caracteristicas).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_Caracteristicas_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Caracteristicas_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_HPV = g_lst_INTERNO_HPV_Caracteristicas_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
//Filtros de Opciones
|
||||||
|
//Datos del Padre si los tuviera .........................
|
||||||
|
long lng_Padre_id = -1;
|
||||||
|
string str_Padre_Opcion = "";
|
||||||
|
if (_lst_INTERNO_Filtro_OpcionPadre_Modelo != null && _lst_INTERNO_Filtro_OpcionPadre_Modelo.Count > 0)
|
||||||
|
{
|
||||||
|
lng_Padre_id = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].VALOR;
|
||||||
|
str_Padre_Opcion = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].NOMBRE_CAMPO;
|
||||||
|
}
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.id) + " = " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.codigo) + " = " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.descripcion) + " = " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.descripcion) + "," +
|
||||||
|
//ids
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.idEmpresa) + " = " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idEmpresa) + "," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.idCaracteristicaTipo) + " = " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idEmpresa) + "," +
|
||||||
|
//CaracteristicaTipo
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.CaracteristicaTipo)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.CaracteristicaTipo_Codigo) + " = " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.CaracteristicaTipo_Descripcion) + " =" + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.CaracteristicaTipo_FechaBorrado) + " =" + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.fechaBorrado) + ","
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.CaracteristicaTipo_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.CaracteristicaTipo_Descripcion) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.CaracteristicaTipo_FechaBorrado) + " = NULL, "
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.Empresa_Codigo) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.Empresa_Descripcion) + " =" + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.Empresa_FechaBorrado) + " =" + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.fechaBorrado)
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.Empresa_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.Empresa_Descripcion) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.Empresa_FechaBorrado) + " = NULL "
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
" FROM " + nameof(HPV_Caracteristicas) +
|
||||||
|
//CaracteristicaTipo
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.CaracteristicaTipo)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(HPV_CaracteristicasTipos) + " ON " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idCaracteristicaTipo) + " = " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(GEN_Empresas) + " ON " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idEmpresa) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
" WHERE " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_Caracteristicas) + "." + (nameof(HPV_Caracteristicas.id) + "=@id") : "1 = 1") + " AND " +
|
||||||
|
//Filtro por datos del padre relacionado
|
||||||
|
(
|
||||||
|
!str_Padre_Opcion.Equals("")
|
||||||
|
//Empresa
|
||||||
|
? str_Padre_Opcion.Equals(Variables.G_STR_OPCION_GEN_EMPRESA)
|
||||||
|
? (nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idEmpresa) + "=@id_Padre")
|
||||||
|
: ("1 = 1")
|
||||||
|
: ("1 = 1")
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id", _lng_id));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id_Padre", lng_Padre_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_Caracteristicas_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Caracteristicas_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_Caracteristicas_Listado_Modelo g_mdl_INTERNO_HPV_Caracteristicas_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Caracteristicas).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Caracteristicas_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_Caracteristicas_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Caracteristicas).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Caracteristicas_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_Caracteristicas_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Obtener_F3_PorId), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionas);
|
||||||
|
|
||||||
|
//Filtros de Opciones
|
||||||
|
//Datos del Padre si los tuviera .........................
|
||||||
|
long lng_Padre_id = -1;
|
||||||
|
string str_Padre_Opcion = "";
|
||||||
|
if (_lst_INTERNO_Filtro_OpcionPadre_Modelo != null && _lst_INTERNO_Filtro_OpcionPadre_Modelo.Count > 0)
|
||||||
|
{
|
||||||
|
lng_Padre_id = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].VALOR;
|
||||||
|
str_Padre_Opcion = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].NOMBRE_CAMPO;
|
||||||
|
}
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.id) + " = " + nameof(HPV_Caracteristicas.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.codigo) + " = " + nameof(HPV_Caracteristicas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.descripcion) + " = " + nameof(HPV_Caracteristicas.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_Caracteristicas) +
|
||||||
|
" WHERE " + nameof(HPV_Caracteristicas.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionas != null && _lst_idEmpresasRelacionas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_Caracteristicas.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_Caracteristicas.codigo)))
|
||||||
|
? (nameof(HPV_Caracteristicas.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Descripcion
|
||||||
|
: (nameof(HPV_Caracteristicas.descripcion) + "=@Filtro")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
+ " AND " +
|
||||||
|
//Filtro por datos del padre relacionado
|
||||||
|
(
|
||||||
|
!str_Padre_Opcion.Equals("")
|
||||||
|
//Empresa
|
||||||
|
? str_Padre_Opcion.Equals(Variables.G_STR_OPCION_GEN_EMPRESA)
|
||||||
|
? (nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idEmpresa) + "=@id_Padre")
|
||||||
|
: ("1 = 1")
|
||||||
|
: ("1 = 1")
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@Filtro", _str_Filtro));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id_Padre", lng_Padre_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_Caracteristicas_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Caracteristicas_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.id) + " = " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.id) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.codigo) + " = " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.codigo) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.descripcion) + " = " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.descripcion) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.fechaBorrado) + " = " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.fechaBorrado) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.idEmpresa) + " = " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idEmpresa) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.F3_id) + " = " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.id) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.F3_Codigo) + " = " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.codigo) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.F3_Descripcion) + " = " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.descripcion) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.F3_FechaBorrado) + " = " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_Caracteristicas) +
|
||||||
|
//HPV_CaracteristicasTipos
|
||||||
|
" LEFT JOIN " + nameof(HPV_CaracteristicasTipos) + " ON " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.idCaracteristicaTipo) + " = " + nameof(HPV_CaracteristicasTipos) + "." + nameof(HPV_CaracteristicasTipos.id) +
|
||||||
|
" WHERE " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<INTERNO_MantenimientoSimple_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_Caracteristicas g_mdl_HPV_Caracteristicas = null;
|
||||||
|
public HPV_Caracteristicas Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_Caracteristicas;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_Caracteristicas = obj_Exferia_Entities.Database.SqlQuery<HPV_Caracteristicas>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_Caracteristicas> g_lst_HPV_Caracteristicas = null;
|
||||||
|
|
||||||
|
public List<HPV_Caracteristicas> Obtener_ModeloListado_Por_Ids(List<long> _lst_Ids)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_lst_Ids != null && _lst_Ids.Count > 0)
|
||||||
|
{
|
||||||
|
string str_Filtro_IDS = Funciones.Formar_ContenidoIN_ParaConsultaWhere(nameof(HPV_Caracteristicas),
|
||||||
|
nameof(HPV_Caracteristicas.id),
|
||||||
|
G_ENUM_FORMARCONTENIDOIN_CONDICIONANTES.NADA,
|
||||||
|
_lst_Ids);
|
||||||
|
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + str_Filtro_IDS;
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
new object[] { });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Obtener_ModeloListado_Por_Ids), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Caracteristicas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HPV_Caracteristicas> Obtener_ModeloListado_Por_IdIngrediente(long _lng_idIngrediente)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//INNER JOIN
|
||||||
|
" INNER JOIN " + nameof(HPV_Ingredientes_Caracteristicas) + " ON " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.id) + " = " + nameof(HPV_Ingredientes_Caracteristicas) + "." + nameof(HPV_Ingredientes_Caracteristicas.idCaracteristica) +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Caracteristicas) + "." + nameof(HPV_Caracteristicas.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Ingredientes_Caracteristicas) + "." + nameof(HPV_Ingredientes_Caracteristicas.idIngrediente) + "=@idIngrediente ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idIngrediente", _lng_idIngrediente)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdIngrediente), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Caracteristicas;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_Caracteristicas = obj_Exferia_Entities.Database.SqlQuery<HPV_Caracteristicas>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Caracteristicas.id) + "," +
|
||||||
|
nameof(HPV_Caracteristicas.codigo) + "," +
|
||||||
|
nameof(HPV_Caracteristicas.descripcion) + "," +
|
||||||
|
nameof(HPV_Caracteristicas.idCaracteristicaTipo) + "," +
|
||||||
|
nameof(HPV_Caracteristicas.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Caracteristicas.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_Caracteristicas);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
INTERNO_MantenimientoSimple_Modelo mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar = (INTERNO_MantenimientoSimple_Modelo)_mdl_obj;
|
||||||
|
HPV_Caracteristicas mdl_HPV_Caracteristicas_DatosViejos = new HPV_Caracteristicas();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Caracteristicas mdl_HPV_Caracteristicas_Final = Obtener_Modelo_Por_Id(mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_Caracteristicas_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Caracteristicas_Final, mdl_HPV_Caracteristicas_DatosViejos, false, false);
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_Caracteristicas_Final, mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar);
|
||||||
|
|
||||||
|
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Caracteristicas) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Caracteristicas.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_Caracteristicas.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_Caracteristicas.idCaracteristicaTipo) + "=@idCaracteristicaTipo," +
|
||||||
|
nameof(HPV_Caracteristicas.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_Caracteristicas.fechaBorrado) + "=@fechaBorrado" +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Caracteristicas.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.descripcion),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.F3_id > -1
|
||||||
|
? new SqlParameter("@idCaracteristicaTipo", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.F3_id.Value)
|
||||||
|
: new SqlParameter("@idCaracteristicaTipo", DBNull.Value),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.idEmpresa),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_Caracteristicas_Final = new HPV_Caracteristicas();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_Caracteristicas_Final, mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_Caracteristicas) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_Caracteristicas.codigo) + "," +
|
||||||
|
nameof(HPV_Caracteristicas.descripcion) + "," +
|
||||||
|
nameof(HPV_Caracteristicas.idCaracteristicaTipo) + "," +
|
||||||
|
nameof(HPV_Caracteristicas.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Caracteristicas.fechaBorrado) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_Caracteristicas.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@idCaracteristicaTipo," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado" +
|
||||||
|
" ) ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.descripcion),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.F3_id > -1
|
||||||
|
? new SqlParameter("@idCaracteristicaTipo", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.F3_id.Value)
|
||||||
|
: new SqlParameter("@idCaracteristicaTipo", DBNull.Value),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.idEmpresa),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value)
|
||||||
|
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Caracteristicas), mdl_HPV_Caracteristicas_DatosViejos, mdl_HPV_Caracteristicas_Final, mdl_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Finalizar transaccion
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Cargar_DatosModelo(HPV_Caracteristicas _mdl_HPV_Caracteristicas, INTERNO_MantenimientoSimple_Modelo _mdl_INTERNO_MantenimientoSimple_Modelo)
|
||||||
|
{
|
||||||
|
//Cargar los datos Nuevos del Modelo
|
||||||
|
_mdl_HPV_Caracteristicas.id = _mdl_INTERNO_MantenimientoSimple_Modelo.id;
|
||||||
|
_mdl_HPV_Caracteristicas.codigo = _mdl_INTERNO_MantenimientoSimple_Modelo.codigo;
|
||||||
|
_mdl_HPV_Caracteristicas.descripcion = _mdl_INTERNO_MantenimientoSimple_Modelo.descripcion;
|
||||||
|
_mdl_HPV_Caracteristicas.idEmpresa = _mdl_INTERNO_MantenimientoSimple_Modelo.idEmpresa;
|
||||||
|
_mdl_HPV_Caracteristicas.idCaracteristicaTipo = _mdl_INTERNO_MantenimientoSimple_Modelo.F3_id != null ? _mdl_INTERNO_MantenimientoSimple_Modelo.F3_id.Value : -1;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Caracteristicas mdl_HPV_Caracteristicas_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_Caracteristicas_Final != null)
|
||||||
|
{
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Caracteristicas) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Caracteristicas.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Caracteristicas.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Caracteristicas), null, mdl_HPV_Caracteristicas_Final, Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Caracteristicas_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,310 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Clientes_AgrupacionesClientesLineas_Datos
|
||||||
|
{
|
||||||
|
#region Obtener
|
||||||
|
public List<long> Obtener_Listado_idCliente_PorIdAGrupacionClienteLinea(long _lng_idAgrupacionClienteLinea)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
List<long> lst_idCliente = new List<long>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .........................................................
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Clientes_AgrupacionesClientesLineas) + "." + nameof(HPV_Clientes_AgrupacionesClientesLineas.idCliente) +
|
||||||
|
" FROM " + nameof(HPV_Clientes_AgrupacionesClientesLineas) +
|
||||||
|
" WHERE " + nameof(HPV_Clientes_AgrupacionesClientesLineas.idAgrupacionClienteLinea) + "=@idAgrupacionClienteLinea ";
|
||||||
|
// .....................................................................
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idAgrupacionClienteLinea", _lng_idAgrupacionClienteLinea)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
lst_idCliente = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL, arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Clientes_AgrupacionesClientesLineas_Datos) + "/" + nameof(Obtener_Listado_idCliente_PorIdAGrupacionClienteLinea), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_idCliente;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_Clientes_AgrupacionesClientesLineas> g_lst_HPV_Clientes_AgrupacionesClientesLineas = null;
|
||||||
|
public List<HPV_Clientes_AgrupacionesClientesLineas> Obtener_ModeloListado_Por_IdCliente(long _lng_idCliente,
|
||||||
|
bool _bol_Cargar_AgrupacionesClientesLineas)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Clientes_AgrupacionesClientesLineas) + "." + nameof(HPV_Clientes_AgrupacionesClientesLineas.idCliente) + "=@idCliente";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idCliente", _lng_idCliente)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros,
|
||||||
|
_bol_Cargar_AgrupacionesClientesLineas);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Clientes_AgrupacionesClientesLineas_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdCliente), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Clientes_AgrupacionesClientesLineas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HPV_Clientes_AgrupacionesClientesLineas> Obtener_ModeloListado_Por_IdsAgrupacionClienteLinea(List<long> _lst_Ids,
|
||||||
|
bool _bol_Cargar_AgrupacionesClientesLineas)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_lst_Ids != null && _lst_Ids.Count > 0)
|
||||||
|
{
|
||||||
|
string str_Filtro_IDS = Funciones.Formar_ContenidoIN_ParaConsultaWhere(nameof(HPV_Clientes_AgrupacionesClientesLineas),
|
||||||
|
nameof(HPV_Clientes_AgrupacionesClientesLineas.idAgrupacionClienteLinea),
|
||||||
|
G_ENUM_FORMARCONTENIDOIN_CONDICIONANTES.NADA,
|
||||||
|
_lst_Ids);
|
||||||
|
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + str_Filtro_IDS;
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
new object[] { },
|
||||||
|
_bol_Cargar_AgrupacionesClientesLineas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Clientes_AgrupacionesClientesLineas_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdCliente), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Clientes_AgrupacionesClientesLineas;
|
||||||
|
}
|
||||||
|
#region Ejecutar consulta
|
||||||
|
//Listado de modelos Relacionados
|
||||||
|
private List<HPV_AgrupacionesClientesLineas> g_lst_HPV_AgrupacionesClientesLineas = null;
|
||||||
|
|
||||||
|
//Hilos
|
||||||
|
private static int g_int_TotalHilos_Modelo_Listado = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Modelo_Listado = new bool[g_int_TotalHilos_Modelo_Listado];
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros,
|
||||||
|
bool _bol_Cargar_AgrupacionesClientesLineas)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_Clientes_AgrupacionesClientesLineas = obj_Exferia_Entities.Database.SqlQuery<HPV_Clientes_AgrupacionesClientesLineas>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_lst_HPV_Clientes_AgrupacionesClientesLineas != null && g_lst_HPV_Clientes_AgrupacionesClientesLineas.Count > 0)
|
||||||
|
{
|
||||||
|
//Si tiene que buscar alguna tabla relacionada
|
||||||
|
if (_bol_Cargar_AgrupacionesClientesLineas)
|
||||||
|
{
|
||||||
|
#region PRIMERO BUSCO LOS DATOS DE LAS TABLAS RELACIONADAS
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Modelo_Listado; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_AgrupacionesClientesLineas #############################################
|
||||||
|
if (_bol_Cargar_AgrupacionesClientesLineas)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_AGRUPACIONCLIENTELINEA = new ThreadStart(Obtener_AgrupacionClienteLinea_Modelo_Listado);
|
||||||
|
Thread obj_Thread_AGRUPACIONCLIENTELINEA = new Thread(obj_ThreadStart_AGRUPACIONCLIENTELINEA);
|
||||||
|
obj_Thread_AGRUPACIONCLIENTELINEA.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Modelo_Listado)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DESPUES SE LO VOY ASIGNANDO A LOS REGISTRO UNO A UNO
|
||||||
|
foreach (HPV_Clientes_AgrupacionesClientesLineas mdl_HPV_Clientes_AgrupacionesClientesLineas in g_lst_HPV_Clientes_AgrupacionesClientesLineas)
|
||||||
|
{
|
||||||
|
//HPV_AgrupacionesClientesLineas #############################################
|
||||||
|
if (_bol_Cargar_AgrupacionesClientesLineas &&
|
||||||
|
g_lst_HPV_AgrupacionesClientesLineas != null &&
|
||||||
|
g_lst_HPV_AgrupacionesClientesLineas.Count > 0)
|
||||||
|
{
|
||||||
|
mdl_HPV_Clientes_AgrupacionesClientesLineas.HPV_AgrupacionesClientesLineas = g_lst_HPV_AgrupacionesClientesLineas.Where(m => m.id == mdl_HPV_Clientes_AgrupacionesClientesLineas.idAgrupacionClienteLinea).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Clientes_AgrupacionesClientesLineas_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_AgrupacionClienteLinea_Modelo_Listado()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_AgrupacionesClientesLineas_Datos obj_HPV_AgrupacionesClientesLineas_Datos = new HPV_AgrupacionesClientesLineas_Datos();
|
||||||
|
g_lst_HPV_AgrupacionesClientesLineas = obj_HPV_AgrupacionesClientesLineas_Datos.Obtener_ModeloListado_Por_Ids(g_lst_HPV_Clientes_AgrupacionesClientesLineas.Select(m => m.idAgrupacionClienteLinea).ToList(), true);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Clientes_AgrupacionesClientesLineas.idCliente) + " , " +
|
||||||
|
nameof(HPV_Clientes_AgrupacionesClientesLineas.idAgrupacionClienteLinea) + " , " +
|
||||||
|
nameof(HPV_Clientes_AgrupacionesClientesLineas.observaciones) +
|
||||||
|
" FROM " + nameof(HPV_Clientes_AgrupacionesClientesLineas);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idCliente, List<long> _lst_idAgrupacionClienteLinea)
|
||||||
|
{
|
||||||
|
Exferia_Entities dbcontext = null;
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbcontext = new Exferia_Entities();
|
||||||
|
dbcontext.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar = " DELETE FROM " + nameof(HPV_Clientes_AgrupacionesClientesLineas) + " WHERE " + nameof(HPV_Clientes_AgrupacionesClientesLineas.idCliente) + "=" + _lng_idCliente;
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Borrar);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_lst_idAgrupacionClienteLinea != null & _lst_idAgrupacionClienteLinea.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (long lng_id in _lst_idAgrupacionClienteLinea)
|
||||||
|
{
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_Clientes_AgrupacionesClientesLineas) + " (" + nameof(HPV_Clientes_AgrupacionesClientesLineas.idCliente) + "," + nameof(HPV_Clientes_AgrupacionesClientesLineas.idAgrupacionClienteLinea) + "," + nameof(HPV_Clientes_AgrupacionesClientesLineas.observaciones) + ") values (" + _lng_idCliente + "," + lng_id + ",'')";
|
||||||
|
}
|
||||||
|
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Clientes_AgrupacionesClientesLineas_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dbcontext.Database.Connection.Close();
|
||||||
|
dbcontext.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,367 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Escandallos_Datos
|
||||||
|
{
|
||||||
|
#region Obtener
|
||||||
|
public bool ExisteEscandallo_PorSeccionMenu(long _lng_idSeccionMenu, Exferia_Entities _obj_Exferia_Entities)
|
||||||
|
{
|
||||||
|
bool bol_Existe = false;
|
||||||
|
|
||||||
|
HPV_Escandallos mdl_HPV_Escandallos = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Escandallos) + "." + nameof(HPV_Escandallos.idPLV) + "," +
|
||||||
|
nameof(HPV_Escandallos) + "." + nameof(HPV_Escandallos.idPLV_Escandallo) + "," +
|
||||||
|
nameof(HPV_Escandallos) + "." + nameof(HPV_Escandallos.observaciones) + "," +
|
||||||
|
nameof(HPV_Escandallos) + "." + nameof(HPV_Escandallos.idSeccionMenu) +
|
||||||
|
" FROM " + nameof(HPV_Escandallos) +
|
||||||
|
//INNER JOIN
|
||||||
|
" INNER JOIN " + nameof(HPV_PLV) + " AS AUX1 ON " + nameof(HPV_Escandallos) + "." + nameof(HPV_Escandallos.idPLV) + " = AUX1." + nameof(HPV_PLV.id) +
|
||||||
|
" INNER JOIN " + nameof(HPV_PLV) + " AS AUX2 ON " + nameof(HPV_Escandallos) + "." + nameof(HPV_Escandallos.idPLV_Escandallo) + " = AUX2." + nameof(HPV_PLV.id) +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Escandallos) + "." + nameof(HPV_Escandallos.idSeccionMenu) + "=@idSeccionMenu AND " +
|
||||||
|
"AUX1." + nameof(HPV_PLV.fechaBorrado) + " IS NULL AND " +
|
||||||
|
"AUX2." + nameof(HPV_PLV.fechaBorrado) + " IS NULL ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idSeccionMenu", _lng_idSeccionMenu)
|
||||||
|
};
|
||||||
|
|
||||||
|
mdl_HPV_Escandallos = _obj_Exferia_Entities.Database.SqlQuery<HPV_Escandallos>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
if(mdl_HPV_Escandallos != null)
|
||||||
|
{
|
||||||
|
bol_Existe = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_Datos) + "/" + nameof(ExisteEscandallo_PorSeccionMenu), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bol_Existe;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_Escandallos> g_lst_HPV_Escandallos = null;
|
||||||
|
|
||||||
|
public List<HPV_Escandallos> Obtener_ModeloListado_Por_IdPLV(long _lng_idPLV,
|
||||||
|
bool _bol_Cargar_PLV,
|
||||||
|
bool _bol_Cargar_SeccionesMenu)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Escandallos) + "." + nameof(HPV_Escandallos.idPLV) + "=@idPLV ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idPLV", _lng_idPLV)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros,
|
||||||
|
_bol_Cargar_PLV,
|
||||||
|
_bol_Cargar_SeccionesMenu);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Escandallos_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdPLV), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Escandallos;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
//Listado de modelos Relacionados
|
||||||
|
private List<HPV_PLV> g_lst_HPV_PLV = null;
|
||||||
|
private List<HPV_SeccionesMenu> g_lst_HPV_SeccionesMenu = null;
|
||||||
|
|
||||||
|
//Hilos
|
||||||
|
private static int g_int_TotalHilos_Modelo_Listado = 2;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Modelo_Listado = new bool[g_int_TotalHilos_Modelo_Listado];
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros,
|
||||||
|
bool _bol_Cargar_PLV,
|
||||||
|
bool _bol_Cargar_SeccionesMenu)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_Escandallos = obj_Exferia_Entities.Database.SqlQuery<HPV_Escandallos>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_lst_HPV_Escandallos != null && g_lst_HPV_Escandallos.Count > 0)
|
||||||
|
{
|
||||||
|
//Si tiene que buscar alguna tabla relacionada
|
||||||
|
if (_bol_Cargar_PLV ||
|
||||||
|
_bol_Cargar_SeccionesMenu)
|
||||||
|
{
|
||||||
|
#region PRIMERO BUSCO LOS DATOS DE LAS TABLAS RELACIONADAS
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Modelo_Listado; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_PLV #############################################
|
||||||
|
if (_bol_Cargar_PLV)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_PLV = new ThreadStart(Obtener_PLV_Modelo_Listado);
|
||||||
|
Thread obj_Thread_PLV = new Thread(obj_ThreadStart_PLV);
|
||||||
|
obj_Thread_PLV.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_SeccionesMenu #############################################
|
||||||
|
if (_bol_Cargar_SeccionesMenu)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_SECCIONESMENU = new ThreadStart(Obtener_SeccionesMenu_Modelo_Listado);
|
||||||
|
Thread obj_Thread_SECCIONESMENU = new Thread(obj_ThreadStart_SECCIONESMENU);
|
||||||
|
obj_Thread_SECCIONESMENU.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Modelo_Listado)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DESPUES SE LO VOY ASIGNANDO A LOS REGISTRO UNO A UNO
|
||||||
|
foreach (HPV_Escandallos mdl_HPV_Escandallos in g_lst_HPV_Escandallos)
|
||||||
|
{
|
||||||
|
//HPV_PLV #############################################
|
||||||
|
if (_bol_Cargar_PLV &&
|
||||||
|
g_lst_HPV_PLV != null &&
|
||||||
|
g_lst_HPV_PLV.Count > 0)
|
||||||
|
{
|
||||||
|
mdl_HPV_Escandallos.HPV_PLV = g_lst_HPV_PLV.Where(m => m.id == mdl_HPV_Escandallos.idPLV).FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_PLV #############################################
|
||||||
|
if (_bol_Cargar_SeccionesMenu &&
|
||||||
|
g_lst_HPV_SeccionesMenu != null &&
|
||||||
|
g_lst_HPV_SeccionesMenu.Count > 0)
|
||||||
|
{
|
||||||
|
mdl_HPV_Escandallos.HPV_SeccionesMenu = g_lst_HPV_SeccionesMenu.Where(m => m.id == mdl_HPV_Escandallos.idSeccionMenu).FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Escandallos_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_PLV_Modelo_Listado()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_PLV_Datos obj_HPV_PLV_Datos = new HPV_PLV_Datos();
|
||||||
|
g_lst_HPV_PLV = obj_HPV_PLV_Datos.Obtener_ModeloListado_Por_Ids(g_lst_HPV_Escandallos.Select(x => x.idPLV).ToList());
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Obtener_SeccionesMenu_Modelo_Listado()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_SeccionesMenu_Datos obj_HPV_SeccionesMenu_Datos = new HPV_SeccionesMenu_Datos();
|
||||||
|
g_lst_HPV_SeccionesMenu = obj_HPV_SeccionesMenu_Datos.Obtener_ModeloListado_Por_Ids(g_lst_HPV_Escandallos.Select(x => x.idSeccionMenu).ToList());
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[1] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Escandallos.idPLV) + "," +
|
||||||
|
nameof(HPV_Escandallos.idPLV_Escandallo) + "," +
|
||||||
|
nameof(HPV_Escandallos.observaciones) + "," +
|
||||||
|
nameof(HPV_Escandallos.idSeccionMenu) +
|
||||||
|
" FROM " + nameof(HPV_Escandallos);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idPLV, Dictionary<long, HPV_SeccionesMenu> _dct_Escandallos)
|
||||||
|
{
|
||||||
|
Exferia_Entities dbcontext = null;
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbcontext = new Exferia_Entities();
|
||||||
|
dbcontext.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar PLV como escandallo, porque ahora es menu y no puede ser escandallo ..............................................
|
||||||
|
string str_SQL_Borrar_ComoEscandallo = " DELETE FROM " + nameof(HPV_Escandallos) + " WHERE " + nameof(HPV_Escandallos.idPLV_Escandallo) + "=" + _lng_idPLV;
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Borrar_ComoEscandallo);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar = " DELETE FROM " + nameof(HPV_Escandallos) + " WHERE " + nameof(HPV_Escandallos.idPLV) + "=" + _lng_idPLV;
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Borrar);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_dct_Escandallos != null & _dct_Escandallos.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (KeyValuePair<long, HPV_SeccionesMenu> kvp_Escandallo in _dct_Escandallos)
|
||||||
|
{
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_Escandallos) + " (" + nameof(HPV_Escandallos.idPLV) + "," + nameof(HPV_Escandallos.idPLV_Escandallo) + "," + nameof(HPV_Escandallos.idSeccionMenu) + ") values (" + _lng_idPLV + "," + kvp_Escandallo.Key + "," + kvp_Escandallo.Value.id + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Escandallos_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dbcontext.Database.Connection.Close();
|
||||||
|
dbcontext.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Borrar(long _lng_idPLV)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar = " DELETE FROM " + nameof(HPV_Escandallos) + " WHERE " + nameof(HPV_Escandallos.idPLV) + "=" + _lng_idPLV;
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Borrar);
|
||||||
|
//.........................................................................
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Escandallos_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,791 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Transactions;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Impresoras_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listado
|
||||||
|
private List<INTERNO_HPV_Impresoras_Listado_Modelo> g_lst_INTERNO_HPV_Impresoras_Listado_Modelo = null;
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_GEN = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Impresoras).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_Impresoras_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Impresoras_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_GEN = g_lst_INTERNO_HPV_Impresoras_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_GEN;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_GEN = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Impresoras).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_Impresoras_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Impresoras_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_GEN = g_lst_INTERNO_HPV_Impresoras_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_GEN;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_Impresoras_Listado_Modelo.id) + " = " + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Impresoras_Listado_Modelo.codigo) + " = " + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Impresoras_Listado_Modelo.descripcion) + " = " + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_Impresoras) +
|
||||||
|
" WHERE " + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.fechaBorrado) + " IS null AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_Impresoras) + "." + (nameof(HPV_Impresoras.id) + "=@id") : "1 = 1");
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_Impresoras_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Impresoras_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_Impresoras_Listado_Modelo g_mdl_INTERNO_HPV_Impresoras_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_GEN = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Impresoras).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Impresoras_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_GEN = g_mdl_INTERNO_HPV_Impresoras_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_GEN;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_GEN = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Impresoras).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Impresoras_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_GEN = g_mdl_INTERNO_HPV_Impresoras_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_GEN;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_Impresoras_Listado_Modelo.id) + " = " + nameof(HPV_Impresoras.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Impresoras_Listado_Modelo.codigo) + " = " + nameof(HPV_Impresoras.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Impresoras_Listado_Modelo.descripcion) + " = " + nameof(HPV_Impresoras.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_Impresoras) +
|
||||||
|
" WHERE " + nameof(HPV_Impresoras.fechaBorrado) + " IS null AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_Impresoras.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_Impresoras.codigo)))
|
||||||
|
? (nameof(HPV_Impresoras.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Descripcion
|
||||||
|
: (nameof(HPV_Impresoras.descripcion) + "=@Filtro")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@Filtro", _str_Filtro)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_Impresoras_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Impresoras_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.id) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.codigo) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.descripcion) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.tipo) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.tipoLiquidacion) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.tipoGastos) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.papel_Ancho) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.papel_Alto) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.logo) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.logo_Ancho) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.logo_Alto) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_Impresoras) +
|
||||||
|
" WHERE " + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<HPV_Impresoras>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<INTERNO_HPV_Impresoras_Listado_Modelo> Obtener_listado_Simple()
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
List<INTERNO_HPV_Impresoras_Listado_Modelo> lst_INTERNO_HPV_Impresoras_Listado_Modelo = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_Impresoras_Listado_Modelo.id) + "=" + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Impresoras_Listado_Modelo.codigo) + "=" + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Impresoras_Listado_Modelo.descripcion) + "=" + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_Impresoras) +
|
||||||
|
" WHERE " + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.fechaBorrado) + " IS null ";
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
lst_INTERNO_HPV_Impresoras_Listado_Modelo = obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Impresoras_Listado_Modelo>(str_SQL).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Obtener_listado_Simple), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_INTERNO_HPV_Impresoras_Listado_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_Impresoras g_mdl_HPV_Impresoras = null;
|
||||||
|
|
||||||
|
public HPV_Impresoras Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_Impresoras;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_Impresoras = obj_Exferia_Entities.Database.SqlQuery<HPV_Impresoras>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_Impresoras> g_lst_HPV_Impresoras = null;
|
||||||
|
|
||||||
|
public List<HPV_Impresoras> Obtener_ModeloListado_Por_IdSala(long _lng_idSala)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//INNER JOIN
|
||||||
|
" INNER JOIN " + nameof(HPV_Salas_Impresoras) + " ON " + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.id) + " = " + nameof(HPV_Salas_Impresoras) + "." + nameof(HPV_Salas_Impresoras.idImpresora) +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Impresoras) + "." + nameof(HPV_Impresoras.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Salas_Impresoras) + "." + nameof(HPV_Salas_Impresoras.idSala) + "=@idSala ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idSala", _lng_idSala)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdSala), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Impresoras;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HPV_Impresoras> Obtener_ModeloListado_Por_Ids(List<long> _lst_Ids)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_lst_Ids != null && _lst_Ids.Count > 0)
|
||||||
|
{
|
||||||
|
string str_Filtro_IDS = Funciones.Formar_ContenidoIN_ParaConsultaWhere(nameof(HPV_Impresoras),
|
||||||
|
nameof(HPV_Impresoras.id),
|
||||||
|
G_ENUM_FORMARCONTENIDOIN_CONDICIONANTES.NADA,
|
||||||
|
_lst_Ids);
|
||||||
|
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + str_Filtro_IDS;
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
new object[] { });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Obtener_ModeloListado_Por_Ids), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Impresoras;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_Impresoras = obj_Exferia_Entities.Database.SqlQuery<HPV_Impresoras>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Impresoras.id) + "," +
|
||||||
|
nameof(HPV_Impresoras.codigo) + "," +
|
||||||
|
nameof(HPV_Impresoras.descripcion) + "," +
|
||||||
|
nameof(HPV_Impresoras.tipo) + "," +
|
||||||
|
nameof(HPV_Impresoras.tipoLiquidacion) + "," +
|
||||||
|
nameof(HPV_Impresoras.tipoGastos) + "," +
|
||||||
|
nameof(HPV_Impresoras.papel_Ancho) + "," +
|
||||||
|
nameof(HPV_Impresoras.papel_Alto) + "," +
|
||||||
|
nameof(HPV_Impresoras.logo) + "," +
|
||||||
|
nameof(HPV_Impresoras.logo_Ancho) + "," +
|
||||||
|
nameof(HPV_Impresoras.logo_Alto) + "," +
|
||||||
|
nameof(HPV_Impresoras.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Impresoras.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_Impresoras);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
HPV_Impresoras mdl_HPV_Impresoras_AGrabar = (HPV_Impresoras)_mdl_obj;
|
||||||
|
HPV_Impresoras mdl_HPV_Impresoras_DatosViejos = new HPV_Impresoras();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Impresoras mdl_HPV_Impresoras_Final = Obtener_Modelo_Por_Id(mdl_HPV_Impresoras_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_Impresoras_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Impresoras_Final, mdl_HPV_Impresoras_DatosViejos, false, false);
|
||||||
|
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Impresoras_AGrabar, mdl_HPV_Impresoras_Final, false, false);
|
||||||
|
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Impresoras) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Impresoras.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_Impresoras.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_Impresoras.tipo) + "=@tipo," +
|
||||||
|
nameof(HPV_Impresoras.tipoLiquidacion) + "=@tipoLiquidacion," +
|
||||||
|
nameof(HPV_Impresoras.tipoGastos) + "=@tipoGastos," +
|
||||||
|
nameof(HPV_Impresoras.papel_Ancho) + "=@papel_Ancho," +
|
||||||
|
nameof(HPV_Impresoras.papel_Alto) + "=@papel_Alto," +
|
||||||
|
nameof(HPV_Impresoras.logo) + "=@logo," +
|
||||||
|
nameof(HPV_Impresoras.logo_Ancho) + "=@logo_Ancho," +
|
||||||
|
nameof(HPV_Impresoras.logo_Alto) + "=@logo_Alto," +
|
||||||
|
nameof(HPV_Impresoras.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_Impresoras.fechaBorrado) + "=@fechaBorrado" +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Impresoras.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_Impresoras_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_Impresoras_Final.descripcion),
|
||||||
|
new SqlParameter("@tipo", mdl_HPV_Impresoras_Final.tipo),
|
||||||
|
mdl_HPV_Impresoras_Final.tipoLiquidacion != null
|
||||||
|
? new SqlParameter("@tipoLiquidacion", mdl_HPV_Impresoras_Final.tipoLiquidacion.Value)
|
||||||
|
: new SqlParameter("@tipoLiquidacion", DBNull.Value),
|
||||||
|
mdl_HPV_Impresoras_Final.tipoGastos != null
|
||||||
|
? new SqlParameter("@tipoGastos", mdl_HPV_Impresoras_Final.tipoGastos.Value)
|
||||||
|
: new SqlParameter("@tipoGastos", DBNull.Value),
|
||||||
|
new SqlParameter("@papel_Ancho", mdl_HPV_Impresoras_Final.papel_Ancho),
|
||||||
|
new SqlParameter("@papel_Alto", mdl_HPV_Impresoras_Final.papel_Alto),
|
||||||
|
new SqlParameter("@logo", mdl_HPV_Impresoras_Final.logo),
|
||||||
|
new SqlParameter("@logo_Ancho", mdl_HPV_Impresoras_Final.logo_Ancho),
|
||||||
|
new SqlParameter("@logo_Alto", mdl_HPV_Impresoras_Final.logo_Alto),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_Impresoras_Final.idEmpresa),
|
||||||
|
mdl_HPV_Impresoras_Final.fechaBorrado != null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_Impresoras_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_HPV_Impresoras_Final.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = mdl_HPV_Impresoras_Final.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_Impresoras_Final = new HPV_Impresoras();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
// Cargar los Datos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Impresoras_AGrabar, mdl_HPV_Impresoras_Final, false, false);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_Impresoras) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_Impresoras.codigo) + "," +
|
||||||
|
nameof(HPV_Impresoras.descripcion) + "," +
|
||||||
|
nameof(HPV_Impresoras.tipo) + "," +
|
||||||
|
nameof(HPV_Impresoras.tipoLiquidacion) + "," +
|
||||||
|
nameof(HPV_Impresoras.tipoGastos) + "," +
|
||||||
|
nameof(HPV_Impresoras.papel_Ancho) + "," +
|
||||||
|
nameof(HPV_Impresoras.papel_Alto) + "," +
|
||||||
|
nameof(HPV_Impresoras.logo) + "," +
|
||||||
|
nameof(HPV_Impresoras.logo_Ancho) + "," +
|
||||||
|
nameof(HPV_Impresoras.logo_Alto) + "," +
|
||||||
|
nameof(HPV_Impresoras.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Impresoras.fechaBorrado) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_Impresoras.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@tipo," +
|
||||||
|
"@tipoLiquidacion," +
|
||||||
|
"@tipoGastos," +
|
||||||
|
"@papel_Ancho," +
|
||||||
|
"@papel_Alto," +
|
||||||
|
"@logo," +
|
||||||
|
"@logo_Ancho," +
|
||||||
|
"@logo_Alto," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado" +
|
||||||
|
" ) ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_Impresoras_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_Impresoras_Final.descripcion),
|
||||||
|
new SqlParameter("@tipo", mdl_HPV_Impresoras_Final.tipo),
|
||||||
|
mdl_HPV_Impresoras_Final.tipoLiquidacion != null
|
||||||
|
? new SqlParameter("@tipoLiquidacion", mdl_HPV_Impresoras_Final.tipoLiquidacion.Value)
|
||||||
|
: new SqlParameter("@tipoLiquidacion", DBNull.Value),
|
||||||
|
mdl_HPV_Impresoras_Final.tipoGastos != null
|
||||||
|
? new SqlParameter("@tipoGastos", mdl_HPV_Impresoras_Final.tipoGastos.Value)
|
||||||
|
: new SqlParameter("@tipoGastos", DBNull.Value),
|
||||||
|
new SqlParameter("@papel_Ancho", mdl_HPV_Impresoras_Final.papel_Ancho),
|
||||||
|
new SqlParameter("@papel_Alto", mdl_HPV_Impresoras_Final.papel_Alto),
|
||||||
|
new SqlParameter("@logo", mdl_HPV_Impresoras_Final.logo),
|
||||||
|
new SqlParameter("@logo_Ancho", mdl_HPV_Impresoras_Final.logo_Ancho),
|
||||||
|
new SqlParameter("@logo_Alto", mdl_HPV_Impresoras_Final.logo_Alto),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_Impresoras_Final.idEmpresa),
|
||||||
|
mdl_HPV_Impresoras_Final.fechaBorrado != null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_Impresoras_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Impresoras), mdl_HPV_Impresoras_DatosViejos, mdl_HPV_Impresoras_Final, mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = mdl_HPV_Impresoras_Final;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Impresoras mdl_HPV_Impresoras_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_Impresoras_Final != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Impresoras) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Impresoras.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Impresoras.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Impresoras), null, mdl_HPV_Impresoras_Final, Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Impresoras_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,234 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Ingredientes_Caracteristicas_Datos
|
||||||
|
{
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_Ingredientes_Caracteristicas> g_lst_HPV_Ingredientes_Caracteristicas = null;
|
||||||
|
|
||||||
|
public List<HPV_Ingredientes_Caracteristicas> Obtener_ModeloListado_Por_IdIngrediente(long _lng_idIngrediente,
|
||||||
|
bool _bol_Cargar_Caracteristicas)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Ingredientes_Caracteristicas) + "." + nameof(HPV_Ingredientes_Caracteristicas.idIngrediente) + "=@idIngrediente ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idIngrediente", _lng_idIngrediente)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros,
|
||||||
|
_bol_Cargar_Caracteristicas);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Caracteristicas_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdIngrediente), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Ingredientes_Caracteristicas;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
//Listado de modelos Relacionados
|
||||||
|
private List<HPV_Caracteristicas> g_lst_HPV_Caracteristicas = null;
|
||||||
|
|
||||||
|
//Hilos
|
||||||
|
private static int g_int_TotalHilos_Modelo_Listado = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Modelo_Listado = new bool[g_int_TotalHilos_Modelo_Listado];
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros,
|
||||||
|
bool _bol_Cargar_Caracteristicas)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_Ingredientes_Caracteristicas = obj_Exferia_Entities.Database.SqlQuery<HPV_Ingredientes_Caracteristicas>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_lst_HPV_Ingredientes_Caracteristicas != null && g_lst_HPV_Ingredientes_Caracteristicas.Count > 0)
|
||||||
|
{
|
||||||
|
//Si tiene que buscar alguna tabla relacionada
|
||||||
|
if (_bol_Cargar_Caracteristicas)
|
||||||
|
{
|
||||||
|
#region PRIMERO BUSCO LOS DATOS DE LAS TABLAS RELACIONADAS
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Modelo_Listado; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_Caracteristicas #############################################
|
||||||
|
if (_bol_Cargar_Caracteristicas)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_EMPRESA = new ThreadStart(Obtener_Caracteristicas_Modelo_Listado);
|
||||||
|
Thread obj_Thread_EMPRESA = new Thread(obj_ThreadStart_EMPRESA);
|
||||||
|
obj_Thread_EMPRESA.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Modelo_Listado)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DESPUES SE LO VOY ASIGNANDO A LOS REGISTRO UNO A UNO
|
||||||
|
foreach (HPV_Ingredientes_Caracteristicas mdl_HPV_Ingredientes_Caracteristicas in g_lst_HPV_Ingredientes_Caracteristicas)
|
||||||
|
{
|
||||||
|
//CTA_MAYOR(CuentaContable) #############################################
|
||||||
|
if (_bol_Cargar_Caracteristicas &&
|
||||||
|
g_lst_HPV_Caracteristicas != null &&
|
||||||
|
g_lst_HPV_Caracteristicas.Count > 0)
|
||||||
|
{
|
||||||
|
mdl_HPV_Ingredientes_Caracteristicas.HPV_Caracteristicas = g_lst_HPV_Caracteristicas.Where(m => m.id == mdl_HPV_Ingredientes_Caracteristicas.idCaracteristica).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Caracteristicas_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_Caracteristicas_Modelo_Listado()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_Caracteristicas_Datos obj_HPV_Caracteristicas_Datos = new HPV_Caracteristicas_Datos();
|
||||||
|
g_lst_HPV_Caracteristicas = obj_HPV_Caracteristicas_Datos.Obtener_ModeloListado_Por_Ids(g_lst_HPV_Ingredientes_Caracteristicas.Select(x => x.idCaracteristica).ToList());
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Ingredientes_Caracteristicas.idIngrediente) + "," +
|
||||||
|
nameof(HPV_Ingredientes_Caracteristicas.idCaracteristica) + "," +
|
||||||
|
nameof(HPV_Ingredientes_Caracteristicas.observaciones) + "," +
|
||||||
|
nameof(HPV_Ingredientes_Caracteristicas.agrupado) +
|
||||||
|
" FROM " + nameof(HPV_Ingredientes_Caracteristicas);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idIngrediente, Dictionary<long, int> _dct_Caracteristicas)
|
||||||
|
{
|
||||||
|
Exferia_Entities dbcontext = null;
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbcontext = new Exferia_Entities();
|
||||||
|
dbcontext.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar = " DELETE FROM " + nameof(HPV_Ingredientes_Caracteristicas) + " WHERE " + nameof(HPV_Ingredientes_Caracteristicas.idIngrediente) + "=" + _lng_idIngrediente;
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Borrar);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_dct_Caracteristicas != null && _dct_Caracteristicas.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (KeyValuePair<long, int> kvp_Caracteristica in _dct_Caracteristicas)
|
||||||
|
{
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_Ingredientes_Caracteristicas) + "(" + nameof(HPV_Ingredientes_Caracteristicas.idIngrediente) + "," + nameof(HPV_Ingredientes_Caracteristicas.idCaracteristica) + "," + nameof(HPV_Ingredientes_Caracteristicas.observaciones) + "," + nameof(HPV_Ingredientes_Caracteristicas.agrupado) + ") values (" + _lng_idIngrediente + "," + kvp_Caracteristica.Key + ",''," + kvp_Caracteristica.Value + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dbcontext.Database.Connection.Close();
|
||||||
|
dbcontext.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,770 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Ingredientes_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listado
|
||||||
|
private List<INTERNO_HPV_Ingredientes_Listado_Modelo> g_lst_INTERNO_HPV_Ingredientes_Listado_Modelo = null;
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_HPV = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Ingredientes).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
if ((g_lst_INTERNO_HPV_Ingredientes_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Ingredientes_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_HPV = g_lst_INTERNO_HPV_Ingredientes_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Ingredientes).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_Ingredientes_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Ingredientes_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_HPV = g_lst_INTERNO_HPV_Ingredientes_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.id) + " = " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.codigo) + " = " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.descripcion) + " = " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.observaciones) + " = " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.observaciones) + "," +
|
||||||
|
//ids
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.idEmpresa) + " = " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.idEmpresa) + "," +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.Empresa_Codigo) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.Empresa_Descripcion) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.Empresa_FechaBorrado) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.fechaBorrado)
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.Empresa_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.Empresa_Descripcion) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.Empresa_FechaBorrado) + " = NULL"
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
" FROM " + nameof(HPV_Ingredientes) +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(GEN_Empresas) + " ON " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.idEmpresa) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
" WHERE " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.idEmpresa) + "=@idEmpresa " +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_Ingredientes) + "." + (nameof(HPV_Ingredientes.id) + "=@id") : "1 = 1");
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id", _lng_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_Ingredientes_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Ingredientes_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_Ingredientes_Listado_Modelo g_mdl_INTERNO_HPV_Ingredientes_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Ingredientes).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Ingredientes_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_Ingredientes_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Conuslta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Ingredientes).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Ingredientes_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_Ingredientes_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Obtener_F3_PorId), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.id) + " = " + nameof(HPV_Ingredientes.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.codigo) + " = " + nameof(HPV_Ingredientes.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.descripcion) + " = " + nameof(HPV_Ingredientes.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_Ingredientes) +
|
||||||
|
" WHERE " + nameof(HPV_Ingredientes.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.idEmpresa) + "=@idEmpresa " +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_Ingredientes.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_Ingredientes.codigo)))
|
||||||
|
? (nameof(HPV_Ingredientes.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Descripcion
|
||||||
|
: (nameof(HPV_Ingredientes.descripcion) + "=@Filtro")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@Filtro", _str_Filtro));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_Ingredientes_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Ingredientes_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
|
||||||
|
#region Obtener Simple
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
private static int g_int_TotalHilos_Obtener = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Obtener = new bool[g_int_TotalHilos_Obtener];
|
||||||
|
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.id) + "," +
|
||||||
|
nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.codigo) + "," +
|
||||||
|
nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.descripcion) + "," +
|
||||||
|
nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.observaciones) + "," +
|
||||||
|
nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_Ingredientes) +
|
||||||
|
" WHERE " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<HPV_Ingredientes>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_dnm_Modelo_Obtener != null)
|
||||||
|
{
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Obtener; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_Ingredientes_Caracteristicas ##########################################################################################
|
||||||
|
ThreadStart obj_ThreadStart_INGREDIENTESCARACTERISTICAS = new ThreadStart(Obtener_IngredientesCaracteristicas_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_INGREDIENTESCARACTERISTICAS = new Thread(obj_ThreadStart_INGREDIENTESCARACTERISTICAS);
|
||||||
|
obj_Thread_INGREDIENTESCARACTERISTICAS.Start();
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Obtener)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_IngredientesCaracteristicas_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_Ingredientes_Caracteristicas_Datos obj_HPV_Ingredientes_Caracteristicas_Datos = new HPV_Ingredientes_Caracteristicas_Datos();
|
||||||
|
g_dnm_Modelo_Obtener.HPV_Ingredientes_Caracteristicas = obj_HPV_Ingredientes_Caracteristicas_Datos.Obtener_ModeloListado_Por_IdIngrediente(g_dnm_Modelo_Obtener.id,true);
|
||||||
|
}
|
||||||
|
catch(Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0]= true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_Ingredientes g_mdl_HPV_Ingredientes = null;
|
||||||
|
public HPV_Ingredientes Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Ingredientes) + "." + nameof(HPV_Ingredientes.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_Ingredientes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_Ingredientes = obj_Exferia_Entities.Database.SqlQuery<HPV_Ingredientes>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_Ingredientes> g_lst_HPV_Ingredientes = null;
|
||||||
|
|
||||||
|
public List<HPV_Ingredientes> Obtener_ModeloListado_Por_Ids(List<long> _lst_Ids)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_lst_Ids != null && _lst_Ids.Count > 0)
|
||||||
|
{
|
||||||
|
string str_Filtro_IDS = Funciones.Formar_ContenidoIN_ParaConsultaWhere(nameof(HPV_Ingredientes),
|
||||||
|
nameof(HPV_Ingredientes.id),
|
||||||
|
G_ENUM_FORMARCONTENIDOIN_CONDICIONANTES.NADA,
|
||||||
|
_lst_Ids);
|
||||||
|
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + str_Filtro_IDS;
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
new object[] { });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Obtener_ModeloListado_Por_Ids), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Ingredientes;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_Ingredientes = obj_Exferia_Entities.Database.SqlQuery<HPV_Ingredientes>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Ingredientes.id) + "," +
|
||||||
|
nameof(HPV_Ingredientes.codigo) + "," +
|
||||||
|
nameof(HPV_Ingredientes.descripcion) + "," +
|
||||||
|
nameof(HPV_Ingredientes.observaciones) + "," +
|
||||||
|
nameof(HPV_Ingredientes.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Ingredientes.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_Ingredientes);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
HPV_Ingredientes mdl_HPV_Ingredientes_AGrabar = (HPV_Ingredientes)_mdl_obj;
|
||||||
|
HPV_Ingredientes mdl_HPV_Ingredientes_DatosViejos = new HPV_Ingredientes();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Ingredientes mdl_HPV_Ingredientes_Final = Obtener_Modelo_Por_Id(mdl_HPV_Ingredientes_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_Ingredientes_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Ingredientes_Final, mdl_HPV_Ingredientes_DatosViejos, false, false);
|
||||||
|
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Ingredientes_AGrabar, mdl_HPV_Ingredientes_Final, false, false);
|
||||||
|
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Ingredientes) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Ingredientes.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_Ingredientes.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_Ingredientes.observaciones) + "=@observaciones," +
|
||||||
|
nameof(HPV_Ingredientes.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_Ingredientes.fechaBorrado) + "=@fechaBorrado" +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Ingredientes.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_Ingredientes_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_Ingredientes_Final.descripcion),
|
||||||
|
mdl_HPV_Ingredientes_Final.observaciones!=null
|
||||||
|
? new SqlParameter("@observaciones", mdl_HPV_Ingredientes_Final.observaciones)
|
||||||
|
: new SqlParameter("@observaciones", DBNull.Value),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_Ingredientes_Final.idEmpresa),
|
||||||
|
mdl_HPV_Ingredientes_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_Ingredientes_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_HPV_Ingredientes_Final.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = mdl_HPV_Ingredientes_Final.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_Ingredientes_Final = new HPV_Ingredientes();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
// Cargar los Datos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Ingredientes_AGrabar, mdl_HPV_Ingredientes_Final, false, false);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_Ingredientes) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_Ingredientes.codigo) + "," +
|
||||||
|
nameof(HPV_Ingredientes.descripcion) + "," +
|
||||||
|
nameof(HPV_Ingredientes.observaciones) + "," +
|
||||||
|
nameof(HPV_Ingredientes.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Ingredientes.fechaBorrado) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_Ingredientes.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@observaciones," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado" +
|
||||||
|
" ) ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_Ingredientes_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_Ingredientes_Final.descripcion),
|
||||||
|
mdl_HPV_Ingredientes_Final.observaciones!=null
|
||||||
|
? new SqlParameter("@observaciones", mdl_HPV_Ingredientes_Final.observaciones)
|
||||||
|
: new SqlParameter("@observaciones", DBNull.Value),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_Ingredientes_Final.idEmpresa),
|
||||||
|
mdl_HPV_Ingredientes_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_Ingredientes_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Ingredientes), mdl_HPV_Ingredientes_DatosViejos, mdl_HPV_Ingredientes_Final, mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = mdl_HPV_Ingredientes_Final;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Ingredientes mdl_HPV_Ingredientes_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_Ingredientes_Final != null)
|
||||||
|
{
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Ingredientes) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Ingredientes.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Ingredientes.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Ingredientes), null, mdl_HPV_Ingredientes_Final, G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Ingredientes_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,604 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Exferia_General;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Mesas_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listado
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_id)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
|
||||||
|
#region Obtener Simple
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
|
||||||
|
private static int g_int_TotalHilos_Obtener = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Obtener = new bool[g_int_TotalHilos_Obtener];
|
||||||
|
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.id) + "," +
|
||||||
|
nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.codigo) + "," +
|
||||||
|
nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.descripcion) + "," +
|
||||||
|
nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.idSala) +
|
||||||
|
" FROM " + nameof(HPV_Mesas) +
|
||||||
|
" WHERE " + nameof(HPV_Mesas.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Mesas.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<HPV_Mesas>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_dnm_Modelo_Obtener != null)
|
||||||
|
{
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Obtener; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//GEN_Empresas ##########################################################################################
|
||||||
|
if (g_dnm_Modelo_Obtener.idEmpresa != null)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_EMPRESA = new ThreadStart(Obtener_Empresa_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_EMPRESA = new Thread(obj_ThreadStart_EMPRESA);
|
||||||
|
obj_Thread_EMPRESA.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Obtener)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Mesas_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_Empresa_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_dnm_Modelo_Obtener.GEN_Empresas = Datos_Generales.GEN_Empresas_Obtener_Modelo_Por_Id(g_dnm_Modelo_Obtener.idEmpresa);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public INTERNO_HPV_Mesas_Listado_Modelo Obtener_Registro_Listado(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
INTERNO_HPV_Mesas_Listado_Modelo mdl_INTERNO_HPV_Mesas_Listado_Modelo = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_Mesas_Listado_Modelo.id) + "=" + nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Mesas_Listado_Modelo.codigo) + "=" + nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Mesas_Listado_Modelo.descripcion) + "=" + nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.descripcion) + "," +
|
||||||
|
//ids
|
||||||
|
nameof(INTERNO_HPV_Mesas_Listado_Modelo.idEmpresa) + "=" + nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.idEmpresa) +
|
||||||
|
" FROM " + nameof(HPV_Mesas) +
|
||||||
|
" WHERE " + nameof(HPV_Mesas.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Mesas.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
mdl_INTERNO_HPV_Mesas_Listado_Modelo = obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Mesas_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Mesas_Datos) + "/" + nameof(Obtener_Registro_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return mdl_INTERNO_HPV_Mesas_Listado_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<INTERNO_HPV_Mesas_Listado_Modelo> Obtener_Listado_PorSala(long _lng_idSala, long _lng_idEmpresaSeleccionada)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<INTERNO_HPV_Mesas_Listado_Modelo> lst_INTERNO_HPV_Mesas_Listado_Modelo = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_Mesas_Listado_Modelo.id) + "=" + nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Mesas_Listado_Modelo.codigo) + "=" + nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Mesas_Listado_Modelo.descripcion) + "=" + nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.descripcion) + "," +
|
||||||
|
//ids
|
||||||
|
nameof(INTERNO_HPV_Mesas_Listado_Modelo.idEmpresa) + "=" + nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.idEmpresa) +
|
||||||
|
" FROM " + nameof(HPV_Mesas) +
|
||||||
|
" WHERE " + nameof(HPV_Mesas.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Mesas.idEmpresa) + "=@idEmpresa AND " +
|
||||||
|
nameof(HPV_Mesas.idSala) + "=@idSala ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada),
|
||||||
|
new SqlParameter("@idSala", _lng_idSala)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
lst_INTERNO_HPV_Mesas_Listado_Modelo = obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Mesas_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Mesas_Datos) + "/" + nameof(Obtener_Listado_PorSala), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_INTERNO_HPV_Mesas_Listado_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_Mesas g_mdl_HPV_Mesas = null;
|
||||||
|
|
||||||
|
public HPV_Mesas Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Mesas) + "." + nameof(HPV_Mesas.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Mesas_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_Mesas;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_Mesas = obj_Exferia_Entities.Database.SqlQuery<HPV_Mesas>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Mesas_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Mesas.id) + "," +
|
||||||
|
nameof(HPV_Mesas.codigo) + "," +
|
||||||
|
nameof(HPV_Mesas.descripcion) + "," +
|
||||||
|
nameof(HPV_Mesas.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Mesas.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_Mesas.idSala) +
|
||||||
|
" FROM " + nameof(HPV_Mesas);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
HPV_Mesas mdl_HPV_Mesas_AGrabar = (HPV_Mesas)_mdl_obj;
|
||||||
|
HPV_Mesas mdl_HPV_Mesas_DatosViejos = new HPV_Mesas();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Mesas mdl_HPV_Mesas_Final = Obtener_Modelo_Por_Id(mdl_HPV_Mesas_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_Mesas_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Mesas_Final, mdl_HPV_Mesas_DatosViejos, false, false);
|
||||||
|
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Mesas_AGrabar, mdl_HPV_Mesas_Final, false, false);
|
||||||
|
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Mesas) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Mesas.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_Mesas.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_Mesas.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_Mesas.fechaBorrado) + "=@fechaBorrado," +
|
||||||
|
nameof(HPV_Mesas.idSala) + "=@idSala" +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Mesas.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_Mesas_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_Mesas_Final.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_Mesas_Final.idEmpresa),
|
||||||
|
mdl_HPV_Mesas_Final.fechaBorrado != null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_Mesas_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@idSala", mdl_HPV_Mesas_Final.idSala),
|
||||||
|
new SqlParameter("@id", mdl_HPV_Mesas_Final.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = mdl_HPV_Mesas_Final.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_Mesas_Final = new HPV_Mesas();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
// Cargar los Datos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Mesas_AGrabar, mdl_HPV_Mesas_Final, true, true);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_Mesas) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_Mesas.codigo) + "," +
|
||||||
|
nameof(HPV_Mesas.descripcion) + "," +
|
||||||
|
nameof(HPV_Mesas.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Mesas.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_Mesas.idSala) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_Mesas.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado," +
|
||||||
|
"@idSala" +
|
||||||
|
" ) ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_Mesas_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_Mesas_Final.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_Mesas_Final.idEmpresa),
|
||||||
|
mdl_HPV_Mesas_Final.fechaBorrado != null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_Mesas_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@idSala", mdl_HPV_Mesas_Final.idSala)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Mesas), mdl_HPV_Mesas_DatosViejos, mdl_HPV_Mesas_Final, mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = mdl_HPV_Mesas_Final;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Mesas_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Mesas mdl_HPV_Mesas_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_Mesas_Final != null)
|
||||||
|
{
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Mesas) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Mesas.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Mesas.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Mesas), null, mdl_HPV_Mesas_Final, Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Mesas_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
List<long> lst_idMesas = (List<long>)_mdl_obj;
|
||||||
|
|
||||||
|
if (lst_idMesas != null & lst_idMesas.Count > 0)
|
||||||
|
{
|
||||||
|
//Coger los ids y ponerlos de forma que sirva para la consulta
|
||||||
|
string str_ids = "";
|
||||||
|
foreach (long lng_id in lst_idMesas)
|
||||||
|
{
|
||||||
|
str_ids += (lng_id + ",");
|
||||||
|
}
|
||||||
|
|
||||||
|
string str_SQL = " DELETE FROM " + nameof(HPV_Mesas) +
|
||||||
|
" WHERE " + nameof(HPV_Mesas.id) + " in (" + str_ids.Substring(0, str_ids.Length - 1) + ")";
|
||||||
|
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Mesas_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,403 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_General;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_PLVFotos_Datos
|
||||||
|
{
|
||||||
|
#region Obtener
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
|
||||||
|
public dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_PLVFotos) + "." + nameof(HPV_PLVFotos.id) + "," +
|
||||||
|
nameof(HPV_PLVFotos) + "." + nameof(HPV_PLVFotos.idPLV) + "," +
|
||||||
|
nameof(HPV_PLVFotos) + "." + nameof(HPV_PLVFotos.foto) + "," +
|
||||||
|
nameof(HPV_PLVFotos) + "." + nameof(HPV_PLVFotos.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_PLVFotos) +
|
||||||
|
" WHERE " + nameof(HPV_PLVFotos) + "." + nameof(HPV_PLVFotos.idPLV) + "=@idPLV ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idPLV", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<HPV_PLVFotos>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLVFotos_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_PLVFotos g_mdl_HPV_PLVFotos = null;
|
||||||
|
public HPV_PLVFotos Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_PLVFotos) + "." + nameof(HPV_PLVFotos.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLVFotos_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_PLVFotos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_mdl_HPV_PLVFotos = obj_Exferia_Entities.Database.SqlQuery<HPV_PLVFotos>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLVFotos_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_PLVFotos> g_lst_HPV_PLVFotos = null;
|
||||||
|
|
||||||
|
public List<HPV_PLVFotos> Obtener_ModeloListadoPor_IdPLV(long _lng_idPLV)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_PLVFotos) + "." + nameof(HPV_PLVFotos.idPLV) + "=@idPLV";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idPLV", _lng_idPLV)
|
||||||
|
};
|
||||||
|
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL, arr_Parametros);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLVFotos_Datos) + "/" + nameof(Obtener_ModeloListadoPor_IdPLV), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_PLVFotos;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_PLVFotos = obj_Exferia_Entities.Database.SqlQuery<HPV_PLVFotos>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLVFotos_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_PLVFotos.id) + "," +
|
||||||
|
nameof(HPV_PLVFotos.idPLV) + "," +
|
||||||
|
nameof(HPV_PLVFotos.foto) + "," +
|
||||||
|
nameof(HPV_PLVFotos.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_PLVFotos);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
// Se utiliza la transaccion por la llamada al procedimiento de almacenado
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
HPV_PLVFotos mdl_HPV_PLVFotos_AGrabar = (HPV_PLVFotos)_mdl_obj;
|
||||||
|
HPV_PLVFotos mdl_HPV_PLVFotos_DatosViejos = new HPV_PLVFotos();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_PLVFotos mdl_HPV_PLVFotos_Final = Obtener_Modelo_Por_Id(mdl_HPV_PLVFotos_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_PLVFotos_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_PLVFotos_Final, mdl_HPV_PLVFotos_DatosViejos, false, false);
|
||||||
|
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_PLVFotos_AGrabar, mdl_HPV_PLVFotos_Final, false, false);
|
||||||
|
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_PLVFotos) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_PLVFotos.idPLV) + "=@idPLV," +
|
||||||
|
nameof(HPV_PLVFotos.foto) + "=@foto," +
|
||||||
|
nameof(HPV_PLVFotos.fechaBorrado) + "=@fechaBorrado" +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_PLVFotos.id) + "=@id";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
SqlParameter obj_SqlParameter_imagen = new SqlParameter("@foto", SqlDbType.Binary);
|
||||||
|
if (mdl_HPV_PLVFotos_Final.foto != null)
|
||||||
|
{ obj_SqlParameter_imagen.Value = mdl_HPV_PLVFotos_Final.foto; }
|
||||||
|
else
|
||||||
|
{ obj_SqlParameter_imagen.Value = DBNull.Value; }
|
||||||
|
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idPLV", mdl_HPV_PLVFotos_Final.idPLV),
|
||||||
|
obj_SqlParameter_imagen,
|
||||||
|
mdl_HPV_PLVFotos_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_PLVFotos_Final.fechaBorrado)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_HPV_PLVFotos_Final.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = mdl_HPV_PLVFotos_Final.id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
// Cargar los Datos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_PLVFotos_AGrabar, mdl_HPV_PLVFotos_Final, false, false);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_PLVFotos) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_PLVFotos.idPLV) + "," +
|
||||||
|
nameof(HPV_PLVFotos.foto) + "," +
|
||||||
|
nameof(HPV_PLVFotos.fechaBorrado) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_PLVFotos.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@idPLV," +
|
||||||
|
"@foto," +
|
||||||
|
"@fechaBorrado" +
|
||||||
|
" ) ";
|
||||||
|
//Parametros
|
||||||
|
SqlParameter obj_SqlParameter_imagen = new SqlParameter("@foto", SqlDbType.Binary);
|
||||||
|
if (mdl_HPV_PLVFotos_Final.foto != null)
|
||||||
|
{ obj_SqlParameter_imagen.Value = mdl_HPV_PLVFotos_Final.foto; }
|
||||||
|
else
|
||||||
|
{ obj_SqlParameter_imagen.Value = DBNull.Value; }
|
||||||
|
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idPLV", mdl_HPV_PLVFotos_Final.idPLV),
|
||||||
|
obj_SqlParameter_imagen,
|
||||||
|
mdl_HPV_PLVFotos_Final.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_PLVFotos_Final.fechaBorrado)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_PLVFotos), mdl_HPV_PLVFotos_DatosViejos, mdl_HPV_PLVFotos_Final, mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLVFotos_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_PLVFotos mdl_HPV_PLVFotos_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_PLVFotos_Final != null)
|
||||||
|
{
|
||||||
|
#region Delete
|
||||||
|
string str_SQL_Delete = " DELETE FROM " + nameof(HPV_PLVFotos) +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_PLVFotos.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Delete = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Delete
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Delete, arr_Parametros_Delete);
|
||||||
|
|
||||||
|
//Devolver tambien el objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = mdl_HPV_PLVFotos_Final.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLVFotos_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,350 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_PLV_AgrupacionesPLVLineas_Datos
|
||||||
|
{
|
||||||
|
#region Obtener
|
||||||
|
public List<long> Obtener_Listado_idPLV_PorIdAgrupacionPLVLinea(long _lng_idAgrupacionPLVLinea)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
List<long> lst_idArticulo = new List<long>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .........................................................
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_PLV_AgrupacionesPLVLineas) + "." + nameof(HPV_PLV_AgrupacionesPLVLineas.idPLV) +
|
||||||
|
" FROM " + nameof(HPV_PLV_AgrupacionesPLVLineas) +
|
||||||
|
" WHERE " + nameof(HPV_PLV_AgrupacionesPLVLineas.idAgrupacionPLVLinea) + "=@idAgrupacionPLVLinea ";
|
||||||
|
// .....................................................................
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idAgrupacionPLVLinea", _lng_idAgrupacionPLVLinea)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
lst_idArticulo = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL, arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_AgrupacionesPLVLineas_Datos) + "/" + nameof(Obtener_Listado_idPLV_PorIdAgrupacionPLVLinea), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_idArticulo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<long> Obtener_Listado_idPLV_PorIdsAgrupacionPLVLinea(List<long> _lst_Ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
List<long> lst_idArticulo = new List<long>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
if (_lst_Ids != null && _lst_Ids.Count > 0)
|
||||||
|
{
|
||||||
|
string str_Filtro_IDS = Funciones.Formar_ContenidoIN_ParaConsultaWhere(nameof(HPV_PLV_AgrupacionesPLVLineas),
|
||||||
|
nameof(HPV_PLV_AgrupacionesPLVLineas.idAgrupacionPLVLinea),
|
||||||
|
G_ENUM_FORMARCONTENIDOIN_CONDICIONANTES.NADA,
|
||||||
|
_lst_Ids);
|
||||||
|
|
||||||
|
// Consulta .........................................................
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_PLV_AgrupacionesPLVLineas) + "." + nameof(HPV_PLV_AgrupacionesPLVLineas.idPLV) +
|
||||||
|
" FROM " + nameof(HPV_PLV_AgrupacionesPLVLineas) +
|
||||||
|
" WHERE " + str_Filtro_IDS;
|
||||||
|
// .....................................................................
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
lst_idArticulo = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL, new object[] { }).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_AgrupacionesPLVLineas_Datos) + "/" + nameof(Obtener_Listado_idPLV_PorIdsAgrupacionPLVLinea), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_idArticulo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODEOS
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_PLV_AgrupacionesPLVLineas> g_lst_HPV_PLV_AgrupacionesPLVLineas = null;
|
||||||
|
public List<HPV_PLV_AgrupacionesPLVLineas> Obtener_ModeloListado_Por_IdPLV(long _lng_idPLV,
|
||||||
|
bool _bol_Cargar_AgrupacionesPLVLineas)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_PLV_AgrupacionesPLVLineas) + "." + nameof(HPV_PLV_AgrupacionesPLVLineas.idPLV) + "=@idPLV";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idPLV", _lng_idPLV)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros,
|
||||||
|
_bol_Cargar_AgrupacionesPLVLineas);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_AgrupacionesPLVLineas_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdPLV), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_PLV_AgrupacionesPLVLineas;
|
||||||
|
}
|
||||||
|
public List<HPV_PLV_AgrupacionesPLVLineas> Obtener_ModeloListado_Por_IdAgruapcionPLVLinea(List<long> _lst_Ids,
|
||||||
|
bool _bol_Cargar_AgrupacionesPLVLineas)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_lst_Ids != null && _lst_Ids.Count > 0)
|
||||||
|
{
|
||||||
|
string str_Filtro_IDS = Funciones.Formar_ContenidoIN_ParaConsultaWhere(nameof(HPV_PLV_AgrupacionesPLVLineas),
|
||||||
|
nameof(HPV_PLV_AgrupacionesPLVLineas.idAgrupacionPLVLinea),
|
||||||
|
G_ENUM_FORMARCONTENIDOIN_CONDICIONANTES.NADA,
|
||||||
|
_lst_Ids);
|
||||||
|
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + str_Filtro_IDS;
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
new object[] { },
|
||||||
|
_bol_Cargar_AgrupacionesPLVLineas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_AgrupacionesPLVLineas_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdPLV), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_PLV_AgrupacionesPLVLineas;
|
||||||
|
}
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
//Listado de modelos Relacionados
|
||||||
|
private List<HPV_AgrupacionesPLVLineas> g_lst_HPV_AgrupacionesPLVLineas = null;
|
||||||
|
|
||||||
|
//Hilos
|
||||||
|
private static int g_int_TotalHilos_Modelo_Listado = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Modelo_Listado = new bool[g_int_TotalHilos_Modelo_Listado];
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros,
|
||||||
|
bool _bol_Cargar_AgrupacionesArticulosLineas)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_PLV_AgrupacionesPLVLineas = obj_Exferia_Entities.Database.SqlQuery<HPV_PLV_AgrupacionesPLVLineas>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_lst_HPV_PLV_AgrupacionesPLVLineas != null && g_lst_HPV_PLV_AgrupacionesPLVLineas.Count > 0)
|
||||||
|
{
|
||||||
|
//Si tiene que buscar alguna tabla relacionada
|
||||||
|
if (_bol_Cargar_AgrupacionesArticulosLineas)
|
||||||
|
{
|
||||||
|
#region PRIMERO BUSCO LOS DATOS DE LAS TABLAS RELACIONADAS
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Modelo_Listado; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_AgrupacionesPLVLineas #############################################
|
||||||
|
if (_bol_Cargar_AgrupacionesArticulosLineas)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_AGRUPACIONPLVLINEA = new ThreadStart(Obtener_AgrupacionPLVLinea_Modelo_Listado);
|
||||||
|
Thread obj_Thread_AGRUPACIONPLVLINEA = new Thread(obj_ThreadStart_AGRUPACIONPLVLINEA);
|
||||||
|
obj_Thread_AGRUPACIONPLVLINEA.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Modelo_Listado)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DESPUES SE LO VOY ASIGNANDO A LOS REGISTRO UNO A UNO
|
||||||
|
foreach (HPV_PLV_AgrupacionesPLVLineas mdl_HPV_PLV_AgrupacionesPLVLineas in g_lst_HPV_PLV_AgrupacionesPLVLineas)
|
||||||
|
{
|
||||||
|
//MAE_AgrupacionesArticulosLineas #############################################
|
||||||
|
if (_bol_Cargar_AgrupacionesArticulosLineas &&
|
||||||
|
g_lst_HPV_AgrupacionesPLVLineas != null &&
|
||||||
|
g_lst_HPV_AgrupacionesPLVLineas.Count > 0)
|
||||||
|
{
|
||||||
|
mdl_HPV_PLV_AgrupacionesPLVLineas.HPV_AgrupacionesPLVLineas = g_lst_HPV_AgrupacionesPLVLineas.Where(m => m.id == mdl_HPV_PLV_AgrupacionesPLVLineas.idAgrupacionPLVLinea).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_AgrupacionesPLVLineas_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_AgrupacionPLVLinea_Modelo_Listado()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_AgrupacionesPLVLineas_Datos obj_HPV_AgrupacionesPLVLineas_Datos = new HPV_AgrupacionesPLVLineas_Datos();
|
||||||
|
g_lst_HPV_AgrupacionesPLVLineas = obj_HPV_AgrupacionesPLVLineas_Datos.Obtener_ModeloListado_Por_Ids(g_lst_HPV_PLV_AgrupacionesPLVLineas.Select(m => m.idAgrupacionPLVLinea).ToList(), true);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_PLV_AgrupacionesPLVLineas.idPLV) + " , " +
|
||||||
|
nameof(HPV_PLV_AgrupacionesPLVLineas.idAgrupacionPLVLinea) + " , " +
|
||||||
|
nameof(HPV_PLV_AgrupacionesPLVLineas.observaciones) +
|
||||||
|
" FROM " + nameof(HPV_PLV_AgrupacionesPLVLineas);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idPLV, List<long> _lst_idAgrupacionPLVLinea)
|
||||||
|
{
|
||||||
|
Exferia_Entities dbcontext = null;
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbcontext = new Exferia_Entities();
|
||||||
|
dbcontext.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar = " DELETE FROM " + nameof(HPV_PLV_AgrupacionesPLVLineas) + " WHERE " + nameof(HPV_PLV_AgrupacionesPLVLineas.idPLV) + "=" + _lng_idPLV;
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Borrar);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_lst_idAgrupacionPLVLinea != null & _lst_idAgrupacionPLVLinea.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (long lng_id in _lst_idAgrupacionPLVLinea)
|
||||||
|
{
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_PLV_AgrupacionesPLVLineas) + " (" + nameof(HPV_PLV_AgrupacionesPLVLineas.idPLV) + "," + nameof(HPV_PLV_AgrupacionesPLVLineas.idAgrupacionPLVLinea) + "," + nameof(HPV_PLV_AgrupacionesPLVLineas.observaciones) + ") values (" + _lng_idPLV + "," + lng_id + ",'')";
|
||||||
|
}
|
||||||
|
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_AgrupacionesPLVLineas_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dbcontext.Database.Connection.Close();
|
||||||
|
dbcontext.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,231 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_PLV_Impresoras_Datos
|
||||||
|
{
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_PLV_Impresoras> g_lst_HPV_PLV_Impresoras = null;
|
||||||
|
|
||||||
|
public List<HPV_PLV_Impresoras> Obtener_ModeloListado_Por_IdPLV(long _lng_idPLV,
|
||||||
|
bool _bol_Cargar_Impresoras)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_PLV_Impresoras) + "." + nameof(HPV_PLV_Impresoras.idPLV) + "=@idPLV ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idPLV", _lng_idPLV)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros,
|
||||||
|
_bol_Cargar_Impresoras);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_Impresoras_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdPLV), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_PLV_Impresoras;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
//Listado de modelos Relacionados
|
||||||
|
private List<HPV_Impresoras> g_lst_HPV_Impresoras = null;
|
||||||
|
|
||||||
|
//Hilos
|
||||||
|
private static int g_int_TotalHilos_Modelo_Listado = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Modelo_Listado = new bool[g_int_TotalHilos_Modelo_Listado];
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros,
|
||||||
|
bool _bol_Cargar_Impresoras)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_PLV_Impresoras = obj_Exferia_Entities.Database.SqlQuery<HPV_PLV_Impresoras>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_lst_HPV_PLV_Impresoras != null && g_lst_HPV_PLV_Impresoras.Count > 0)
|
||||||
|
{
|
||||||
|
//Si tiene que buscar alguna tabla relacionada
|
||||||
|
if (_bol_Cargar_Impresoras)
|
||||||
|
{
|
||||||
|
#region PRIMERO BUSCO LOS DATOS DE LAS TABLAS RELACIONADAS
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Modelo_Listado; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_PLV #############################################
|
||||||
|
if (_bol_Cargar_Impresoras)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_IMPRESORAS = new ThreadStart(Obtener_Impresoras_Modelo_Listado);
|
||||||
|
Thread obj_Thread_IMPRESORAS= new Thread(obj_ThreadStart_IMPRESORAS);
|
||||||
|
obj_Thread_IMPRESORAS.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Modelo_Listado)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DESPUES SE LO VOY ASIGNANDO A LOS REGISTRO UNO A UNO
|
||||||
|
foreach (HPV_PLV_Impresoras mdl_HPV_PLV_Impresoras in g_lst_HPV_PLV_Impresoras)
|
||||||
|
{
|
||||||
|
//HPV_PLV #############################################
|
||||||
|
if (_bol_Cargar_Impresoras &&
|
||||||
|
g_lst_HPV_Impresoras != null &&
|
||||||
|
g_lst_HPV_Impresoras.Count > 0)
|
||||||
|
{
|
||||||
|
mdl_HPV_PLV_Impresoras.HPV_Impresoras = g_lst_HPV_Impresoras.Where(m => m.id == mdl_HPV_PLV_Impresoras.idImpresora).FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_Impresoras_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_Impresoras_Modelo_Listado()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_Impresoras_Datos obj_HPV_Impresoras_Datos = new HPV_Impresoras_Datos();
|
||||||
|
g_lst_HPV_Impresoras = obj_HPV_Impresoras_Datos.Obtener_ModeloListado_Por_Ids(g_lst_HPV_PLV_Impresoras.Select(x => x.idImpresora).ToList());
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_PLV_Impresoras.idPLV) + "," +
|
||||||
|
nameof(HPV_PLV_Impresoras.idImpresora) + "," +
|
||||||
|
nameof(HPV_PLV_Impresoras.observaciones) +
|
||||||
|
" FROM " + nameof(HPV_PLV_Impresoras);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idPLV, List<long> _lst_idImpresoras)
|
||||||
|
{
|
||||||
|
Exferia_Entities dbcontext = null;
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbcontext = new Exferia_Entities();
|
||||||
|
dbcontext.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar_ComoImpresora = " DELETE FROM " + nameof(HPV_PLV_Impresoras) + " WHERE " + nameof(HPV_PLV_Impresoras.idPLV) + "=" + _lng_idPLV;
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Borrar_ComoImpresora);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_lst_idImpresoras != null & _lst_idImpresoras.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (long lng_id in _lst_idImpresoras)
|
||||||
|
{
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_PLV_Impresoras) + " (" + nameof(HPV_PLV_Impresoras.idPLV) + "," + nameof(HPV_PLV_Impresoras.idImpresora) + "," + nameof(HPV_PLV_Impresoras.observaciones) + ") values (" + _lng_idPLV + "," + lng_id + ",'')";
|
||||||
|
}
|
||||||
|
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_Impresoras_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dbcontext.Database.Connection.Close();
|
||||||
|
dbcontext.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,231 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_PLV_Ingredientes_Datos
|
||||||
|
{
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_PLV_Ingredientes> g_lst_HPV_PLV_Ingredientes = null;
|
||||||
|
|
||||||
|
public List<HPV_PLV_Ingredientes> Obtener_ModeloListado_Por_IdPLV(long _lng_idPLV,
|
||||||
|
bool _bol_Cargar_Ingredientes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_PLV_Ingredientes) + "." + nameof(HPV_PLV_Ingredientes.idPLV) + "=@idPLV ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idPLV", _lng_idPLV)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros,
|
||||||
|
_bol_Cargar_Ingredientes);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_Ingredientes_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdPLV), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_PLV_Ingredientes;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
//Listado de modelos Relacionados
|
||||||
|
private List<HPV_Ingredientes> g_lst_HPV_Ingredientes = null;
|
||||||
|
|
||||||
|
//Hilos
|
||||||
|
private static int g_int_TotalHilos_Modelo_Listado = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Modelo_Listado = new bool[g_int_TotalHilos_Modelo_Listado];
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros,
|
||||||
|
bool _bol_Cargar_Ingredientes)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_PLV_Ingredientes = obj_Exferia_Entities.Database.SqlQuery<HPV_PLV_Ingredientes>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_lst_HPV_PLV_Ingredientes != null && g_lst_HPV_PLV_Ingredientes.Count > 0)
|
||||||
|
{
|
||||||
|
//Si tiene que buscar alguna tabla relacionada
|
||||||
|
if (_bol_Cargar_Ingredientes)
|
||||||
|
{
|
||||||
|
#region PRIMERO BUSCO LOS DATOS DE LAS TABLAS RELACIONADAS
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Modelo_Listado; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_PLV #############################################
|
||||||
|
if (_bol_Cargar_Ingredientes)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_INGREDIENTE = new ThreadStart(Obtener_Ingrediente_Modelo_Listado);
|
||||||
|
Thread obj_Thread_INGREDIENTE = new Thread(obj_ThreadStart_INGREDIENTE);
|
||||||
|
obj_Thread_INGREDIENTE.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Modelo_Listado)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DESPUES SE LO VOY ASIGNANDO A LOS REGISTRO UNO A UNO
|
||||||
|
foreach (HPV_PLV_Ingredientes mdl_HPV_PLV_Ingredientes in g_lst_HPV_PLV_Ingredientes)
|
||||||
|
{
|
||||||
|
//HPV_PLV #############################################
|
||||||
|
if (_bol_Cargar_Ingredientes &&
|
||||||
|
g_lst_HPV_Ingredientes != null &&
|
||||||
|
g_lst_HPV_Ingredientes.Count > 0)
|
||||||
|
{
|
||||||
|
mdl_HPV_PLV_Ingredientes.HPV_Ingredientes = g_lst_HPV_Ingredientes.Where(m => m.id == mdl_HPV_PLV_Ingredientes.idIngrediente).FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_Ingredientes_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_Ingrediente_Modelo_Listado()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_Ingredientes_Datos obj_HPV_Ingredientes_Datos = new HPV_Ingredientes_Datos();
|
||||||
|
g_lst_HPV_Ingredientes = obj_HPV_Ingredientes_Datos.Obtener_ModeloListado_Por_Ids(g_lst_HPV_PLV_Ingredientes.Select(x => x.idIngrediente).ToList());
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Modelo_Listado[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_PLV_Ingredientes.idPLV) + "," +
|
||||||
|
nameof(HPV_PLV_Ingredientes.idIngrediente) + "," +
|
||||||
|
nameof(HPV_PLV_Ingredientes.observaciones) +
|
||||||
|
" FROM " + nameof(HPV_PLV_Ingredientes);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idPLV, List<long> _lst_idIngredientes)
|
||||||
|
{
|
||||||
|
Exferia_Entities dbcontext = null;
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbcontext = new Exferia_Entities();
|
||||||
|
dbcontext.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar_ComoImpresora = " DELETE FROM " + nameof(HPV_PLV_Ingredientes) + " WHERE " + nameof(HPV_PLV_Ingredientes.idPLV) + "=" + _lng_idPLV;
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Borrar_ComoImpresora);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_lst_idIngredientes != null & _lst_idIngredientes.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (long lng_id in _lst_idIngredientes)
|
||||||
|
{
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_PLV_Ingredientes) + " (" + nameof(HPV_PLV_Ingredientes.idPLV) + "," + nameof(HPV_PLV_Ingredientes.idIngrediente) + "," + nameof(HPV_PLV_Ingredientes.observaciones) + ") values (" + _lng_idPLV + "," + lng_id + ",'')";
|
||||||
|
}
|
||||||
|
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_Ingredientes_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dbcontext.Database.Connection.Close();
|
||||||
|
dbcontext.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,147 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_PLV_SalasPrecios_Datos
|
||||||
|
{
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_PLV_SalasPrecios> g_lst_HPV_PLV_SalasPrecios = null;
|
||||||
|
|
||||||
|
public List<HPV_PLV_SalasPrecios> Obtener_ModeloListado_Por_IdPLV(long _lng_idPLV)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_PLV_SalasPrecios) + "." + nameof(HPV_PLV_SalasPrecios.idPLV) + "=@idPLV ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idPLV", _lng_idPLV)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_SalasPrecios_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdPLV), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_PLV_SalasPrecios;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_PLV_SalasPrecios = obj_Exferia_Entities.Database.SqlQuery<HPV_PLV_SalasPrecios>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_SalasPrecios_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_PLV_SalasPrecios.idPLV) + "," +
|
||||||
|
nameof(HPV_PLV_SalasPrecios.idSala) + "," +
|
||||||
|
nameof(HPV_PLV_SalasPrecios.precio) + "," +
|
||||||
|
nameof(HPV_PLV_SalasPrecios.descuento) +
|
||||||
|
" FROM " + nameof(HPV_PLV_SalasPrecios);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idPLV, List<HPV_PLV_SalasPrecios> _lst_HPV_PLV_SalasPrecios)
|
||||||
|
{
|
||||||
|
Exferia_Entities dbcontext = null;
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbcontext = new Exferia_Entities();
|
||||||
|
dbcontext.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar = " DELETE FROM " + nameof(HPV_PLV_SalasPrecios) + " WHERE " + nameof(HPV_PLV_SalasPrecios.idPLV) + "=" + _lng_idPLV;
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Borrar);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_lst_HPV_PLV_SalasPrecios != null & _lst_HPV_PLV_SalasPrecios.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (HPV_PLV_SalasPrecios mdl_HPV_PLV_SalasPrecios in _lst_HPV_PLV_SalasPrecios)
|
||||||
|
{
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_PLV_SalasPrecios) + "(" + nameof(HPV_PLV_SalasPrecios.idPLV) + "," + nameof(HPV_PLV_SalasPrecios.idSala) + "," + nameof(HPV_PLV_SalasPrecios.precio) + "," + nameof(HPV_PLV_SalasPrecios.descuento) + ") values (" + _lng_idPLV + "," + mdl_HPV_PLV_SalasPrecios.idSala + "," + mdl_HPV_PLV_SalasPrecios.precio.ToString().Replace(',', '.') + "," + mdl_HPV_PLV_SalasPrecios.descuento.ToString().Replace(',', '.') + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_SalasPrecios_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dbcontext.Database.Connection.Close();
|
||||||
|
dbcontext.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,785 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_Aplicacion.Modelos_MantenimientoSimple;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Perfiles_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listado
|
||||||
|
private List<INTERNO_HPV_Perfiles_Listado_Modelo> g_lst_INTERNO_HPV_Perfiles_Listado_Modelo = null;
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Perfiles).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_Perfiles_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Perfiles_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_HPV = g_lst_INTERNO_HPV_Perfiles_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Perfiles).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_Perfiles_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Perfiles_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_HPV = g_lst_INTERNO_HPV_Perfiles_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
//Filtros de Opciones
|
||||||
|
//Datos del Padre si los tuviera .........................
|
||||||
|
long lng_Padre_id = -1;
|
||||||
|
string str_Padre_Opcion = "";
|
||||||
|
if (_lst_INTERNO_Filtro_OpcionPadre_Modelo != null && _lst_INTERNO_Filtro_OpcionPadre_Modelo.Count > 0)
|
||||||
|
{
|
||||||
|
lng_Padre_id = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].VALOR;
|
||||||
|
str_Padre_Opcion = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].NOMBRE_CAMPO;
|
||||||
|
}
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.id) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.codigo) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.descripcion) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.descripcion) + "," +
|
||||||
|
//ids
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.idEmpresa) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idEmpresa) + "," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.idAgrupacionPLVCabecera) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idAgrupacionPLVCabecera) + "," +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Perfiles_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.Empresa_Codigo) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.Empresa_Descripcion) + " =" + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.Empresa_FechaBorrado) + " =" + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.fechaBorrado) + ","
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.Empresa_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.Empresa_Descripcion) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.Empresa_FechaBorrado) + " = NULL, "
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
//AgrupacionPLVCabecera
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Perfiles_Listado_Modelo.AgrupacionPLVCabecera)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.AgrupacionPLVCabecera_Codigo) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.AgrupacionPLVCabecera_Descripcion) + " =" + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.AgrupacionPLVCabecera_FechaBorrado) + " =" + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.fechaBorrado)
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.AgrupacionPLVCabecera_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.AgrupacionPLVCabecera_Descripcion) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.AgrupacionPLVCabecera_FechaBorrado) + " = NULL "
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
" FROM " + nameof(HPV_Perfiles) +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Perfiles_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(GEN_Empresas) + " ON " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idEmpresa) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
//AgrupacionPLVCabecera
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Perfiles_Listado_Modelo.AgrupacionPLVCabecera)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(HPV_AgrupacionesPLVCabeceras) + " ON " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idAgrupacionPLVCabecera) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
" WHERE " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_Perfiles) + "." + (nameof(HPV_Perfiles.id) + "=@id") : "1 = 1") + " AND " +
|
||||||
|
//Filtro por datos del padre relacionado
|
||||||
|
(
|
||||||
|
!str_Padre_Opcion.Equals("")
|
||||||
|
//Empresa
|
||||||
|
? str_Padre_Opcion.Equals(Variables.G_STR_OPCION_GEN_EMPRESA)
|
||||||
|
? (nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idEmpresa) + "=@id_Padre")
|
||||||
|
: ("1 = 1")
|
||||||
|
: ("1 = 1")
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id", _lng_id));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id_Padre", lng_Padre_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_Perfiles_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Perfiles_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_Perfiles_Listado_Modelo g_mdl_INTERNO_HPV_Perfiles_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Perfiles).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Perfiles_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_Perfiles_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Perfiles).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Perfiles_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_Perfiles_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
//Filtros de Opciones
|
||||||
|
//Datos del Padre si los tuviera .........................
|
||||||
|
long lng_Padre_id = -1;
|
||||||
|
string str_Padre_Opcion = "";
|
||||||
|
if (_lst_INTERNO_Filtro_OpcionPadre_Modelo != null && _lst_INTERNO_Filtro_OpcionPadre_Modelo.Count > 0)
|
||||||
|
{
|
||||||
|
lng_Padre_id = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].VALOR;
|
||||||
|
str_Padre_Opcion = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].NOMBRE_CAMPO;
|
||||||
|
}
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.id) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.codigo) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Perfiles_Listado_Modelo.descripcion) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_Perfiles) +
|
||||||
|
" WHERE " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_Perfiles.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_Perfiles.codigo)))
|
||||||
|
? (nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Descripcion
|
||||||
|
: (nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.descripcion) + "=@Filtro")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
+ " AND " +
|
||||||
|
//Filtro por datos del padre relacionado
|
||||||
|
(
|
||||||
|
!str_Padre_Opcion.Equals("")
|
||||||
|
//Empresa
|
||||||
|
? str_Padre_Opcion.Equals(Variables.G_STR_OPCION_GEN_EMPRESA)
|
||||||
|
? (nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idEmpresa) + "=@id_Padre")
|
||||||
|
: ("1 = 1")
|
||||||
|
: ("1 = 1")
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@Filtro", _str_Filtro));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id_Padre", lng_Padre_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_Perfiles_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Perfiles_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.id) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.id) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.codigo) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.codigo) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.descripcion) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.descripcion) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.fechaBorrado) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.fechaBorrado) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.idEmpresa) + " = " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idEmpresa) + "," +
|
||||||
|
//AgrupacionesPLVCabecera
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.F3_id) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.id) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.F3_Codigo) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.codigo) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.F3_Descripcion) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.descripcion) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.F3_FechaBorrado) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_Perfiles) +
|
||||||
|
//AgrupacionesPLVCabecera
|
||||||
|
" LEFT JOIN " + nameof(HPV_AgrupacionesPLVCabeceras) + " ON " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idAgrupacionPLVCabecera) + " = " + nameof(HPV_AgrupacionesPLVCabeceras) + "." + nameof(HPV_AgrupacionesPLVCabeceras.id) +
|
||||||
|
" WHERE " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<INTERNO_MantenimientoSimple_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Existe_PorAgrupacionPLVCabecera(long _lng_idAgrupacionPLVCabecera, Exferia_Entities _obj_Exferia_Entities)
|
||||||
|
{
|
||||||
|
bool bol_Existe = false;
|
||||||
|
HPV_Perfiles mdl_HPV_Perfiles = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.id) + "," +
|
||||||
|
nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.codigo) + "," +
|
||||||
|
nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.descripcion) + "," +
|
||||||
|
nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idAgrupacionPLVCabecera) + "," +
|
||||||
|
" FROM " + nameof(HPV_Perfiles) +
|
||||||
|
" WHERE " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( NOT" + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idAgrupacionPLVCabecera) + " IS NULL ) AND " +
|
||||||
|
nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.idAgrupacionPLVCabecera) + "=@idAgrupacionPLVCabecera ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idAgrupacionPLVCabecera", _lng_idAgrupacionPLVCabecera)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
mdl_HPV_Perfiles = _obj_Exferia_Entities.Database.SqlQuery<HPV_Perfiles>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
if(mdl_HPV_Perfiles != null)
|
||||||
|
{
|
||||||
|
bol_Existe = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(Existe_PorAgrupacionPLVCabecera), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bol_Existe;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_Perfiles g_mdl_HPV_Perfiles = null;
|
||||||
|
public HPV_Perfiles Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Perfiles) + "." + nameof(HPV_Perfiles.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_Perfiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_Perfiles = obj_Exferia_Entities.Database.SqlQuery<HPV_Perfiles>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Perfiles.id) + "," +
|
||||||
|
nameof(HPV_Perfiles.codigo) + "," +
|
||||||
|
nameof(HPV_Perfiles.descripcion) + "," +
|
||||||
|
nameof(HPV_Perfiles.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Perfiles.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_Perfiles.idAgrupacionPLVCabecera) +
|
||||||
|
" FROM " + nameof(HPV_Perfiles);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
INTERNO_MantenimientoSimple_Modelo mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar = (INTERNO_MantenimientoSimple_Modelo)_mdl_obj;
|
||||||
|
HPV_Perfiles mdl_HPV_Perfiles_DatosViejos = new HPV_Perfiles();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Perfiles mdl_HPV_Perfiles_Final = Obtener_Modelo_Por_Id(mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_Perfiles_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Perfiles_Final, mdl_HPV_Perfiles_DatosViejos, false, false);
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_Perfiles_Final, mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar);
|
||||||
|
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Perfiles) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Perfiles.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_Perfiles.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_Perfiles.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_Perfiles.fechaBorrado) + "=@fechaBorrado," +
|
||||||
|
nameof(HPV_Perfiles.idAgrupacionPLVCabecera) + "=@idAgrupacionPLVCabecera" +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Perfiles.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.idEmpresa),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.F3_id > -1
|
||||||
|
? new SqlParameter("@idAgrupacionPLVCabecera", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.F3_id.Value)
|
||||||
|
: new SqlParameter("@idAgrupacionPLVCabecera", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_Perfiles_Final = new HPV_Perfiles();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_Perfiles_Final, mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_Perfiles) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_Perfiles.codigo) + "," +
|
||||||
|
nameof(HPV_Perfiles.descripcion) + "," +
|
||||||
|
nameof(HPV_Perfiles.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Perfiles.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_Perfiles.idAgrupacionPLVCabecera) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_Perfiles.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado," +
|
||||||
|
"@idAgrupacionPLVCabecera" +
|
||||||
|
" ) ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.idEmpresa),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.F3_id > -1
|
||||||
|
? new SqlParameter("@idAgrupacionPLVCabecera", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.F3_id.Value)
|
||||||
|
: new SqlParameter("@idAgrupacionPLVCabecera", DBNull.Value)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Perfiles), mdl_HPV_Perfiles_DatosViejos, mdl_HPV_Perfiles_Final, mdl_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Finalizar transaccion
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Cargar_DatosModelo(HPV_Perfiles _mdl_HPV_Perfiles, INTERNO_MantenimientoSimple_Modelo _mdl_INTERNO_MantenimientoSimple_Modelo)
|
||||||
|
{
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
_mdl_HPV_Perfiles.id = _mdl_INTERNO_MantenimientoSimple_Modelo.id;
|
||||||
|
_mdl_HPV_Perfiles.codigo = _mdl_INTERNO_MantenimientoSimple_Modelo.codigo;
|
||||||
|
_mdl_HPV_Perfiles.descripcion = _mdl_INTERNO_MantenimientoSimple_Modelo.descripcion;
|
||||||
|
_mdl_HPV_Perfiles.idEmpresa = _mdl_INTERNO_MantenimientoSimple_Modelo.idEmpresa;
|
||||||
|
_mdl_HPV_Perfiles.idAgrupacionPLVCabecera = _mdl_INTERNO_MantenimientoSimple_Modelo.F3_id;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
HPV_Perfiles mdl_HPV_Perfiles_Final = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Comprobar si existe en algun Terminal con este perfil antes de borrar
|
||||||
|
HPV_Terminales_Datos obj_HPV_Terminales_Datos = new HPV_Terminales_Datos();
|
||||||
|
bool bol_Existe_EnTerminales = obj_HPV_Terminales_Datos.Existe_PorPerfil(_lng_id, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
if (bol_Existe_EnTerminales)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_PERFILES_VALIDACION_EXISTERELACION_TERMINALES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Perfiles mdl_HPV_Perfiless_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_Perfiless_Final != null)
|
||||||
|
{
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Perfiles) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Perfiles.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Perfiles.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Grabar un registro de trazabilidad con los datos de la trasaccion realizada
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Perfiles), null, mdl_HPV_Perfiles_Final, Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Devolver tambien el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Perfiles_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,599 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Exferia_General;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_PuntosBarra_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listado
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_id)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
|
||||||
|
#region Obtener Simple
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
|
||||||
|
private static int g_int_TotalHilos_Obtener = 1;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Obtener = new bool[g_int_TotalHilos_Obtener];
|
||||||
|
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.id) + "," +
|
||||||
|
nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.codigo) + "," +
|
||||||
|
nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.descripcion) + "," +
|
||||||
|
nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.idEmpresa) + "," +
|
||||||
|
nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.idSala) +
|
||||||
|
" FROM " + nameof(HPV_PuntosBarra) +
|
||||||
|
" WHERE " + nameof(HPV_PuntosBarra.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_PuntosBarra.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<HPV_PuntosBarra>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_dnm_Modelo_Obtener != null)
|
||||||
|
{
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Obtener; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//GEN_Empresas ##########################################################################################
|
||||||
|
if (g_dnm_Modelo_Obtener.idEmpresa != null)
|
||||||
|
{
|
||||||
|
ThreadStart obj_ThreadStart_EMPRESA = new ThreadStart(Obtener_Empresa_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_EMPRESA = new Thread(obj_ThreadStart_EMPRESA);
|
||||||
|
obj_Thread_EMPRESA.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Obtener)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PuntosBarra_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_Empresa_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_dnm_Modelo_Obtener.GEN_Empresas = Datos_Generales.GEN_Empresas_Obtener_Modelo_Por_Id(g_dnm_Modelo_Obtener.idEmpresa);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public INTERNO_HPV_PuntosBarra_Listado_Modelo Obtener_Registro_Listado(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
INTERNO_HPV_PuntosBarra_Listado_Modelo mdl_INTERNO_HPV_PuntosBarra_Listado_Modelo = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_PuntosBarra_Listado_Modelo.id) + "=" + nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_PuntosBarra_Listado_Modelo.codigo) + "=" + nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_PuntosBarra_Listado_Modelo.descripcion) + "=" + nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.descripcion) + "," +
|
||||||
|
//ids
|
||||||
|
nameof(INTERNO_HPV_PuntosBarra_Listado_Modelo.idEmpresa) + "=" + nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.idEmpresa) +
|
||||||
|
" FROM " + nameof(HPV_PuntosBarra) +
|
||||||
|
" WHERE " + nameof(HPV_PuntosBarra.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_PuntosBarra.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
mdl_INTERNO_HPV_PuntosBarra_Listado_Modelo = obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_PuntosBarra_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PuntosBarra_Datos) + "/" + nameof(Obtener_Registro_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return mdl_INTERNO_HPV_PuntosBarra_Listado_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<INTERNO_HPV_PuntosBarra_Listado_Modelo> Obtener_Listado_PorSala(long _lng_idSala, long _lng_idEmpresaSeleccionada)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<INTERNO_HPV_PuntosBarra_Listado_Modelo> lst_INTERNO_HPV_PuntosBarra_Listado_Modelo = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_PuntosBarra_Listado_Modelo.id) + "=" + nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_PuntosBarra_Listado_Modelo.codigo) + "=" + nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_PuntosBarra_Listado_Modelo.descripcion) + "=" + nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.descripcion) + "," +
|
||||||
|
//ids
|
||||||
|
nameof(INTERNO_HPV_PuntosBarra_Listado_Modelo.idEmpresa) + "=" + nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.idEmpresa) +
|
||||||
|
" FROM " + nameof(HPV_PuntosBarra) +
|
||||||
|
" WHERE " + nameof(HPV_PuntosBarra.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_PuntosBarra.idEmpresa) + "=@idEmpresa AND " +
|
||||||
|
nameof(HPV_PuntosBarra.idSala) + "=@idSala ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada),
|
||||||
|
new SqlParameter("@idSala", _lng_idSala)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
lst_INTERNO_HPV_PuntosBarra_Listado_Modelo = obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_PuntosBarra_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PuntosBarra_Datos) + "/" + nameof(Obtener_Listado_PorSala), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_INTERNO_HPV_PuntosBarra_Listado_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_PuntosBarra g_mdl_HPV_PuntosBarra = null;
|
||||||
|
|
||||||
|
public HPV_PuntosBarra Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_PuntosBarra) + "." + nameof(HPV_PuntosBarra.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PuntosBarra_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_PuntosBarra;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_PuntosBarra = obj_Exferia_Entities.Database.SqlQuery<HPV_PuntosBarra>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PuntosBarra_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_PuntosBarra.id) + "," +
|
||||||
|
nameof(HPV_PuntosBarra.codigo) + "," +
|
||||||
|
nameof(HPV_PuntosBarra.descripcion) + "," +
|
||||||
|
nameof(HPV_PuntosBarra.idEmpresa) + "," +
|
||||||
|
nameof(HPV_PuntosBarra.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_PuntosBarra.idSala) +
|
||||||
|
" FROM " + nameof(HPV_PuntosBarra);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
// Se utiliza la transaccion por la llamada al procedimiento de almacenado
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
HPV_PuntosBarra mdl_HPV_PuntosBarra_AGrabar = (HPV_PuntosBarra)_mdl_obj;
|
||||||
|
HPV_PuntosBarra mdl_HPV_PuntosBarra_DatosViejos = new HPV_PuntosBarra();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_PuntosBarra mdl_HPV_PuntosBarra_Final = Obtener_Modelo_Por_Id(mdl_HPV_PuntosBarra_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_PuntosBarra_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_PuntosBarra_Final, mdl_HPV_PuntosBarra_DatosViejos, false, false);
|
||||||
|
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_PuntosBarra_AGrabar, mdl_HPV_PuntosBarra_Final, false, false);
|
||||||
|
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_PuntosBarra) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_PuntosBarra.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_PuntosBarra.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_PuntosBarra.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_PuntosBarra.fechaBorrado) + "=@fechaBorrado," +
|
||||||
|
nameof(HPV_PuntosBarra.idSala) + "=@idSala" +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_PuntosBarra.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_PuntosBarra_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_PuntosBarra_Final.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_PuntosBarra_Final.idEmpresa),
|
||||||
|
mdl_HPV_PuntosBarra_Final.fechaBorrado != null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_PuntosBarra_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@idSala", mdl_HPV_PuntosBarra_Final.idSala),
|
||||||
|
new SqlParameter("@id", mdl_HPV_PuntosBarra_Final.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = mdl_HPV_PuntosBarra_Final.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_PuntosBarra_Final = new HPV_PuntosBarra();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
// Cargar los Datos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_PuntosBarra_AGrabar, mdl_HPV_PuntosBarra_Final, false, false);
|
||||||
|
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_PuntosBarra) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_PuntosBarra.codigo) + "," +
|
||||||
|
nameof(HPV_PuntosBarra.descripcion) + "," +
|
||||||
|
nameof(HPV_PuntosBarra.idEmpresa) + "," +
|
||||||
|
nameof(HPV_PuntosBarra.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_PuntosBarra.idSala) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_PuntosBarra.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado," +
|
||||||
|
"@idSala" +
|
||||||
|
" ) ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_PuntosBarra_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_PuntosBarra_Final.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_PuntosBarra_Final.idEmpresa),
|
||||||
|
mdl_HPV_PuntosBarra_Final.fechaBorrado != null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_PuntosBarra_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@idSala", mdl_HPV_PuntosBarra_Final.idSala)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_PuntosBarra), mdl_HPV_PuntosBarra_DatosViejos, mdl_HPV_PuntosBarra_Final, mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = mdl_HPV_PuntosBarra_Final;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PuntosBarra_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_PuntosBarra mdl_HPV_PuntosBarra_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_PuntosBarra_Final != null)
|
||||||
|
{
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_PuntosBarra) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_PuntosBarra.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_PuntosBarra.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_PuntosBarra), null, mdl_HPV_PuntosBarra_Final, Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PuntosBarra_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
List<long> lst_idPuntosBarra = (List<long>)_mdl_obj;
|
||||||
|
|
||||||
|
if (lst_idPuntosBarra != null & lst_idPuntosBarra.Count > 0)
|
||||||
|
{
|
||||||
|
//Coger los ids y ponerlos de forma que sirva para la consulta
|
||||||
|
string str_Filtros_IDS = Funciones.Formar_ContenidoIN_ParaConsultaWhere(lst_idPuntosBarra);
|
||||||
|
|
||||||
|
string str_SQL = " DELETE FROM " + nameof(HPV_PuntosBarra) +
|
||||||
|
" WHERE " + nameof(HPV_PuntosBarra.id) + " in (" + str_Filtros_IDS + ")";
|
||||||
|
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PuntosBarra_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,850 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using Exferia_Aplicacion.Modelos_Informes;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Salas_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listados
|
||||||
|
private List<INTERNO_HPV_Salas_Listado_Modelo> g_lst_INTERNO_HPV_Salas_Listado_Modelo = null;
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_HPV = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Salas).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
if ((g_lst_INTERNO_HPV_Salas_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Salas_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_HPV = g_lst_INTERNO_HPV_Salas_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Salas).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_Salas_Listado_Modelo != null) && (g_lst_INTERNO_HPV_Salas_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_HPV = g_lst_INTERNO_HPV_Salas_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.id) + " = " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.codigo) + " = " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.descripcion) + " = " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.descripcion) + "," +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Salas_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.Empresa_Codigo) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.Empresa_Descripcion) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.Empresa_FechaBorrado) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.fechaBorrado)
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.Empresa_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.Empresa_Descripcion) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.Empresa_FechaBorrado) + " = NULL "
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
" FROM " + nameof(HPV_Salas) +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_Salas_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(GEN_Empresas) + " ON " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.idEmpresa) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
" WHERE " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.idEmpresa) + "=@idEmpresa " +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_Salas) + "." + (nameof(HPV_Salas.id) + "=@id") : "1 = 1");
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id", _lng_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_Salas_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Salas_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_Salas_Listado_Modelo g_mdl_INTERNO_HPV_Salas_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Salas).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Salas_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_Salas_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Conuslta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_Salas).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_Salas_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_Salas_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Obtener_F3_PorId), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.id) + " = " + nameof(HPV_Salas.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.codigo) + " = " + nameof(HPV_Salas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Salas_Listado_Modelo.descripcion) + " = " + nameof(HPV_Salas.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_Salas) +
|
||||||
|
" WHERE " + nameof(HPV_Salas.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.idEmpresa) + "=@idEmpresa " +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_Salas.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_Salas.codigo)))
|
||||||
|
? (nameof(HPV_Salas.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Descripcion
|
||||||
|
: (nameof(HPV_Salas.descripcion) + "=@Filtro")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@Filtro", _str_Filtro));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_Salas_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Salas_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
|
||||||
|
#region Obtener Simple
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
|
||||||
|
private static int g_int_TotalHilos_Obtener = 4;
|
||||||
|
private bool[] g_bol_Hilos_Terminados_Obtener = new bool[g_int_TotalHilos_Obtener];
|
||||||
|
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_Salas_Modelo.id) + "=" + nameof(HPV_Salas) + "." + nameof(HPV_Salas.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_Salas_Modelo.codigo) + "=" + nameof(HPV_Salas) + "." + nameof(HPV_Salas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_Salas_Modelo.descripcion) + "=" + nameof(HPV_Salas) + "." + nameof(HPV_Salas.descripcion) + "," +
|
||||||
|
//ids
|
||||||
|
nameof(INTERNO_HPV_Salas_Modelo.idEmpresa) + "=" + nameof(HPV_Salas) + "." + nameof(HPV_Salas.idEmpresa) +
|
||||||
|
" FROM " + nameof(HPV_Salas) +
|
||||||
|
" WHERE " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Salas) + "." + nameof(HPV_Salas.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_Salas_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
#region Rellenar tablas Relacionadas
|
||||||
|
if (g_dnm_Modelo_Obtener != null)
|
||||||
|
{
|
||||||
|
//reiniciar Valores de los hilos
|
||||||
|
for (int int_Contador = 0; int_Contador < g_int_TotalHilos_Obtener; int_Contador++)
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[int_Contador] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HPV_Terminales ##########################################################################################
|
||||||
|
ThreadStart obj_ThreadStart_TERMINALES = new ThreadStart(Obtener_Terminales_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_TERMINALES = new Thread(obj_ThreadStart_TERMINALES);
|
||||||
|
obj_Thread_TERMINALES.Start();
|
||||||
|
|
||||||
|
//HPV_Mesas ##########################################################################################
|
||||||
|
ThreadStart obj_ThreadStart_MESAS = new ThreadStart(Obtener_Mesas_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_TMESAS = new Thread(obj_ThreadStart_MESAS);
|
||||||
|
obj_Thread_TMESAS.Start();
|
||||||
|
|
||||||
|
//HPV_PuntosBarra ##########################################################################################
|
||||||
|
ThreadStart obj_ThreadStart_PUNTOSBARRA = new ThreadStart(Obtener_PuntosBarra_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_PUNTOSBARRA = new Thread(obj_ThreadStart_PUNTOSBARRA);
|
||||||
|
obj_Thread_PUNTOSBARRA.Start();
|
||||||
|
|
||||||
|
//HPV_Impresoras ##########################################################################################
|
||||||
|
ThreadStart obj_ThreadStart_IMPRESORAS = new ThreadStart(Obtener_Impresoras_Modelo_Obtener);
|
||||||
|
Thread obj_Thread_IMPRESORAS = new Thread(obj_ThreadStart_IMPRESORAS);
|
||||||
|
obj_Thread_IMPRESORAS.Start();
|
||||||
|
|
||||||
|
//Esperando a que terminen todos los hilos .........................................
|
||||||
|
bool bol_Termino = false;
|
||||||
|
while (bol_Termino == false)
|
||||||
|
{
|
||||||
|
bol_Termino = true;
|
||||||
|
foreach (bool bol_Termino_Hilo in g_bol_Hilos_Terminados_Obtener)
|
||||||
|
{
|
||||||
|
if (bol_Termino_Hilo == false)
|
||||||
|
{
|
||||||
|
bol_Termino = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
//.................................................................................
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Tablas Relacionadas
|
||||||
|
private void Obtener_Terminales_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_Terminales_Datos obj_HPV_Terminales_Datos = new HPV_Terminales_Datos();
|
||||||
|
g_dnm_Modelo_Obtener.Terminales = obj_HPV_Terminales_Datos.Obtener_ModeloListado_Por_IdSala(g_dnm_Modelo_Obtener.id);
|
||||||
|
}
|
||||||
|
catch(Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[0] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Obtener_Mesas_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_Mesas_Datos obj_HPV_Mesas_Datos = new HPV_Mesas_Datos();
|
||||||
|
g_dnm_Modelo_Obtener.Mesas = obj_HPV_Mesas_Datos.Obtener_Listado_PorSala(g_dnm_Modelo_Obtener.id, g_dnm_Modelo_Obtener.idEmpresa);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[1] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Obtener_PuntosBarra_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_PuntosBarra_Datos obj_HPV_PuntosBarra_Datos = new HPV_PuntosBarra_Datos();
|
||||||
|
g_dnm_Modelo_Obtener.PuntosBarra = obj_HPV_PuntosBarra_Datos.Obtener_Listado_PorSala(g_dnm_Modelo_Obtener.id, g_dnm_Modelo_Obtener.idEmpresa);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[2] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Obtener_Impresoras_Modelo_Obtener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_Impresoras_Datos obj_HPV_Impresoras_Datos = new HPV_Impresoras_Datos();
|
||||||
|
g_dnm_Modelo_Obtener.Impresoras = obj_HPV_Impresoras_Datos.Obtener_ModeloListado_Por_IdSala(g_dnm_Modelo_Obtener.id);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
g_bol_Hilos_Terminados_Obtener[3] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_Salas g_mdl_HPV_Salas = null;
|
||||||
|
|
||||||
|
public HPV_Salas Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_Salas;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_Salas = obj_Exferia_Entities.Database.SqlQuery<HPV_Salas>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_Salas> g_lst_HPV_Salas = null;
|
||||||
|
|
||||||
|
public List<HPV_Salas> Obtener_ModeloListado_Por_IdTerminal(long _lng_idTerminal)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//INNER JOIN
|
||||||
|
" INNER JOIN " + nameof(HPV_Terminales_Salas) + " ON " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.id) + " = " + nameof(HPV_Terminales_Salas) + "." + nameof(HPV_Terminales_Salas.idSala) +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Terminales_Salas) + "." + nameof(HPV_Terminales_Salas.idTerminal) + "=@idTerminal ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idTerminal", _lng_idTerminal)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdTerminal), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Salas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HPV_Salas> Obtener_ModeloListado_Por_IdEmpresa(long _lng_idEmpresa)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Salas) + "." + nameof(HPV_Salas.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_Salas) + "." + nameof(HPV_Salas.idEmpresa) + "=@idTerminal ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idTerminal", _lng_idEmpresa)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdEmpresa), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Salas;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_Salas = obj_Exferia_Entities.Database.SqlQuery<HPV_Salas>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Salas.id) + "," +
|
||||||
|
nameof(HPV_Salas.codigo) + "," +
|
||||||
|
nameof(HPV_Salas.descripcion) + "," +
|
||||||
|
nameof(HPV_Salas.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Salas.fechaBorrado) +
|
||||||
|
" FROM " + nameof(HPV_Salas);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
HPV_Salas mdl_HPV_Salas_AGrabar = (HPV_Salas)_mdl_obj;
|
||||||
|
HPV_Salas mdl_HPV_Salas_DatosViejos = new HPV_Salas();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Salas mdl_HPV_Salas_Final = Obtener_Modelo_Por_Id(mdl_HPV_Salas_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_Salas_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Salas_Final, mdl_HPV_Salas_DatosViejos, false, false);
|
||||||
|
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Salas_AGrabar, mdl_HPV_Salas_Final, false, false);
|
||||||
|
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Salas) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Salas.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_Salas.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_Salas.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_Salas.fechaBorrado) + "=@fechaBorrado" +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Salas.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_Salas_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_Salas_Final.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_Salas_Final.idEmpresa),
|
||||||
|
mdl_HPV_Salas_Final.fechaBorrado != null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_Salas_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_HPV_Salas_Final.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = mdl_HPV_Salas_Final.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_Salas_Final = new HPV_Salas();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
// Cargar los Datos del Modelo
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_Salas_AGrabar, mdl_HPV_Salas_Final, false, false);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_Salas) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_Salas.codigo) + "," +
|
||||||
|
nameof(HPV_Salas.descripcion) + "," +
|
||||||
|
nameof(HPV_Salas.idEmpresa) + "," +
|
||||||
|
nameof(HPV_Salas.fechaBorrado) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_Salas.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado" +
|
||||||
|
" ) ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_HPV_Salas_Final.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_HPV_Salas_Final.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_HPV_Salas_Final.idEmpresa),
|
||||||
|
mdl_HPV_Salas_Final.fechaBorrado != null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_HPV_Salas_Final.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Salas), mdl_HPV_Salas_DatosViejos, mdl_HPV_Salas_Final, mdl_INTERNO_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = mdl_HPV_Salas_Final;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_Salas mdl_HPV_Salas_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_Salas_Final != null)
|
||||||
|
{
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_Salas) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_Salas.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_Salas.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_Salas), null, mdl_HPV_Salas_Final, G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Devolver también el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Salas_Impresoras_Datos
|
||||||
|
{
|
||||||
|
#region Obtener
|
||||||
|
public long Obtener_PorDefecto_IdImpresora_Por_IdSala(long _lng_idSala)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
long lng_idPorDefecto = -1;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Salas_Impresoras) + "." + nameof(HPV_Salas_Impresoras.idImpresora) +
|
||||||
|
" FROM " + nameof(HPV_Salas_Impresoras) +
|
||||||
|
" WHERE " + nameof(HPV_Salas_Impresoras) + "." + nameof(HPV_Salas_Impresoras.idSala) + "=@idSala AND " +
|
||||||
|
nameof(HPV_Salas_Impresoras) + "." + nameof(HPV_Salas_Impresoras.porDefecto) + "=convert(bit,1) ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idSala", _lng_idSala)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
lng_idPorDefecto = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Impresoras_Datos) + "/" + nameof(Obtener_PorDefecto_IdImpresora_Por_IdSala), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lng_idPorDefecto;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idSala, Dictionary<long, bool> _dct_Impresoras)
|
||||||
|
{
|
||||||
|
Exferia_Entities dbcontext = null;
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
string str_PorDefecto = "0";//Es un string para identificar el booleano siendo "o"=False y "1"=True
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbcontext = new Exferia_Entities();
|
||||||
|
dbcontext.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar = " DELETE FROM " + nameof(HPV_Salas_Impresoras) + " WHERE " + nameof(HPV_Salas_Impresoras.idSala) + "=" + _lng_idSala;
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Borrar);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_dct_Impresoras != null & _dct_Impresoras.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (KeyValuePair<long, bool> kvp_Impresora in _dct_Impresoras)
|
||||||
|
{
|
||||||
|
str_PorDefecto = "0";
|
||||||
|
|
||||||
|
if (kvp_Impresora.Value)
|
||||||
|
{
|
||||||
|
str_PorDefecto = "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_Salas_Impresoras) + "(" + nameof(HPV_Salas_Impresoras.idSala) + "," + nameof(HPV_Salas_Impresoras.idImpresora) + "," + nameof(HPV_Salas_Impresoras.porDefecto) + "," + nameof(HPV_Salas_Impresoras.observaciones) + ") values (" + _lng_idSala + "," + kvp_Impresora.Key + "," + str_PorDefecto + ",'')";
|
||||||
|
}
|
||||||
|
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Salas_Impresoras_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dbcontext.Database.Connection.Close();
|
||||||
|
dbcontext.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,824 @@
|
||||||
|
using Exferia_Aplicacion.Herencia.Capas;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_Aplicacion.Modelos_MantenimientoSimple;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Data.Objects.SqlClient;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_SeccionesMenu_Datos : ABS_Datos
|
||||||
|
{
|
||||||
|
#region Listado
|
||||||
|
private List<INTERNO_HPV_SeccionesMenu_Listado_Modelo> g_lst_INTERNO_HPV_SeccionesMenu_Listado_Modelo = null;
|
||||||
|
|
||||||
|
public override List<dynamic> Obtener_Listado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_SeccionesMenu).Name), _lst_CamposConRelacionABuscar, -1, null, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_SeccionesMenu_Listado_Modelo != null) && (g_lst_INTERNO_HPV_SeccionesMenu_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
lst_HPV = g_lst_INTERNO_HPV_SeccionesMenu_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Obtener_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
// Consulta .....................................................
|
||||||
|
ConsultaRellenar_Listado(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_SeccionesMenu).Name), _lst_CamposConRelacionABuscar, _lng_id, _lst_ids, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if ((g_lst_INTERNO_HPV_SeccionesMenu_Listado_Modelo != null) && (g_lst_INTERNO_HPV_SeccionesMenu_Listado_Modelo.Count() > 0))
|
||||||
|
{
|
||||||
|
dnm_HPV = g_lst_INTERNO_HPV_SeccionesMenu_Listado_Modelo.Cast<dynamic>().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Obtener_RegistroListado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
//Filtros de Opciones
|
||||||
|
//Datos del Padre si los tuviera .........................
|
||||||
|
long lng_Padre_id = -1;
|
||||||
|
string str_Padre_Opcion = "";
|
||||||
|
if (_lst_INTERNO_Filtro_OpcionPadre_Modelo != null && _lst_INTERNO_Filtro_OpcionPadre_Modelo.Count > 0)
|
||||||
|
{
|
||||||
|
lng_Padre_id = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].VALOR;
|
||||||
|
str_Padre_Opcion = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].NOMBRE_CAMPO;
|
||||||
|
}
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.id) + " = " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.codigo) + " = " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.descripcion) + " = " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.orden) + " = " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.orden) + "," +
|
||||||
|
//ids
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.idEmpresa) + " = " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.idEmpresa) + "," +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.Empresa_Codigo) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.Empresa_Descripcion) + " =" + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.descripcion) + "," +
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.Empresa_FechaBorrado) + " =" + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.fechaBorrado)
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.Empresa_Codigo) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.Empresa_Descripcion) + " = ''," +
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.Empresa_FechaBorrado) + " = NULL "
|
||||||
|
)
|
||||||
|
) +
|
||||||
|
" FROM " + nameof(HPV_SeccionesMenu) +
|
||||||
|
//Empresa
|
||||||
|
(
|
||||||
|
(_lst_CamposConRelacionABuscar.Contains(nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.Empresa)))
|
||||||
|
?
|
||||||
|
(
|
||||||
|
" LEFT JOIN " + nameof(GEN_Empresas) + " ON " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.idEmpresa) + " = " + nameof(GEN_Empresas) + "." + nameof(GEN_Empresas.id)
|
||||||
|
)
|
||||||
|
: ("")
|
||||||
|
) +
|
||||||
|
" WHERE " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(_lng_id > -1 ? nameof(HPV_SeccionesMenu) + "." + (nameof(HPV_SeccionesMenu.id) + "=@id") : "1 = 1") + " AND " +
|
||||||
|
//Filtro por datos del padre relacionado
|
||||||
|
(
|
||||||
|
!str_Padre_Opcion.Equals("")
|
||||||
|
//Empresa
|
||||||
|
? str_Padre_Opcion.Equals(Variables.G_STR_OPCION_GEN_EMPRESA)
|
||||||
|
? (nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.idEmpresa) + "=@id_Padre")
|
||||||
|
: ("1 = 1")
|
||||||
|
: ("1 = 1")
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id", _lng_id));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id_Padre", lng_Padre_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_lst_INTERNO_HPV_SeccionesMenu_Listado_Modelo = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_SeccionesMenu_Listado_Modelo>(str_SQL, arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(ConsultaRellenar_Listado), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Listado Secundario
|
||||||
|
public override List<dynamic> Obtener_Listado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_RegistroListado_Secundario(long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<string> _lst_CamposConRelacionABuscar, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo, long _lng_id, List<long> _lst_ids)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_Listado_Secundario(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, List<string> _lst_CamposConRelacionABuscar, long _lng_id, List<long> _lst_ids, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region F3
|
||||||
|
private INTERNO_HPV_SeccionesMenu_Listado_Modelo g_mdl_INTERNO_HPV_SeccionesMenu_Listado_Modelo_F3 = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener_F3(string _str_filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_SeccionesMenu).Name), _str_CampoBusqueda, _str_filtro, -1, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_SeccionesMenu_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_SeccionesMenu_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
public override dynamic Obtener_F3_PorId(long _lng_id, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
dynamic dnm_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Consulta ......................................................
|
||||||
|
ConsultaRellenar_F3(obj_Exferia_Entities, _lng_idEmpresaSeleccionada, _lng_idEjercicioActual, Datos_Generales.GEN_Empresas_Devolver_EmpresasCompartidas_SegunFichero(_lng_idEmpresaSeleccionada, typeof(HPV_SeccionesMenu).Name), "", "", _lng_id, _lst_INTERNO_Filtro_OpcionPadre_Modelo, _lst_INTERNO_Filtro_Modelo);
|
||||||
|
// ..............................................................
|
||||||
|
|
||||||
|
if (g_mdl_INTERNO_HPV_SeccionesMenu_Listado_Modelo_F3 != null)
|
||||||
|
{
|
||||||
|
dnm_HPV = g_mdl_INTERNO_HPV_SeccionesMenu_Listado_Modelo_F3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Obtener_F3), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return dnm_HPV;
|
||||||
|
}
|
||||||
|
protected override void ConsultaRellenar_F3(Exferia_Entities _obj_Exferia_Entities, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual, List<long> _lst_idEmpresasRelacionadas, string _str_CampoBusqueda, string _str_Filtro, long _lng_id, List<INTERNO_Filtro_OpcionPadre_Modelo> _lst_INTERNO_Filtro_OpcionPadre_Modelo, List<INTERNO_Filtro_Modelo> _lst_INTERNO_Filtro_Modelo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<SqlParameter> lst_Parametros = new List<SqlParameter>();
|
||||||
|
|
||||||
|
string str_Filtros_Empresas = Funciones.Formar_ContenidoIN_ParaConsultaWhere(_lst_idEmpresasRelacionadas);
|
||||||
|
|
||||||
|
//Filtros de Opciones
|
||||||
|
//Datos del Padre si los tuviera .........................
|
||||||
|
long lng_Padre_id = -1;
|
||||||
|
string str_Padre_Opcion = "";
|
||||||
|
if (_lst_INTERNO_Filtro_OpcionPadre_Modelo != null && _lst_INTERNO_Filtro_OpcionPadre_Modelo.Count > 0)
|
||||||
|
{
|
||||||
|
lng_Padre_id = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].VALOR;
|
||||||
|
str_Padre_Opcion = _lst_INTERNO_Filtro_OpcionPadre_Modelo[0].NOMBRE_CAMPO;
|
||||||
|
}
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT distinct " +
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.id) + " = " + nameof(HPV_SeccionesMenu.id) + "," +
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.codigo) + " = " + nameof(HPV_SeccionesMenu.codigo) + "," +
|
||||||
|
nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.descripcion) + " = " + nameof(HPV_SeccionesMenu.descripcion) +
|
||||||
|
" FROM " + nameof(HPV_SeccionesMenu) +
|
||||||
|
" WHERE " + nameof(HPV_SeccionesMenu.fechaBorrado) + " IS null AND " +
|
||||||
|
" ( " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.idEmpresa) + "=@idEmpresa" +
|
||||||
|
(
|
||||||
|
(_lst_idEmpresasRelacionadas != null && _lst_idEmpresasRelacionadas.Count > 0)
|
||||||
|
? (" OR " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.idEmpresa) + " in (" + str_Filtros_Empresas + ") ")
|
||||||
|
: " "
|
||||||
|
) +
|
||||||
|
" ) AND " +
|
||||||
|
(
|
||||||
|
(_lng_id > -1)
|
||||||
|
? (nameof(HPV_SeccionesMenu.id) + " = " + _lng_id)
|
||||||
|
: (
|
||||||
|
//Filtrar por Codigo
|
||||||
|
(_str_CampoBusqueda.Equals(nameof(HPV_SeccionesMenu.codigo)))
|
||||||
|
? (nameof(HPV_SeccionesMenu.codigo) + "=@Filtro")
|
||||||
|
//Filtrar por Descripcion
|
||||||
|
: (nameof(HPV_SeccionesMenu.descripcion) + "=@Filtro")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
+ " AND " +
|
||||||
|
//Filtro por datos del padre relacionado
|
||||||
|
(
|
||||||
|
!str_Padre_Opcion.Equals("")
|
||||||
|
//Empresa
|
||||||
|
? str_Padre_Opcion.Equals(Variables.G_STR_OPCION_GEN_EMPRESA)
|
||||||
|
? (nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.idEmpresa) + "=@id_Padre")
|
||||||
|
: ("1 = 1")
|
||||||
|
: ("1 = 1")
|
||||||
|
);
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
lst_Parametros.Add(new SqlParameter("@idEmpresa", _lng_idEmpresaSeleccionada));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@Filtro", _str_Filtro));
|
||||||
|
lst_Parametros.Add(new SqlParameter("@id_Padre", lng_Padre_id));
|
||||||
|
|
||||||
|
object[] arr_Parametros = lst_Parametros.ToArray();
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_INTERNO_HPV_SeccionesMenu_Listado_Modelo_F3 = _obj_Exferia_Entities.Database.SqlQuery<INTERNO_HPV_SeccionesMenu_Listado_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(ConsultaRellenar_F3), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obtener
|
||||||
|
|
||||||
|
#region Obtener Simple
|
||||||
|
private dynamic g_dnm_Modelo_Obtener = null;
|
||||||
|
|
||||||
|
public override dynamic Obtener(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.id) + " = " + nameof(HPV_SeccionesMenu.id) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.codigo) + " = " + nameof(HPV_SeccionesMenu.codigo) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.descripcion) + " = " + nameof(HPV_SeccionesMenu.descripcion) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.Auxiliar_1_Entero) + " = (CASE WHEN " + nameof(HPV_SeccionesMenu.orden) + " IS NULL THEN convert(int,0) ELSE " + nameof(HPV_SeccionesMenu.orden) + " END)," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.fechaBorrado) + " = " + nameof(HPV_SeccionesMenu.fechaBorrado) + "," +
|
||||||
|
nameof(INTERNO_MantenimientoSimple_Modelo.idEmpresa) + " = " + nameof(HPV_SeccionesMenu.idEmpresa) +
|
||||||
|
" FROM " + nameof(HPV_SeccionesMenu) +
|
||||||
|
" WHERE " + nameof(HPV_SeccionesMenu.fechaBorrado) + " IS null AND " +
|
||||||
|
nameof(HPV_SeccionesMenu.id) + "=@id ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_dnm_Modelo_Obtener = obj_Exferia_Entities.Database.SqlQuery<INTERNO_MantenimientoSimple_Modelo>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Obtener), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return g_dnm_Modelo_Obtener;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override dynamic Obtener_Registro_PorCampo(string _str_Filtro, string _str_CampoBusqueda, long _lng_idEmpresaSeleccionada, long _lng_idEjercicioActual)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public dynamic Obtener_Listado_Simple()
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
List<dynamic> lst_HPV = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_SeccionesMenu.id) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.codigo) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.descripcion) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.orden) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.idEmpresa) +
|
||||||
|
" FROM " + nameof(HPV_SeccionesMenu) +
|
||||||
|
" WHERE " + nameof(HPV_SeccionesMenu.fechaBorrado) + " IS NULL ";
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
lst_HPV = obj_Exferia_Entities.Database.SqlQuery<HPV_SeccionesMenu>(str_SQL).ToList().Cast<dynamic>().ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Obtener_Listado_Simple), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lst_HPV;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Simple
|
||||||
|
private HPV_SeccionesMenu g_mdl_HPV_SeccionesMenu = null;
|
||||||
|
public HPV_SeccionesMenu Obtener_Modelo_Por_Id(long _lng_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_SeccionesMenu) + "." + nameof(HPV_SeccionesMenu.id) + "=@id";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Obtener_Modelo_Por_Id), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_mdl_HPV_SeccionesMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
g_mdl_HPV_SeccionesMenu = obj_Exferia_Entities.Database.SqlQuery<HPV_SeccionesMenu>(_str_SQL, _arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_SeccionesMenu> g_lst_HPV_SeccionesMenu = null;
|
||||||
|
|
||||||
|
public List<HPV_SeccionesMenu> Obtener_ModeloListado_Por_Ids(List<long> _lst_Ids)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_lst_Ids != null && _lst_Ids.Count > 0)
|
||||||
|
{
|
||||||
|
string str_Filtro_IDS = Funciones.Formar_ContenidoIN_ParaConsultaWhere(nameof(HPV_SeccionesMenu),
|
||||||
|
nameof(HPV_SeccionesMenu.id),
|
||||||
|
G_ENUM_FORMARCONTENIDOIN_CONDICIONANTES.NADA,
|
||||||
|
_lst_Ids);
|
||||||
|
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + str_Filtro_IDS;
|
||||||
|
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
new object[] { });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Obtener_ModeloListado_Por_Ids), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_SeccionesMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_SeccionesMenu = obj_Exferia_Entities.Database.SqlQuery<HPV_SeccionesMenu>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_SeccionesMenu.id) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.codigo) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.descripcion) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.idEmpresa) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.orden) +
|
||||||
|
" FROM " + nameof(HPV_SeccionesMenu);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Grabar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
INTERNO_MantenimientoSimple_Modelo mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar = (INTERNO_MantenimientoSimple_Modelo)_mdl_obj;
|
||||||
|
HPV_SeccionesMenu mdl_HPV_SeccionesMenu_DatosViejos = new HPV_SeccionesMenu();
|
||||||
|
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_SeccionesMenu mdl_HPV_SeccionesMenu_Final = Obtener_Modelo_Por_Id(mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
if (mdl_HPV_SeccionesMenu_Final != null)
|
||||||
|
{
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_MODIFICAR;
|
||||||
|
|
||||||
|
//Datos viejos para la trazabilidad
|
||||||
|
Funciones.CopiarPropiedadesObjetos(mdl_HPV_SeccionesMenu_Final, mdl_HPV_SeccionesMenu_DatosViejos, false, false);
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_SeccionesMenu_Final, mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar);
|
||||||
|
|
||||||
|
#region UPDATE
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_SeccionesMenu) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_SeccionesMenu.codigo) + "=@codigo," +
|
||||||
|
nameof(HPV_SeccionesMenu.descripcion) + "=@descripcion," +
|
||||||
|
nameof(HPV_SeccionesMenu.idEmpresa) + "=@idEmpresa," +
|
||||||
|
nameof(HPV_SeccionesMenu.fechaBorrado) + "=@fechaBorrado, " +
|
||||||
|
nameof(HPV_SeccionesMenu.orden) + "=@orden " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_SeccionesMenu.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.idEmpresa),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.Auxiliar_1_Entero > 0
|
||||||
|
? new SqlParameter("@orden", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.Auxiliar_1_Entero)
|
||||||
|
: new SqlParameter("@orden", DBNull.Value),
|
||||||
|
new SqlParameter("@id", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.id;
|
||||||
|
}
|
||||||
|
//INSERT
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_SeccionesMenu_Final = new HPV_SeccionesMenu();
|
||||||
|
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_INSERTAR;
|
||||||
|
|
||||||
|
//Cargar los Datos del Modelo
|
||||||
|
Cargar_DatosModelo(mdl_HPV_SeccionesMenu_Final, mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar);
|
||||||
|
|
||||||
|
#region INSERT
|
||||||
|
string str_SQL_Insert = " INSERT INTO " + nameof(HPV_SeccionesMenu) +
|
||||||
|
" (" +
|
||||||
|
nameof(HPV_SeccionesMenu.codigo) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.descripcion) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.idEmpresa) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.fechaBorrado) + "," +
|
||||||
|
nameof(HPV_SeccionesMenu.orden) +
|
||||||
|
" ) " +
|
||||||
|
" OUTPUT INSERTED." + nameof(HPV_SeccionesMenu.id) +
|
||||||
|
" VALUES " +
|
||||||
|
" ( " +
|
||||||
|
"@codigo," +
|
||||||
|
"@descripcion," +
|
||||||
|
"@idEmpresa," +
|
||||||
|
"@fechaBorrado," +
|
||||||
|
"@orden" +
|
||||||
|
" ) ";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Insert = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@codigo", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.codigo),
|
||||||
|
new SqlParameter("@descripcion", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.descripcion),
|
||||||
|
new SqlParameter("@idEmpresa", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.idEmpresa),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado!=null
|
||||||
|
? new SqlParameter("@fechaBorrado", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.fechaBorrado.Value)
|
||||||
|
: new SqlParameter("@fechaBorrado", DBNull.Value),
|
||||||
|
mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.Auxiliar_1_Entero > 0
|
||||||
|
? new SqlParameter("@orden", mdl_INTERNO_MantenimientoSimple_Modelo_AGrabar.Auxiliar_1_Entero)
|
||||||
|
: new SqlParameter("@orden", DBNull.Value)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Id de la tabla
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Insert, arr_Parametros_Insert).Single();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grabar un registro de trazabilidad con los datos de la transaccion realizada.
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_SeccionesMenu), mdl_HPV_SeccionesMenu_DatosViejos, mdl_HPV_SeccionesMenu_Final, mdl_ValorDevuelto_Modelo.TipoAccion, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Finalizar transaccion
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Cargar_DatosModelo(HPV_SeccionesMenu _mdl_HPV_SeccionesMenu, INTERNO_MantenimientoSimple_Modelo _mdl_INTERNO_MantenimientoSimple_Modelo)
|
||||||
|
{
|
||||||
|
// Cargar los Datos Nuevos del Modelo
|
||||||
|
_mdl_HPV_SeccionesMenu.id = _mdl_INTERNO_MantenimientoSimple_Modelo.id;
|
||||||
|
_mdl_HPV_SeccionesMenu.codigo = _mdl_INTERNO_MantenimientoSimple_Modelo.codigo;
|
||||||
|
_mdl_HPV_SeccionesMenu.descripcion = _mdl_INTERNO_MantenimientoSimple_Modelo.descripcion;
|
||||||
|
_mdl_HPV_SeccionesMenu.idEmpresa = _mdl_INTERNO_MantenimientoSimple_Modelo.idEmpresa;
|
||||||
|
_mdl_HPV_SeccionesMenu.orden = (_mdl_INTERNO_MantenimientoSimple_Modelo.Auxiliar_1 != null && _mdl_INTERNO_MantenimientoSimple_Modelo.Auxiliar_1.Trim().Length>0) ? int.Parse(_mdl_INTERNO_MantenimientoSimple_Modelo.Auxiliar_1) : 0;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
//Tipo de Accion que se va a realizar
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
//Comprobar si existe en algun Escandallo antes de borrar
|
||||||
|
HPV_Escandallos_Datos obj_HPV_Escandallos_Datos = new HPV_Escandallos_Datos();
|
||||||
|
bool bol_Existe_EnEscandallos = obj_HPV_Escandallos_Datos.ExisteEscandallo_PorSeccionMenu(_lng_id, obj_Exferia_Entities);
|
||||||
|
|
||||||
|
if (bol_Existe_EnEscandallos)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_SECCIONMENU_VALIDACION_EXISTERELACION_ESCANDALLOS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Ver si existe ######################################################################
|
||||||
|
HPV_SeccionesMenu mdl_HPV_SeccionesMenu_Final = Obtener_Modelo_Por_Id(_lng_id);
|
||||||
|
//######################################################################################
|
||||||
|
|
||||||
|
if (mdl_HPV_SeccionesMenu_Final != null)
|
||||||
|
{
|
||||||
|
#region Update
|
||||||
|
string str_SQL_Update = " UPDATE " + nameof(HPV_SeccionesMenu) +
|
||||||
|
" SET " +
|
||||||
|
nameof(HPV_SeccionesMenu.fechaBorrado) + "=@fechaBorrado " +
|
||||||
|
" WHERE " +
|
||||||
|
nameof(HPV_SeccionesMenu.id) + "=@id";
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros_Update = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@fechaBorrado", DateTime.Now),
|
||||||
|
new SqlParameter("@id", _lng_id)
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//Update
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Update, arr_Parametros_Update);
|
||||||
|
|
||||||
|
//Grabar un registro de trazabilidad con los datos de la trasaccion realizada
|
||||||
|
Datos_Generales.USR_Trazabilidad_Grabar(typeof(HPV_SeccionesMenu), null, mdl_HPV_SeccionesMenu_Final, Enumerados.G_ENUM_TIPOACCION.INT_ELIMINAR, obj_Exferia_Entities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Devolver tambien el Objeto
|
||||||
|
mdl_ValorDevuelto_Modelo.Id = _lng_id;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_SeccionesMenu_Datos) + "/" + nameof(Borrar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(long _lng_id, long _lng_idAuxiliar)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
public override INTERNO_ValorDevuelto_Modelo Borrar(object _mdl_obj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,143 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Tarifas_SalasPrecios_Datos
|
||||||
|
{
|
||||||
|
#region MODELOS
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_Tarifas_SalasPrecios> g_lst_HPV_Tarifas_SalasPrecios = null;
|
||||||
|
|
||||||
|
public List<HPV_Tarifas_SalasPrecios> Obtener_ModeloListado_Por_IdTarifa(long _lng_idTarifa)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Tarifas_SalasPrecios) + "." + nameof(HPV_Tarifas_SalasPrecios.idTarifa) + "=@idTarifa";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idTarifa", _lng_idTarifa)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el modelo
|
||||||
|
Ejecutar_Consulta_Modelo(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_PLV_AgrupacionesPLVLineas_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdTarifa), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Tarifas_SalasPrecios;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_Tarifas_SalasPrecios = obj_Exferia_Entities.Database.SqlQuery<HPV_Tarifas_SalasPrecios>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Tarifas_SalasPrecios_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Tarifas_SalasPrecios.idTarifa) + "," +
|
||||||
|
nameof(HPV_Tarifas_SalasPrecios.idSala) + "," +
|
||||||
|
nameof(HPV_Tarifas_SalasPrecios.precio) + "," +
|
||||||
|
nameof(HPV_Tarifas_SalasPrecios.descuento) +
|
||||||
|
" FROM " + nameof(HPV_Tarifas_SalasPrecios);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idTarifa, List<HPV_Tarifas_SalasPrecios> _HPV_Tarifas_SalasPrecios)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar = " DELETE FROM " + nameof(HPV_Tarifas_SalasPrecios) + " WHERE " + nameof(HPV_Tarifas_SalasPrecios.idTarifa) + "=" + _lng_idTarifa;
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Borrar);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_HPV_Tarifas_SalasPrecios != null & _HPV_Tarifas_SalasPrecios.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (HPV_Tarifas_SalasPrecios mdl_HPV_Tarifas_SalasPrecios in _HPV_Tarifas_SalasPrecios)
|
||||||
|
{
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_Tarifas_SalasPrecios) + "(" + nameof(HPV_Tarifas_SalasPrecios.idTarifa) + "," + nameof(HPV_Tarifas_SalasPrecios.idSala) + "," + nameof(HPV_Tarifas_SalasPrecios.precio) + "," + nameof(HPV_Tarifas_SalasPrecios.descuento) + ") values (" + _lng_idTarifa + "," + mdl_HPV_Tarifas_SalasPrecios.idSala + "," + mdl_HPV_Tarifas_SalasPrecios.precio.ToString().Replace(',', '.') + "," + mdl_HPV_Tarifas_SalasPrecios.descuento.ToString().Replace(',', '.') + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Tarifas_SalasPrecios_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Terminales_AgrupacionesTerminales_Datos
|
||||||
|
{
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idTerminal, Dictionary<long, bool> _dct_AgrupacionesTerminales)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar = " DELETE FROM " + nameof(HPV_Terminales_AgrupacionesTerminales) + " WHERE " + nameof(HPV_Terminales_AgrupacionesTerminales.idTerminal) + "=" + _lng_idTerminal;
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Borrar);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_dct_AgrupacionesTerminales != null & _dct_AgrupacionesTerminales.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (KeyValuePair<long, bool> kvp_AgrupacionesTerminales in _dct_AgrupacionesTerminales)
|
||||||
|
{
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_Terminales_AgrupacionesTerminales) + "(" + nameof(HPV_Terminales_AgrupacionesTerminales.idTerminal) + "," + nameof(HPV_Terminales_AgrupacionesTerminales.idAgrupacionTerminal) + "," + nameof(HPV_Terminales_AgrupacionesTerminales.observaciones) + ") values (" + _lng_idTerminal + "," + kvp_AgrupacionesTerminales.Key + ",'')";
|
||||||
|
}
|
||||||
|
|
||||||
|
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Terminales_AgrupacionesTerminales_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,110 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Terminales_Salas_Datos
|
||||||
|
{
|
||||||
|
#region Obtener
|
||||||
|
public long Obtener_PorDefecto_IdSala_Por_IdTerminal(long _lng_idTerminal)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
long lng_idPorDefecto = -1;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
string str_SQL =
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Terminales_Salas) + "." + nameof(HPV_Terminales_Salas.idSala) +
|
||||||
|
" FROM " + nameof(HPV_Terminales_Salas) +
|
||||||
|
" WHERE " + nameof(HPV_Terminales_Salas) + "." + nameof(HPV_Terminales_Salas.idTerminal) + "=@idTerminal AND " +
|
||||||
|
nameof(HPV_Terminales_Salas) + "." + nameof(HPV_Terminales_Salas.porDefecto) + "=convert(bit,1) ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idTerminal", _lng_idTerminal)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Rellenar el Modelo
|
||||||
|
lng_idPorDefecto = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL, arr_Parametros).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Terminales_Salas_Datos) + "/" + nameof(Obtener_PorDefecto_IdSala_Por_IdTerminal), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
return lng_idPorDefecto;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Grabar(long _lng_idTerminal, Dictionary<long, bool> _dct_Salas)
|
||||||
|
{
|
||||||
|
Exferia_Entities dbcontext = null;
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
string str_PorDefecto = "0";//Es un string para identificar el booleano siendo "o"=False y "1"=True
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbcontext = new Exferia_Entities();
|
||||||
|
dbcontext.Configuration.ProxyCreationEnabled = true;
|
||||||
|
|
||||||
|
//Borrar Relaciones Antiguas ..............................................
|
||||||
|
string str_SQL_Borrar = " DELETE FROM " + nameof(HPV_Terminales_Salas) + " WHERE " + nameof(HPV_Terminales_Salas.idTerminal) + "=" + _lng_idTerminal;
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Borrar);
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
//Grabar Relaciones Nuevas .................................................
|
||||||
|
if (_dct_Salas != null & _dct_Salas.Count > 0)
|
||||||
|
{
|
||||||
|
string str_SQL_Insertar = "";
|
||||||
|
foreach (KeyValuePair<long, bool> kvp_Salas in _dct_Salas)
|
||||||
|
{
|
||||||
|
str_PorDefecto = "0";
|
||||||
|
|
||||||
|
if (kvp_Salas.Value)
|
||||||
|
{
|
||||||
|
str_PorDefecto = "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
str_SQL_Insertar += " INSERT INTO " + nameof(HPV_Terminales_Salas) + "(" + nameof(HPV_Terminales_Salas.idTerminal) + "," + nameof(HPV_Terminales_Salas.idSala) + "," + nameof(HPV_Terminales_Salas.observaciones) + "," + nameof(HPV_Terminales_Salas.porDefecto) + ") values (" + _lng_idTerminal + "," + kvp_Salas.Key + ",''," + str_PorDefecto + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
dbcontext.Database.ExecuteSqlCommand(str_SQL_Insertar);
|
||||||
|
}
|
||||||
|
//.........................................................................
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Terminales_Salas_Datos) + "/" + nameof(Grabar), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dbcontext.Database.Connection.Close();
|
||||||
|
dbcontext.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._1_Datos
|
||||||
|
{
|
||||||
|
public class HPV_Terminales_ValidacionesHistorico_Datos
|
||||||
|
{
|
||||||
|
#region Modelos
|
||||||
|
|
||||||
|
#region Modelo Listado
|
||||||
|
private List<HPV_Terminales_ValidacionesHistorico> g_lst_HPV_Terminales_ValidacionesHistorico = null;
|
||||||
|
|
||||||
|
public List<HPV_Terminales_ValidacionesHistorico> Obtener_ModeloListado_Por_IdTerminal(long _lng_idTerminal)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Consulta
|
||||||
|
string str_SQL = Obtener_Consulta_Modelo() +
|
||||||
|
//WHERE
|
||||||
|
" WHERE " + nameof(HPV_Terminales_ValidacionesHistorico) + "." + nameof(HPV_Terminales_ValidacionesHistorico.idTerminal) + "=@idTerminal ";
|
||||||
|
|
||||||
|
//Parametros
|
||||||
|
object[] arr_Parametros = new object[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@idTerminal", _lng_idTerminal)
|
||||||
|
};
|
||||||
|
|
||||||
|
//Ejecutar y rellenar el listado
|
||||||
|
Ejecutar_Consulta_Modelo_Listado(str_SQL,
|
||||||
|
arr_Parametros);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Terminales_ValidacionesHistorico_Datos) + "/" + nameof(Obtener_ModeloListado_Por_IdTerminal), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_lst_HPV_Terminales_ValidacionesHistorico;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ejecutar Consulta
|
||||||
|
private void Ejecutar_Consulta_Modelo_Listado(string _str_SQL,
|
||||||
|
object[] _arr_Parametros)
|
||||||
|
{
|
||||||
|
Exferia_Entities obj_Exferia_Entities = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Conexion
|
||||||
|
obj_Exferia_Entities = new Exferia_Entities();
|
||||||
|
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
//Rellenar el modelo
|
||||||
|
g_lst_HPV_Terminales_ValidacionesHistorico = obj_Exferia_Entities.Database.SqlQuery<HPV_Terminales_ValidacionesHistorico>(_str_SQL, _arr_Parametros).ToList();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(HPV_Terminales_ValidacionesHistorico_Datos) + "/" + nameof(Ejecutar_Consulta_Modelo_Listado), true);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
obj_Exferia_Entities.Database.Connection.Close();
|
||||||
|
obj_Exferia_Entities.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private string Obtener_Consulta_Modelo()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
" SELECT " +
|
||||||
|
nameof(HPV_Terminales_ValidacionesHistorico.id) + "," +
|
||||||
|
nameof(HPV_Terminales_ValidacionesHistorico.clave) + "," +
|
||||||
|
nameof(HPV_Terminales_ValidacionesHistorico.fechaHora) + "," +
|
||||||
|
nameof(HPV_Terminales_ValidacionesHistorico.idTerminal) + "," +
|
||||||
|
nameof(HPV_Terminales_ValidacionesHistorico.MAC) +
|
||||||
|
" FROM " + nameof(HPV_Terminales_ValidacionesHistorico);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,958 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Sincronizacion;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_Formularios;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_HotelPuntoVenta._1_Datos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.Controladoras
|
||||||
|
{
|
||||||
|
public class P_CamareroPerfil_Controladora
|
||||||
|
{
|
||||||
|
#region Variables Generales
|
||||||
|
private P_CamareroPerfil g_frm_P_CamareroPerfil; //Variable que enlaza con la pantalla
|
||||||
|
private PE_Esperando g_frm_PE_Esperando;//Pantalla de espera, para cuando se ejecuten tareas pesadas como cargar,guardar,etc
|
||||||
|
|
||||||
|
//Clases de Negocio necesarias
|
||||||
|
private HPV_CamarerosPerfiles_Datos g_obj_HPV_CamarerosPerfiles_Datos = new HPV_CamarerosPerfiles_Datos();
|
||||||
|
private HPV_CamarerosPerfiles_Permisos_Datos g_obj_HPV_CamarerosPerfiles_Permisos_Datos = new HPV_CamarerosPerfiles_Permisos_Datos();
|
||||||
|
|
||||||
|
//Modelos necesarios
|
||||||
|
private HPV_CamarerosPerfiles g_mdl_HPV_CamarerosPerfiles = null;
|
||||||
|
private List<INTERNO_IDCodigoDescripcion_Modelo> g_lst_INTERNO_IDCodigoDescripcion_Modelo_PERMISOS = null;
|
||||||
|
public string g_str_ValorCelda_CONPERMISO = "V";
|
||||||
|
public string g_str_ValorCelda_SINPERMISO = "X";
|
||||||
|
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_CargarDatosIniciales;
|
||||||
|
|
||||||
|
//Tarea Asincrona de carga de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_CargarDatos;
|
||||||
|
public bool g_bol_Termino_CargaDatos_Inicial = true;
|
||||||
|
|
||||||
|
//Tareea Asincrona de grabar de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_GrabarDatos;
|
||||||
|
public bool g_bol_GrabarDatos_TerminoCorrectamente = false;
|
||||||
|
private bool g_bol_GrabarDatos_VolverListado = true;
|
||||||
|
|
||||||
|
//Tareea Asincrona de borrar de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_BorrarDatos;
|
||||||
|
private bool g_bol_BorrarDatos_VolverListado = true;
|
||||||
|
|
||||||
|
public bool g_bol_CampoCodigo_Numerico = false;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
public P_CamareroPerfil_Controladora(P_CamareroPerfil _frm_P_CamareroPerfil)
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil = _frm_P_CamareroPerfil;
|
||||||
|
|
||||||
|
//RELLENAR PERMISOS
|
||||||
|
g_lst_INTERNO_IDCodigoDescripcion_Modelo_PERMISOS = new List<INTERNO_IDCodigoDescripcion_Modelo>();
|
||||||
|
g_lst_INTERNO_IDCodigoDescripcion_Modelo_PERMISOS.Add(new INTERNO_IDCodigoDescripcion_Modelo(Variables.G_LNG_CAMAREROPERMISO_MODIFICARPRECIO, Variables.G_LNG_CAMAREROPERMISO_MODIFICARPRECIO.ToString(), Variables.G_STR_CAMAREROPERMISO_MODIFICARPRECIO));
|
||||||
|
g_lst_INTERNO_IDCodigoDescripcion_Modelo_PERMISOS.Add(new INTERNO_IDCodigoDescripcion_Modelo(Variables.G_LNG_CAMAREROPERMISO_MODIFICARDESCUENTO, Variables.G_LNG_CAMAREROPERMISO_MODIFICARDESCUENTO.ToString(), Variables.G_STR_CAMAREROPERMISO_MODIFICARDESCUENTO));
|
||||||
|
g_lst_INTERNO_IDCodigoDescripcion_Modelo_PERMISOS.Add(new INTERNO_IDCodigoDescripcion_Modelo(Variables.G_LNG_CAMAREROPERMISO_LIQUIDACIONCIEGA, Variables.G_LNG_CAMAREROPERMISO_LIQUIDACIONCIEGA.ToString(), Variables.G_STR_CAMAREROPERMISO_LIQUIDACIONCIEGA));
|
||||||
|
g_lst_INTERNO_IDCodigoDescripcion_Modelo_PERMISOS.Add(new INTERNO_IDCodigoDescripcion_Modelo(Variables.G_LNG_CAMAREROPERMISO_INVITARTICKET, Variables.G_LNG_CAMAREROPERMISO_INVITARTICKET.ToString(), Variables.G_STR_CAMAREROPERMISO_INVITARTICKET));
|
||||||
|
g_lst_INTERNO_IDCodigoDescripcion_Modelo_PERMISOS.Add(new INTERNO_IDCodigoDescripcion_Modelo(Variables.G_LNG_CAMAREROPERMISO_INVITARTICKETLINEA, Variables.G_LNG_CAMAREROPERMISO_INVITARTICKETLINEA.ToString(), Variables.G_STR_CAMAREROPERMISO_INVITARTICKETLINEA));
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cargar Datos Iniciales
|
||||||
|
public void CargarDatos_Iniciales(bool _bol_CargarValores)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Mostrar la pantalla de espera
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando();
|
||||||
|
|
||||||
|
//Bloquear el formulario para que no se pueda hacer nada hasta que termine
|
||||||
|
g_frm_P_CamareroPerfil.Enabled = false;
|
||||||
|
// Si la tarea asincrona esta en marcha la paro
|
||||||
|
if (g_obj_TareaAsincrona_CargarDatosIniciales != null)
|
||||||
|
{
|
||||||
|
while (g_obj_TareaAsincrona_CargarDatosIniciales.IsBusy)
|
||||||
|
Application.DoEvents();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_obj_TareaAsincrona_CargarDatosIniciales = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_CargarDatosIniciales.DoWork += new DoWorkEventHandler(TareaAsincrona_CargarDatosIniciales_DoWork);
|
||||||
|
g_obj_TareaAsincrona_CargarDatosIniciales.ProgressChanged += new ProgressChangedEventHandler(TareaAsincrona_CargarDatosIniciales_ProgressChanged);
|
||||||
|
g_obj_TareaAsincrona_CargarDatosIniciales.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_CargarDatosIniciales_Completed);
|
||||||
|
g_obj_TareaAsincrona_CargarDatosIniciales.WorkerReportsProgress = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//(Tarea Asincrona) Cargar Datos ##################################################################
|
||||||
|
g_obj_TareaAsincrona_CargarDatosIniciales.RunWorkerAsync(_bol_CargarValores);
|
||||||
|
//#################################################################################################
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.Enabled = true;
|
||||||
|
|
||||||
|
if (!g_frm_PE_Esperando.IsDisposed)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Control_Errores("", ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(CargarDatos_Iniciales), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TareaAsincrona_CargarDatosIniciales_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Argumentos
|
||||||
|
bool bol_CargarValores=(bool)e.Argument;
|
||||||
|
|
||||||
|
foreach (INTERNO_IDCodigoDescripcion_Modelo mdl_INTERNO_IDCodigoDescripcion_Modelo in g_lst_INTERNO_IDCodigoDescripcion_Modelo_PERMISOS)
|
||||||
|
{
|
||||||
|
//Se Cancelo la tarea asincrona #########################
|
||||||
|
if (((BackgroundWorker)sender).CancellationPending)
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
((BackgroundWorker)sender).ReportProgress(1, Transformar_Modelo_A_Row(mdl_INTERNO_IDCodigoDescripcion_Modelo, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto= bol_CargarValores;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_CargarDatosIniciales_DoWork));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_CargarDatosIniciales_DoWork));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_CargarDatosIniciales_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.Exferia_DataGridView_Permisos.Rows.Add((DataGridViewRow)e.UserState);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_CargarDatosIniciales_ProgressChanged));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_CargarDatosIniciales_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Desbloquear el Formulario
|
||||||
|
g_frm_P_CamareroPerfil.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
g_frm_P_CamareroPerfil.Salir_P_Base();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (((bool)mdl_ValorDevuelto_Modelo_Resultado.Objeto))
|
||||||
|
{
|
||||||
|
RecargarDatos();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_CargarDatosIniciales_Completed));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA());
|
||||||
|
|
||||||
|
g_frm_P_CamareroPerfil.Salir_P_Base();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DataGridViewRow Transformar_Modelo_A_Row(INTERNO_IDCodigoDescripcion_Modelo _mdl_INTERNO_IDCodigoDescripcion_Modelo, bool _bol_TienePermiso)
|
||||||
|
{
|
||||||
|
DataGridViewRow obj_DataGridViewRow = (DataGridViewRow)g_frm_P_CamareroPerfil.Exferia_DataGridView_Permisos.RowTemplate.Clone();
|
||||||
|
obj_DataGridViewRow.CreateCells(g_frm_P_CamareroPerfil.Exferia_DataGridView_Permisos);
|
||||||
|
|
||||||
|
// Rellenamos las celdas de la fila
|
||||||
|
//id
|
||||||
|
obj_DataGridViewRow.Cells[0].Value = _mdl_INTERNO_IDCodigoDescripcion_Modelo.Id;
|
||||||
|
|
||||||
|
//descripcion
|
||||||
|
obj_DataGridViewRow.Cells[1].Value = _mdl_INTERNO_IDCodigoDescripcion_Modelo.Descripcion;
|
||||||
|
|
||||||
|
//permiso
|
||||||
|
if (_bol_TienePermiso)
|
||||||
|
{
|
||||||
|
obj_DataGridViewRow.Cells[2].Value = g_str_ValorCelda_CONPERMISO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obj_DataGridViewRow.Cells[2].Value = g_str_ValorCelda_SINPERMISO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj_DataGridViewRow;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Buscar Codigo Siguiente
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Buscar_CodigoSiguiente()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_CodigoSiguiente = Datos_Generales.Buscar_CodigoSiguiente(nameof(HPV_CamarerosPerfiles),
|
||||||
|
nameof(HPV_CamarerosPerfiles.codigo),
|
||||||
|
"",
|
||||||
|
-1,
|
||||||
|
true,
|
||||||
|
g_frm_P_CamareroPerfil.Exferia_TextBox_Codigo.Exferia_TextBox_MaxLength);
|
||||||
|
|
||||||
|
if (!str_CodigoSiguiente.Equals("-1"))
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.Exferia_TextBox_Codigo.Text = str_CodigoSiguiente;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_CODIGOSIGUIENTE_LIMITEALCANZADO(g_frm_P_CamareroPerfil.Exferia_Label_Codigo.Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BUSCARCODIGOSIGUIENTE();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(Buscar_CodigoSiguiente));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BUSCARCODIGOSIGUIENTE();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Comprobar Cambios
|
||||||
|
public bool ComprobarCambios()
|
||||||
|
{
|
||||||
|
if (g_frm_P_CamareroPerfil.P_Base_SeModificoDatosPantalla)
|
||||||
|
{
|
||||||
|
if (Mensajes.MostrarMensaje_Pregunta(Mensajes.G_STR_MENSAJES_GENERAL_PREGUNTA_GUARDARCAMBIOS()))
|
||||||
|
{
|
||||||
|
GrabarDatos(false);
|
||||||
|
|
||||||
|
//Te quedas espernado a que termine la tarea asincrona de grabar
|
||||||
|
while (g_obj_TareaAsincrona_GrabarDatos.IsBusy)
|
||||||
|
Application.DoEvents();
|
||||||
|
|
||||||
|
return g_bol_GrabarDatos_TerminoCorrectamente;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Varciar Datos
|
||||||
|
public void VaciarDatos()
|
||||||
|
{
|
||||||
|
//Modelo
|
||||||
|
g_mdl_HPV_CamarerosPerfiles = null;
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
g_frm_P_CamareroPerfil.Exferia_TextBox_Codigo.Text = "";
|
||||||
|
//Descripcion
|
||||||
|
g_frm_P_CamareroPerfil.Exferia_TextBox_Descripcion.Text = "";
|
||||||
|
|
||||||
|
//poner todas las row como 'Sin permiso'
|
||||||
|
g_frm_P_CamareroPerfil.Exferia_DataGridView_Permisos.Rows.Cast<DataGridViewRow>().ToList().ForEach(m=>m.Cells[2].Value=g_str_ValorCelda_SINPERMISO);
|
||||||
|
|
||||||
|
|
||||||
|
string[] str_Separador = new string[] { " [" };
|
||||||
|
//Si ya hay valores de objeto, los elimino para rellenarlos de nuevo
|
||||||
|
if (g_frm_P_CamareroPerfil.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None).Count() > 1)
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_TituloPantalla = (g_frm_P_CamareroPerfil.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None))[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Actualizar el Boton de Seleccion de pantalla ####################################################
|
||||||
|
Variables.G_EMS_CONTROL_MENUSUPERIOR.Update_Texto_NombrePantalla(g_frm_P_CamareroPerfil.Tag.ToString());
|
||||||
|
//#################################################################################################
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cargar Datos
|
||||||
|
public void RecargarDatos()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Si la tarea asincrona esta en marcha la paro
|
||||||
|
if (g_obj_TareaAsincrona_CargarDatos != null)
|
||||||
|
{
|
||||||
|
while (g_obj_TareaAsincrona_CargarDatos.IsBusy)
|
||||||
|
Application.DoEvents();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_obj_TareaAsincrona_CargarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_CargarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.ProgressChanged += new ProgressChangedEventHandler(TareaAsincrona_CargarDatos_ProgressChanged);
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_CargarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.WorkerReportsProgress = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_bol_Termino_CargaDatos_Inicial = false;
|
||||||
|
|
||||||
|
//Vaciar
|
||||||
|
VaciarDatos();
|
||||||
|
|
||||||
|
//(Tarea Asincrona) Cargar Datos ##################################################################
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.RunWorkerAsync();
|
||||||
|
//#################################################################################################
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores("", ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(RecargarDatos), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TareaAsincrona_CargarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Cargar Valores
|
||||||
|
if (CargarDatos(g_frm_P_CamareroPerfil.P_Base_id))
|
||||||
|
{
|
||||||
|
if (g_mdl_HPV_CamarerosPerfiles.HPV_CamarerosPerfiles_Permisos!=null &&
|
||||||
|
g_mdl_HPV_CamarerosPerfiles.HPV_CamarerosPerfiles_Permisos.Count>0)
|
||||||
|
{
|
||||||
|
foreach (HPV_CamarerosPerfiles_Permisos mdl_HPV_CamarerosPerfiles_Permisos in g_mdl_HPV_CamarerosPerfiles.HPV_CamarerosPerfiles_Permisos)
|
||||||
|
{
|
||||||
|
|
||||||
|
//Buscar el Row con el numero de linea
|
||||||
|
DataGridViewRow obj_DataGridViewRow = g_frm_P_CamareroPerfil.Exferia_DataGridView_Permisos.Rows
|
||||||
|
.Cast<DataGridViewRow>()
|
||||||
|
.Where(r => r.Cells[0].Value.ToString().Equals(mdl_HPV_CamarerosPerfiles_Permisos.permiso.ToString())).FirstOrDefault();
|
||||||
|
|
||||||
|
if (obj_DataGridViewRow != null)
|
||||||
|
{
|
||||||
|
((BackgroundWorker)sender).ReportProgress(1, obj_DataGridViewRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_DoWork));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_DoWork));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_CargarDatos_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DataGridViewRow obj_DataGridViewRow = (DataGridViewRow)e.UserState;
|
||||||
|
|
||||||
|
obj_DataGridViewRow.Cells[2].Value = g_str_ValorCelda_CONPERMISO;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_CargarDatosIniciales_ProgressChanged));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_CargarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_bol_Termino_CargaDatos_Inicial = true;
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
g_frm_P_CamareroPerfil.Salir_P_Base();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_Completed));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA());
|
||||||
|
|
||||||
|
g_frm_P_CamareroPerfil.Salir_P_Base();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Hacemos foco al primer control.
|
||||||
|
g_frm_P_CamareroPerfil.Exferia_TextBox_Codigo.Exferia_TextBox_Foco();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CargarDatos(long _lng_id)
|
||||||
|
{
|
||||||
|
bool bol_ValorDevuelto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_mdl_HPV_CamarerosPerfiles = g_obj_HPV_CamarerosPerfiles_Datos.Obtener(_lng_id);
|
||||||
|
|
||||||
|
//Si no es Nulo Cargo lo Datos
|
||||||
|
if (g_mdl_HPV_CamarerosPerfiles != null)
|
||||||
|
{
|
||||||
|
//Paginador ................................................................................
|
||||||
|
if (g_frm_P_CamareroPerfil.P_Base_PantallaOrigen != null &&
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados != null &&
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados.Count > 0)
|
||||||
|
{
|
||||||
|
long lng_id_ParaPaginacion = g_mdl_HPV_CamarerosPerfiles.id;
|
||||||
|
int int_PaginaDelObjeto = g_frm_P_CamareroPerfil.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados.IndexOf(g_frm_P_CamareroPerfil.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados.Where(n => n.ID.Equals(lng_id_ParaPaginacion)).FirstOrDefault());
|
||||||
|
|
||||||
|
g_frm_P_CamareroPerfil.g_obj_Funciones_Paginador.SetPaginaActual(int_PaginaDelObjeto);
|
||||||
|
// Asignando al paginador la pagina actual.
|
||||||
|
g_frm_P_CamareroPerfil.Exferia_Paginador_CamareroPerfil.PaginaActual = g_frm_P_CamareroPerfil.g_obj_Funciones_Paginador.GetPaginaActual();
|
||||||
|
}
|
||||||
|
//...........................................................................................
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
g_frm_P_CamareroPerfil.Exferia_TextBox_Codigo.Text = g_mdl_HPV_CamarerosPerfiles.codigo;
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
g_frm_P_CamareroPerfil.Exferia_TextBox_Descripcion.Text = g_mdl_HPV_CamarerosPerfiles.descripcion;
|
||||||
|
|
||||||
|
}
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
bol_ValorDevuelto = false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(CargarDatos));
|
||||||
|
bol_ValorDevuelto = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bol_ValorDevuelto;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar Datos
|
||||||
|
public void GrabarDatos(bool _bol_VolverAlListado)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_bol_GrabarDatos_VolverListado = _bol_VolverAlListado;
|
||||||
|
g_bol_GrabarDatos_TerminoCorrectamente = true;
|
||||||
|
|
||||||
|
g_frm_P_CamareroPerfil.Enabled = false;
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando(Mensajes.G_STR_ESPERANDO_GRABANDODATOS());
|
||||||
|
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_GrabarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_GrabarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.RunWorkerAsync();
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
g_bol_GrabarDatos_TerminoCorrectamente = false;
|
||||||
|
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_CamareroPerfil.Enabled = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(GrabarDatos));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TareaAsincrona_GrabarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Validar primero
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_VALIDACION = ValidarDatos();
|
||||||
|
if (mdl_ValorDevuelto_Modelo_VALIDACION.TodoCorrecto)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = GrabarDatos_Final();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = mdl_ValorDevuelto_Modelo_VALIDACION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_GrabarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_CamareroPerfil.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Mensaje.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
|
||||||
|
//Poner el Foco en el objeto que tuvo el problema en validar
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Objeto != null)
|
||||||
|
{
|
||||||
|
Funciones.Poner_Foco_Objeto(g_frm_P_CamareroPerfil, mdl_ValorDevuelto_Modelo_Resultado.Objeto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_bol_GrabarDatos_TerminoCorrectamente = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Ver si se modifico algun otro registro, por cambiar el campo por defecto
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Listado_Id != null && mdl_ValorDevuelto_Modelo_Resultado.Listado_Id.Count > 0)
|
||||||
|
{
|
||||||
|
// Devolver al Listado el Row Añadido/Modificado
|
||||||
|
if (g_frm_P_CamareroPerfil.P_Base_PantallaOrigen != null)
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_PantallaOrigen.P_Base_RecargarListado();
|
||||||
|
}
|
||||||
|
else if (g_frm_P_CamareroPerfil.P_Base_F3Origen != null)
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_F3Origen.Exferia_F3_ActualizarRegistro(mdl_ValorDevuelto_Modelo_Resultado.Id, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Devolver al Listado el Row Añadido/Modificado ............................................
|
||||||
|
if (g_frm_P_CamareroPerfil.P_Base_PantallaOrigen != null)
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_PantallaOrigen.P_Base_ActualizarRegistro(mdl_ValorDevuelto_Modelo_Resultado.Id, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
else if (g_frm_P_CamareroPerfil.P_Base_F3Origen != null)
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_F3Origen.Exferia_F3_ActualizarRegistro(mdl_ValorDevuelto_Modelo_Resultado.Id, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
//............................................................................................
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_bol_GrabarDatos_VolverListado)
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
g_frm_P_CamareroPerfil.Salir_P_Base();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_Completed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public INTERNO_ValorDevuelto_Modelo ValidarDatos()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Si el codigo esta vacio y se intenta buscar el ultimo numerico y llego al limite de base de datos
|
||||||
|
if (g_frm_P_CamareroPerfil.Exferia_TextBox_Codigo.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = Buscar_CodigoSiguiente();
|
||||||
|
|
||||||
|
if (mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = mdl_INTERNO_ValorDevuelto_Modelo.Mensaje;
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = g_frm_P_CamareroPerfil.Exferia_TextBox_Codigo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// El codigo no puede estar Repetido
|
||||||
|
if (mdl_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
string str_Codigo = g_frm_P_CamareroPerfil.Exferia_TextBox_Codigo.Text.Trim();
|
||||||
|
if (g_bol_CampoCodigo_Numerico)
|
||||||
|
{
|
||||||
|
int int_Codigo = int.Parse(str_Codigo);
|
||||||
|
str_Codigo = int_Codigo.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Datos_Generales.Buscar_CodigoRepetido(nameof(HPV_CamarerosPerfiles), nameof(HPV_CamarerosPerfiles.codigo), str_Codigo, nameof(HPV_CamarerosPerfiles.id), (g_mdl_HPV_CamarerosPerfiles != null ? g_mdl_HPV_CamarerosPerfiles.id : -1), "", -1, true))
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_REPETIDO(g_frm_P_CamareroPerfil.Exferia_Label_Codigo.Text);
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = g_frm_P_CamareroPerfil.Exferia_TextBox_Codigo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// La descripcion no puede estar vacia
|
||||||
|
if (mdl_ValorDevuelto_Modelo.TodoCorrecto && g_frm_P_CamareroPerfil.Exferia_TextBox_Descripcion.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_VACIO(g_frm_P_CamareroPerfil.Exferia_Label_Descripcion.Text);
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = g_frm_P_CamareroPerfil.Exferia_TextBox_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_VALIDARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(ValidarDatos));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_VALIDARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private INTERNO_ValorDevuelto_Modelo GrabarDatos_Final()
|
||||||
|
{
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
|
||||||
|
//Iniciar transaccion
|
||||||
|
using (TransactionScope transaccion_SQL = new TransactionScope(TransactionScopeOption.Required))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
long lng_idCamareroperfil = -1;
|
||||||
|
|
||||||
|
HPV_CamarerosPerfiles mdl_HPV_CamarerosPerfiles = new HPV_CamarerosPerfiles();
|
||||||
|
mdl_HPV_CamarerosPerfiles.id = g_mdl_HPV_CamarerosPerfiles != null ? g_mdl_HPV_CamarerosPerfiles.id : -1;
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
mdl_HPV_CamarerosPerfiles.codigo = g_frm_P_CamareroPerfil.Exferia_TextBox_Codigo.Text;
|
||||||
|
|
||||||
|
//Descripcion
|
||||||
|
mdl_HPV_CamarerosPerfiles.descripcion = g_frm_P_CamareroPerfil.Exferia_TextBox_Descripcion.Text;
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo = g_obj_HPV_CamarerosPerfiles_Datos.Grabar(mdl_HPV_CamarerosPerfiles);
|
||||||
|
|
||||||
|
if (mdl_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
lng_idCamareroperfil = mdl_ValorDevuelto_Modelo.Id;
|
||||||
|
|
||||||
|
//Obtener los Permisos seleccionados
|
||||||
|
List<long> lst_Permisos = g_frm_P_CamareroPerfil.Exferia_DataGridView_Permisos.Rows
|
||||||
|
.Cast<DataGridViewRow>()
|
||||||
|
.Where(r => r.Cells[2].Value.ToString().Equals(g_str_ValorCelda_CONPERMISO))
|
||||||
|
.Select(r=>long.Parse(r.Cells[0].Value.ToString())).ToList();
|
||||||
|
|
||||||
|
//Borrar todos los permisos que no esten pra insertar
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_PERMISOS =g_obj_HPV_CamarerosPerfiles_Permisos_Datos.Grabar(lng_idCamareroperfil, lst_Permisos);
|
||||||
|
if (mdl_ValorDevuelto_Modelo_PERMISOS.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = mdl_ValorDevuelto_Modelo_PERMISOS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
transaccion_SQL.Complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
|
||||||
|
//Si todo esta Correcto recargo datos
|
||||||
|
if (mdl_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
//Obtener el modelo que se acaba de grabar
|
||||||
|
g_mdl_HPV_CamarerosPerfiles = g_obj_HPV_CamarerosPerfiles_Datos.Obtener(lng_idCamareroperfil);
|
||||||
|
|
||||||
|
#region SINCRONIZACION PARA TERMINALES
|
||||||
|
Sincronizar_Registros obj_Sincronizar_Registros = new Sincronizar_Registros();
|
||||||
|
|
||||||
|
//HPV_CamarerosPerfiles
|
||||||
|
obj_Sincronizar_Registros.Sincronizar_Actualizar(new Sincronizar_Actualizar_Modelo(g_mdl_HPV_CamarerosPerfiles,
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_ValoresGenerales.lng_idEmpresa,
|
||||||
|
nameof(HPV_CamarerosPerfiles)));
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(GrabarDatos_Final));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar Datos
|
||||||
|
public void BorrarDatos(bool _bol_VolverAlListado)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Preguntar si esta Seguro de Borrar
|
||||||
|
if (Mensajes.MostrarMensaje_Pregunta(Mensajes.G_STR_MENSAJES_GENERAL_PREGUNTA_BORRAR()))
|
||||||
|
{
|
||||||
|
g_bol_BorrarDatos_VolverListado = _bol_VolverAlListado;
|
||||||
|
g_frm_P_CamareroPerfil.Enabled = false;
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando(Mensajes.G_STR_ESPERANDO_BORRANDODATOS());
|
||||||
|
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_BorrarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_BorrarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.RunWorkerAsync();
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_frm_P_CamareroPerfil.Enabled = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(BorrarDatos));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TareaAsincrona_BorrarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = BorrarDatos_Final();
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_BorrarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_CamareroPerfil.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Mensaje.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Devolver al Listado el Row Borrar
|
||||||
|
if (g_frm_P_CamareroPerfil.P_Base_PantallaOrigen != null)
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_PantallaOrigen.P_Base_ActualizarRegistro(mdl_ValorDevuelto_Modelo_Resultado.Id, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
else if (g_frm_P_CamareroPerfil.P_Base_F3Origen != null)
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_F3Origen.Exferia_F3_ActualizarRegistro(mdl_ValorDevuelto_Modelo_Resultado.Id, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_bol_BorrarDatos_VolverListado)
|
||||||
|
{
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
g_frm_P_CamareroPerfil.Salir_P_Base();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_Completed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private INTERNO_ValorDevuelto_Modelo BorrarDatos_Final()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo = g_obj_HPV_CamarerosPerfiles_Datos.Borrar(g_mdl_HPV_CamarerosPerfiles != null ? g_mdl_HPV_CamarerosPerfiles.id : -1);
|
||||||
|
|
||||||
|
if (mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
#region SINCRONIZACION PARA TERMINALES
|
||||||
|
Sincronizar_Registros obj_Sincronizar_Registros = new Sincronizar_Registros();
|
||||||
|
|
||||||
|
//HPV_CamarerosPerfiles
|
||||||
|
obj_Sincronizar_Registros.Sincronizar_Borrar(new Sincronizar_Borrar_Modelo(g_mdl_HPV_CamarerosPerfiles.id.ToString(),
|
||||||
|
g_frm_P_CamareroPerfil.P_Base_ValoresGenerales.lng_idEmpresa,
|
||||||
|
nameof(HPV_CamarerosPerfiles)));
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_CamareroPerfil_Controladora) + "/" + nameof(BorrarDatos_Final));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,902 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Sincronizacion;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_Formularios;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_HotelPuntoVenta._1_Datos;
|
||||||
|
using Exferia_HotelPuntoVenta.General;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.Controladoras
|
||||||
|
{
|
||||||
|
public class P_Impresora_Controladora
|
||||||
|
{
|
||||||
|
#region Variables GEnerales
|
||||||
|
private P_Impresora g_frm_P_Impresora;//Variable que enlaza con la pantalla asociada
|
||||||
|
private PE_Esperando g_frm_PE_Esperando;//Pantalla de Espera, para cuando se ejecutan tareas pesadas como cargar, guardar, etc
|
||||||
|
|
||||||
|
//Clases de Datos Necesarias para la carga de datos
|
||||||
|
private HPV_Impresoras_Datos g_obj_HPV_Impresoras_Datos = new HPV_Impresoras_Datos();
|
||||||
|
|
||||||
|
//Modelos necesarios
|
||||||
|
private HPV_Impresoras g_mdl_HPV_Impresoras = null;
|
||||||
|
|
||||||
|
public bool g_bol_Termino_CargaDatos_Inicial = false;//Se utiliza para saber cuando se termina la carga de datos estaticos inciales
|
||||||
|
|
||||||
|
#region Tareas Asincronas
|
||||||
|
//Tareea Asincrona de carga de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_CargarDatos;
|
||||||
|
|
||||||
|
//Tareea Asincrona de grabar de datos
|
||||||
|
public BackgroundWorker g_obj_TareaAsincrona_GrabarDatos;
|
||||||
|
private bool g_bol_GrabarDatos_TerminoCorrectamente = true;
|
||||||
|
|
||||||
|
//Tareea Asincrona de borrar de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_BorrarDatos;
|
||||||
|
|
||||||
|
public bool g_bol_CampoCodigo_Numerico = false;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
public P_Impresora_Controladora(P_Impresora _frm_P_Impresora)
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora = _frm_P_Impresora;
|
||||||
|
|
||||||
|
g_bol_Termino_CargaDatos_Inicial = true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Vaciar Datos
|
||||||
|
public void VaciarDatos()
|
||||||
|
{
|
||||||
|
//Modelo
|
||||||
|
g_mdl_HPV_Impresoras = null;
|
||||||
|
|
||||||
|
//codigo
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Codigo.Text = "";
|
||||||
|
|
||||||
|
//descripcion
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Descripcion.Text = "";
|
||||||
|
|
||||||
|
//Papel_Ancho
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Papel_Ancho.Text = "0";
|
||||||
|
//Papel_Alto
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Papel_Alto.Text = "0";
|
||||||
|
|
||||||
|
//Logo_Ancho
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Logo_Ancho.Text = "0";
|
||||||
|
//Logo_Alto
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Logo_Alto.Text = "0";
|
||||||
|
|
||||||
|
//Tipo_Ticket
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Ticket.Checked = false;
|
||||||
|
|
||||||
|
//Tipo_Comanda
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Comanda.Checked = false;
|
||||||
|
|
||||||
|
//Liquidacion
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Liquidacion.Checked = false;
|
||||||
|
|
||||||
|
//Gastos
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Gastos.Checked = false;
|
||||||
|
|
||||||
|
//Logo_Mostrar
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Logo_Mostrar.Checked = false;
|
||||||
|
|
||||||
|
string[] str_Separador = new string[] { " [" };
|
||||||
|
//Si ya hay valores de objeto, los elimino para rellenarlos de nuevo
|
||||||
|
if (g_frm_P_Impresora.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None).Count() > 1)
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.P_Base_TituloPantalla = (g_frm_P_Impresora.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None))[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Actualizar el Boton de Seleccion de pantalla ####################################################
|
||||||
|
Variables.G_EMS_CONTROL_MENUSUPERIOR.Update_Texto_NombrePantalla(g_frm_P_Impresora.Tag.ToString());
|
||||||
|
//#################################################################################################
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Comprobacion de cambios, para grabar o no antes de salir o cambiar de registro
|
||||||
|
public bool ComprobarCambios()
|
||||||
|
{
|
||||||
|
if (g_frm_P_Impresora.P_Base_SeModificoDatosPantalla)
|
||||||
|
{
|
||||||
|
if (Mensajes.MostrarMensaje_Pregunta(Mensajes.G_STR_MENSAJES_GENERAL_PREGUNTA_GUARDARCAMBIOS()))
|
||||||
|
{
|
||||||
|
GrabarDatos();
|
||||||
|
|
||||||
|
//Te quedas espernado a que termine la tarea asincrona de grabar
|
||||||
|
while (g_obj_TareaAsincrona_GrabarDatos.IsBusy)
|
||||||
|
Application.DoEvents();
|
||||||
|
|
||||||
|
return g_bol_GrabarDatos_TerminoCorrectamente;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Buscar Codigo Siguiente
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Buscar_CodigoSiguiente()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_CodigoSiguiente = Datos_Generales.Buscar_CodigoSiguiente(nameof(HPV_Impresoras),
|
||||||
|
nameof(HPV_Impresoras.codigo),
|
||||||
|
nameof(HPV_Impresoras.idEmpresa),
|
||||||
|
g_mdl_HPV_Impresoras != null ? g_mdl_HPV_Impresoras.idEmpresa : Datos_Generales.GEN_Empresas_Devolver_IdEmpresa_AGrabar(g_frm_P_Impresora.P_Base_ValoresGenerales.lng_idEmpresa, nameof(HPV_Impresoras)),
|
||||||
|
true,
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Codigo.Exferia_TextBox_MaxLength);
|
||||||
|
|
||||||
|
if (!str_CodigoSiguiente.Equals("-1"))
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Codigo.Text = str_CodigoSiguiente;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_CODIGOSIGUIENTE_LIMITEALCANZADO(g_frm_P_Impresora.Exferia_Label_Codigo.Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BUSCARCODIGOSIGUIENTE();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(Buscar_CodigoSiguiente));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BUSCARCODIGOSIGUIENTE();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cargar Datos
|
||||||
|
public void RecargarDatos()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Bloquear el formulario para que no se pueda hacer nada hasta que termine
|
||||||
|
g_frm_P_Impresora.Enabled = false;
|
||||||
|
|
||||||
|
//Mostrar la pantalla de espera
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando();
|
||||||
|
|
||||||
|
// Si la tarea asincrona esta en marcha la paro
|
||||||
|
if (g_obj_TareaAsincrona_CargarDatos != null)
|
||||||
|
{
|
||||||
|
while (g_obj_TareaAsincrona_CargarDatos.IsBusy)
|
||||||
|
Application.DoEvents();
|
||||||
|
|
||||||
|
//Vaciar
|
||||||
|
VaciarDatos();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_obj_TareaAsincrona_CargarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_CargarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_CargarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.WorkerReportsProgress = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Vaciar
|
||||||
|
VaciarDatos();
|
||||||
|
|
||||||
|
//(Tarea Asincrona) Cargar Datos ##################################################################
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.RunWorkerAsync();
|
||||||
|
//#################################################################################################
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.Enabled = true;
|
||||||
|
g_bol_Termino_CargaDatos_Inicial = true;
|
||||||
|
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Control_Errores(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA(), ex, nameof(P_Impresora_Controladora) + "/" + nameof(RecargarDatos), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_CargarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Cargar Valores
|
||||||
|
if (CargarDatos(g_frm_P_Impresora.P_Base_id) == false)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_DoWork));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_DoWork));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_CargarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
//Desbloquear el Formulario
|
||||||
|
g_frm_P_Impresora.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
g_frm_P_Impresora.Salir_P_Base();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_Completed));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA());
|
||||||
|
|
||||||
|
g_frm_P_Impresora.Salir_P_Base();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
|
||||||
|
//Hacemos foco al primer control.
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Codigo.Exferia_TextBox_Foco();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool CargarDatos(long _lng_id)
|
||||||
|
{
|
||||||
|
bool bol_ValorDevuelto = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_mdl_HPV_Impresoras = g_obj_HPV_Impresoras_Datos.Obtener(_lng_id);
|
||||||
|
|
||||||
|
//Si no es Nulo Cargo lo Datos
|
||||||
|
if (g_mdl_HPV_Impresoras != null)
|
||||||
|
{
|
||||||
|
//Paginador ................................................................................
|
||||||
|
if (g_frm_P_Impresora.P_Base_PantallaOrigen != null &&
|
||||||
|
g_frm_P_Impresora.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados != null &&
|
||||||
|
g_frm_P_Impresora.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados.Count > 0)
|
||||||
|
{
|
||||||
|
long lng_id_ParaPaginacion = g_mdl_HPV_Impresoras.id;
|
||||||
|
int int_PaginaDelObjeto = g_frm_P_Impresora.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados.IndexOf(g_frm_P_Impresora.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados.Where(n => n.ID.Equals(lng_id_ParaPaginacion)).FirstOrDefault());
|
||||||
|
|
||||||
|
g_frm_P_Impresora.g_obj_Funciones_Paginador.SetPaginaActual(int_PaginaDelObjeto);
|
||||||
|
// Asignando al paginador la pagina actual.
|
||||||
|
g_frm_P_Impresora.Exferia_Paginador_Impresoras.PaginaActual = g_frm_P_Impresora.g_obj_Funciones_Paginador.GetPaginaActual();
|
||||||
|
}
|
||||||
|
//...........................................................................................
|
||||||
|
|
||||||
|
//codigo
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Codigo.Text = g_mdl_HPV_Impresoras.codigo;
|
||||||
|
|
||||||
|
//descripcion
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Descripcion.Text = g_mdl_HPV_Impresoras.descripcion;
|
||||||
|
|
||||||
|
//tipo
|
||||||
|
if (g_mdl_HPV_Impresoras.tipo.Equals(Variables_HotelPuntoVenta.G_INT_IMPRESORA_TIPO_COMANDA))
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Ticket.Checked = false;
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Comanda.Checked = true;
|
||||||
|
}
|
||||||
|
else if (g_mdl_HPV_Impresoras.tipo.Equals(Variables_HotelPuntoVenta.G_INT_IMPRESORA_TIPO_TICKET))
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Ticket.Checked = true;
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Comanda.Checked = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Ticket.Checked = true;
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Comanda.Checked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//tipoLiquidacion
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Liquidacion.Checked = g_mdl_HPV_Impresoras.tipoLiquidacion != null ? g_mdl_HPV_Impresoras.tipoLiquidacion.Value : false;
|
||||||
|
|
||||||
|
//tipoGastos
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Gastos.Checked = g_mdl_HPV_Impresoras.tipoGastos != null ? g_mdl_HPV_Impresoras.tipoGastos.Value : false;
|
||||||
|
|
||||||
|
//papel_Ancho
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Papel_Ancho.Text = g_mdl_HPV_Impresoras.papel_Ancho.ToString();
|
||||||
|
//papel_Alto
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Papel_Alto.Text = g_mdl_HPV_Impresoras.papel_Alto.ToString();
|
||||||
|
|
||||||
|
if (g_mdl_HPV_Impresoras.logo)
|
||||||
|
{
|
||||||
|
//logo
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Logo_Mostrar.Checked = true;
|
||||||
|
//logo_Ancho
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Logo_Ancho.Text = g_mdl_HPV_Impresoras.logo_Ancho.ToString();
|
||||||
|
//logo_Alto
|
||||||
|
g_frm_P_Impresora.Exferia_TextBox_Logo_Alto.Text = g_mdl_HPV_Impresoras.logo_Alto.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Mostrar Campo en el Titulo de mantenimiento
|
||||||
|
string str_MenuSuperior_ADD = "";
|
||||||
|
if (g_frm_P_Impresora.g_mdl_PRV_OpcionesDetalle != null &&
|
||||||
|
g_frm_P_Impresora.g_mdl_PRV_OpcionesDetalle.camposMostrar_TituloMantenimiento != null &&
|
||||||
|
g_frm_P_Impresora.g_mdl_PRV_OpcionesDetalle.camposMostrar_TituloMantenimiento.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
//Obtener el Array de Campos
|
||||||
|
string[] arr_Campos = g_frm_P_Impresora.g_mdl_PRV_OpcionesDetalle.camposMostrar_TituloMantenimiento.Split(new Char[] { ',' });
|
||||||
|
string str_ValorAMostrarFinal = "";
|
||||||
|
|
||||||
|
string[] str_Separador = new string[] { " [" };
|
||||||
|
//Si ya hay valores de objeto, los elimino para rellenarlos de nuevo
|
||||||
|
if (g_frm_P_Impresora.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None).Count() > 1)
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.P_Base_TituloPantalla = (g_frm_P_Impresora.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None))[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic dnm_Objeto = g_mdl_HPV_Impresoras;
|
||||||
|
foreach (string str_campo in arr_Campos)
|
||||||
|
{
|
||||||
|
var Valor = dnm_Objeto.GetType().GetProperty(str_campo).GetValue(dnm_Objeto, null);
|
||||||
|
if (Valor != null)
|
||||||
|
{
|
||||||
|
str_ValorAMostrarFinal += " " + Valor;
|
||||||
|
}
|
||||||
|
|
||||||
|
// codigo
|
||||||
|
if (str_campo.Equals(nameof(g_mdl_HPV_Impresoras.codigo)))
|
||||||
|
{
|
||||||
|
str_MenuSuperior_ADD += g_mdl_HPV_Impresoras.codigo;
|
||||||
|
}
|
||||||
|
// nombre
|
||||||
|
else if (str_campo.Equals(nameof(g_mdl_HPV_Impresoras.descripcion)))
|
||||||
|
{
|
||||||
|
str_MenuSuperior_ADD += (" " + g_mdl_HPV_Impresoras.descripcion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (str_ValorAMostrarFinal != "")
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.P_Base_TituloPantalla += " [" + str_ValorAMostrarFinal + "] -Modificar";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Actualizar el Boton de Seleccion de pantalla ####################################################
|
||||||
|
Variables.G_EMS_CONTROL_MENUSUPERIOR.Add_Texto_NombrePantalla_Descripciones(g_frm_P_Impresora.Tag.ToString(), str_MenuSuperior_ADD);
|
||||||
|
//#################################################################################################
|
||||||
|
|
||||||
|
g_frm_P_Impresora.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
bol_ValorDevuelto = false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(CargarDatos));
|
||||||
|
bol_ValorDevuelto = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bol_ValorDevuelto;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar Datos
|
||||||
|
public void GrabarDatos()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_bol_GrabarDatos_TerminoCorrectamente = true;
|
||||||
|
|
||||||
|
g_frm_P_Impresora.Enabled = false;
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando(Mensajes.G_STR_ESPERANDO_GRABANDODATOS());
|
||||||
|
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_GrabarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_GrabarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.RunWorkerAsync();
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
g_bol_GrabarDatos_TerminoCorrectamente = false;
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_Impresora.Enabled = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(GrabarDatos));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_GrabarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Validar Primero
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_VALIDACION = ValidarDatos();
|
||||||
|
if (mdl_ValorDevuelto_Modelo_VALIDACION.TodoCorrecto)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = GrabarDatos_Final();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = mdl_ValorDevuelto_Modelo_VALIDACION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_GrabarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_Impresora.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Mensaje.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
|
||||||
|
//Poner el Foco en el objeto que tuvoel problema en validar
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Objeto != null)
|
||||||
|
{
|
||||||
|
Funciones.Poner_Foco_Objeto(g_frm_P_Impresora, mdl_ValorDevuelto_Modelo_Resultado.Objeto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_bol_GrabarDatos_TerminoCorrectamente = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Recargar el Listado
|
||||||
|
if (g_frm_P_Impresora.P_Base_PantallaOrigen != null)
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.P_Base_PantallaOrigen.P_Base_ActualizarRegistro(mdl_ValorDevuelto_Modelo_Resultado.Id, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
else if (g_frm_P_Impresora.P_Base_F3Origen != null)
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.P_Base_F3Origen.Exferia_F3_ActualizarRegistro(mdl_ValorDevuelto_Modelo_Resultado.Id, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_frm_P_Impresora.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
g_frm_P_Impresora.Salir_P_Base();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_Completed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public INTERNO_ValorDevuelto_Modelo ValidarDatos()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Si el codigo esta vacio y se intenta buscar el ultimo numerico y llego al limite de base de datos
|
||||||
|
if (g_frm_P_Impresora.Exferia_TextBox_Codigo.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo_BUSCARCODIGO = Buscar_CodigoSiguiente();
|
||||||
|
|
||||||
|
if (mdl_INTERNO_ValorDevuelto_Modelo_BUSCARCODIGO.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = mdl_INTERNO_ValorDevuelto_Modelo_BUSCARCODIGO.Mensaje;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = g_frm_P_Impresora.Exferia_TextBox_Codigo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// El codigo no puede estar Repetido
|
||||||
|
if (mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
string str_Codigo = g_frm_P_Impresora.Exferia_TextBox_Codigo.Text.Trim();
|
||||||
|
if (g_bol_CampoCodigo_Numerico)
|
||||||
|
{
|
||||||
|
int int_Codigo = int.Parse(str_Codigo);
|
||||||
|
str_Codigo = int_Codigo.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Datos_Generales.Buscar_CodigoRepetido(nameof(HPV_Impresoras), nameof(HPV_Impresoras.codigo), str_Codigo, nameof(HPV_Impresoras.id), (g_mdl_HPV_Impresoras != null ? g_mdl_HPV_Impresoras.id : -1), nameof(HPV_Impresoras.idEmpresa), g_frm_P_Impresora.P_Base_ValoresGenerales.lng_idEmpresa, true))
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_REPETIDO(g_frm_P_Impresora.Exferia_Label_Codigo.Text);
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = g_frm_P_Impresora.Exferia_TextBox_Codigo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// La descripcion no puede estar vacía
|
||||||
|
if ((mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto) && (g_frm_P_Impresora.Exferia_TextBox_Descripcion.Text.Trim().Length == 0))
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_VACIO(g_frm_P_Impresora.Exferia_Label_Descripcion.Text);
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = g_frm_P_Impresora.Exferia_TextBox_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// El ancho del papel no puede estar vacío
|
||||||
|
if ((mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto) && (g_frm_P_Impresora.Exferia_TextBox_Papel_Ancho.Text.Trim().Length == 0))
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_VACIO(g_frm_P_Impresora.Exferia_Label_Papel_Ancho.Text);
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = g_frm_P_Impresora.Exferia_TextBox_Papel_Ancho;
|
||||||
|
}
|
||||||
|
|
||||||
|
// El alto del papel no puede estar vacía
|
||||||
|
if ((mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto) && (g_frm_P_Impresora.Exferia_TextBox_Papel_Alto.Text.Trim().Length == 0))
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_VACIO(g_frm_P_Impresora.Exferia_Label_Papel_Alto.Text);
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = g_frm_P_Impresora.Exferia_TextBox_Papel_Alto;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Si muestra el logo
|
||||||
|
if (mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto &&
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Logo_Mostrar.Checked)
|
||||||
|
{
|
||||||
|
// El ancho del logo no puede estar vacío
|
||||||
|
if ((mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto) && (g_frm_P_Impresora.Exferia_TextBox_Logo_Ancho.Text.Trim().Length == 0))
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_VACIO(g_frm_P_Impresora.Exferia_Label_Logo_Ancho.Text);
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = g_frm_P_Impresora.Exferia_TextBox_Logo_Ancho;
|
||||||
|
}
|
||||||
|
|
||||||
|
// El alto del logo no puede estar vacía
|
||||||
|
if ((mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto) && (g_frm_P_Impresora.Exferia_TextBox_Logo_Alto.Text.Trim().Length == 0))
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_VACIO(g_frm_P_Impresora.Exferia_Label_Logo_Alto.Text);
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Objeto = g_frm_P_Impresora.Exferia_TextBox_Logo_Alto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_VALIDARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(ValidarDatos));
|
||||||
|
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_VALIDARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
private INTERNO_ValorDevuelto_Modelo GrabarDatos_Final()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HPV_Impresoras mdl_HPV_Impresoras = new HPV_Impresoras();
|
||||||
|
mdl_HPV_Impresoras.id = g_mdl_HPV_Impresoras != null ? g_mdl_HPV_Impresoras.id : -1;
|
||||||
|
|
||||||
|
//idEmpresa
|
||||||
|
if ((g_mdl_HPV_Impresoras != null ? g_mdl_HPV_Impresoras.idEmpresa : -1) != -1)
|
||||||
|
{
|
||||||
|
mdl_HPV_Impresoras.idEmpresa = g_mdl_HPV_Impresoras.idEmpresa;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Buscar el idEmpresa que Corresponda
|
||||||
|
mdl_HPV_Impresoras.idEmpresa = Datos_Generales.GEN_Empresas_Devolver_IdEmpresa_AGrabar(g_frm_P_Impresora.P_Base_ValoresGenerales.lng_idEmpresa, nameof(HPV_Impresoras));
|
||||||
|
}
|
||||||
|
|
||||||
|
//codigo
|
||||||
|
mdl_HPV_Impresoras.codigo = g_frm_P_Impresora.Exferia_TextBox_Codigo.Text.Trim();
|
||||||
|
|
||||||
|
//descripcion
|
||||||
|
mdl_HPV_Impresoras.descripcion = g_frm_P_Impresora.Exferia_TextBox_Descripcion.Text.Trim();
|
||||||
|
|
||||||
|
//tipo
|
||||||
|
if (g_frm_P_Impresora.Exferia_CheckBox_Tipo_Ticket.Checked &&
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Comanda.Checked==false)
|
||||||
|
{
|
||||||
|
mdl_HPV_Impresoras.tipo = Variables_HotelPuntoVenta.G_INT_IMPRESORA_TIPO_TICKET;
|
||||||
|
}
|
||||||
|
else if (g_frm_P_Impresora.Exferia_CheckBox_Tipo_Ticket.Checked == false &&
|
||||||
|
g_frm_P_Impresora.Exferia_CheckBox_Tipo_Comanda.Checked)
|
||||||
|
{
|
||||||
|
mdl_HPV_Impresoras.tipo = Variables_HotelPuntoVenta.G_INT_IMPRESORA_TIPO_COMANDA;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_HPV_Impresoras.tipo = Variables_HotelPuntoVenta.G_INT_IMPRESORA_TIPO_TICKET + Variables_HotelPuntoVenta.G_INT_IMPRESORA_TIPO_COMANDA;
|
||||||
|
}
|
||||||
|
|
||||||
|
//tipoLiquidacion
|
||||||
|
mdl_HPV_Impresoras.tipoLiquidacion = g_frm_P_Impresora.Exferia_CheckBox_Tipo_Liquidacion.Checked;
|
||||||
|
|
||||||
|
//tipoGastos
|
||||||
|
mdl_HPV_Impresoras.tipoGastos = g_frm_P_Impresora.Exferia_CheckBox_Tipo_Gastos.Checked;
|
||||||
|
|
||||||
|
//papel_Ancho
|
||||||
|
mdl_HPV_Impresoras.papel_Ancho = int.Parse(g_frm_P_Impresora.Exferia_TextBox_Papel_Ancho.Text.Trim());
|
||||||
|
//papel_Alto
|
||||||
|
mdl_HPV_Impresoras.papel_Alto = int.Parse(g_frm_P_Impresora.Exferia_TextBox_Papel_Alto.Text.Trim());
|
||||||
|
|
||||||
|
//logo
|
||||||
|
if (g_frm_P_Impresora.Exferia_CheckBox_Logo_Mostrar.Checked)
|
||||||
|
{
|
||||||
|
//logo
|
||||||
|
mdl_HPV_Impresoras.logo = true;
|
||||||
|
//logo_Ancho
|
||||||
|
mdl_HPV_Impresoras.logo_Ancho = int.Parse(g_frm_P_Impresora.Exferia_TextBox_Logo_Ancho.Text.Trim());
|
||||||
|
//logo_Alto
|
||||||
|
mdl_HPV_Impresoras.logo_Alto = int.Parse(g_frm_P_Impresora.Exferia_TextBox_Logo_Alto.Text.Trim());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//logo
|
||||||
|
mdl_HPV_Impresoras.logo = false;
|
||||||
|
//logo_Ancho
|
||||||
|
mdl_HPV_Impresoras.logo_Ancho =0;
|
||||||
|
//logo_Alto
|
||||||
|
mdl_HPV_Impresoras.logo_Alto = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Se graba el modelo ya relleno.
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo = g_obj_HPV_Impresoras_Datos.Grabar(mdl_HPV_Impresoras);
|
||||||
|
|
||||||
|
//Si todo esta Correcto recargo datos
|
||||||
|
if (mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
//Obtener el modelo que se acaba de grabar
|
||||||
|
g_mdl_HPV_Impresoras = g_obj_HPV_Impresoras_Datos.Obtener(mdl_INTERNO_ValorDevuelto_Modelo.Id);
|
||||||
|
|
||||||
|
#region SINCRONIZACION PARA TERMINALES
|
||||||
|
Sincronizar_Registros obj_Sincronizar_Registros = new Sincronizar_Registros();
|
||||||
|
|
||||||
|
//HPV_Impresoras
|
||||||
|
obj_Sincronizar_Registros.Sincronizar_Actualizar(new Sincronizar_Actualizar_Modelo(g_mdl_HPV_Impresoras,
|
||||||
|
g_frm_P_Impresora.P_Base_ValoresGenerales.lng_idEmpresa,
|
||||||
|
nameof(HPV_Impresoras)));
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(GrabarDatos_Final));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar Datos
|
||||||
|
public void BorrarDatos()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Preguntar si esta Seguro de Borrar
|
||||||
|
if (Mensajes.MostrarMensaje_Pregunta(Mensajes.G_STR_MENSAJES_GENERAL_PREGUNTA_BORRAR()))
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.Enabled = false;
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando(Mensajes.G_STR_ESPERANDO_BORRANDODATOS());
|
||||||
|
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_BorrarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_BorrarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.RunWorkerAsync();
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_frm_P_Impresora.Enabled = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(BorrarDatos));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_BorrarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Borrar
|
||||||
|
mdl_ValorDevuelto_Modelo = BorrarDatos_Final();
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_BorrarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_Impresora.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Mensaje.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Devolver al Listado el Row Borrar
|
||||||
|
if (g_frm_P_Impresora.P_Base_PantallaOrigen != null)
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.P_Base_PantallaOrigen.P_Base_ActualizarRegistro(mdl_ValorDevuelto_Modelo_Resultado.Id, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
else if (g_frm_P_Impresora.P_Base_F3Origen != null)
|
||||||
|
{
|
||||||
|
g_frm_P_Impresora.P_Base_F3Origen.Exferia_F3_ActualizarRegistro(mdl_ValorDevuelto_Modelo_Resultado.Id, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_frm_P_Impresora.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
g_frm_P_Impresora.Salir_P_Base();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_Completed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private INTERNO_ValorDevuelto_Modelo BorrarDatos_Final()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo = g_obj_HPV_Impresoras_Datos.Borrar(g_mdl_HPV_Impresoras != null ? g_mdl_HPV_Impresoras.id : -1);
|
||||||
|
|
||||||
|
if (mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
#region SINCRONIZACION PARA TERMINALES
|
||||||
|
Sincronizar_Registros obj_Sincronizar_Registros = new Sincronizar_Registros();
|
||||||
|
|
||||||
|
//HPV_Impresoras
|
||||||
|
obj_Sincronizar_Registros.Sincronizar_Borrar(new Sincronizar_Borrar_Modelo(g_mdl_HPV_Impresoras.id.ToString(),
|
||||||
|
g_frm_P_Impresora.P_Base_ValoresGenerales.lng_idEmpresa,
|
||||||
|
nameof(HPV_Impresoras)));
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Impresora_Controladora) + "/" + nameof(BorrarDatos_Final));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,586 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Modelos_MantenimientoAgrupacionesCabecera;
|
||||||
|
using Exferia_Aplicacion.Sincronizacion;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_Formularios;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_HotelPuntoVenta._1_Datos;
|
||||||
|
using Exferia_HotelPuntoVenta._3_Vistas.Listados;
|
||||||
|
using Exferia_HotelPuntoVenta.General;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.Controladoras
|
||||||
|
{
|
||||||
|
public class P_Liquidacion_Controladora
|
||||||
|
{
|
||||||
|
#region Variables Generales
|
||||||
|
private P_Liquidacion g_frm_P_Liquidacion = null;//Variable que enlaza con la pantalla asociada
|
||||||
|
private PE_Esperando g_frm_PE_Esperando;//Pantalla de Espera, para cuando se ejecutan tareas pesadas como cargar, guardar, etc
|
||||||
|
|
||||||
|
//Clases de Negocio Necesarias para la carga de datos
|
||||||
|
private HPVH_Liquidaciones_Datos g_obj_HPVH_Liquidaciones_Datos = new HPVH_Liquidaciones_Datos();
|
||||||
|
|
||||||
|
//Modelos
|
||||||
|
public HPVH_Liquidaciones g_mdl_HPVH_Liquidaciones = null;
|
||||||
|
|
||||||
|
public bool g_bol_Termino_CargaDatos_Inicial = false;//Se utiliza para saber cuando se termina la carga de datos estaticos inciales
|
||||||
|
|
||||||
|
#region Tareas Asincronas
|
||||||
|
//Tareea Asincrona de carga de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_CargarDatos;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
public P_Liquidacion_Controladora(P_Liquidacion _frm_P_Liquidacion)
|
||||||
|
{
|
||||||
|
g_frm_P_Liquidacion = _frm_P_Liquidacion;
|
||||||
|
|
||||||
|
g_bol_Termino_CargaDatos_Inicial = true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Vaciar datos
|
||||||
|
public void VaciarDatos()
|
||||||
|
{
|
||||||
|
//Modelo
|
||||||
|
g_mdl_HPVH_Liquidaciones = null;
|
||||||
|
|
||||||
|
//Apertura empleado
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_Empleado.Text = "";
|
||||||
|
|
||||||
|
//Apertura fechaHora
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_FechaHora.Text = "";
|
||||||
|
|
||||||
|
//Apertura 500
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_500.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_500.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 200
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_200.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_200.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 100
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_100.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_100.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 50
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_50.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_50.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 20
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_20.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_20.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 10
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_10.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_10.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 5
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_5.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_5.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 2
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_2.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_2.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 1
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_1.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_1.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 050
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_050.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_050.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 020
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_020.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_020.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 010
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_010.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_010.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 005
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_005.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_005.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 002
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_002.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_002.Text = "0";
|
||||||
|
|
||||||
|
//Apertura 001
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_001.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_001.Text = "0";
|
||||||
|
|
||||||
|
//Total Apertura
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_Total.Text = "0,00";
|
||||||
|
|
||||||
|
//Cierre Empleado
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_Empleado.Text = "";
|
||||||
|
|
||||||
|
//Cierre fecha hora
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_FechaHora.Text = "";
|
||||||
|
|
||||||
|
//Cierre 500
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_500.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_500.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 200
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_200.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_200.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 100
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_100.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_100.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 50
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_50.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_50.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 20
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_20.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_20.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 10
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_10.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_10.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 5
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_5.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_5.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 2
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_2.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_2.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 1
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_1.Text = "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_1.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 050
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_050.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_050.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 020
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_020.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_020.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 010
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_010.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_010.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 005
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_005.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_005.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 002
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_002.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_002.Text = "0";
|
||||||
|
|
||||||
|
//Cierre 001
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_001.Text = "0,00";
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_001.Text = "0";
|
||||||
|
|
||||||
|
//Total Cierre
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_Total.Text = "0,00";
|
||||||
|
|
||||||
|
//Total Calculado
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Total_Calculado.Text = "0,00";
|
||||||
|
|
||||||
|
//Total Gastos
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Total_Gastos.Text = "0,00";
|
||||||
|
|
||||||
|
//Total CajaAC
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Total_CajaAC.Text = "0,00";
|
||||||
|
|
||||||
|
//Total
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_SinColor_Total.Text = "0,00";
|
||||||
|
|
||||||
|
//Diferencia
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_SinColor_Diferencia.Text = "0,00";
|
||||||
|
|
||||||
|
//En Caja
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_EnCaja.Text = "0,00";
|
||||||
|
|
||||||
|
|
||||||
|
string[] str_Separador = new string[] { " [" };
|
||||||
|
//Si ya hay valores de objeto, los elimino para rellenarlos de nuevo
|
||||||
|
if (g_frm_P_Liquidacion.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None).Count() > 1)
|
||||||
|
{
|
||||||
|
g_frm_P_Liquidacion.P_Base_TituloPantalla = (g_frm_P_Liquidacion.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None))[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Actualizar el Boton de Seleccion de pantalla ####################################################
|
||||||
|
Variables.G_EMS_CONTROL_MENUSUPERIOR.Update_Texto_NombrePantalla(g_frm_P_Liquidacion.Tag.ToString());
|
||||||
|
//#################################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cargar Datos
|
||||||
|
public void RecargarDatos()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Bloquear el formulario para que no se pueda hacer nada hasta que termine
|
||||||
|
g_frm_P_Liquidacion.Enabled = false;
|
||||||
|
|
||||||
|
//Mostrar la pantalla de espera
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando();
|
||||||
|
|
||||||
|
// Si la tarea asincrona esta en marcha la paro
|
||||||
|
if (g_obj_TareaAsincrona_CargarDatos != null)
|
||||||
|
{
|
||||||
|
while (g_obj_TareaAsincrona_CargarDatos.IsBusy)
|
||||||
|
Application.DoEvents();
|
||||||
|
|
||||||
|
//Vaciar
|
||||||
|
VaciarDatos();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_obj_TareaAsincrona_CargarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_CargarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_CargarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.WorkerReportsProgress = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Vaciar
|
||||||
|
VaciarDatos();
|
||||||
|
|
||||||
|
//(Tarea Asincrona) Cargar Datos ##################################################################
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.RunWorkerAsync();
|
||||||
|
//#################################################################################################
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
g_frm_P_Liquidacion.Enabled = true;
|
||||||
|
g_bol_Termino_CargaDatos_Inicial = true;
|
||||||
|
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Control_Errores(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA(), ex, nameof(P_Liquidacion_Controladora) + "/" + nameof(RecargarDatos), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_CargarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Cargar Valores
|
||||||
|
if (CargarDatos(g_frm_P_Liquidacion.P_Base_id) == false)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Liquidacion_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_DoWork));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Liquidacion_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_DoWork));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_CargarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
//Desbloquear el Formulario
|
||||||
|
g_frm_P_Liquidacion.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
g_frm_P_Liquidacion.Salir_P_Base();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Liquidacion_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_Completed));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA());
|
||||||
|
|
||||||
|
g_frm_P_Liquidacion.Salir_P_Base();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CargarDatos(long _lng_id)
|
||||||
|
{
|
||||||
|
bool bol_ValorDevuelto = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_mdl_HPVH_Liquidaciones = g_obj_HPVH_Liquidaciones_Datos.Obtener(_lng_id);
|
||||||
|
|
||||||
|
//Si no es Nulo Cargo lo Datos
|
||||||
|
if (g_mdl_HPVH_Liquidaciones != null)
|
||||||
|
{
|
||||||
|
//Paginador ................................................................................
|
||||||
|
if (g_frm_P_Liquidacion.P_Base_PantallaOrigen != null &&
|
||||||
|
g_frm_P_Liquidacion.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados != null &&
|
||||||
|
g_frm_P_Liquidacion.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados.Count > 0)
|
||||||
|
{
|
||||||
|
long lng_id_ParaPaginacion = g_mdl_HPVH_Liquidaciones.id;
|
||||||
|
int int_PaginaDelObjeto = g_frm_P_Liquidacion.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados.IndexOf(g_frm_P_Liquidacion.P_Base_PantallaOrigen.P_Base_Objetos_Filtrados.Where(n => n.ID.Equals(lng_id_ParaPaginacion)).FirstOrDefault());
|
||||||
|
|
||||||
|
g_frm_P_Liquidacion.g_obj_Funciones_Paginador.SetPaginaActual(int_PaginaDelObjeto);
|
||||||
|
// Asignando al paginador la pagina actual.
|
||||||
|
g_frm_P_Liquidacion.Exferia_Paginador_Liquidiacion.PaginaActual = g_frm_P_Liquidacion.g_obj_Funciones_Paginador.GetPaginaActual();
|
||||||
|
}
|
||||||
|
//...........................................................................................
|
||||||
|
|
||||||
|
|
||||||
|
//Apertura empleado
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_Empleado.Text = g_mdl_HPVH_Liquidaciones.HPV_Camareros.nombre;
|
||||||
|
|
||||||
|
//Apertura fechaHora
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_FechaHora.Text = g_mdl_HPVH_Liquidaciones.fechaHora_Inicial.ToString("dd/MM/yyyy HH:mm");
|
||||||
|
|
||||||
|
//Apertura 500
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_500.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_500.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_500.Text = (g_mdl_HPVH_Liquidaciones.arqueoInicial_500*500).ToString();
|
||||||
|
|
||||||
|
//Apertura 200
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_200.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_200.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_200.Text = (g_mdl_HPVH_Liquidaciones.arqueoInicial_200 * 200).ToString();
|
||||||
|
|
||||||
|
//Apertura 100
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_100.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_100.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_100.Text = (g_mdl_HPVH_Liquidaciones.arqueoInicial_100 * 100).ToString();
|
||||||
|
|
||||||
|
//Apertura 50
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_50.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_50.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_50.Text = (g_mdl_HPVH_Liquidaciones.arqueoInicial_50 * 50).ToString();
|
||||||
|
|
||||||
|
//Apertura 20
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_20.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_20.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_20.Text = (g_mdl_HPVH_Liquidaciones.arqueoInicial_20 * 20).ToString();
|
||||||
|
|
||||||
|
//Apertura 10
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_10.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_10.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_10.Text = (g_mdl_HPVH_Liquidaciones.arqueoInicial_10 * 10).ToString();
|
||||||
|
|
||||||
|
//Apertura 5
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_5.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_5.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_5.Text = (g_mdl_HPVH_Liquidaciones.arqueoInicial_5 * 5).ToString();
|
||||||
|
|
||||||
|
//Apertura 2
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_2.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_2.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_2.Text = (g_mdl_HPVH_Liquidaciones.arqueoInicial_2 * 2).ToString();
|
||||||
|
|
||||||
|
//Apertura 1
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_1.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_1.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_1.Text = (g_mdl_HPVH_Liquidaciones.arqueoInicial_1 * 1).ToString();
|
||||||
|
|
||||||
|
//Apertura 050
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_050.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_050.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_050.Text = string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoInicial_050.ToString()) * 0.50m));
|
||||||
|
|
||||||
|
//Apertura 020
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_020.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_020.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_020.Text = string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoInicial_020.ToString()) * 0.20m));
|
||||||
|
|
||||||
|
//Apertura 010
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_010.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_010.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_010.Text = string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoInicial_010.ToString()) * 0.10m));
|
||||||
|
|
||||||
|
//Apertura 005
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_005.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_005.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_005.Text = string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoInicial_005.ToString()) * 0.05m));
|
||||||
|
|
||||||
|
//Apertura 002
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_002.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_002.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_002.Text = string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoInicial_002.ToString()) * 0.02m));
|
||||||
|
|
||||||
|
//Apertura 001
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_001.Text = g_mdl_HPVH_Liquidaciones.arqueoInicial_001.ToString();
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Apertura_001.Text = string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoInicial_001.ToString()) * 0.01m));
|
||||||
|
|
||||||
|
|
||||||
|
//Total Apertura
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Apertura_Total.Text = string.Format("{0:0.00}", g_mdl_HPVH_Liquidaciones.arqueoInicial_Metalico_Total);
|
||||||
|
|
||||||
|
//Cierre Empleado
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_Empleado.Text = g_mdl_HPVH_Liquidaciones.HPV_Camareros1!=null ? g_mdl_HPVH_Liquidaciones.HPV_Camareros1.nombre : "";
|
||||||
|
|
||||||
|
//Cierre fecha hora
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_FechaHora.Text = g_mdl_HPVH_Liquidaciones.fechaHora_Final != null ? g_mdl_HPVH_Liquidaciones.fechaHora_Final.Value.ToString("dd/MM/yyyy HH:mm") : "";
|
||||||
|
|
||||||
|
//Cierre 500
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_500.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_500!=null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_500.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_500.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_500 != null ? (g_mdl_HPVH_Liquidaciones.arqueoFinal_500.Value * 500).ToString() : "0";
|
||||||
|
|
||||||
|
//Cierre 200
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_200.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_200 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_200.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_200.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_200 != null ? (g_mdl_HPVH_Liquidaciones.arqueoFinal_200.Value * 200).ToString() : "0";
|
||||||
|
|
||||||
|
//Cierre 100
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_100.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_100 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_100.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_100.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_100 != null ? (g_mdl_HPVH_Liquidaciones.arqueoFinal_100.Value * 100).ToString() : "0";
|
||||||
|
|
||||||
|
//Cierre 50
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_50.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_50 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_50.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_50.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_50 != null ? (g_mdl_HPVH_Liquidaciones.arqueoFinal_50.Value * 50).ToString() : "0";
|
||||||
|
|
||||||
|
//Cierre 20
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_20.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_20 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_20.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_20.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_20 != null ? (g_mdl_HPVH_Liquidaciones.arqueoFinal_20.Value * 20).ToString() : "0";
|
||||||
|
|
||||||
|
//Cierre 10
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_10.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_10 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_10.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_10.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_10 != null ? (g_mdl_HPVH_Liquidaciones.arqueoFinal_10.Value * 10).ToString() : "0";
|
||||||
|
|
||||||
|
//Cierre 5
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_5.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_5 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_5.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_5.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_5 != null ? (g_mdl_HPVH_Liquidaciones.arqueoFinal_5.Value * 5).ToString() : "0";
|
||||||
|
|
||||||
|
//Cierre 2
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_2.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_2 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_2.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_2.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_2 != null ? (g_mdl_HPVH_Liquidaciones.arqueoFinal_2.Value * 2).ToString() : "0";
|
||||||
|
|
||||||
|
//Cierre 1
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_1.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_1 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_1.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_1.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_1 != null ? (g_mdl_HPVH_Liquidaciones.arqueoFinal_1.Value * 1).ToString() : "0";
|
||||||
|
|
||||||
|
//Cierre 050
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_050.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_050 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_050.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_050.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_050 != null ? string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoFinal_050.ToString()) * 0.50m)) : "0,00";
|
||||||
|
|
||||||
|
//Cierre 020
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_020.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_020 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_020.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_020.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_020 != null ? string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoFinal_020.ToString()) * 0.20m)) : "0,00";
|
||||||
|
|
||||||
|
//Cierre 010
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_010.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_010 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_010.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_010.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_010 != null ? string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoFinal_010.ToString()) * 0.10m)) : "0,00";
|
||||||
|
|
||||||
|
//Cierre 005
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_005.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_005 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_005.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_005.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_005 != null ? string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoFinal_005.ToString()) * 0.05m)) : "0,00";
|
||||||
|
|
||||||
|
//Cierre 002
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_002.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_002 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_002.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_002.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_002 != null ? string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoFinal_002.ToString()) * 0.02m)) : "0,00";
|
||||||
|
|
||||||
|
//Cierre 001
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_001.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_001 != null ? g_mdl_HPVH_Liquidaciones.arqueoFinal_001.Value.ToString() : "0";
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Cierre_001.Text = g_mdl_HPVH_Liquidaciones.arqueoFinal_001 != null ? string.Format("{0:0.00}", (decimal.Parse(g_mdl_HPVH_Liquidaciones.arqueoFinal_001.ToString()) * 0.01m)) : "0,00";
|
||||||
|
|
||||||
|
//Total Cierre
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_Cierre_Total.Text = string.Format("{0:0.00}", g_mdl_HPVH_Liquidaciones.arqueoFinal_Metalico_Total);
|
||||||
|
|
||||||
|
//Total Calculado
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Total_Calculado.Text = "0,00";
|
||||||
|
|
||||||
|
//Total Gastos
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Total_Gastos.Text = "0,00";
|
||||||
|
|
||||||
|
//Total CajaAC
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_Total_CajaAC.Text = "0,00";
|
||||||
|
|
||||||
|
//Total
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_SinColor_Total.Text = "0,00";
|
||||||
|
|
||||||
|
//Diferencia
|
||||||
|
g_frm_P_Liquidacion.Exferia_Label_SinColor_Diferencia.Text = "0,00";
|
||||||
|
|
||||||
|
//En Caja
|
||||||
|
g_frm_P_Liquidacion.Exferia_TextBox_EnCaja.Text = string.Format("{0:0.00}", g_mdl_HPVH_Liquidaciones.importeTotal_Encaja);
|
||||||
|
|
||||||
|
// Mostrar Campo en el Titulo de mantenimiento
|
||||||
|
string str_MenuSuperior_ADD = "";
|
||||||
|
if (g_frm_P_Liquidacion.g_mdl_PRV_OpcionesDetalle != null &&
|
||||||
|
g_frm_P_Liquidacion.g_mdl_PRV_OpcionesDetalle.camposMostrar_TituloMantenimiento != null &&
|
||||||
|
g_frm_P_Liquidacion.g_mdl_PRV_OpcionesDetalle.camposMostrar_TituloMantenimiento.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
//Obtener el Array de Campos
|
||||||
|
string[] arr_Campos = g_frm_P_Liquidacion.g_mdl_PRV_OpcionesDetalle.camposMostrar_TituloMantenimiento.Split(new Char[] { ',' });
|
||||||
|
string str_ValorAMostrarFinal = "";
|
||||||
|
|
||||||
|
string[] str_Separador = new string[] { " [" };
|
||||||
|
//Si ya hay valores de objeto, los elimino para rellenarlos de nuevo
|
||||||
|
if (g_frm_P_Liquidacion.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None).Count() > 1)
|
||||||
|
{
|
||||||
|
g_frm_P_Liquidacion.P_Base_TituloPantalla = (g_frm_P_Liquidacion.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None))[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic dnm_Objeto = g_mdl_HPVH_Liquidaciones;
|
||||||
|
foreach (string str_campo in arr_Campos)
|
||||||
|
{
|
||||||
|
var Valor = dnm_Objeto.GetType().GetProperty(str_campo).GetValue(dnm_Objeto, null);
|
||||||
|
if (Valor != null)
|
||||||
|
{
|
||||||
|
str_ValorAMostrarFinal += " " + Valor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (str_ValorAMostrarFinal != "")
|
||||||
|
{
|
||||||
|
g_frm_P_Liquidacion.P_Base_TituloPantalla += " [" + str_ValorAMostrarFinal + "] -Modificar";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Actualizar el Boton de Seleccion de pantalla ####################################################
|
||||||
|
Variables.G_EMS_CONTROL_MENUSUPERIOR.Add_Texto_NombrePantalla_Descripciones(g_frm_P_Liquidacion.Tag.ToString(), str_MenuSuperior_ADD);
|
||||||
|
//#################################################################################################
|
||||||
|
|
||||||
|
g_frm_P_Liquidacion.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
bol_ValorDevuelto = false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Liquidacion_Controladora) + "/" + nameof(CargarDatos));
|
||||||
|
bol_ValorDevuelto = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bol_ValorDevuelto;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,703 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Sincronizacion;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_Formularios;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_HotelPuntoVenta._1_Datos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.Controladoras
|
||||||
|
{
|
||||||
|
public class P_Mesa_Controladora
|
||||||
|
{
|
||||||
|
#region Variables Generales
|
||||||
|
private P_Mesa g_frm_P_Mesa; //Variable que enlaza con la pantalla
|
||||||
|
private PE_Esperando g_frm_PE_Esperando;//Pantalla de espera, para cuando se ejecuten tareas pesadas como cargar,guardar,etc
|
||||||
|
|
||||||
|
//Clases de Negocio necesarias
|
||||||
|
private HPV_Mesas_Datos g_obj_HPV_Mesas_Datos = new HPV_Mesas_Datos();
|
||||||
|
|
||||||
|
//Modelos necesarios
|
||||||
|
private HPV_Mesas g_mdl_HPV_Mesas = null;
|
||||||
|
|
||||||
|
//Listados necesarios
|
||||||
|
public List<HPV_Mesas> g_lst_HPV_Mesas = null;
|
||||||
|
|
||||||
|
//Modelo de la pantalla padre
|
||||||
|
public HPV_Salas g_mdl_HPV_Salas = new HPV_Salas();
|
||||||
|
|
||||||
|
public bool g_bol_Termino_CargaDatos_Inicial = false;
|
||||||
|
|
||||||
|
//Tarea Asincrona de carga de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_CargarDatos;
|
||||||
|
|
||||||
|
//Tareea Asincrona de grabar de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_GrabarDatos;
|
||||||
|
public bool g_bol_GrabarDatos_VaciarDatos = false;
|
||||||
|
|
||||||
|
//Tareea Asincrona de borrar de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_BorrarDatos;
|
||||||
|
|
||||||
|
public bool g_bol_CampoCodigo_Numerico = false;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
public P_Mesa_Controladora(P_Mesa _frm_P_Mesa)
|
||||||
|
{
|
||||||
|
g_frm_P_Mesa = _frm_P_Mesa;
|
||||||
|
|
||||||
|
g_bol_Termino_CargaDatos_Inicial = true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Buscar Codigo Siguiente
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Buscar_CodigoSiguiente()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_CodigoSiguiente = "1";
|
||||||
|
List<INTERNO_HPV_Mesas_Listado_Modelo> lst_INTERNO_HPV_Mesas_Listado_Modelo = null;
|
||||||
|
|
||||||
|
//Para saber los contactos segun Cliente,Proveedor
|
||||||
|
lst_INTERNO_HPV_Mesas_Listado_Modelo = g_obj_HPV_Mesas_Datos.Obtener_Listado_PorSala(g_mdl_HPV_Salas.id, g_frm_P_Mesa.P_Base_ValoresGenerales.lng_idEmpresa);
|
||||||
|
|
||||||
|
//Si en el listado ya existe el codigo le sumo uno al ultimo de la lista
|
||||||
|
if (lst_INTERNO_HPV_Mesas_Listado_Modelo != null)
|
||||||
|
{
|
||||||
|
int int_Comparacion;
|
||||||
|
var consulta_CodigoSiguiente = lst_INTERNO_HPV_Mesas_Listado_Modelo.Where(x => int.TryParse(x.codigo, out int_Comparacion)).Select(x => Convert.ToInt32(x.codigo)).ToList();
|
||||||
|
|
||||||
|
if (consulta_CodigoSiguiente != null && consulta_CodigoSiguiente.Count() > 0)
|
||||||
|
{
|
||||||
|
str_CodigoSiguiente = (consulta_CodigoSiguiente.OrderByDescending(m => m).Take(1).FirstOrDefault() + 1).ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str_CodigoSiguiente.Length <= g_frm_P_Mesa.Exferia_TextBox_Codigo.Exferia_TextBox_MaxLength)
|
||||||
|
{
|
||||||
|
g_frm_P_Mesa.Exferia_TextBox_Codigo.Text = str_CodigoSiguiente;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_CODIGOSIGUIENTE_LIMITEALCANZADO(g_frm_P_Mesa.Exferia_Label_Codigo.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BUSCARCODIGOSIGUIENTE();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(Buscar_CodigoSiguiente));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BUSCARCODIGOSIGUIENTE();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Varciar Datos
|
||||||
|
public void VaciarDatos()
|
||||||
|
{
|
||||||
|
//Modelo
|
||||||
|
g_mdl_HPV_Mesas = null;
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
g_frm_P_Mesa.Exferia_TextBox_Codigo.Text = "";
|
||||||
|
//Descripcion
|
||||||
|
g_frm_P_Mesa.Exferia_TextBox_Descripcion.Text = "";
|
||||||
|
|
||||||
|
string[] str_Separador = new string[] { " [" };
|
||||||
|
//Si ya hay valores de objeto, los elimino para rellenarlos de nuevo
|
||||||
|
if (g_frm_P_Mesa.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None).Count() > 1)
|
||||||
|
{
|
||||||
|
g_frm_P_Mesa.P_Base_TituloPantalla = (g_frm_P_Mesa.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None))[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Actualizar el Boton de Seleccion de pantalla ####################################################
|
||||||
|
Variables.G_EMS_CONTROL_MENUSUPERIOR.Update_Texto_NombrePantalla(g_frm_P_Mesa.Tag.ToString());
|
||||||
|
//#################################################################################################
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cargar Datos
|
||||||
|
public void RecargarDatos()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Si la tarea asincrona esta en marcha la paro
|
||||||
|
if (g_obj_TareaAsincrona_CargarDatos != null)
|
||||||
|
{
|
||||||
|
while (g_obj_TareaAsincrona_CargarDatos.IsBusy)
|
||||||
|
Application.DoEvents();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_obj_TareaAsincrona_CargarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_CargarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_CargarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.WorkerReportsProgress = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Vaciar
|
||||||
|
VaciarDatos();
|
||||||
|
|
||||||
|
//(Tarea Asincrona) Cargar Datos ##################################################################
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.RunWorkerAsync();
|
||||||
|
//#################################################################################################
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA(), ex, nameof(P_Mesa_Controladora) + "/" + nameof(RecargarDatos), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TareaAsincrona_CargarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Cargar Valores
|
||||||
|
if (CargarDatos(g_frm_P_Mesa.P_Base_id) == false)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_DoWork));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_DoWork));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_CargarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
g_frm_P_Mesa.Salir_P_Base();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_Completed));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA());
|
||||||
|
|
||||||
|
g_frm_P_Mesa.Salir_P_Base();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Hacemos foco al primer control.
|
||||||
|
g_frm_P_Mesa.Exferia_TextBox_Codigo.Exferia_TextBox_Foco();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CargarDatos(long _lng_id)
|
||||||
|
{
|
||||||
|
bool bol_ValorDevuelto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_mdl_HPV_Mesas = g_obj_HPV_Mesas_Datos.Obtener(_lng_id);
|
||||||
|
|
||||||
|
//Si no es Nulo Cargo lo Datos
|
||||||
|
if (g_mdl_HPV_Mesas != null)
|
||||||
|
{
|
||||||
|
//Codigo
|
||||||
|
g_frm_P_Mesa.Exferia_TextBox_Codigo.Text = g_mdl_HPV_Mesas.codigo;
|
||||||
|
//Descripcion
|
||||||
|
g_frm_P_Mesa.Exferia_TextBox_Descripcion.Text = g_mdl_HPV_Mesas.descripcion;
|
||||||
|
|
||||||
|
}
|
||||||
|
g_frm_P_Mesa.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
bol_ValorDevuelto = false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(CargarDatos));
|
||||||
|
bol_ValorDevuelto = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bol_ValorDevuelto;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar Datos
|
||||||
|
public void GrabarDatos(bool _bol_GrabarDatos_VaciarDatos)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_bol_GrabarDatos_VaciarDatos = _bol_GrabarDatos_VaciarDatos;
|
||||||
|
|
||||||
|
g_frm_P_Mesa.Enabled = false;
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando(Mensajes.G_STR_ESPERANDO_GRABANDODATOS());
|
||||||
|
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_GrabarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_GrabarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.RunWorkerAsync();
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_Mesa.Enabled = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(GrabarDatos));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TareaAsincrona_GrabarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Validar primero
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_VALIDACION = ValidarDatos();
|
||||||
|
if (mdl_ValorDevuelto_Modelo_VALIDACION.TodoCorrecto)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = GrabarDatos_Final();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = mdl_ValorDevuelto_Modelo_VALIDACION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_GrabarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_Mesa.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Mensaje.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
|
||||||
|
//Poner el Foco en el objeto que tuvo el problema en validar
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Objeto != null)
|
||||||
|
{
|
||||||
|
Funciones.Poner_Foco_Objeto(g_frm_P_Mesa, mdl_ValorDevuelto_Modelo_Resultado.Objeto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (g_frm_P_Mesa.P_Base_PantallaOrigen != null)
|
||||||
|
{
|
||||||
|
//Devolder al Listado el Row Añadido/Modificado
|
||||||
|
List<object> lst_obj = new List<object>();
|
||||||
|
lst_obj.Add(g_frm_P_Mesa.g_mdl_PRV_OpcionesDetalle.opcion);
|
||||||
|
lst_obj.Add(mdl_ValorDevuelto_Modelo_Resultado.Id);
|
||||||
|
|
||||||
|
g_frm_P_Mesa.P_Base_PantallaOrigen.P_Base_ActualizarRegistro_ConObjeto(lst_obj, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(g_bol_GrabarDatos_VaciarDatos)
|
||||||
|
{
|
||||||
|
VaciarDatos();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Poner el Foco Inicial
|
||||||
|
Funciones.Poner_Foco_Objeto(g_frm_P_Mesa, g_frm_P_Mesa.Exferia_TextBox_Descripcion);
|
||||||
|
//Se pone para que no pregunte si se modifico algo
|
||||||
|
g_frm_P_Mesa.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Mesa_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_Completed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public INTERNO_ValorDevuelto_Modelo ValidarDatos()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Si el codigo esta vacio y se intenta buscar el ultimo numerico y llego al limite de base de datos
|
||||||
|
if (g_frm_P_Mesa.Exferia_TextBox_Codigo.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = Buscar_CodigoSiguiente();
|
||||||
|
|
||||||
|
if (mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = mdl_INTERNO_ValorDevuelto_Modelo.Mensaje;
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = g_frm_P_Mesa.Exferia_TextBox_Codigo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// El codigo no puede estar Repetido
|
||||||
|
if (mdl_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
if (g_lst_HPV_Mesas != null && g_lst_HPV_Mesas.Count > 0)
|
||||||
|
{
|
||||||
|
long lng_id = g_mdl_HPV_Mesas != null ? g_mdl_HPV_Mesas.id : 0;
|
||||||
|
|
||||||
|
if (g_lst_HPV_Mesas.Where(m => !m.id.Equals(lng_id) && m.codigo.Equals(g_frm_P_Mesa.Exferia_TextBox_Codigo.Text)).FirstOrDefault() != null)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_REPETIDO(g_frm_P_Mesa.Exferia_Label_Codigo.Text);
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = g_frm_P_Mesa.Exferia_TextBox_Codigo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// La descripcion no puede estar vacia
|
||||||
|
if (mdl_ValorDevuelto_Modelo.TodoCorrecto && g_frm_P_Mesa.Exferia_TextBox_Descripcion.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_VACIO(g_frm_P_Mesa.Exferia_Label_Descripcion.Text);
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = g_frm_P_Mesa.Exferia_TextBox_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_VALIDARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(ValidarDatos));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_VALIDARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private INTERNO_ValorDevuelto_Modelo GrabarDatos_Final()
|
||||||
|
{
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
//Iniciar transaccion
|
||||||
|
using (TransactionScope transaccion_SQL = new TransactionScope(TransactionScopeOption.Required))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (g_mdl_HPV_Mesas == null)
|
||||||
|
{
|
||||||
|
g_mdl_HPV_Mesas = new HPV_Mesas();
|
||||||
|
g_mdl_HPV_Mesas.id = -1;
|
||||||
|
|
||||||
|
//ver si hay que poner otro id .........................
|
||||||
|
if (g_lst_HPV_Mesas != null)
|
||||||
|
{
|
||||||
|
List<long> lst_idSinGrabar = g_lst_HPV_Mesas.Where(m => m.id < 0).Select(m => m.id).ToList();
|
||||||
|
if (lst_idSinGrabar.Count > 0)
|
||||||
|
{
|
||||||
|
g_mdl_HPV_Mesas.id = lst_idSinGrabar.Min() - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//.......................................................
|
||||||
|
}
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
g_mdl_HPV_Mesas.codigo = g_frm_P_Mesa.Exferia_TextBox_Codigo.Text;
|
||||||
|
//Descripcion
|
||||||
|
g_mdl_HPV_Mesas.descripcion = g_frm_P_Mesa.Exferia_TextBox_Descripcion.Text;
|
||||||
|
|
||||||
|
//Asignar el idEmpresa...........................................................................................
|
||||||
|
if ((g_mdl_HPV_Salas != null ? g_mdl_HPV_Salas.idEmpresa : -1) != -1)
|
||||||
|
{
|
||||||
|
g_mdl_HPV_Mesas.idEmpresa = g_mdl_HPV_Salas.idEmpresa;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Buscar el idEmpresa que Corresponda
|
||||||
|
g_mdl_HPV_Mesas.idEmpresa = Datos_Generales.GEN_Empresas_Devolver_IdEmpresa_AGrabar(g_frm_P_Mesa.P_Base_ValoresGenerales.lng_idEmpresa, nameof(HPV_Mesas));
|
||||||
|
}
|
||||||
|
|
||||||
|
//idSala
|
||||||
|
g_mdl_HPV_Mesas.idSala = g_mdl_HPV_Salas.id;
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo = g_obj_HPV_Mesas_Datos.Grabar(g_mdl_HPV_Mesas);
|
||||||
|
|
||||||
|
if (mdl_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
transaccion_SQL.Complete();
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
|
||||||
|
//Obtener el modelo que se acaba de grabar
|
||||||
|
g_mdl_HPV_Mesas = g_obj_HPV_Mesas_Datos.Obtener(mdl_ValorDevuelto_Modelo.Id);
|
||||||
|
g_frm_P_Mesa.P_Base_id = g_mdl_HPV_Mesas.id;
|
||||||
|
|
||||||
|
#region SINCRONIZACION PARA TERMINALES
|
||||||
|
Sincronizar_Registros obj_Sincronizar_Registros = new Sincronizar_Registros();
|
||||||
|
|
||||||
|
//HPV_Mesas
|
||||||
|
obj_Sincronizar_Registros.Sincronizar_Actualizar(new Sincronizar_Actualizar_Modelo(g_mdl_HPV_Mesas,
|
||||||
|
g_frm_P_Mesa.P_Base_ValoresGenerales.lng_idEmpresa,
|
||||||
|
nameof(HPV_Mesas)));
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = g_lst_HPV_Mesas;
|
||||||
|
|
||||||
|
//Termino Transaccion
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(GrabarDatos_Final));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Termino Transaccion
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar Datos
|
||||||
|
public void BorrarDatos()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Preguntar si esta Seguro de Borrar
|
||||||
|
if (Mensajes.MostrarMensaje_Pregunta(Mensajes.G_STR_MENSAJES_GENERAL_PREGUNTA_BORRAR()))
|
||||||
|
{
|
||||||
|
g_frm_P_Mesa.Enabled = false;
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando(Mensajes.G_STR_ESPERANDO_BORRANDODATOS());
|
||||||
|
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_BorrarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_BorrarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.RunWorkerAsync();
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_frm_P_Mesa.Enabled = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(BorrarDatos));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TareaAsincrona_BorrarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = BorrarDatos_Final();
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_BorrarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_Mesa.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Mensaje.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (g_frm_P_Mesa.P_Base_PantallaOrigen != null)
|
||||||
|
{
|
||||||
|
List<object> lst_obj = new List<object>();
|
||||||
|
mdl_ValorDevuelto_Modelo_Resultado.Listado_Id = new List<long>();
|
||||||
|
mdl_ValorDevuelto_Modelo_Resultado.Listado_Id.Add(mdl_ValorDevuelto_Modelo_Resultado.Id);
|
||||||
|
lst_obj.Add(g_frm_P_Mesa.g_mdl_PRV_OpcionesDetalle.opcion);
|
||||||
|
lst_obj.Add(mdl_ValorDevuelto_Modelo_Resultado.Listado_Id);
|
||||||
|
|
||||||
|
g_frm_P_Mesa.P_Base_PantallaOrigen.P_Base_ActualizarRegistro_ConObjeto(lst_obj, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_frm_P_Mesa.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Mesa_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_Completed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private INTERNO_ValorDevuelto_Modelo BorrarDatos_Final()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo = g_obj_HPV_Mesas_Datos.Borrar(g_mdl_HPV_Mesas != null ? g_mdl_HPV_Mesas.id : -1);
|
||||||
|
|
||||||
|
|
||||||
|
if (mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
#region SINCRONIZACION PARA TERMINALES
|
||||||
|
Sincronizar_Registros obj_Sincronizar_Registros = new Sincronizar_Registros();
|
||||||
|
|
||||||
|
//HPV_Mesas
|
||||||
|
obj_Sincronizar_Registros.Sincronizar_Borrar(new Sincronizar_Borrar_Modelo(g_mdl_HPV_Mesas.id.ToString(),
|
||||||
|
g_frm_P_Mesa.P_Base_ValoresGenerales.lng_idEmpresa,
|
||||||
|
nameof(HPV_Mesas)));
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Mesa_Controladora) + "/" + nameof(BorrarDatos_Final));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,699 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Sincronizacion;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_Formularios;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_HotelPuntoVenta._1_Datos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.Controladoras
|
||||||
|
{
|
||||||
|
public class P_PuntoBarra_Controladora
|
||||||
|
{
|
||||||
|
#region Variables Generales
|
||||||
|
private P_PuntoBarra g_frm_P_PuntoBarra;//Variable que enlaza con la pantalla
|
||||||
|
private PE_Esperando g_frm_PE_Esperando;//Pantalla de espera, para cuando se ejecuten tareas pesadas como cargar,guardar,etc
|
||||||
|
|
||||||
|
//Clases de Negocio necesarias
|
||||||
|
private HPV_PuntosBarra_Datos g_obj_HPV_PuntosBarra_Datos = new HPV_PuntosBarra_Datos();
|
||||||
|
|
||||||
|
//Modelos necesarios
|
||||||
|
private HPV_PuntosBarra g_mdl_HPV_PuntosBarra = null;
|
||||||
|
|
||||||
|
//Listados necesarios
|
||||||
|
private List<HPV_PuntosBarra> g_lst_HPV_PuntosBarra = null;
|
||||||
|
|
||||||
|
//Modelo de la pantalla padre
|
||||||
|
public HPV_Salas g_mdl_HPV_Salas = new HPV_Salas();
|
||||||
|
|
||||||
|
public bool g_bol_Termino_CargaDatos_Inicial = false;
|
||||||
|
|
||||||
|
//Tarea Asincrona de carga de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_CargarDatos;
|
||||||
|
|
||||||
|
//Tareea Asincrona de grabar de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_GrabarDatos;
|
||||||
|
public bool g_bol_GrabarDatos_VaciarDatos = false;
|
||||||
|
|
||||||
|
//Tareea Asincrona de borrar de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_BorrarDatos;
|
||||||
|
|
||||||
|
public bool g_bol_CampoCodigo_Numerico = false;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
public P_PuntoBarra_Controladora(P_PuntoBarra _frm_P_PuntoBarra)
|
||||||
|
{
|
||||||
|
g_frm_P_PuntoBarra = _frm_P_PuntoBarra;
|
||||||
|
|
||||||
|
g_bol_Termino_CargaDatos_Inicial = true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Buscar Codigo Siguiente
|
||||||
|
public INTERNO_ValorDevuelto_Modelo Buscar_CodigoSiguiente()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string str_CodigoSiguiente = "1";
|
||||||
|
List<INTERNO_HPV_PuntosBarra_Listado_Modelo> lst_INTERNO_HPV_PuntosBarra_Listado_Modelo = null;
|
||||||
|
|
||||||
|
//Para saber los contactos segun Cliente,Proveedor
|
||||||
|
lst_INTERNO_HPV_PuntosBarra_Listado_Modelo = g_obj_HPV_PuntosBarra_Datos.Obtener_Listado_PorSala(g_mdl_HPV_Salas.id, g_frm_P_PuntoBarra.P_Base_ValoresGenerales.lng_idEmpresa);
|
||||||
|
|
||||||
|
//Si en el listado ya existe el codigo le sumo uno al ultimo de la lista
|
||||||
|
if (lst_INTERNO_HPV_PuntosBarra_Listado_Modelo != null)
|
||||||
|
{
|
||||||
|
int int_Comparacion;
|
||||||
|
var consulta_CodigoSiguiente = lst_INTERNO_HPV_PuntosBarra_Listado_Modelo.Where(x => int.TryParse(x.codigo, out int_Comparacion)).Select(x => Convert.ToInt32(x.codigo)).ToList();
|
||||||
|
|
||||||
|
if (consulta_CodigoSiguiente != null && consulta_CodigoSiguiente.Count() > 0)
|
||||||
|
{
|
||||||
|
str_CodigoSiguiente = (consulta_CodigoSiguiente.OrderByDescending(m => m).Take(1).FirstOrDefault() + 1).ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str_CodigoSiguiente.Length <= g_frm_P_PuntoBarra.Exferia_TextBox_Codigo.Exferia_TextBox_MaxLength)
|
||||||
|
{
|
||||||
|
g_frm_P_PuntoBarra.Exferia_TextBox_Codigo.Text = str_CodigoSiguiente;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_CODIGOSIGUIENTE_LIMITEALCANZADO(g_frm_P_PuntoBarra.Exferia_Label_Codigo.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BUSCARCODIGOSIGUIENTE();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(Buscar_CodigoSiguiente));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BUSCARCODIGOSIGUIENTE();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Vaciar Datos
|
||||||
|
public void VaciarDatos()
|
||||||
|
{
|
||||||
|
//Modelo
|
||||||
|
g_mdl_HPV_PuntosBarra = null;
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
g_frm_P_PuntoBarra.Exferia_TextBox_Codigo.Text = "";
|
||||||
|
//Descripcion
|
||||||
|
g_frm_P_PuntoBarra.Exferia_TextBox_Descripcion.Text = "";
|
||||||
|
|
||||||
|
string[] str_Separador = new string[] { " [" };
|
||||||
|
//Si ya hay valores de objeto, los elimino para rellenarlos de nuevo
|
||||||
|
if (g_frm_P_PuntoBarra.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None).Count() > 1)
|
||||||
|
{
|
||||||
|
g_frm_P_PuntoBarra.P_Base_TituloPantalla = (g_frm_P_PuntoBarra.P_Base_TituloPantalla.Split(str_Separador, StringSplitOptions.None))[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Actualizar el Boton de Seleccion de pantalla ####################################################
|
||||||
|
Variables.G_EMS_CONTROL_MENUSUPERIOR.Update_Texto_NombrePantalla(g_frm_P_PuntoBarra.Tag.ToString());
|
||||||
|
//#################################################################################################
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cargar Datos
|
||||||
|
public void RecargarDatos()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Si la tarea asincrona esta en marcha la paro
|
||||||
|
if (g_obj_TareaAsincrona_CargarDatos != null)
|
||||||
|
{
|
||||||
|
while (g_obj_TareaAsincrona_CargarDatos.IsBusy)
|
||||||
|
Application.DoEvents();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_obj_TareaAsincrona_CargarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_CargarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_CargarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.WorkerReportsProgress = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Vaciar
|
||||||
|
VaciarDatos();
|
||||||
|
|
||||||
|
//(Tarea Asincrona) Cargar Datos ##################################################################
|
||||||
|
g_obj_TareaAsincrona_CargarDatos.RunWorkerAsync();
|
||||||
|
//#################################################################################################
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Control_Errores(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA(), ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(RecargarDatos), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TareaAsincrona_CargarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Cargar Valores
|
||||||
|
if (CargarDatos(g_frm_P_PuntoBarra.P_Base_id) == false)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_DoWork));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_DoWork));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_CargarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
g_frm_P_PuntoBarra.Salir_P_Base();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(TareaAsincrona_CargarDatos_Completed));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSPANTALLA());
|
||||||
|
|
||||||
|
g_frm_P_PuntoBarra.Salir_P_Base();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Hacemos foco al primer control.
|
||||||
|
g_frm_P_PuntoBarra.Exferia_TextBox_Codigo.Exferia_TextBox_Foco();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CargarDatos(long _lng_id)
|
||||||
|
{
|
||||||
|
bool bol_ValorDevuelto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_mdl_HPV_PuntosBarra = g_obj_HPV_PuntosBarra_Datos.Obtener(_lng_id);
|
||||||
|
|
||||||
|
//Si no es Nulo Cargo lo Datos
|
||||||
|
if (g_mdl_HPV_PuntosBarra != null)
|
||||||
|
{
|
||||||
|
//Codigo
|
||||||
|
g_frm_P_PuntoBarra.Exferia_TextBox_Codigo.Text = g_mdl_HPV_PuntosBarra.codigo;
|
||||||
|
//Descripcion
|
||||||
|
g_frm_P_PuntoBarra.Exferia_TextBox_Descripcion.Text = g_mdl_HPV_PuntosBarra.descripcion;
|
||||||
|
|
||||||
|
}
|
||||||
|
g_frm_P_PuntoBarra.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
bol_ValorDevuelto = false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(CargarDatos));
|
||||||
|
bol_ValorDevuelto = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bol_ValorDevuelto;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Grabar Datos
|
||||||
|
public void GrabarDatos(bool _bol_GrabarDatos_VaciarDatos)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_bol_GrabarDatos_VaciarDatos = _bol_GrabarDatos_VaciarDatos;
|
||||||
|
|
||||||
|
g_frm_P_PuntoBarra.Enabled = false;
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando(Mensajes.G_STR_ESPERANDO_GRABANDODATOS());
|
||||||
|
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_GrabarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_GrabarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_GrabarDatos.RunWorkerAsync();
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_PuntoBarra.Enabled = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(GrabarDatos));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TareaAsincrona_GrabarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Validar primero
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_VALIDACION = ValidarDatos();
|
||||||
|
if (mdl_ValorDevuelto_Modelo_VALIDACION.TodoCorrecto)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = GrabarDatos_Final();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = mdl_ValorDevuelto_Modelo_VALIDACION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_GrabarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_PuntoBarra.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Mensaje.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
|
||||||
|
//Poner el Foco en el objeto que tuvo el problema en validar
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Objeto != null)
|
||||||
|
{
|
||||||
|
Funciones.Poner_Foco_Objeto(g_frm_P_PuntoBarra, mdl_ValorDevuelto_Modelo_Resultado.Objeto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (g_frm_P_PuntoBarra.P_Base_PantallaOrigen != null)
|
||||||
|
{
|
||||||
|
//Devolder al Listado el Row Añadido/Modificado
|
||||||
|
List<object> lst_obj = new List<object>();
|
||||||
|
lst_obj.Add(g_frm_P_PuntoBarra.g_mdl_PRV_OpcionesDetalle.opcion);
|
||||||
|
lst_obj.Add(mdl_ValorDevuelto_Modelo_Resultado.Id);
|
||||||
|
|
||||||
|
g_frm_P_PuntoBarra.P_Base_PantallaOrigen.P_Base_ActualizarRegistro_ConObjeto(lst_obj, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_bol_GrabarDatos_VaciarDatos)
|
||||||
|
{
|
||||||
|
VaciarDatos();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Poner el Foco Inicial
|
||||||
|
Funciones.Poner_Foco_Objeto(g_frm_P_PuntoBarra, g_frm_P_PuntoBarra.Exferia_TextBox_Descripcion);
|
||||||
|
//Se pone para que no pregunte si se modifico algo
|
||||||
|
g_frm_P_PuntoBarra.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(TareaAsincrona_GrabarDatos_Completed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public INTERNO_ValorDevuelto_Modelo ValidarDatos()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Si el codigo esta vacio y se intenta buscar el ultimo numerico y llego al limite de base de datos
|
||||||
|
if (g_frm_P_PuntoBarra.Exferia_TextBox_Codigo.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = Buscar_CodigoSiguiente();
|
||||||
|
|
||||||
|
if (mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = mdl_INTERNO_ValorDevuelto_Modelo.Mensaje;
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = g_frm_P_PuntoBarra.Exferia_TextBox_Codigo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// El codigo no puede estar Repetido
|
||||||
|
if (mdl_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
if (g_lst_HPV_PuntosBarra != null && g_lst_HPV_PuntosBarra.Count > 0)
|
||||||
|
{
|
||||||
|
long lng_id = g_mdl_HPV_PuntosBarra != null ? g_mdl_HPV_PuntosBarra.id : 0;
|
||||||
|
|
||||||
|
if (g_lst_HPV_PuntosBarra.Where(m => !m.id.Equals(lng_id) && m.codigo.Equals(g_frm_P_PuntoBarra.Exferia_TextBox_Codigo.Text)).FirstOrDefault() != null)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_REPETIDO(g_frm_P_PuntoBarra.Exferia_Label_Codigo.Text);
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = g_frm_P_PuntoBarra.Exferia_TextBox_Codigo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// La descripcion no puede estar vacia
|
||||||
|
if (mdl_ValorDevuelto_Modelo.TodoCorrecto && g_frm_P_PuntoBarra.Exferia_TextBox_Descripcion.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_GENERAL_VALIDACIONES_VACIO(g_frm_P_PuntoBarra.Exferia_Label_Descripcion.Text);
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = g_frm_P_PuntoBarra.Exferia_TextBox_Descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_VALIDARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(ValidarDatos));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_VALIDARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private INTERNO_ValorDevuelto_Modelo GrabarDatos_Final()
|
||||||
|
{
|
||||||
|
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
//Iniciar transaccion
|
||||||
|
using (TransactionScope transaccion_SQL = new TransactionScope(TransactionScopeOption.Required))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (g_mdl_HPV_PuntosBarra == null)
|
||||||
|
{
|
||||||
|
g_mdl_HPV_PuntosBarra = new HPV_PuntosBarra();
|
||||||
|
g_mdl_HPV_PuntosBarra.id = -1;
|
||||||
|
|
||||||
|
//ver si hay que poner otro id .........................
|
||||||
|
if (g_lst_HPV_PuntosBarra != null)
|
||||||
|
{
|
||||||
|
List<long> lst_idSinGrabar = g_lst_HPV_PuntosBarra.Where(m => m.id < 0).Select(m => m.id).ToList();
|
||||||
|
if (lst_idSinGrabar.Count > 0)
|
||||||
|
{
|
||||||
|
g_mdl_HPV_PuntosBarra.id = lst_idSinGrabar.Min() - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//.......................................................
|
||||||
|
}
|
||||||
|
|
||||||
|
//Codigo
|
||||||
|
g_mdl_HPV_PuntosBarra.codigo = g_frm_P_PuntoBarra.Exferia_TextBox_Codigo.Text;
|
||||||
|
//Descripcion
|
||||||
|
g_mdl_HPV_PuntosBarra.descripcion = g_frm_P_PuntoBarra.Exferia_TextBox_Descripcion.Text;
|
||||||
|
|
||||||
|
//Asignar el idEmpresa...........................................................................................
|
||||||
|
if ((g_mdl_HPV_Salas != null ? g_mdl_HPV_Salas.idEmpresa : -1) != -1)
|
||||||
|
{
|
||||||
|
g_mdl_HPV_PuntosBarra.idEmpresa = g_mdl_HPV_Salas.idEmpresa;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Buscar el idEmpresa que Corresponda
|
||||||
|
g_mdl_HPV_PuntosBarra.idEmpresa = Datos_Generales.GEN_Empresas_Devolver_IdEmpresa_AGrabar(g_frm_P_PuntoBarra.P_Base_ValoresGenerales.lng_idEmpresa, nameof(HPV_PuntosBarra));
|
||||||
|
}
|
||||||
|
|
||||||
|
//idSala
|
||||||
|
g_mdl_HPV_PuntosBarra.idSala = g_mdl_HPV_Salas.id;
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo = g_obj_HPV_PuntosBarra_Datos.Grabar(g_mdl_HPV_PuntosBarra);
|
||||||
|
|
||||||
|
if (mdl_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
transaccion_SQL.Complete();
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
|
||||||
|
//Obtener el modelo que se acaba de grabar
|
||||||
|
g_mdl_HPV_PuntosBarra = g_obj_HPV_PuntosBarra_Datos.Obtener(mdl_ValorDevuelto_Modelo.Id);
|
||||||
|
|
||||||
|
g_frm_P_PuntoBarra.P_Base_id = g_mdl_HPV_PuntosBarra.id;
|
||||||
|
|
||||||
|
#region SINCRONIZACION PARA TERMINALES
|
||||||
|
Sincronizar_Registros obj_Sincronizar_Registros = new Sincronizar_Registros();
|
||||||
|
|
||||||
|
//HPV_PuntosBarra
|
||||||
|
obj_Sincronizar_Registros.Sincronizar_Actualizar(new Sincronizar_Actualizar_Modelo(g_mdl_HPV_PuntosBarra,
|
||||||
|
g_frm_P_PuntoBarra.P_Base_ValoresGenerales.lng_idEmpresa,
|
||||||
|
nameof(HPV_PuntosBarra)));
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
mdl_ValorDevuelto_Modelo.Objeto = g_lst_HPV_PuntosBarra;
|
||||||
|
|
||||||
|
//Termino Transaccion
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(GrabarDatos_Final));
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_GRABARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
//Termino Transaccion
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar
|
||||||
|
public void BorrarDatos()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Preguntar si esta Seguro de Borrar
|
||||||
|
if (Mensajes.MostrarMensaje_Pregunta(Mensajes.G_STR_MENSAJES_GENERAL_PREGUNTA_BORRAR()))
|
||||||
|
{
|
||||||
|
g_frm_P_PuntoBarra.Enabled = false;
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando(Mensajes.G_STR_ESPERANDO_BORRANDODATOS());
|
||||||
|
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_BorrarDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_BorrarDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_BorrarDatos.RunWorkerAsync();
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_frm_P_PuntoBarra.Enabled = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(BorrarDatos));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TareaAsincrona_BorrarDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo = BorrarDatos_Final();
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_BorrarDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_PuntoBarra.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Mensaje.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (g_frm_P_PuntoBarra.P_Base_PantallaOrigen != null)
|
||||||
|
{
|
||||||
|
List<object> lst_obj = new List<object>();
|
||||||
|
mdl_ValorDevuelto_Modelo_Resultado.Listado_Id = new List<long>();
|
||||||
|
mdl_ValorDevuelto_Modelo_Resultado.Listado_Id.Add(mdl_ValorDevuelto_Modelo_Resultado.Id);
|
||||||
|
lst_obj.Add(g_frm_P_PuntoBarra.g_mdl_PRV_OpcionesDetalle.opcion);
|
||||||
|
lst_obj.Add(mdl_ValorDevuelto_Modelo_Resultado.Listado_Id);
|
||||||
|
|
||||||
|
g_frm_P_PuntoBarra.P_Base_PantallaOrigen.P_Base_ActualizarRegistro_ConObjeto(lst_obj, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_frm_P_PuntoBarra.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(TareaAsincrona_BorrarDatos_Completed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private INTERNO_ValorDevuelto_Modelo BorrarDatos_Final()
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo = g_obj_HPV_PuntosBarra_Datos.Borrar(g_mdl_HPV_PuntosBarra != null ? g_mdl_HPV_PuntosBarra.id : -1);
|
||||||
|
|
||||||
|
if (mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
#region SINCRONIZACION PARA TERMINALES
|
||||||
|
Sincronizar_Registros obj_Sincronizar_Registros = new Sincronizar_Registros();
|
||||||
|
|
||||||
|
//HPV_PuntosBarra
|
||||||
|
obj_Sincronizar_Registros.Sincronizar_Borrar(new Sincronizar_Borrar_Modelo(g_mdl_HPV_PuntosBarra.id.ToString(),
|
||||||
|
g_frm_P_PuntoBarra.P_Base_ValoresGenerales.lng_idEmpresa,
|
||||||
|
nameof(HPV_PuntosBarra)));
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_PuntoBarra_Controladora) + "/" + nameof(BorrarDatos_Final));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,626 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Formularios;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_HotelPuntoVenta._1_Datos;
|
||||||
|
using Exferia_HotelPuntoVenta._3_Vistas.Listados;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Transactions;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.Controladoras
|
||||||
|
{
|
||||||
|
public class P_Tarifas_Controladora
|
||||||
|
{
|
||||||
|
#region Variables Generales
|
||||||
|
private P_Tarifas g_frm_P_Tarifas = null;//Variable que enlaza con la pantalla asociada
|
||||||
|
private PE_Esperando g_frm_PE_Esperando;//Pantalla de Espera, para cuando se ejecutan tareas pesadas como cargar, guardar, etc
|
||||||
|
|
||||||
|
//Clases de Negocio Necesarias para la carga de datos ...............................................................
|
||||||
|
private HPV_Tarifas_Datos g_obj_HPV_Tarifas_Datos = new HPV_Tarifas_Datos();
|
||||||
|
|
||||||
|
public List<INTERNO_ABS_Listado_ColumnasDatos_Modelo> g_lst_INTERNO_ABS_Listado_ColumnasDatos_Modelo_Columnas;
|
||||||
|
|
||||||
|
public List<dynamic> g_lst_ListadoRegistros = null;
|
||||||
|
public List<dynamic> g_lst_ListadoRegistros_Filtrados = null;
|
||||||
|
|
||||||
|
//Obtencion de los valores de los registros desde base de datos
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_Obtener_ListadoCompleto_BaseDatos;
|
||||||
|
public bool g_bol_Obtencion_ListadoCompleto_BaseDatos_Termino = false;
|
||||||
|
|
||||||
|
//Tarea Asincrona para la Rellenar DataGridView
|
||||||
|
private BackgroundWorker g_obj_TareaAsincrona_Rellenar_DataGrid;
|
||||||
|
public bool g_bol_CancelarTareaAsincrona_Rellenar_DataGrid = false;
|
||||||
|
|
||||||
|
//Filtrado del Listado
|
||||||
|
public List<string> g_lst_ColumnasAMostrar = new List<string>();
|
||||||
|
public ABS_Listado_HPV_Tarifas g_obj_ABS_Listado_HPV_Tarifas = new ABS_Listado_HPV_Tarifas();
|
||||||
|
public Dictionary<string, object> g_dct_ListadoFiltros = new Dictionary<string, object>();
|
||||||
|
private int g_int_TotalRegistrosInsertados = 0;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
// Constructor de la clase Logica
|
||||||
|
public P_Tarifas_Controladora(P_Tarifas _frm_P_Tarifas)
|
||||||
|
{
|
||||||
|
g_frm_P_Tarifas = _frm_P_Tarifas;
|
||||||
|
|
||||||
|
//(Tarea Asincrona) Obtener Listado de BaseDatos ####################################################################
|
||||||
|
g_obj_TareaAsincrona_Obtener_ListadoCompleto_BaseDatos = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_Obtener_ListadoCompleto_BaseDatos.DoWork += new DoWorkEventHandler(TareaAsincrona_Obtener_ListadoCompleto_BaseDatos_DoWork);
|
||||||
|
g_obj_TareaAsincrona_Obtener_ListadoCompleto_BaseDatos.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_Obtener_ListadoCompleto_BaseDatos_Completed);
|
||||||
|
g_obj_TareaAsincrona_Obtener_ListadoCompleto_BaseDatos.WorkerReportsProgress = false;
|
||||||
|
g_obj_TareaAsincrona_Obtener_ListadoCompleto_BaseDatos.WorkerSupportsCancellation = true;
|
||||||
|
//#####################################################################################################
|
||||||
|
|
||||||
|
//(Tarea Asincrona) Rellenar Listado Incluir Registros ####################################################################
|
||||||
|
g_obj_TareaAsincrona_Rellenar_DataGrid = new BackgroundWorker();
|
||||||
|
g_obj_TareaAsincrona_Rellenar_DataGrid.DoWork += new DoWorkEventHandler(TareaAsincrona_Rellenar_DataGrid_DoWork);
|
||||||
|
g_obj_TareaAsincrona_Rellenar_DataGrid.ProgressChanged += new ProgressChangedEventHandler(TareaAsincrona_Rellenar_DataGrid_ProgressChanged);
|
||||||
|
g_obj_TareaAsincrona_Rellenar_DataGrid.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_Rellenar_DataGrid_Completed);
|
||||||
|
g_obj_TareaAsincrona_Rellenar_DataGrid.WorkerReportsProgress = true;
|
||||||
|
g_obj_TareaAsincrona_Rellenar_DataGrid.WorkerSupportsCancellation = true;
|
||||||
|
//#####################################################################################################
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Obtener Listado Completo de base de datos
|
||||||
|
public void Obtener_ListadoCompleto_BaseDatos()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando();
|
||||||
|
g_frm_PE_Esperando.TopMost = true;
|
||||||
|
g_frm_PE_Esperando.Show();
|
||||||
|
|
||||||
|
//Si se estaba ejecutando lo paro
|
||||||
|
while (g_obj_TareaAsincrona_Obtener_ListadoCompleto_BaseDatos.IsBusy)
|
||||||
|
Application.DoEvents();
|
||||||
|
|
||||||
|
g_bol_Obtencion_ListadoCompleto_BaseDatos_Termino = false;
|
||||||
|
|
||||||
|
//Empezar TareaAsincrona
|
||||||
|
g_obj_TareaAsincrona_Obtener_ListadoCompleto_BaseDatos.RunWorkerAsync(g_lst_ColumnasAMostrar);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
g_bol_Obtencion_ListadoCompleto_BaseDatos_Termino = true;
|
||||||
|
|
||||||
|
if (!g_frm_PE_Esperando.IsDisposed)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
protected void TareaAsincrona_Obtener_ListadoCompleto_BaseDatos_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
List<dynamic> lst_ValorDevuelto = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<string> lst_ColumnasAMostrar = (List<string>)e.Argument;
|
||||||
|
|
||||||
|
//Pasamos los parametros al metodo y lo ejecutamos
|
||||||
|
lst_ValorDevuelto = g_obj_HPV_Tarifas_Datos.Obtener_Listado(g_frm_P_Tarifas.P_Base_ValoresGenerales.lng_idEmpresa, g_frm_P_Tarifas.P_Base_ValoresGenerales.EjercicioActivo.id, lst_ColumnasAMostrar, null, null);
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException)
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = lst_ValorDevuelto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected void TareaAsincrona_Obtener_ListadoCompleto_BaseDatos_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!g_frm_PE_Esperando.IsDisposed)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
g_bol_Obtencion_ListadoCompleto_BaseDatos_Termino = true;
|
||||||
|
|
||||||
|
if (e.Cancelled == false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros = (List<dynamic>)e.Result;
|
||||||
|
|
||||||
|
|
||||||
|
Rellenar_DataGridView();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Rellenar DataGridView
|
||||||
|
public void Rellenar_DataGridView()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_bol_CancelarTareaAsincrona_Rellenar_DataGrid = true;
|
||||||
|
|
||||||
|
while (g_obj_TareaAsincrona_Rellenar_DataGrid.IsBusy)
|
||||||
|
Application.DoEvents();
|
||||||
|
|
||||||
|
g_bol_CancelarTareaAsincrona_Rellenar_DataGrid = false;
|
||||||
|
|
||||||
|
//Vaciar el Listado
|
||||||
|
g_frm_P_Tarifas.Exferia_DataGridView_Listado.Rows.Clear();
|
||||||
|
g_int_TotalRegistrosInsertados = 0;
|
||||||
|
g_frm_P_Tarifas.Exferia_BarraProgreso_Listado.Exferia_BarraProgreso_Total = 0;
|
||||||
|
g_frm_P_Tarifas.Exferia_BarraProgreso_Listado.Exferia_BarraProgreso_Actualizar = 0;
|
||||||
|
|
||||||
|
//parametros para Filtrar
|
||||||
|
List<object> lst_Argumentos = new List<object>();
|
||||||
|
|
||||||
|
//Orden Actual
|
||||||
|
if (g_frm_P_Tarifas.Exferia_ComboBox_OrdenListado.SelectedItem != null && ((INTERNO_ComboBox_Modelo)g_frm_P_Tarifas.Exferia_ComboBox_OrdenListado.SelectedItem).Identificador.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
lst_Argumentos.Add(((INTERNO_ComboBox_Modelo)g_frm_P_Tarifas.Exferia_ComboBox_OrdenListado.SelectedItem).Identificador);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lst_Argumentos.Add(g_obj_ABS_Listado_HPV_Tarifas.ORDENACION_NOMBRECOLUMNA_PORDEFECTO());
|
||||||
|
}
|
||||||
|
|
||||||
|
//Filtrados
|
||||||
|
lst_Argumentos.Add(g_frm_P_Tarifas.Exferia_CheckBox_Filtrado_Clientes.Checked);
|
||||||
|
lst_Argumentos.Add(g_frm_P_Tarifas.Exferia_CheckBox_Filtrado_AgrupacionesClientes.Checked);
|
||||||
|
lst_Argumentos.Add(g_frm_P_Tarifas.Exferia_CheckBox_Filtrado_PLV.Checked);
|
||||||
|
lst_Argumentos.Add(g_frm_P_Tarifas.Exferia_CheckBox_Filtrado_AgrupacionesPLV.Checked);
|
||||||
|
|
||||||
|
//Lllamra a la tarea asincrona
|
||||||
|
g_obj_TareaAsincrona_Rellenar_DataGrid.RunWorkerAsync(lst_Argumentos);
|
||||||
|
}
|
||||||
|
catch (Control_Errores ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Tarifas_Controladora) + "/" + nameof(Rellenar_DataGridView));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSLISTADO());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log(ex.Message, nameof(P_Tarifas_Controladora) + "/" + nameof(Rellenar_DataGridView));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_CARGARDATOSLISTADO());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_Rellenar_DataGrid_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Datos Recibidos ..................................................
|
||||||
|
List<object> lst_Argumentos = (List<object>)e.Argument;
|
||||||
|
|
||||||
|
//Orden Actual
|
||||||
|
string str_Ordenacion_PorDefecto = (string)lst_Argumentos[0];
|
||||||
|
|
||||||
|
//Filtrado
|
||||||
|
bool bol_Filtrado_Cliente = (bool)lst_Argumentos[1];
|
||||||
|
bool bol_Filtrado_AgrupacionCliente = (bool)lst_Argumentos[2];
|
||||||
|
bool bol_Filtrado_PLV = (bool)lst_Argumentos[3];
|
||||||
|
bool bol_Filtrado_AgrupacionPLV = (bool)lst_Argumentos[4];
|
||||||
|
|
||||||
|
//Listado de la tabla
|
||||||
|
g_lst_ListadoRegistros_Filtrados = null;
|
||||||
|
|
||||||
|
//Filtrar #############################################
|
||||||
|
if (g_dct_ListadoFiltros.Count > 0)
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros_Filtrados = g_lst_ListadoRegistros;
|
||||||
|
|
||||||
|
//Filtros Avanzados
|
||||||
|
if (g_dct_ListadoFiltros != null && g_dct_ListadoFiltros.Count > 0)
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros_Filtrados = Funciones_Listado.Filtrar_Listado(g_lst_ListadoRegistros_Filtrados, g_obj_ABS_Listado_HPV_Tarifas, g_dct_ListadoFiltros);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros_Filtrados = g_lst_ListadoRegistros;
|
||||||
|
}
|
||||||
|
//#####################################################
|
||||||
|
|
||||||
|
if (g_lst_ListadoRegistros_Filtrados != null)
|
||||||
|
{
|
||||||
|
//Añadir los filtros de Cliente/Agrupacion cliente
|
||||||
|
if (bol_Filtrado_Cliente && !bol_Filtrado_AgrupacionCliente)
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros_Filtrados = g_lst_ListadoRegistros_Filtrados.Where(m => m.GetType().GetProperty(nameof(INTERNO_HPV_Tarifas_Listado_Modelo.idCliente)).GetValue(m, null) != null).ToList();
|
||||||
|
}
|
||||||
|
else if (!bol_Filtrado_Cliente && bol_Filtrado_AgrupacionCliente)
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros_Filtrados = g_lst_ListadoRegistros_Filtrados.Where(m => m.GetType().GetProperty(nameof(INTERNO_HPV_Tarifas_Listado_Modelo.idAgrupacionClienteLinea)).GetValue(m, null) != null).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Añadir los filtros de PLV/Agrupacion PLV
|
||||||
|
if (bol_Filtrado_PLV && !bol_Filtrado_AgrupacionPLV)
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros_Filtrados = g_lst_ListadoRegistros_Filtrados.Where(m => m.GetType().GetProperty(nameof(INTERNO_HPV_Tarifas_Listado_Modelo.idPLV)).GetValue(m, null) != null).ToList();
|
||||||
|
}
|
||||||
|
else if (!bol_Filtrado_PLV && bol_Filtrado_AgrupacionPLV)
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros_Filtrados = g_lst_ListadoRegistros_Filtrados.Where(m => m.GetType().GetProperty(nameof(INTERNO_HPV_Tarifas_Listado_Modelo.idAgrupacionPLVLinea)).GetValue(m, null) != null).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Ordenar el Listado ##################
|
||||||
|
if (str_Ordenacion_PorDefecto.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
//Descendente
|
||||||
|
if (g_frm_P_Tarifas.Exferia_Button_OrdenListado.Tag.ToString().Equals("1"))
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros_Filtrados = g_lst_ListadoRegistros_Filtrados.OrderByDescending(m => m.GetType().GetProperty(str_Ordenacion_PorDefecto).GetValue(m, null)).ToList();
|
||||||
|
}
|
||||||
|
//Ascendente
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros_Filtrados = g_lst_ListadoRegistros_Filtrados.OrderBy(m => m.GetType().GetProperty(str_Ordenacion_PorDefecto).GetValue(m, null)).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//#####################################
|
||||||
|
|
||||||
|
g_frm_P_Tarifas.Listado_Ordenar_DataGridView();
|
||||||
|
g_frm_P_Tarifas.Exferia_BarraProgreso_Listado.Exferia_BarraProgreso_Total = g_lst_ListadoRegistros_Filtrados.Count;
|
||||||
|
|
||||||
|
object[] row;
|
||||||
|
foreach (dynamic obj_Dinamico in g_lst_ListadoRegistros_Filtrados)
|
||||||
|
{
|
||||||
|
//Se Cancelo la tarea asincrona ---------------------------
|
||||||
|
if (g_bol_CancelarTareaAsincrona_Rellenar_DataGrid)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Añadir Fila con Columnas .............................
|
||||||
|
row = Funciones_Listado.Transformar_Dynamic_A_Row(obj_Dinamico, g_obj_ABS_Listado_HPV_Tarifas);
|
||||||
|
|
||||||
|
//Llamar al Progress
|
||||||
|
g_int_TotalRegistrosInsertados += 1;
|
||||||
|
|
||||||
|
((BackgroundWorker)sender).ReportProgress(1, row);
|
||||||
|
|
||||||
|
//Application.DoEvents();
|
||||||
|
Thread.Sleep(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
g_bol_CancelarTareaAsincrona_Rellenar_DataGrid = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Tarifas_Controladora) + "/" + nameof(TareaAsincrona_Rellenar_DataGrid_DoWork));
|
||||||
|
}
|
||||||
|
catch (Control_Errores ex)
|
||||||
|
{
|
||||||
|
g_bol_CancelarTareaAsincrona_Rellenar_DataGrid = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Tarifas_Controladora) + "/" + nameof(TareaAsincrona_Rellenar_DataGrid_DoWork));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
g_bol_CancelarTareaAsincrona_Rellenar_DataGrid = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log(ex.Message, ex, nameof(P_Tarifas_Controladora) + "/" + nameof(TareaAsincrona_Rellenar_DataGrid_DoWork));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_Rellenar_DataGrid_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_frm_P_Tarifas.Exferia_DataGridView_Listado.Rows.Add((object[])e.UserState);
|
||||||
|
|
||||||
|
g_frm_P_Tarifas.Exferia_BarraProgreso_Listado.Exferia_BarraProgreso_Actualizar = g_int_TotalRegistrosInsertados;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_Rellenar_DataGrid_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{ }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Actualizar registros grabados desde la pantalla de detalles
|
||||||
|
public void Linea_Actualizar_Registro(long _lng_idLinea, G_ENUM_TIPOACCION _enum_TipoAccion, bool _bol_RecargarTrazabilidad)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Buscar el Campo Clave
|
||||||
|
string str_NombreCampoClave = "id";
|
||||||
|
INTERNO_ABS_Listado_ColumnasDatos_Modelo mdl_INTERNO_ABS_Listado_ColumnasDatos_Modelo = g_obj_ABS_Listado_HPV_Tarifas.LISTADO_COLUMNAS().Values.Where(m => m.ColumnaClave).FirstOrDefault();
|
||||||
|
if (mdl_INTERNO_ABS_Listado_ColumnasDatos_Modelo != null)
|
||||||
|
{
|
||||||
|
str_NombreCampoClave = mdl_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Descripcion_Interna;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<dynamic> lst_Listado_Modelo = g_obj_HPV_Tarifas_Datos.Obtener_RegistroListado(((g_frm_P_Tarifas.P_Base_ValoresGenerales != null) ? g_frm_P_Tarifas.P_Base_ValoresGenerales.lng_idEmpresa : -1),
|
||||||
|
((g_frm_P_Tarifas.P_Base_ValoresGenerales != null && g_frm_P_Tarifas.P_Base_ValoresGenerales.EjercicioActivo != null) ? g_frm_P_Tarifas.P_Base_ValoresGenerales.EjercicioActivo.id : -1),
|
||||||
|
g_lst_ColumnasAMostrar,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
_lng_idLinea,
|
||||||
|
null);
|
||||||
|
|
||||||
|
if (lst_Listado_Modelo != null)
|
||||||
|
{
|
||||||
|
dynamic dnm_Listado_Modelo = lst_Listado_Modelo.ToList().FirstOrDefault();
|
||||||
|
|
||||||
|
//Actualizar primero el List<> General ################################################################################
|
||||||
|
if (g_lst_ListadoRegistros != null && g_lst_ListadoRegistros.Count > 0)
|
||||||
|
{
|
||||||
|
dynamic dnm_Listado_Modelo_BUSQUEDA = g_lst_ListadoRegistros.Where(m => m.id.Equals(dnm_Listado_Modelo.GetType().GetProperty(str_NombreCampoClave).GetValue(dnm_Listado_Modelo, null))).FirstOrDefault();
|
||||||
|
if (dnm_Listado_Modelo_BUSQUEDA != null)
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros[g_lst_ListadoRegistros.FindIndex(m => m.id.Equals(dnm_Listado_Modelo.GetType().GetProperty(str_NombreCampoClave).GetValue(dnm_Listado_Modelo, null)))] = dnm_Listado_Modelo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros.Add(dnm_Listado_Modelo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (g_lst_ListadoRegistros == null)
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros = new List<dynamic>();
|
||||||
|
}
|
||||||
|
|
||||||
|
g_lst_ListadoRegistros.Add(dnm_Listado_Modelo);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Actualizar el DataGridView #####################################################################################
|
||||||
|
//Modificar
|
||||||
|
if (_enum_TipoAccion.Equals(G_ENUM_TIPOACCION.INT_MODIFICAR))
|
||||||
|
{
|
||||||
|
DataGridViewRow row = g_frm_P_Tarifas.Exferia_DataGridView_Listado.Rows
|
||||||
|
.Cast<DataGridViewRow>()
|
||||||
|
.Where(r => r.Cells[str_NombreCampoClave].Value.Equals(_lng_idLinea)).FirstOrDefault();
|
||||||
|
|
||||||
|
if (row != null)//Modificada
|
||||||
|
{
|
||||||
|
//Actualzar grid
|
||||||
|
g_frm_P_Tarifas.Exferia_DataGridView_Listado.Rows[row.Index].SetValues(Funciones_Listado.Transformar_Dynamic_A_Row(dnm_Listado_Modelo, g_obj_ABS_Listado_HPV_Tarifas));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Insertar
|
||||||
|
else if (_enum_TipoAccion.Equals(G_ENUM_TIPOACCION.INT_INSERTAR))
|
||||||
|
{
|
||||||
|
g_frm_P_Tarifas.Exferia_DataGridView_Listado.Rows.Add(Funciones_Listado.Transformar_Dynamic_A_Row(dnm_Listado_Modelo, g_obj_ABS_Listado_HPV_Tarifas));
|
||||||
|
|
||||||
|
//Sumar Cantidad de Lineas Insertadas
|
||||||
|
g_frm_P_Tarifas.Exferia_BarraProgreso_Listado.Exferia_BarraProgreso_Total += 1;
|
||||||
|
g_frm_P_Tarifas.Exferia_BarraProgreso_Listado.Exferia_BarraProgreso_Actualizar = g_int_TotalRegistrosInsertados + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Tarifas_Controladora) + "/" + nameof(Linea_Actualizar_Registro));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public void Linea_Borrar_Registro(List<long> _lst_idLinea)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Buscar el Campo Clave
|
||||||
|
string str_NombreCampoClave = "id";
|
||||||
|
INTERNO_ABS_Listado_ColumnasDatos_Modelo mdl_INTERNO_ABS_Listado_ColumnasDatos_Modelo = g_obj_ABS_Listado_HPV_Tarifas.LISTADO_COLUMNAS().Values.Where(m => m.ColumnaClave).FirstOrDefault();
|
||||||
|
if (mdl_INTERNO_ABS_Listado_ColumnasDatos_Modelo != null)
|
||||||
|
{
|
||||||
|
str_NombreCampoClave = mdl_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Descripcion_Interna;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Borrar primero el List<> General ################################################################################
|
||||||
|
if (g_lst_ListadoRegistros != null && g_lst_ListadoRegistros.Count > 0)
|
||||||
|
{
|
||||||
|
List<dynamic> lst_ListadoRegistros_BUSQUEDA = g_lst_ListadoRegistros.Where(m => _lst_idLinea.Contains(m.GetType().GetProperty(str_NombreCampoClave).GetValue(m, null))).ToList();
|
||||||
|
if (lst_ListadoRegistros_BUSQUEDA != null && lst_ListadoRegistros_BUSQUEDA.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (dynamic dnm_RegistroABorrar in lst_ListadoRegistros_BUSQUEDA)
|
||||||
|
{
|
||||||
|
g_lst_ListadoRegistros.Remove(dnm_RegistroABorrar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Borrar del DataGridView
|
||||||
|
List<DataGridViewRow> lst_DataGridViewRow = g_frm_P_Tarifas.Exferia_DataGridView_Listado.Rows
|
||||||
|
.Cast<DataGridViewRow>()
|
||||||
|
.Where(r => _lst_idLinea.Contains(long.Parse(r.Cells[str_NombreCampoClave].Value.ToString()))).ToList();
|
||||||
|
|
||||||
|
if (lst_DataGridViewRow != null && lst_DataGridViewRow.Count > 0)
|
||||||
|
{
|
||||||
|
//Borrar del Grid
|
||||||
|
foreach (DataGridViewRow dgvr_Borrar in lst_DataGridViewRow)
|
||||||
|
{
|
||||||
|
g_frm_P_Tarifas.Exferia_DataGridView_Listado.Rows.Remove(dgvr_Borrar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Restar Cantidad de Lineas Borradas
|
||||||
|
g_frm_P_Tarifas.Exferia_BarraProgreso_Listado.Exferia_BarraProgreso_Total -= _lst_idLinea.Count();
|
||||||
|
g_frm_P_Tarifas.Exferia_BarraProgreso_Listado.Exferia_BarraProgreso_Actualizar = g_int_TotalRegistrosInsertados - _lst_idLinea.Count();
|
||||||
|
|
||||||
|
g_frm_P_Tarifas.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{ }
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Tarifas_Controladora) + "/" + nameof(Linea_Borrar_Registro));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Borrar Datos en Base Datos Linea
|
||||||
|
public void BorrarDatos_Linea(List<long> _lst_idLinea_ABorrar)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Preguntar si esta Seguro de Borrar
|
||||||
|
if (Mensajes.MostrarMensaje_Pregunta(Mensajes.G_STR_MENSAJES_GENERAL_PREGUNTA_BORRAR()))
|
||||||
|
{
|
||||||
|
g_frm_P_Tarifas.Enabled = false;
|
||||||
|
g_frm_PE_Esperando = new PE_Esperando(Mensajes.G_STR_ESPERANDO_BORRANDODATOS());
|
||||||
|
|
||||||
|
List<object> lst_Argumentos = new List<object>();
|
||||||
|
lst_Argumentos.Add(_lst_idLinea_ABorrar);
|
||||||
|
|
||||||
|
BackgroundWorker obj_TareaAsincrona_Borrar_Linea = new BackgroundWorker();
|
||||||
|
obj_TareaAsincrona_Borrar_Linea.DoWork += new DoWorkEventHandler(TareaAsincrona_Borrar_Linea_DoWork);
|
||||||
|
obj_TareaAsincrona_Borrar_Linea.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_Borrar_Linea_Completed);
|
||||||
|
obj_TareaAsincrona_Borrar_Linea.RunWorkerAsync(lst_Argumentos);
|
||||||
|
|
||||||
|
g_frm_PE_Esperando.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_frm_P_Tarifas.Enabled = true;
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Tarifas_Controladora) + "/" + nameof(BorrarDatos_Linea));
|
||||||
|
Mensajes.MostrarMensaje(Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TareaAsincrona_Borrar_Linea_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
|
||||||
|
//Iniciar transaccion
|
||||||
|
using (TransactionScope transaccion_SQL = new TransactionScope(TransactionScopeOption.Required, TimeSpan.MaxValue))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Argumentos
|
||||||
|
List<object> lst_Argumentos = (List<object>)e.Argument;
|
||||||
|
List<long> lst_idLinea_ABorrar = (List<long>)lst_Argumentos[0];
|
||||||
|
|
||||||
|
// Borrar
|
||||||
|
mdl_ValorDevuelto_Modelo = BorrarDatos_Final_Linea(lst_idLinea_ABorrar);
|
||||||
|
|
||||||
|
//Si esta todo Correcto cierro transaccion
|
||||||
|
if (mdl_ValorDevuelto_Modelo.TodoCorrecto)
|
||||||
|
{
|
||||||
|
mdl_ValorDevuelto_Modelo.Listado_Id = lst_idLinea_ABorrar;
|
||||||
|
mdl_ValorDevuelto_Modelo.TipoAccion = G_ENUM_TIPOACCION.INT_ELIMINAR;
|
||||||
|
transaccion_SQL.Complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
}
|
||||||
|
catch (ThreadAbortException ex)
|
||||||
|
{
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Tarifas_Controladora) + "/" + nameof(TareaAsincrona_Borrar_Linea_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
transaccion_SQL.Dispose();
|
||||||
|
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Tarifas_Controladora) + "/" + nameof(TareaAsincrona_Borrar_Linea_DoWork));
|
||||||
|
|
||||||
|
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
e.Result = mdl_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TareaAsincrona_Borrar_Linea_Completed(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_frm_PE_Esperando != null)
|
||||||
|
{
|
||||||
|
g_frm_PE_Esperando.Close();
|
||||||
|
g_frm_PE_Esperando = null;
|
||||||
|
}
|
||||||
|
g_frm_P_Tarifas.Enabled = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
|
||||||
|
|
||||||
|
//Mostrar si tuviera algun mensaje
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
|
||||||
|
{
|
||||||
|
if (mdl_ValorDevuelto_Modelo_Resultado.Mensaje.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Devolver al Listado el Row Borrar
|
||||||
|
List<object> lst_obj = new List<object>();
|
||||||
|
lst_obj.Add(g_obj_ABS_Listado_HPV_Tarifas.DATOS_OPCION().opcion);
|
||||||
|
lst_obj.Add(mdl_ValorDevuelto_Modelo_Resultado.Listado_Id);
|
||||||
|
|
||||||
|
g_frm_P_Tarifas.P_Base_ActualizarRegistro_ConObjeto(lst_obj, mdl_ValorDevuelto_Modelo_Resultado.TipoAccion);
|
||||||
|
|
||||||
|
g_frm_P_Tarifas.P_Base_SeModificoDatosPantalla = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Tarifas_Controladora) + "/" + nameof(TareaAsincrona_Borrar_Linea_Completed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private INTERNO_ValorDevuelto_Modelo BorrarDatos_Final_Linea(List<long> _lst_idLinea_ABorrar)
|
||||||
|
{
|
||||||
|
INTERNO_ValorDevuelto_Modelo mdl_INTERNO_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Pasamos los parametros al metodo y lo ejecutamos
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo = g_obj_HPV_Tarifas_Datos.Borrar(_lst_idLinea_ABorrar);
|
||||||
|
}
|
||||||
|
catch (Control_Errores)
|
||||||
|
{
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Control_Errores.Errores_Log("", ex, nameof(P_Tarifas_Controladora) + "/" + nameof(BorrarDatos_Final_Linea));
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.TodoCorrecto = false;
|
||||||
|
mdl_INTERNO_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_MENSAJES_GENERAL_ERROR_BORRARDATOSPANTALLA();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mdl_INTERNO_ValorDevuelto_Modelo;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,147 @@
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.ControlesPersonalizados_DentroPaneles
|
||||||
|
{
|
||||||
|
partial class CTU_P_PLV_SalasPrecios
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Variable del diseñador necesaria.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Limpiar los recursos que se estén usando.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true si los recursos administrados se deben desechar; false en caso contrario.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Código generado por el Diseñador de componentes
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Método necesario para admitir el Diseñador. No se puede modificar
|
||||||
|
/// el contenido de este método con el editor de código.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Precio = new Exferia_Controles.Exferia_Label();
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio = new Exferia_Controles.Exferia_TextBox();
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento = new Exferia_Controles.Exferia_TextBox();
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Descuento = new Exferia_Controles.Exferia_Label();
|
||||||
|
this.ex_lbl_Sala = new Exferia_Controles.Exferia_Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ex_lbl_CTU_P_PLV_SalasPrecios_Precio
|
||||||
|
//
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Precio.AutoSize = true;
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Precio.Location = new System.Drawing.Point(3, 26);
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Precio.Name = "ex_lbl_CTU_P_PLV_SalasPrecios_Precio";
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Precio.Size = new System.Drawing.Size(37, 13);
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Precio.TabIndex = 1;
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Precio.Text = "Precio";
|
||||||
|
//
|
||||||
|
// ex_txt_CTU_P_PLV_SalasPrecios_Precio
|
||||||
|
//
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_BordeColor_Foco = System.Drawing.Color.Red;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_BordeColor_Normal = System.Drawing.Color.Black;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_Fondo = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_MaxLength = 18;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_Multiline = false;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_NoBloquear = true;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_Obligatorio = false;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_PasswordChar = '\0';
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_ReadOnly = false;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_ScrollBars = System.Windows.Forms.ScrollBars.None;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_SelectionLength = 0;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_SelectionStart = 0;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_TabStop_Txt = true;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_Texto_Inicial = "";
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_Tipo_Decimal_Decimales = 3;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_Tipo_Decimal_Enteros = 16;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_Tipos = Exferia_Aplicacion.General.Enumerados.G_ENUM_TEXTBOX_TIPODATO.Decimales;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_UseSystemPasswordChar = false;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Location = new System.Drawing.Point(45, 22);
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Name = "ex_txt_CTU_P_PLV_SalasPrecios_Precio";
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Padding = new System.Windows.Forms.Padding(2);
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Size = new System.Drawing.Size(122, 22);
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.TabIndex = 2;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_Evento_KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ex_txt_CTU_P_PLV_SalasPrecios_Exferia_TextBox_Evento_KeyPress);
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Precio.Exferia_TextBox_Evento_LostFocus += new System.EventHandler(this.ex_txt_CTU_P_PLV_SalasPrecios_Exferia_TextBox_Evento_LostFocus);
|
||||||
|
//
|
||||||
|
// ex_txt_CTU_P_PLV_SalasPrecios_Descuento
|
||||||
|
//
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_BordeColor_Foco = System.Drawing.Color.Red;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_BordeColor_Normal = System.Drawing.Color.Black;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_Fondo = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_MaxLength = 18;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_Multiline = false;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_NoBloquear = true;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_Obligatorio = false;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_PasswordChar = '\0';
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_ReadOnly = false;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_ScrollBars = System.Windows.Forms.ScrollBars.None;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_SelectionLength = 0;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_SelectionStart = 0;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_TabStop_Txt = true;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_Texto_Inicial = "";
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_Tipo_Decimal_Decimales = 2;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_Tipo_Decimal_Enteros = 16;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_Tipos = Exferia_Aplicacion.General.Enumerados.G_ENUM_TEXTBOX_TIPODATO.Decimales;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_UseSystemPasswordChar = false;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Location = new System.Drawing.Point(248, 22);
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Name = "ex_txt_CTU_P_PLV_SalasPrecios_Descuento";
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Padding = new System.Windows.Forms.Padding(2);
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Size = new System.Drawing.Size(122, 22);
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.TabIndex = 4;
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_Evento_KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ex_txt_CTU_P_PLV_SalasPrecios_Exferia_TextBox_Evento_KeyPress);
|
||||||
|
this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Exferia_TextBox_Evento_LostFocus += new System.EventHandler(this.ex_txt_CTU_P_PLV_SalasPrecios_Exferia_TextBox_Evento_LostFocus);
|
||||||
|
//
|
||||||
|
// ex_lbl_CTU_P_PLV_SalasPrecios_Descuento
|
||||||
|
//
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Descuento.AutoSize = true;
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Descuento.Location = new System.Drawing.Point(186, 26);
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Descuento.Name = "ex_lbl_CTU_P_PLV_SalasPrecios_Descuento";
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Descuento.Size = new System.Drawing.Size(59, 13);
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Descuento.TabIndex = 3;
|
||||||
|
this.ex_lbl_CTU_P_PLV_SalasPrecios_Descuento.Text = "Descuento";
|
||||||
|
//
|
||||||
|
// ex_lbl_Sala
|
||||||
|
//
|
||||||
|
this.ex_lbl_Sala.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.ex_lbl_Sala.Location = new System.Drawing.Point(3, 3);
|
||||||
|
this.ex_lbl_Sala.Name = "ex_lbl_Sala";
|
||||||
|
this.ex_lbl_Sala.Size = new System.Drawing.Size(371, 13);
|
||||||
|
this.ex_lbl_Sala.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// CTU_P_PLV_SalasPrecios
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||||
|
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.Controls.Add(this.ex_lbl_Sala);
|
||||||
|
this.Controls.Add(this.ex_txt_CTU_P_PLV_SalasPrecios_Descuento);
|
||||||
|
this.Controls.Add(this.ex_lbl_CTU_P_PLV_SalasPrecios_Descuento);
|
||||||
|
this.Controls.Add(this.ex_txt_CTU_P_PLV_SalasPrecios_Precio);
|
||||||
|
this.Controls.Add(this.ex_lbl_CTU_P_PLV_SalasPrecios_Precio);
|
||||||
|
this.Name = "CTU_P_PLV_SalasPrecios";
|
||||||
|
this.Size = new System.Drawing.Size(376, 49);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private Exferia_Controles.Exferia_Label ex_lbl_CTU_P_PLV_SalasPrecios_Precio;
|
||||||
|
private Exferia_Controles.Exferia_TextBox ex_txt_CTU_P_PLV_SalasPrecios_Precio;
|
||||||
|
private Exferia_Controles.Exferia_TextBox ex_txt_CTU_P_PLV_SalasPrecios_Descuento;
|
||||||
|
private Exferia_Controles.Exferia_Label ex_lbl_CTU_P_PLV_SalasPrecios_Descuento;
|
||||||
|
private Exferia_Controles.Exferia_Label ex_lbl_Sala;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Exferia_Controles;
|
||||||
|
using Exferia_Formularios;
|
||||||
|
using Exferia_Aplicacion.Visualizacion;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.ControlesPersonalizados_DentroPaneles
|
||||||
|
{
|
||||||
|
public partial class CTU_P_PLV_SalasPrecios : UserControl
|
||||||
|
{
|
||||||
|
#region Propiedades privadas
|
||||||
|
private HPV_Salas g_mdl_HPV_Salas;
|
||||||
|
private int g_int_NumeroObjeto;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Eventos Publicos
|
||||||
|
public event KeyPressEventHandler TextBox_P_PLV_Keypress;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Propiedades publicas
|
||||||
|
public Exferia_TextBox CTU_P_PLV_SalasPrecios_Precio
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ex_txt_CTU_P_PLV_SalasPrecios_Precio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Exferia_TextBox CTU_P_PLV_SalasPrecios_Descuento
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ex_txt_CTU_P_PLV_SalasPrecios_Descuento;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public long CTU_P_PLV_SalasPrecios_id
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_id = -1;
|
||||||
|
if (g_mdl_HPV_Salas != null)
|
||||||
|
{
|
||||||
|
lng_id = g_mdl_HPV_Salas.id;
|
||||||
|
}
|
||||||
|
return lng_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CTU_P_PLV_SalasPrecios_Precio_TITULO
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ex_lbl_CTU_P_PLV_SalasPrecios_Precio.Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CTU_P_PLV_SalasPrecios_Descuento_TITULO
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ex_lbl_CTU_P_PLV_SalasPrecios_Descuento.Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
public CTU_P_PLV_SalasPrecios(P_Base _frm_Pantalla_DeDondeheredar,
|
||||||
|
int _int_NumeroObjeto,
|
||||||
|
HPV_Salas _mdl_HPV_Salas,
|
||||||
|
decimal _dcm_Precio,
|
||||||
|
decimal _dcm_Descuento)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
Repintar.Empezar(this);
|
||||||
|
|
||||||
|
g_int_NumeroObjeto = _int_NumeroObjeto;
|
||||||
|
g_mdl_HPV_Salas = _mdl_HPV_Salas;
|
||||||
|
|
||||||
|
//Cargar los datos si los tuviera
|
||||||
|
if(g_mdl_HPV_Salas != null)
|
||||||
|
{
|
||||||
|
//Sala
|
||||||
|
ex_lbl_Sala.Text = g_mdl_HPV_Salas.descripcion;
|
||||||
|
//Precio
|
||||||
|
ex_txt_CTU_P_PLV_SalasPrecios_Precio.Text = _dcm_Precio.ToString();
|
||||||
|
//Descuento
|
||||||
|
ex_txt_CTU_P_PLV_SalasPrecios_Descuento.Text = _dcm_Descuento.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Eventos
|
||||||
|
private void ex_txt_CTU_P_PLV_SalasPrecios_Exferia_TextBox_Evento_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
//Para que salte el evento en el otro lado
|
||||||
|
KeyPressEventHandler temp = TextBox_P_PLV_Keypress;
|
||||||
|
if (temp != null)
|
||||||
|
temp(sender, e);
|
||||||
|
}
|
||||||
|
private void ex_txt_CTU_P_PLV_SalasPrecios_Exferia_TextBox_Evento_LostFocus(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Exferia_TextBox obj_Exferia_TextBox = (Exferia_TextBox)sender;
|
||||||
|
|
||||||
|
//Si cuando pierde el foco y esta vacio pongo 0,00
|
||||||
|
if (obj_Exferia_TextBox.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
obj_Exferia_TextBox.Text = "0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
|
|
@ -0,0 +1,148 @@
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.ControlesPersonalizados_DentroPaneles
|
||||||
|
{
|
||||||
|
partial class CTU_P_Tarifas_Detalle_SalasPrecios
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Variable del diseñador necesaria.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Limpiar los recursos que se estén usando.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true si los recursos administrados se deben desechar; false en caso contrario.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Código generado por el Diseñador de componentes
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Método necesario para admitir el Diseñador. No se puede modificar
|
||||||
|
/// el contenido de este método con el editor de código.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.ex_lbl_Sala = new Exferia_Controles.Exferia_Label();
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento = new Exferia_Controles.Exferia_TextBox();
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento = new Exferia_Controles.Exferia_Label();
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio = new Exferia_Controles.Exferia_TextBox();
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio = new Exferia_Controles.Exferia_Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// ex_lbl_Sala
|
||||||
|
//
|
||||||
|
this.ex_lbl_Sala.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.ex_lbl_Sala.Location = new System.Drawing.Point(3, 3);
|
||||||
|
this.ex_lbl_Sala.Name = "ex_lbl_Sala";
|
||||||
|
this.ex_lbl_Sala.Size = new System.Drawing.Size(371, 13);
|
||||||
|
this.ex_lbl_Sala.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento
|
||||||
|
//
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_BordeColor_Foco = System.Drawing.Color.Red;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_BordeColor_Normal = System.Drawing.Color.Black;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_Fondo = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_MaxLength = 18;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_Multiline = false;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_NoBloquear = true;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_Obligatorio = false;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_PasswordChar = '\0';
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_ReadOnly = false;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_ScrollBars = System.Windows.Forms.ScrollBars.None;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_SelectionLength = 0;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_SelectionStart = 0;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_TabStop_Txt = true;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_Texto_Inicial = "";
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_Tipo_Decimal_Decimales = 2;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_Tipo_Decimal_Enteros = 16;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_Tipos = Exferia_Aplicacion.General.Enumerados.G_ENUM_TEXTBOX_TIPODATO.Decimales;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_UseSystemPasswordChar = false;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Location = new System.Drawing.Point(248, 22);
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Name = "ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento";
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Padding = new System.Windows.Forms.Padding(2);
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Size = new System.Drawing.Size(122, 22);
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.TabIndex = 8;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_Evento_KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Exferia_TextBox_Evento_KeyPress);
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Exferia_TextBox_Evento_LostFocus += new System.EventHandler(this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Exferia_TextBox_Evento_LostFocus);
|
||||||
|
//
|
||||||
|
// ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento
|
||||||
|
//
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.AutoSize = true;
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Location = new System.Drawing.Point(186, 26);
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Name = "ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento";
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Size = new System.Drawing.Size(59, 13);
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.TabIndex = 7;
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Text = "Descuento";
|
||||||
|
//
|
||||||
|
// ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio
|
||||||
|
//
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_BordeColor_Foco = System.Drawing.Color.Red;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_BordeColor_Normal = System.Drawing.Color.Black;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_Fondo = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_MaxLength = 18;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_Multiline = false;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_NoBloquear = true;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_Obligatorio = false;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_PasswordChar = '\0';
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_ReadOnly = false;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_ScrollBars = System.Windows.Forms.ScrollBars.None;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_SelectionLength = 0;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_SelectionStart = 0;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_TabStop_Txt = true;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_Texto_Inicial = "";
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_Tipo_Decimal_Decimales = 3;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_Tipo_Decimal_Enteros = 16;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_Tipos = Exferia_Aplicacion.General.Enumerados.G_ENUM_TEXTBOX_TIPODATO.Decimales;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_UseSystemPasswordChar = false;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Location = new System.Drawing.Point(45, 22);
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Name = "ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio";
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Padding = new System.Windows.Forms.Padding(2);
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Size = new System.Drawing.Size(122, 22);
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.TabIndex = 6;
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_Evento_KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Exferia_TextBox_Evento_KeyPress);
|
||||||
|
this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Exferia_TextBox_Evento_LostFocus += new System.EventHandler(this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Exferia_TextBox_Evento_LostFocus);
|
||||||
|
//
|
||||||
|
// ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio
|
||||||
|
//
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.AutoSize = true;
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Location = new System.Drawing.Point(3, 26);
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Name = "ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio";
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Size = new System.Drawing.Size(37, 13);
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.TabIndex = 10;
|
||||||
|
this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Text = "Precio";
|
||||||
|
//
|
||||||
|
// CTU_P_Tarifas_Detalle_SalasPrecios
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||||
|
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.Controls.Add(this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio);
|
||||||
|
this.Controls.Add(this.ex_lbl_Sala);
|
||||||
|
this.Controls.Add(this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento);
|
||||||
|
this.Controls.Add(this.ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento);
|
||||||
|
this.Controls.Add(this.ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio);
|
||||||
|
this.Name = "CTU_P_Tarifas_Detalle_SalasPrecios";
|
||||||
|
this.Size = new System.Drawing.Size(376, 49);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Exferia_Controles.Exferia_Label ex_lbl_Sala;
|
||||||
|
private Exferia_Controles.Exferia_TextBox ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento;
|
||||||
|
private Exferia_Controles.Exferia_Label ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento;
|
||||||
|
private Exferia_Controles.Exferia_TextBox ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio;
|
||||||
|
private Exferia_Controles.Exferia_Label ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_Controles;
|
||||||
|
using Exferia_Formularios;
|
||||||
|
using Exferia_Aplicacion.Visualizacion;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.ControlesPersonalizados_DentroPaneles
|
||||||
|
{
|
||||||
|
public partial class CTU_P_Tarifas_Detalle_SalasPrecios : UserControl
|
||||||
|
{
|
||||||
|
#region Propiedades privadas
|
||||||
|
private HPV_Salas g_mdl_HPV_Salas;
|
||||||
|
private int g_int_NumeroObjeto;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Eventos Publicos
|
||||||
|
public event KeyPressEventHandler TextBox_P_Tarifas_Detalle_Keypress;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Propiedades publicas
|
||||||
|
public Exferia_TextBox CTU_P_Tarifas_Detalle_SalasPrecios_Precio
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Exferia_TextBox CTU_P_Tarifas_Detalle_SalasPrecios_Descuento
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public long CTU_P_Tarifas_Detalle_SalasPrecios_id
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
long lng_id = -1;
|
||||||
|
if (g_mdl_HPV_Salas != null)
|
||||||
|
{
|
||||||
|
lng_id = g_mdl_HPV_Salas.id;
|
||||||
|
}
|
||||||
|
return lng_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CTU_P_Tarifas_Detalle_SalasPrecios_Precio_TITULO
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CTU_P_Tarifas_Detalle_SalasPrecios_Descuento_TITULO
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ex_lbl_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cosntructor
|
||||||
|
public CTU_P_Tarifas_Detalle_SalasPrecios(P_Base _frm_Pantalla_DeDondeheredar,
|
||||||
|
int _int_NumeroObjeto,
|
||||||
|
HPV_Salas _mdl_HPV_Salas,
|
||||||
|
decimal _dcm_Precio,
|
||||||
|
decimal _dcm_Descuento)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
Repintar.Empezar(this);
|
||||||
|
|
||||||
|
g_int_NumeroObjeto = _int_NumeroObjeto;
|
||||||
|
g_mdl_HPV_Salas = _mdl_HPV_Salas;
|
||||||
|
|
||||||
|
//Cargar los datos si los tuviera
|
||||||
|
if (g_mdl_HPV_Salas != null)
|
||||||
|
{
|
||||||
|
//Sala
|
||||||
|
ex_lbl_Sala.Text = g_mdl_HPV_Salas.descripcion;
|
||||||
|
//Precio
|
||||||
|
ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Precio.Text = _dcm_Precio.ToString();
|
||||||
|
//Descuento
|
||||||
|
ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Descuento.Text = _dcm_Descuento.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Eventos
|
||||||
|
private void ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Exferia_TextBox_Evento_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
//Para que salte el evento en el otro lado
|
||||||
|
KeyPressEventHandler temp = TextBox_P_Tarifas_Detalle_Keypress;
|
||||||
|
if (temp != null)
|
||||||
|
temp(sender, e);
|
||||||
|
}
|
||||||
|
private void ex_txt_CTU_P_Tarifas_Detalle_SalasPrecios_Exferia_TextBox_Evento_LostFocus(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Exferia_TextBox obj_Exferia_TextBox = (Exferia_TextBox)sender;
|
||||||
|
|
||||||
|
//Si cuando pierde el foco y esta vacio pongo 0,00
|
||||||
|
if (obj_Exferia_TextBox.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
obj_Exferia_TextBox.Text = "0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Modelos_MantenimientoAgrupacionesCabecera;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_AgrupacionesLineas : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_MantenimientoAgrupacionesLinea_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_MantenimientoAgrupacionesLinea_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_MantenimientoAgrupacionesLinea_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_MantenimientoAgrupacionesLinea_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_AgrupacionesClientesCabeceras : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_AgrupacionesPLVCabeceras : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesPLVCabeceras_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_AgrupacionesTerminales : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesTerminales_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_Camareros : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Camareros_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Camareros_Listado_Modelo.nombre);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Camareros_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Camareros_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_CamarerosPerfiles : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_CamarerosPerfiles_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_Caracteristicas : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Caracteristicas_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_CaracteristicasTipos : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_CaracteristicasTipos_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_Clientes : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Clientes_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Clientes_Listado_Modelo.razonSocial);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Clientes_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Clientes_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_Impresoras : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Impresoras_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Impresoras_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Impresoras_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Impresoras_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_Ingredientes : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Ingredientes_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_PLV : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_PLV_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_PLV_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_PLV_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_PLV_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_Perfiles : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Perfiles_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Perfiles_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Perfiles_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Perfiles_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_Salas : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Salas_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Salas_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Salas_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Salas_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_SeccionesMenu : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_SeccionesMenu_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.F3
|
||||||
|
{
|
||||||
|
public class ABS_F3_HPV_Terminales : ABS_F3
|
||||||
|
{
|
||||||
|
public override string NOMBRE_CAMPO_CODIGO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Terminales_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DESCRIPCION()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Terminales_Listado_Modelo.descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_FECHABORRADO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Terminales_Listado_Modelo.fechaBorrado);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_ID()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_Terminales_Listado_Modelo.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_IDEJERCICIO_BAJA()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_1()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_2()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRE_CAMPO_DATOSAUXILIARES_3()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,159 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Modelos_Listado_Filtros;
|
||||||
|
using Exferia_EntityFramework;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_HotelPuntoVenta.General;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using static Exferia_Aplicacion.General.Enumerados;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.Listados
|
||||||
|
{
|
||||||
|
public class ABS_Listado_HPVH_Liquidaciones : ABS_Listado
|
||||||
|
{
|
||||||
|
private INTERNO_ValoresGenerales_Modelo g_mdl_INTERNO_ValoresGenerales_Modelo = null;
|
||||||
|
private Dictionary<string, INTERNO_ABS_Listado_ColumnasDatos_Modelo> g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo = new Dictionary<string, INTERNO_ABS_Listado_ColumnasDatos_Modelo>();
|
||||||
|
|
||||||
|
//Constructor
|
||||||
|
public ABS_Listado_HPVH_Liquidaciones(INTERNO_ValoresGenerales_Modelo _mdl_INTERNO_ValoresGenerales_Modelo)
|
||||||
|
{
|
||||||
|
g_mdl_INTERNO_ValoresGenerales_Modelo = _mdl_INTERNO_ValoresGenerales_Modelo;
|
||||||
|
|
||||||
|
Rellenar_Columnas();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Rellenar_Columnas()
|
||||||
|
{
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo = new Dictionary<string, INTERNO_ABS_Listado_ColumnasDatos_Modelo>();
|
||||||
|
|
||||||
|
//id
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.id), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(true, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.id), "id", G_ENUM_TIPOSDATOS.LONG, true, 0, false, false, false, false, "", null));
|
||||||
|
|
||||||
|
//numeroLiquidacion
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.numeroLiquidacion), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.numeroLiquidacion), "Nº liquidación", G_ENUM_TIPOSDATOS.LONG, false, 120, true, true, true, false, "", null));
|
||||||
|
|
||||||
|
//fechaHora_Inicial
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.fechaHora_Inicial), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.fechaHora_Inicial), "Fecha inicial", G_ENUM_TIPOSDATOS.DATETIME, false, 120, true, true, true, false, "", null));
|
||||||
|
|
||||||
|
//fechaHora_Final
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.fechaHora_Final), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.fechaHora_Final), "Fecha Final", G_ENUM_TIPOSDATOS.DATETIME, false, 120, true, true, true, false, "", null));
|
||||||
|
|
||||||
|
//importeTotal_Calculado
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.importeTotal_Calculado), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.importeTotal_Calculado), "Importe total calculado", G_ENUM_TIPOSDATOS.DECIMAL, false, 140, true, true, true, false, "", null));
|
||||||
|
|
||||||
|
//importeTotal_Gastos
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.importeTotal_Gastos), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.importeTotal_Gastos), "Importe total gastos", G_ENUM_TIPOSDATOS.DECIMAL, false, 140, true, true, true, false, "", null));
|
||||||
|
|
||||||
|
//importeTotal_Cierre
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.importeTotal_Cierre), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.importeTotal_Cierre), "Importe total cierre", G_ENUM_TIPOSDATOS.DECIMAL, false, 140, true, true, true, false, "", null));
|
||||||
|
|
||||||
|
//importeTotal_Encaja
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.importeTotal_Encaja), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.importeTotal_Encaja), "Importe total en caja", G_ENUM_TIPOSDATOS.DECIMAL, false, 140, true, true, true, false, "", null));
|
||||||
|
|
||||||
|
//Ejercicio
|
||||||
|
INTERNO_Filtro_Relacionadas_Modelo mdl_INTERNO_Filtro_Relacionadas_Modelo_EJERCICIO = new INTERNO_Filtro_Relacionadas_Modelo(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.idEjercicio), nameof(GEN_EjerciciosActivos_Empresa), nameof(GEN_EjerciciosActivos_Empresa.id), nameof(GEN_EjerciciosActivos_Empresa.anioControl), nameof(GEN_EjerciciosActivos_Empresa.descripcion), nameof(GEN_EjerciciosActivos_Empresa.fechaBorrado), "", "", "", "", "", nameof(GEN_EjerciciosActivos_Empresa.idEmpresa), g_mdl_INTERNO_ValoresGenerales_Modelo.lng_idEmpresa, nameof(GEN_EjerciciosActivos_Empresa.anioControl), 1);
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.Ejercicio), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.Ejercicio), "Ejercicio", G_ENUM_TIPOSDATOS.RELACIONADA, false, 100, true, false, false, true, "", null, false, null, mdl_INTERNO_Filtro_Relacionadas_Modelo_EJERCICIO, "", true));
|
||||||
|
|
||||||
|
//TERMINAL
|
||||||
|
INTERNO_Filtro_Relacionadas_Modelo mdl_INTERNO_Filtro_Relacionadas_Modelo_TERMINAL = new INTERNO_Filtro_Relacionadas_Modelo(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.idTerminal), nameof(HPV_Terminales), nameof(HPV_Terminales.id), nameof(HPV_Terminales.codigo), nameof(HPV_Terminales.descripcion), nameof(HPV_Terminales.fechaBorrado));
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.Terminal), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.Terminal), "Terminal", G_ENUM_TIPOSDATOS.RELACIONADA, false, 250, true, false, false,true, "", null, false, null, mdl_INTERNO_Filtro_Relacionadas_Modelo_TERMINAL));
|
||||||
|
|
||||||
|
//CAMARERO_INICIAL
|
||||||
|
INTERNO_Filtro_Relacionadas_Modelo mdl_INTERNO_Filtro_Relacionadas_Modelo_CAMARERO_INICIAL = new INTERNO_Filtro_Relacionadas_Modelo(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.idCamarero_Inicial), nameof(HPV_Camareros), nameof(HPV_Camareros.id), nameof(HPV_Camareros.codigo), nameof(HPV_Camareros.nombre), nameof(HPV_Camareros.fechaBorrado));
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.Camarero_Inicial), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.Camarero_Inicial), "Camarero inicial", G_ENUM_TIPOSDATOS.RELACIONADA, false, 250, true, false, false, true, "", null, false, null, mdl_INTERNO_Filtro_Relacionadas_Modelo_CAMARERO_INICIAL));
|
||||||
|
|
||||||
|
//CAMARERO_FINAL
|
||||||
|
INTERNO_Filtro_Relacionadas_Modelo mdl_INTERNO_Filtro_Relacionadas_Modelo_CAMARERO_FINAL = new INTERNO_Filtro_Relacionadas_Modelo(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.idCamarero_Final), nameof(HPV_Camareros), nameof(HPV_Camareros.id), nameof(HPV_Camareros.codigo), nameof(HPV_Camareros.nombre), nameof(HPV_Camareros.fechaBorrado));
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.Camarero_Final), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.Camarero_Final), "Camarero final", G_ENUM_TIPOSDATOS.RELACIONADA, false, 250, true, false, false, true, "", null, false, null, mdl_INTERNO_Filtro_Relacionadas_Modelo_CAMARERO_FINAL));
|
||||||
|
|
||||||
|
//Empresa
|
||||||
|
INTERNO_Filtro_Relacionadas_Modelo mdl_INTERNO_Filtro_Relacionadas_Modelo_EMPRESA = new INTERNO_Filtro_Relacionadas_Modelo(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.idEmpresa), nameof(GEN_Empresas), nameof(GEN_Empresas.id), nameof(GEN_Empresas.codigo), nameof(GEN_Empresas.descripcion), nameof(GEN_Empresas.fechaBorrado));
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.Empresa), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.Empresa), "Empresa", G_ENUM_TIPOSDATOS.RELACIONADA, false, 250, true, false, false, true, "", null, false, null, mdl_INTERNO_Filtro_Relacionadas_Modelo_EMPRESA));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<dynamic> LISTADO()
|
||||||
|
{
|
||||||
|
return Registros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_OpcionesDetalle_Modelo DATOS_OPCION()
|
||||||
|
{
|
||||||
|
return Datos_Generales.PRV_Opciones_Buscar_Detalles(Variables.G_STR_OPCION_HPVH_LIQUIDACIONES);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRELISTADO_ALMACENARCONFIGURACION()
|
||||||
|
{
|
||||||
|
return Variables.G_STR_OPCION_HPVH_LIQUIDACIONES;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Dictionary<string, INTERNO_ABS_Listado_ColumnasDatos_Modelo> LISTADO_COLUMNAS()
|
||||||
|
{
|
||||||
|
return g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ORDENACION_NOMBRECOLUMNA_PORDEFECTO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPVH_Liquidaciones_Listado_Modelo.fechaHora_Inicial);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ORDENACION_TIPO_PORDEFECTO()
|
||||||
|
{
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_1()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_2()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_3()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_4()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_5()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_6()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_7()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<INTERNO_ArbolSecundarioSeleccion_Modelo> LISTADO_ARBOLSECUNDARIOSELECCION()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<INTERNO_Listado_Paginado_Filtro_Modelo> FILTRADO_PARAPAGINADO()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<string> LISTADOCAMPOS_ENVIAR_A_MANTENIMIENTO()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Modelos_Listado_Filtros;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_HotelPuntoVenta.General;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.Listados
|
||||||
|
{
|
||||||
|
public class ABS_Listado_HPV_AgrupacionesClientesCabeceras : ABS_Listado
|
||||||
|
{
|
||||||
|
private Dictionary<string, INTERNO_ABS_Listado_ColumnasDatos_Modelo> g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo = new Dictionary<string, INTERNO_ABS_Listado_ColumnasDatos_Modelo>();
|
||||||
|
|
||||||
|
//Constructor
|
||||||
|
public ABS_Listado_HPV_AgrupacionesClientesCabeceras()
|
||||||
|
{
|
||||||
|
Rellenar_Columnas();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Rellenar_Columnas()
|
||||||
|
{
|
||||||
|
//id
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.id), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(true, nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.id), "id", Enumerados.G_ENUM_TIPOSDATOS.LONG, true, 0, false, false, true, false, "", null));
|
||||||
|
//codigo
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.codigo), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.codigo), "Código", Enumerados.G_ENUM_TIPOSDATOS.LONG_TEXT, false, 90, true, true, true, false, "", null));
|
||||||
|
//descripcion
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.descripcion), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.descripcion), "Descripción", Enumerados.G_ENUM_TIPOSDATOS.TEXT, false, 250, true, true, true, false, "", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<dynamic> LISTADO()
|
||||||
|
{
|
||||||
|
return Registros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_OpcionesDetalle_Modelo DATOS_OPCION()
|
||||||
|
{
|
||||||
|
return Datos_Generales.PRV_Opciones_Buscar_Detalles(Variables.G_STR_OPCION_HPV_AGRUPACIONESCLIENTESCABECERAS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRELISTADO_ALMACENARCONFIGURACION()
|
||||||
|
{
|
||||||
|
return Variables.G_STR_OPCION_HPV_AGRUPACIONESCLIENTESCABECERAS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Dictionary<string, INTERNO_ABS_Listado_ColumnasDatos_Modelo> LISTADO_COLUMNAS()
|
||||||
|
{
|
||||||
|
return g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ORDENACION_NOMBRECOLUMNA_PORDEFECTO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ORDENACION_TIPO_PORDEFECTO()
|
||||||
|
{
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_1()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_2()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_3()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_4()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_5()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_6()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_7()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<INTERNO_ArbolSecundarioSeleccion_Modelo> LISTADO_ARBOLSECUNDARIOSELECCION()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<INTERNO_Listado_Paginado_Filtro_Modelo> FILTRADO_PARAPAGINADO()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<string> LISTADOCAMPOS_ENVIAR_A_MANTENIMIENTO()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
using Exferia_Aplicacion.General;
|
||||||
|
using Exferia_Aplicacion.Modelos_Listado_Filtros;
|
||||||
|
using Exferia_General;
|
||||||
|
using Exferia_HotelPuntoVenta._0_Modelos;
|
||||||
|
using Exferia_HotelPuntoVenta.General;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Exferia_HotelPuntoVenta._3_Vistas.Listados
|
||||||
|
{
|
||||||
|
public class ABS_Listado_HPV_AgrupacionesClientesCabeceras_P_Cliente_IncluirRegistros : ABS_Listado
|
||||||
|
{
|
||||||
|
private Dictionary<string, INTERNO_ABS_Listado_ColumnasDatos_Modelo> g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo = new Dictionary<string, INTERNO_ABS_Listado_ColumnasDatos_Modelo>();
|
||||||
|
|
||||||
|
//Constructor
|
||||||
|
public ABS_Listado_HPV_AgrupacionesClientesCabeceras_P_Cliente_IncluirRegistros()
|
||||||
|
{
|
||||||
|
Rellenar_Columnas();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Rellenar_Columnas()
|
||||||
|
{
|
||||||
|
//Seleccionar
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.Seleccionar), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.Seleccionar), "Sel.", Enumerados.G_ENUM_TIPOSDATOS.SELECCIONAR, false, 50, true, true, true, false, "", null, true));
|
||||||
|
|
||||||
|
//id
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.id), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(true, nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.id), "id", Enumerados.G_ENUM_TIPOSDATOS.LONG, true, 0, false, false, true, false, "", null));
|
||||||
|
|
||||||
|
//codigo
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.codigo), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.codigo), "Código", Enumerados.G_ENUM_TIPOSDATOS.LONG_TEXT, false, 90, true, true, true, false, "", null));
|
||||||
|
|
||||||
|
//descripcion
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.descripcion), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.descripcion), "Descripción", Enumerados.G_ENUM_TIPOSDATOS.TEXT, false, 250, true, true, true, false, "", null));
|
||||||
|
|
||||||
|
//sinRepeticion
|
||||||
|
g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo.Add(nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.sinRepeticion), new INTERNO_ABS_Listado_ColumnasDatos_Modelo(false, nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.sinRepeticion), "Sin repeticiones", Enumerados.G_ENUM_TIPOSDATOS.BOOLEAN, false, 200, true, true, true, false, "", null, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<dynamic> LISTADO()
|
||||||
|
{
|
||||||
|
return Registros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_OpcionesDetalle_Modelo DATOS_OPCION()
|
||||||
|
{
|
||||||
|
return Datos_Generales.PRV_Opciones_Buscar_Detalles(Variables.G_STR_OPCION_HPV_AGRUPACIONESCLIENTESCABECERAS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string NOMBRELISTADO_ALMACENARCONFIGURACION()
|
||||||
|
{
|
||||||
|
return Variables.G_STR_OPCION_HPV_AGRUPACIONESCLIENTESCABECERAS + "_" + nameof(P_Cliente) + "_IncluirRegistros";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Dictionary<string, INTERNO_ABS_Listado_ColumnasDatos_Modelo> LISTADO_COLUMNAS()
|
||||||
|
{
|
||||||
|
return g_dct_INTERNO_ABS_Listado_ColumnasDatos_Modelo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ORDENACION_NOMBRECOLUMNA_PORDEFECTO()
|
||||||
|
{
|
||||||
|
return nameof(INTERNO_HPV_AgrupacionesClientesCabeceras_Listado_Modelo.codigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ORDENACION_TIPO_PORDEFECTO()
|
||||||
|
{
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_1()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_2()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_3()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_4()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_5()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_6()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INTERNO_Listado_BotonesAuxiliares_Modelo BOTONAUXILIAR_7()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<INTERNO_ArbolSecundarioSeleccion_Modelo> LISTADO_ARBOLSECUNDARIOSELECCION()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<INTERNO_Listado_Paginado_Filtro_Modelo> FILTRADO_PARAPAGINADO()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<string> LISTADOCAMPOS_ENVIAR_A_MANTENIMIENTO()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue