Correccion de nmbres en español
This commit is contained in:
@@ -47,10 +47,10 @@ namespace SIG.Web.AppCode.Configuration
|
||||
public static IUserRepository UserRepository { get; private set; }
|
||||
private static IUserAdministrationRepository UserAdministrationRepository { get; set; }
|
||||
public static IUserAdministrationService UserAdministrationService { get; private set; }
|
||||
public static IPerfilUsuarioService PerfilUsuarioService { get; private set; }
|
||||
public static IServicioPerfilUsuario ServicioPerfilUsuario { get; private set; }
|
||||
public static IGeneralCatalogRepository GeneralCatalogRepository { get; private set; }
|
||||
public static IProductoServicioService ProductoServicioService { get; private set; }
|
||||
public static IProductoCatalogService ProductoCatalogService { get; private set; }
|
||||
public static IServicioProductoServicio ServicioProductoServicio { get; private set; }
|
||||
public static IServicioCatalogoProducto ServicioCatalogoProducto { get; private set; }
|
||||
public static IClienteDocumentoService ClienteDocumentoService { get; private set; }
|
||||
public static ITramiteDocumentoService TramiteDocumentoService { get; private set; }
|
||||
public static IFraccionamientoService FraccionamientoService { get; private set; }
|
||||
@@ -58,7 +58,7 @@ namespace SIG.Web.AppCode.Configuration
|
||||
public static ITramiteCatalogService TramiteCatalogService { get; private set; }
|
||||
public static ITramiteSolicitudService TramiteSolicitudService { get; private set; }
|
||||
public static IServicioVentaTramite ServicioVentaTramite { get; private set; }
|
||||
public static ICfdiTimbradoService CfdiTimbradoService { get; private set; }
|
||||
public static IServicioTimbradoCfdi ServicioTimbradoCfdi { get; private set; }
|
||||
public static IPublicRegistrationService PublicRegistrationService { get; private set; }
|
||||
public static ILoginAttemptRepository LoginAttemptRepository { get; private set; }
|
||||
public static IUserSessionRepository UserSessionRepository { get; private set; }
|
||||
@@ -97,15 +97,15 @@ namespace SIG.Web.AppCode.Configuration
|
||||
UserAdministrationRepository,
|
||||
PasswordHasher,
|
||||
BitacoraService);
|
||||
PerfilUsuarioService = new PerfilUsuarioService(
|
||||
new PerfilUsuarioRepository(DbExecutor),
|
||||
ServicioPerfilUsuario = new ServicioPerfilUsuario(
|
||||
new RepositorioPerfilUsuario(DbExecutor),
|
||||
PasswordHasher);
|
||||
GeneralCatalogRepository = new GeneralCatalogRepository(DbExecutor);
|
||||
ProductoServicioService = new ProductoServicioService(
|
||||
new ProductoServicioRepository(DbExecutor),
|
||||
ServicioProductoServicio = new ServicioProductoServicio(
|
||||
new RepositorioProductoServicio(DbExecutor),
|
||||
BitacoraService);
|
||||
ProductoCatalogService = new ProductoCatalogService(
|
||||
new ProductoCatalogRepository(DbExecutor),
|
||||
ServicioCatalogoProducto = new ServicioCatalogoProducto(
|
||||
new RepositorioCatalogoProducto(DbExecutor),
|
||||
BitacoraService);
|
||||
ClienteDocumentoService = new ClienteDocumentoService(
|
||||
new ClienteDocumentoRepository(DbExecutor));
|
||||
@@ -142,23 +142,23 @@ namespace SIG.Web.AppCode.Configuration
|
||||
TramiteSolicitudService = new TramiteSolicitudService(
|
||||
tramiteSolicitudRepository,
|
||||
BitacoraService);
|
||||
var clienteProfact = new ProfactPacTimbradoClient(
|
||||
new ConfigurationPacCredentialProvider());
|
||||
CfdiTimbradoService = new CfdiTimbradoService(
|
||||
new CfdiRepository(DbExecutor),
|
||||
new ProfactCfdi40XmlBuilder(),
|
||||
new IPacTimbradoClient[]
|
||||
var clienteProfact = new ClienteTimbradoPacProfact(
|
||||
new ProveedorCredencialPacConfiguracion());
|
||||
ServicioTimbradoCfdi = new ServicioTimbradoCfdi(
|
||||
new RepositorioCfdi(DbExecutor),
|
||||
new ConstructorXmlCfdi40Profact(),
|
||||
new IClienteTimbradoPac[]
|
||||
{
|
||||
clienteProfact
|
||||
},
|
||||
new IPacCancelacionClient[]
|
||||
new IClienteCancelacionPac[]
|
||||
{
|
||||
clienteProfact
|
||||
},
|
||||
new AlmacenArchivosCfdi());
|
||||
ServicioVentaTramite = new ServicioVentaTramite(
|
||||
new RepositorioVentaTramite(DbExecutor),
|
||||
CfdiTimbradoService);
|
||||
ServicioTimbradoCfdi);
|
||||
LoginAttemptRepository = new LoginAttemptRepository(DbExecutor);
|
||||
UserSessionRepository = new UserSessionRepository(DbExecutor);
|
||||
|
||||
|
||||
@@ -5,29 +5,29 @@ using SIG.Web.AppCode.Models.Facturacion;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.Facturacion
|
||||
{
|
||||
public interface ICfdiRepository
|
||||
public interface IRepositorioCfdi
|
||||
{
|
||||
DbResult<CfdiEmisorFiscalModel> ObtenerEmisor(
|
||||
DbResult<ModeloEmisorFiscalCfdi> ObtenerEmisor(
|
||||
int cveEmpresa,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiReceptorFiscalModel> ObtenerReceptor(
|
||||
DbResult<ModeloReceptorFiscalCfdi> ObtenerReceptor(
|
||||
int cveCliente,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<long> GuardarBorrador(
|
||||
CfdiDocumentoModel documento,
|
||||
ModeloDocumentoCfdi documento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiDocumentoModel> ObtenerDocumento(
|
||||
DbResult<ModeloDocumentoCfdi> ObtenerDocumento(
|
||||
long cveCfdiDocumento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiTimbradoInicioModel> IniciarIntento(
|
||||
DbResult<ModeloInicioTimbradoCfdi> IniciarIntento(
|
||||
long cveCfdiDocumento,
|
||||
Guid idSolicitud,
|
||||
string proveedorPac,
|
||||
@@ -36,63 +36,63 @@ namespace SIG.Web.AppCode.Contracts.Facturacion
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiTimbradoIntentoModel> FinalizarIntento(
|
||||
DbResult<ModeloIntentoTimbradoCfdi> FinalizarIntento(
|
||||
long cveCfdiTimbrado,
|
||||
CfdiPacResultadoModel resultadoPac,
|
||||
ModeloResultadoPacCfdi resultadoPac,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<List<CfdiTimbradoIntentoModel>> ListarIntentos(
|
||||
DbResult<List<ModeloIntentoTimbradoCfdi>> ListarIntentos(
|
||||
long cveCfdiDocumento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiArchivoModel> ObtenerXml(
|
||||
DbResult<ModeloArchivoCfdi> ObtenerXml(
|
||||
long cveCfdiDocumento,
|
||||
bool timbrado,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiCancelacionInicioModel> IniciarCancelacion(
|
||||
CfdiCancelacionSolicitudModel solicitud,
|
||||
DbResult<ModeloInicioCancelacionCfdi> IniciarCancelacion(
|
||||
ModeloSolicitudCancelacionCfdi solicitud,
|
||||
Guid idSolicitud,
|
||||
string proveedorPac,
|
||||
string ambiente,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiCancelacionResultadoModel> FinalizarCancelacion(
|
||||
DbResult<ModeloResultadoCancelacionCfdi> FinalizarCancelacion(
|
||||
long cveCfdiCancelacion,
|
||||
CfdiPacCancelacionResultadoModel resultadoPac,
|
||||
ModeloResultadoCancelacionPacCfdi resultadoPac,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
}
|
||||
|
||||
public interface ICfdiXmlBuilder
|
||||
public interface IConstructorXmlCfdi
|
||||
{
|
||||
DbResult<CfdiXmlBuildResultModel> Construir(
|
||||
CfdiSolicitudModel solicitud,
|
||||
CfdiEmisorFiscalModel emisor,
|
||||
CfdiReceptorFiscalModel receptor);
|
||||
DbResult<ModeloResultadoConstruccionXmlCfdi> Construir(
|
||||
ModeloSolicitudCfdi solicitud,
|
||||
ModeloEmisorFiscalCfdi emisor,
|
||||
ModeloReceptorFiscalCfdi receptor);
|
||||
}
|
||||
|
||||
public interface IPacTimbradoClient
|
||||
public interface IClienteTimbradoPac
|
||||
{
|
||||
string Proveedor { get; }
|
||||
|
||||
CfdiPacResultadoModel Timbrar(
|
||||
CfdiPacSolicitudModel solicitud);
|
||||
ModeloResultadoPacCfdi Timbrar(
|
||||
ModeloSolicitudPacCfdi solicitud);
|
||||
}
|
||||
|
||||
public interface IPacCancelacionClient
|
||||
public interface IClienteCancelacionPac
|
||||
{
|
||||
string Proveedor { get; }
|
||||
|
||||
CfdiPacCancelacionResultadoModel Cancelar(
|
||||
CfdiPacCancelacionSolicitudModel solicitud);
|
||||
ModeloResultadoCancelacionPacCfdi Cancelar(
|
||||
ModeloSolicitudCancelacionPacCfdi solicitud);
|
||||
}
|
||||
|
||||
public interface IPacCredentialProvider
|
||||
public interface IProveedorCredencialPac
|
||||
{
|
||||
string ObtenerCredencial(string referencia);
|
||||
}
|
||||
@@ -100,41 +100,41 @@ namespace SIG.Web.AppCode.Contracts.Facturacion
|
||||
public interface IAlmacenArchivosCfdi
|
||||
{
|
||||
DbResult<string> GuardarXmlTimbrado(
|
||||
CfdiDocumentoModel documento,
|
||||
CfdiTimbradoIntentoModel intento);
|
||||
ModeloDocumentoCfdi documento,
|
||||
ModeloIntentoTimbradoCfdi intento);
|
||||
}
|
||||
|
||||
public interface ICfdiTimbradoService
|
||||
public interface IServicioTimbradoCfdi
|
||||
{
|
||||
DbResult<long> GuardarBorrador(
|
||||
CfdiSolicitudModel solicitud,
|
||||
ModeloSolicitudCfdi solicitud,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiTimbradoResultadoModel> Timbrar(
|
||||
DbResult<ModeloResultadoTimbradoCfdi> Timbrar(
|
||||
long cveCfdiDocumento,
|
||||
Guid? idSolicitud,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiDocumentoModel> ObtenerDocumento(
|
||||
DbResult<ModeloDocumentoCfdi> ObtenerDocumento(
|
||||
long cveCfdiDocumento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<List<CfdiTimbradoIntentoModel>> ListarIntentos(
|
||||
DbResult<List<ModeloIntentoTimbradoCfdi>> ListarIntentos(
|
||||
long cveCfdiDocumento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiArchivoModel> ObtenerXml(
|
||||
DbResult<ModeloArchivoCfdi> ObtenerXml(
|
||||
long cveCfdiDocumento,
|
||||
bool timbrado,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<CfdiCancelacionResultadoModel> Cancelar(
|
||||
CfdiCancelacionSolicitudModel solicitud,
|
||||
DbResult<ModeloResultadoCancelacionCfdi> Cancelar(
|
||||
ModeloSolicitudCancelacionCfdi solicitud,
|
||||
Guid? idSolicitud,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
@@ -4,46 +4,46 @@ using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.General
|
||||
{
|
||||
public interface IProductoCatalogService
|
||||
public interface IRepositorioCatalogoProducto
|
||||
{
|
||||
DbResult<List<ClasificacionModel>> ListClasificaciones(
|
||||
DbResult<List<ModeloClasificacion>> ListarClasificaciones(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ClasificacionModel> GetClasificacion(
|
||||
DbResult<ModeloClasificacion> ObtenerClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> SaveClasificacion(
|
||||
ClasificacionModel clasificacion,
|
||||
DbResult<int> GuardarClasificacion(
|
||||
ModeloClasificacion clasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> DeleteClasificacion(
|
||||
DbResult<bool> EliminarClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<List<UnidadMedidaModel>> ListUnidadesMedida(
|
||||
DbResult<List<ModeloUnidadMedida>> ListarUnidadesMedida(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<UnidadMedidaModel> GetUnidadMedida(
|
||||
DbResult<ModeloUnidadMedida> ObtenerUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> SaveUnidadMedida(
|
||||
UnidadMedidaModel unidadMedida,
|
||||
DbResult<int> GuardarUnidadMedida(
|
||||
ModeloUnidadMedida unidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> DeleteUnidadMedida(
|
||||
DbResult<bool> EliminarUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
@@ -4,31 +4,31 @@ using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.General
|
||||
{
|
||||
public interface IProductoServicioRepository
|
||||
public interface IRepositorioProductoServicio
|
||||
{
|
||||
DbResult<List<ProductoServicioModel>> List(
|
||||
DbResult<List<ModeloProductoServicio>> Listar(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ProductoServicioModel> Get(
|
||||
DbResult<ModeloProductoServicio> Obtener(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ProductoServicioOpcionesModel> ListOptions(
|
||||
DbResult<ModeloOpcionesProductoServicio> ListarOpciones(
|
||||
int? cveClasificacionActual,
|
||||
int? cveUnidadMedidaActual,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> Save(
|
||||
ProductoServicioModel productoServicio,
|
||||
DbResult<int> Guardar(
|
||||
ModeloProductoServicio productoServicio,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> Delete(
|
||||
DbResult<bool> Eliminar(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio);
|
||||
@@ -4,46 +4,46 @@ using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.General
|
||||
{
|
||||
public interface IProductoCatalogRepository
|
||||
public interface IServicioCatalogoProducto
|
||||
{
|
||||
DbResult<List<ClasificacionModel>> ListClasificaciones(
|
||||
DbResult<List<ModeloClasificacion>> ListarClasificaciones(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ClasificacionModel> GetClasificacion(
|
||||
DbResult<ModeloClasificacion> ObtenerClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> SaveClasificacion(
|
||||
ClasificacionModel clasificacion,
|
||||
DbResult<int> GuardarClasificacion(
|
||||
ModeloClasificacion clasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> DeleteClasificacion(
|
||||
DbResult<bool> EliminarClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<List<UnidadMedidaModel>> ListUnidadesMedida(
|
||||
DbResult<List<ModeloUnidadMedida>> ListarUnidadesMedida(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<UnidadMedidaModel> GetUnidadMedida(
|
||||
DbResult<ModeloUnidadMedida> ObtenerUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> SaveUnidadMedida(
|
||||
UnidadMedidaModel unidadMedida,
|
||||
DbResult<int> GuardarUnidadMedida(
|
||||
ModeloUnidadMedida unidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> DeleteUnidadMedida(
|
||||
DbResult<bool> EliminarUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio);
|
||||
@@ -4,31 +4,31 @@ using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.General
|
||||
{
|
||||
public interface IProductoServicioService
|
||||
public interface IServicioProductoServicio
|
||||
{
|
||||
DbResult<List<ProductoServicioModel>> List(
|
||||
DbResult<List<ModeloProductoServicio>> Listar(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ProductoServicioModel> Get(
|
||||
DbResult<ModeloProductoServicio> Obtener(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<ProductoServicioOpcionesModel> ListOptions(
|
||||
DbResult<ModeloOpcionesProductoServicio> ListarOpciones(
|
||||
int? cveClasificacionActual,
|
||||
int? cveUnidadMedidaActual,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<int> Save(
|
||||
ProductoServicioModel productoServicio,
|
||||
DbResult<int> Guardar(
|
||||
ModeloProductoServicio productoServicio,
|
||||
int usuario,
|
||||
string dominio);
|
||||
|
||||
DbResult<bool> Delete(
|
||||
DbResult<bool> Eliminar(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio);
|
||||
@@ -4,14 +4,14 @@ using SIG.Web.AppCode.Models.Security;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.Security
|
||||
{
|
||||
public interface IPerfilUsuarioRepository
|
||||
public interface IRepositorioPerfilUsuario
|
||||
{
|
||||
DbResult<PerfilUsuarioConsultaModel> ObtenerPerfil(
|
||||
DbResult<ModeloConsultaPerfilUsuario> ObtenerPerfil(
|
||||
int cveUsuario,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<PerfilSesionModel> ActualizarSesion(
|
||||
DbResult<ModeloPerfilSesion> ActualizarSesion(
|
||||
int cveUsuario,
|
||||
string nombreUsuario,
|
||||
string hashContrasena,
|
||||
@@ -19,17 +19,17 @@ namespace SIG.Web.AppCode.Contracts.Security
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<bool> ActualizarCliente(
|
||||
PerfilClienteModel cliente,
|
||||
ModeloPerfilCliente cliente,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<List<UsuarioCambioContextoModel>>
|
||||
DbResult<List<ModeloUsuarioCambioContexto>>
|
||||
ListarUsuariosCambio(
|
||||
string texto,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
|
||||
DbResult<UsuarioCambioContextoModel> ObtenerUsuarioContexto(
|
||||
DbResult<ModeloUsuarioCambioContexto> ObtenerUsuarioContexto(
|
||||
int cveUsuario,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio);
|
||||
@@ -5,21 +5,21 @@ using SIG.Web.AppCode.Session;
|
||||
|
||||
namespace SIG.Web.AppCode.Contracts.Security
|
||||
{
|
||||
public interface IPerfilUsuarioService
|
||||
public interface IServicioPerfilUsuario
|
||||
{
|
||||
DbResult<PerfilUsuarioConsultaModel> ObtenerPerfil(
|
||||
DbResult<ModeloConsultaPerfilUsuario> ObtenerPerfil(
|
||||
UserSessionModel usuarioSesion);
|
||||
|
||||
DbResult<PerfilSesionModel> ActualizarSesion(
|
||||
DbResult<ModeloPerfilSesion> ActualizarSesion(
|
||||
UserSessionModel usuarioSesion,
|
||||
string nombreUsuario,
|
||||
string contrasena);
|
||||
|
||||
DbResult<bool> ActualizarCliente(
|
||||
UserSessionModel usuarioSesion,
|
||||
PerfilClienteModel cliente);
|
||||
ModeloPerfilCliente cliente);
|
||||
|
||||
DbResult<List<UsuarioCambioContextoModel>>
|
||||
DbResult<List<ModeloUsuarioCambioContexto>>
|
||||
ListarUsuariosCambio(
|
||||
UserSessionModel usuarioSesion,
|
||||
string texto);
|
||||
@@ -39,8 +39,8 @@ namespace SIG.Web.AppCode.Contracts.Tramites
|
||||
DbResult<TramitePagoDetalleModel> GetPagoDetalle(int id, int usuario, string dominio);
|
||||
DbResult<int> SavePagoDetalle(TramitePagoDetalleModel model, int usuario, string dominio);
|
||||
DbResult<bool> DeletePagoDetalle(int id, int usuario, string dominio);
|
||||
DbResult<List<ProductoServicioTramiteModel>> ListProductosServicios(string texto, bool incluirInactivos, int usuario, string dominio);
|
||||
DbResult<ProductoServicioTramiteModel> GetProductoServicio(int id, int usuario, string dominio);
|
||||
DbResult<List<ModeloProductoServicioTramite>> ListProductosServicios(string texto, bool incluirInactivos, int usuario, string dominio);
|
||||
DbResult<ModeloProductoServicioTramite> GetProductoServicio(int id, int usuario, string dominio);
|
||||
DbResult<int> UpdateProductoServicioPrecio(int id, decimal precio, int usuario, string dominio);
|
||||
DbResult<bool> MoveOrder(TramiteCatalogOrderEntity entity, int id, int referenceId, bool placeAfter, int usuario, string dominio);
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public const string Duplicado = "DUPLICADO";
|
||||
}
|
||||
|
||||
public sealed class CfdiSolicitudModel
|
||||
public sealed class ModeloSolicitudCfdi
|
||||
{
|
||||
public CfdiSolicitudModel()
|
||||
public ModeloSolicitudCfdi()
|
||||
{
|
||||
Conceptos = new List<CfdiConceptoModel>();
|
||||
CfdiRelacionados = new List<CfdiRelacionadoModel>();
|
||||
Conceptos = new List<ModeloConceptoCfdi>();
|
||||
CfdiRelacionados = new List<ModeloCfdiRelacionado>();
|
||||
}
|
||||
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
@@ -48,11 +48,11 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public string Exportacion { get; set; }
|
||||
public string UsoCfdi { get; set; }
|
||||
public string LugarExpedicion { get; set; }
|
||||
public IList<CfdiConceptoModel> Conceptos { get; private set; }
|
||||
public IList<CfdiRelacionadoModel> CfdiRelacionados { get; private set; }
|
||||
public IList<ModeloConceptoCfdi> Conceptos { get; private set; }
|
||||
public IList<ModeloCfdiRelacionado> CfdiRelacionados { get; private set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiEmisorFiscalModel
|
||||
public sealed class ModeloEmisorFiscalCfdi
|
||||
{
|
||||
public int CveEmisorFiscal { get; set; }
|
||||
public int CveEmpresa { get; set; }
|
||||
@@ -73,7 +73,7 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public bool EsActivo { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiReceptorFiscalModel
|
||||
public sealed class ModeloReceptorFiscalCfdi
|
||||
{
|
||||
public int CveCliente { get; set; }
|
||||
public string Rfc { get; set; }
|
||||
@@ -83,11 +83,11 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public string UsoCfdi { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiConceptoModel
|
||||
public sealed class ModeloConceptoCfdi
|
||||
{
|
||||
public CfdiConceptoModel()
|
||||
public ModeloConceptoCfdi()
|
||||
{
|
||||
Impuestos = new List<CfdiImpuestoConceptoModel>();
|
||||
Impuestos = new List<ModeloImpuestoConceptoCfdi>();
|
||||
}
|
||||
|
||||
public string ClaveProductoServicio { get; set; }
|
||||
@@ -99,10 +99,10 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public decimal ValorUnitario { get; set; }
|
||||
public decimal Descuento { get; set; }
|
||||
public string ObjetoImpuesto { get; set; }
|
||||
public IList<CfdiImpuestoConceptoModel> Impuestos { get; private set; }
|
||||
public IList<ModeloImpuestoConceptoCfdi> Impuestos { get; private set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiImpuestoConceptoModel
|
||||
public sealed class ModeloImpuestoConceptoCfdi
|
||||
{
|
||||
public bool EsRetencion { get; set; }
|
||||
public decimal Base { get; set; }
|
||||
@@ -112,13 +112,13 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public decimal Importe { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiRelacionadoModel
|
||||
public sealed class ModeloCfdiRelacionado
|
||||
{
|
||||
public string TipoRelacion { get; set; }
|
||||
public string Uuid { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiDocumentoModel
|
||||
public sealed class ModeloDocumentoCfdi
|
||||
{
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
public Guid IdentificadorDocumento { get; set; }
|
||||
@@ -158,16 +158,16 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public long? CveCfdiTimbradoVigente { get; set; }
|
||||
public string UuidVigente { get; set; }
|
||||
public byte[] VersionFila { get; set; }
|
||||
public CfdiEmisorFiscalModel EmisorFiscal { get; set; }
|
||||
public ModeloEmisorFiscalCfdi EmisorFiscal { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiXmlBuildResultModel
|
||||
public sealed class ModeloResultadoConstruccionXmlCfdi
|
||||
{
|
||||
public CfdiDocumentoModel Documento { get; set; }
|
||||
public ModeloDocumentoCfdi Documento { get; set; }
|
||||
public string Xml { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiTimbradoInicioModel
|
||||
public sealed class ModeloInicioTimbradoCfdi
|
||||
{
|
||||
public long CveCfdiTimbrado { get; set; }
|
||||
public int NumeroIntento { get; set; }
|
||||
@@ -176,7 +176,7 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public bool PuedeEnviar { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiTimbradoIntentoModel
|
||||
public sealed class ModeloIntentoTimbradoCfdi
|
||||
{
|
||||
public long CveCfdiTimbrado { get; set; }
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
@@ -207,7 +207,7 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public byte[] CodigoBidimensional { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiPacSolicitudModel
|
||||
public sealed class ModeloSolicitudPacCfdi
|
||||
{
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
public long CveCfdiTimbrado { get; set; }
|
||||
@@ -220,7 +220,7 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public byte[] XmlSinTimbrar { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiPacResultadoModel
|
||||
public sealed class ModeloResultadoPacCfdi
|
||||
{
|
||||
public bool Exitoso { get; set; }
|
||||
public bool ResultadoIndeterminado { get; set; }
|
||||
@@ -240,14 +240,14 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public byte[] CodigoBidimensional { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiCancelacionSolicitudModel
|
||||
public sealed class ModeloSolicitudCancelacionCfdi
|
||||
{
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
public string Motivo { get; set; }
|
||||
public string UuidSustitucion { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiCancelacionInicioModel
|
||||
public sealed class ModeloInicioCancelacionCfdi
|
||||
{
|
||||
public long CveCfdiCancelacion { get; set; }
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
@@ -260,7 +260,7 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public bool PuedeEnviar { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiPacCancelacionSolicitudModel
|
||||
public sealed class ModeloSolicitudCancelacionPacCfdi
|
||||
{
|
||||
public string RfcEmisor { get; set; }
|
||||
public string Uuid { get; set; }
|
||||
@@ -270,7 +270,7 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public string ReferenciaCredencialPac { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiPacCancelacionResultadoModel
|
||||
public sealed class ModeloResultadoCancelacionPacCfdi
|
||||
{
|
||||
public bool Exitoso { get; set; }
|
||||
public bool ResultadoIndeterminado { get; set; }
|
||||
@@ -279,7 +279,7 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public string TipoExcepcion { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiCancelacionResultadoModel
|
||||
public sealed class ModeloResultadoCancelacionCfdi
|
||||
{
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
public long CveCfdiCancelacion { get; set; }
|
||||
@@ -289,7 +289,7 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public string Mensaje { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiTimbradoResultadoModel
|
||||
public sealed class ModeloResultadoTimbradoCfdi
|
||||
{
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
public long CveCfdiTimbrado { get; set; }
|
||||
@@ -302,7 +302,7 @@ namespace SIG.Web.AppCode.Models.Facturacion
|
||||
public string Mensaje { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CfdiArchivoModel
|
||||
public sealed class ModeloArchivoCfdi
|
||||
{
|
||||
public long CveCfdiDocumento { get; set; }
|
||||
public long? CveCfdiTimbrado { get; set; }
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace SIG.Web.AppCode.Models.General
|
||||
{
|
||||
public sealed class ClasificacionModel
|
||||
public sealed class ModeloClasificacion
|
||||
{
|
||||
public int CveClasificacion { get; set; }
|
||||
public string Codigo { get; set; }
|
||||
@@ -9,7 +9,7 @@ namespace SIG.Web.AppCode.Models.General
|
||||
public bool EsActivo { get; set; }
|
||||
}
|
||||
|
||||
public sealed class UnidadMedidaModel
|
||||
public sealed class ModeloUnidadMedida
|
||||
{
|
||||
public int CveUnidadMedida { get; set; }
|
||||
public string UnidadMedida { get; set; }
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
namespace SIG.Web.AppCode.Models.General
|
||||
{
|
||||
[System.Serializable]
|
||||
public sealed class ProductoServicioModel
|
||||
public sealed class ModeloProductoServicio
|
||||
{
|
||||
public int CvePS { get; set; }
|
||||
public string Codigo { get; set; }
|
||||
@@ -18,34 +18,34 @@ namespace SIG.Web.AppCode.Models.General
|
||||
public bool EsActivo { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ProductoServicioOpcionesModel
|
||||
public sealed class ModeloOpcionesProductoServicio
|
||||
{
|
||||
public ProductoServicioOpcionesModel()
|
||||
public ModeloOpcionesProductoServicio()
|
||||
{
|
||||
Clasificaciones = new List<ClasificacionProductoOpcionModel>();
|
||||
UnidadesMedida = new List<UnidadMedidaOpcionModel>();
|
||||
Clasificaciones = new List<ModeloOpcionClasificacionProducto>();
|
||||
UnidadesMedida = new List<ModeloOpcionUnidadMedida>();
|
||||
}
|
||||
|
||||
public List<ClasificacionProductoOpcionModel> Clasificaciones
|
||||
public List<ModeloOpcionClasificacionProducto> Clasificaciones
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public List<UnidadMedidaOpcionModel> UnidadesMedida
|
||||
public List<ModeloOpcionUnidadMedida> UnidadesMedida
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ClasificacionProductoOpcionModel
|
||||
public sealed class ModeloOpcionClasificacionProducto
|
||||
{
|
||||
public int CveClasificacion { get; set; }
|
||||
public string Clasificacion { get; set; }
|
||||
}
|
||||
|
||||
public sealed class UnidadMedidaOpcionModel
|
||||
public sealed class ModeloOpcionUnidadMedida
|
||||
{
|
||||
public int CveUnidadMedida { get; set; }
|
||||
public string UnidadMedida { get; set; }
|
||||
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
namespace SIG.Web.AppCode.Models.Security
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class PerfilSesionModel
|
||||
public sealed class ModeloPerfilSesion
|
||||
{
|
||||
public int CveUsuario { get; set; }
|
||||
public string NombreUsuario { get; set; }
|
||||
@@ -16,7 +16,7 @@ namespace SIG.Web.AppCode.Models.Security
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class PerfilClienteModel
|
||||
public sealed class ModeloPerfilCliente
|
||||
{
|
||||
public int CveCliente { get; set; }
|
||||
public string Nombre { get; set; }
|
||||
@@ -41,7 +41,7 @@ namespace SIG.Web.AppCode.Models.Security
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class RegimenFiscalPerfilOpcionModel
|
||||
public sealed class ModeloOpcionRegimenFiscalPerfil
|
||||
{
|
||||
public int CveRegimenFiscal { get; set; }
|
||||
public string CodigoRegimenFiscal { get; set; }
|
||||
@@ -57,7 +57,7 @@ namespace SIG.Web.AppCode.Models.Security
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class UsoCfdiPerfilOpcionModel
|
||||
public sealed class ModeloOpcionUsoCfdiPerfil
|
||||
{
|
||||
public int CveUsoCFDI { get; set; }
|
||||
public string UsoCFDI { get; set; }
|
||||
@@ -70,24 +70,24 @@ namespace SIG.Web.AppCode.Models.Security
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class PerfilUsuarioConsultaModel
|
||||
public sealed class ModeloConsultaPerfilUsuario
|
||||
{
|
||||
public PerfilUsuarioConsultaModel()
|
||||
public ModeloConsultaPerfilUsuario()
|
||||
{
|
||||
RegimenesFiscales =
|
||||
new List<RegimenFiscalPerfilOpcionModel>();
|
||||
UsosCfdi = new List<UsoCfdiPerfilOpcionModel>();
|
||||
new List<ModeloOpcionRegimenFiscalPerfil>();
|
||||
UsosCfdi = new List<ModeloOpcionUsoCfdiPerfil>();
|
||||
}
|
||||
|
||||
public PerfilSesionModel Sesion { get; set; }
|
||||
public PerfilClienteModel Cliente { get; set; }
|
||||
public List<RegimenFiscalPerfilOpcionModel>
|
||||
public ModeloPerfilSesion Sesion { get; set; }
|
||||
public ModeloPerfilCliente Cliente { get; set; }
|
||||
public List<ModeloOpcionRegimenFiscalPerfil>
|
||||
RegimenesFiscales { get; set; }
|
||||
public List<UsoCfdiPerfilOpcionModel> UsosCfdi { get; set; }
|
||||
public List<ModeloOpcionUsoCfdiPerfil> UsosCfdi { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class UsuarioCambioContextoModel
|
||||
public sealed class ModeloUsuarioCambioContexto
|
||||
{
|
||||
public int CveUsuario { get; set; }
|
||||
public string NombreUsuario { get; set; }
|
||||
@@ -145,7 +145,7 @@ namespace SIG.Web.AppCode.Models.Tramites
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ProductoServicioTramiteModel
|
||||
public sealed class ModeloProductoServicioTramite
|
||||
{
|
||||
public int CvePS { get; set; }
|
||||
public string Codigo { get; set; }
|
||||
|
||||
@@ -11,48 +11,48 @@ using SIG.Web.AppCode.Utilities;
|
||||
|
||||
namespace SIG.Web.AppCode.Repositories.Facturacion
|
||||
{
|
||||
public sealed class CfdiRepository
|
||||
: RepositoryBase, ICfdiRepository
|
||||
public sealed class RepositorioCfdi
|
||||
: RepositoryBase, IRepositorioCfdi
|
||||
{
|
||||
public CfdiRepository(IDbExecutor db)
|
||||
: base(db)
|
||||
public RepositorioCfdi(IDbExecutor ejecutorBaseDatos)
|
||||
: base(ejecutorBaseDatos)
|
||||
{
|
||||
}
|
||||
|
||||
public DbResult<CfdiEmisorFiscalModel> ObtenerEmisor(
|
||||
public DbResult<ModeloEmisorFiscalCfdi> ObtenerEmisor(
|
||||
int cveEmpresa,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<CfdiEmisorFiscalModel>(
|
||||
return QueryOne<ModeloEmisorFiscalCfdi>(
|
||||
"dbo.PA_Fac_EmisorFiscalGet",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
command => StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
comando => StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveEmpresa",
|
||||
cveEmpresa,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<CfdiReceptorFiscalModel> ObtenerReceptor(
|
||||
public DbResult<ModeloReceptorFiscalCfdi> ObtenerReceptor(
|
||||
int cveCliente,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<CfdiReceptorFiscalModel>(
|
||||
return QueryOne<ModeloReceptorFiscalCfdi>(
|
||||
"dbo.PA_Fac_ReceptorFiscalGet",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
command => StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
comando => StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
"@CveCliente",
|
||||
cveCliente,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<long> GuardarBorrador(
|
||||
CfdiDocumentoModel documento,
|
||||
ModeloDocumentoCfdi documento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
@@ -60,195 +60,195 @@ namespace SIG.Web.AppCode.Repositories.Facturacion
|
||||
"dbo.PA_Fac_CfdiDocumentoSaveDraft",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
command =>
|
||||
comando =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveCfdiDocumento",
|
||||
documento.CveCfdiDocumento <= 0
|
||||
? (object)null
|
||||
: documento.CveCfdiDocumento,
|
||||
DbType.Int64);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveEmpresa",
|
||||
documento.CveEmpresa,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveCliente",
|
||||
documento.CveCliente,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@TipoOrigen",
|
||||
documento.TipoOrigen,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveOrigen",
|
||||
documento.CveOrigen,
|
||||
DbType.Int64);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@ReferenciaOrigen",
|
||||
documento.ReferenciaOrigen,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@VersionCfdi",
|
||||
documento.VersionCfdi,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Serie",
|
||||
documento.Serie,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Folio",
|
||||
documento.Folio,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@FechaEmision",
|
||||
documento.FechaEmision,
|
||||
DbType.DateTime2);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@TipoComprobante",
|
||||
documento.TipoComprobante,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@FormaPago",
|
||||
documento.FormaPago,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@MetodoPago",
|
||||
documento.MetodoPago,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CondicionesPago",
|
||||
documento.CondicionesPago,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Moneda",
|
||||
documento.Moneda,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@TipoCambio",
|
||||
documento.TipoCambio,
|
||||
DbType.Decimal);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Exportacion",
|
||||
documento.Exportacion,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@LugarExpedicion",
|
||||
documento.LugarExpedicion,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Subtotal",
|
||||
documento.Subtotal,
|
||||
DbType.Decimal);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Descuento",
|
||||
documento.Descuento,
|
||||
DbType.Decimal);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@TotalImpuestosTrasladados",
|
||||
documento.TotalImpuestosTrasladados,
|
||||
DbType.Decimal);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@TotalImpuestosRetenidos",
|
||||
documento.TotalImpuestosRetenidos,
|
||||
DbType.Decimal);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Total",
|
||||
documento.Total,
|
||||
DbType.Decimal);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@RfcEmisor",
|
||||
documento.RfcEmisor,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@NombreEmisor",
|
||||
documento.NombreEmisor,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@RegimenFiscalEmisor",
|
||||
documento.RegimenFiscalEmisor,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@RfcReceptor",
|
||||
documento.RfcReceptor,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@NombreReceptor",
|
||||
documento.NombreReceptor,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@DomicilioFiscalReceptor",
|
||||
documento.DomicilioFiscalReceptor,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@RegimenFiscalReceptor",
|
||||
documento.RegimenFiscalReceptor,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@UsoCfdi",
|
||||
documento.UsoCfdi,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@XmlSinTimbrar",
|
||||
documento.XmlSinTimbrar,
|
||||
DbType.Binary);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@HashXmlSinTimbrar",
|
||||
documento.HashXmlSinTimbrar,
|
||||
DbType.Binary);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<CfdiDocumentoModel> ObtenerDocumento(
|
||||
public DbResult<ModeloDocumentoCfdi> ObtenerDocumento(
|
||||
long cveCfdiDocumento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<CfdiDocumentoModel>(
|
||||
return QueryOne<ModeloDocumentoCfdi>(
|
||||
"dbo.PA_Fac_CfdiDocumentoGet",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
command => Add(
|
||||
command,
|
||||
comando => Agregar(
|
||||
comando,
|
||||
"@CveCfdiDocumento",
|
||||
cveCfdiDocumento,
|
||||
DbType.Int64));
|
||||
}
|
||||
|
||||
public DbResult<CfdiTimbradoInicioModel> IniciarIntento(
|
||||
public DbResult<ModeloInicioTimbradoCfdi> IniciarIntento(
|
||||
long cveCfdiDocumento,
|
||||
Guid idSolicitud,
|
||||
string proveedorPac,
|
||||
@@ -257,199 +257,199 @@ namespace SIG.Web.AppCode.Repositories.Facturacion
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<CfdiTimbradoInicioModel>(
|
||||
return QueryOne<ModeloInicioTimbradoCfdi>(
|
||||
"dbo.PA_Fac_CfdiTimbradoAttemptStart",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
command =>
|
||||
comando =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveCfdiDocumento",
|
||||
cveCfdiDocumento,
|
||||
DbType.Int64);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@IdSolicitud",
|
||||
idSolicitud,
|
||||
DbType.Guid);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@ProveedorPac",
|
||||
proveedorPac,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Ambiente",
|
||||
ambiente,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@ReferenciaContratoPac",
|
||||
referenciaContratoPac,
|
||||
DbType.String);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<CfdiTimbradoIntentoModel> FinalizarIntento(
|
||||
public DbResult<ModeloIntentoTimbradoCfdi> FinalizarIntento(
|
||||
long cveCfdiTimbrado,
|
||||
CfdiPacResultadoModel resultadoPac,
|
||||
ModeloResultadoPacCfdi resultadoPac,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
byte[] hashXmlTimbrado =
|
||||
ProfactPacTimbradoClient.CalcularSha256(
|
||||
ClienteTimbradoPacProfact.CalcularSha256(
|
||||
resultadoPac.XmlTimbrado);
|
||||
|
||||
return QueryOne<CfdiTimbradoIntentoModel>(
|
||||
return QueryOne<ModeloIntentoTimbradoCfdi>(
|
||||
"dbo.PA_Fac_CfdiTimbradoAttemptComplete",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
command =>
|
||||
comando =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveCfdiTimbrado",
|
||||
cveCfdiTimbrado,
|
||||
DbType.Int64);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Exitoso",
|
||||
resultadoPac.Exitoso,
|
||||
DbType.Boolean);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@ResultadoIndeterminado",
|
||||
resultadoPac.ResultadoIndeterminado,
|
||||
DbType.Boolean);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@IdOperacionPac",
|
||||
resultadoPac.IdOperacionPac,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CodigoRespuesta",
|
||||
resultadoPac.CodigoRespuesta,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@MensajeRespuesta",
|
||||
resultadoPac.MensajeRespuesta,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@TipoExcepcion",
|
||||
resultadoPac.TipoExcepcion,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Uuid",
|
||||
resultadoPac.Uuid,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@FechaTimbrado",
|
||||
resultadoPac.FechaTimbrado,
|
||||
DbType.DateTime2);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@RfcProveedorCertificacion",
|
||||
resultadoPac.RfcProveedorCertificacion,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@NumeroCertificadoEmisor",
|
||||
resultadoPac.NumeroCertificadoEmisor,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@NumeroCertificadoSat",
|
||||
resultadoPac.NumeroCertificadoSat,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@SelloCfdi",
|
||||
resultadoPac.SelloCfdi,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@SelloSat",
|
||||
resultadoPac.SelloSat,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CadenaTimbre",
|
||||
resultadoPac.CadenaTimbre,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@XmlTimbrado",
|
||||
resultadoPac.XmlTimbrado,
|
||||
DbType.Binary);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@HashXmlTimbrado",
|
||||
hashXmlTimbrado,
|
||||
DbType.Binary);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CodigoBidimensional",
|
||||
resultadoPac.CodigoBidimensional,
|
||||
DbType.Binary);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<List<CfdiTimbradoIntentoModel>> ListarIntentos(
|
||||
public DbResult<List<ModeloIntentoTimbradoCfdi>> ListarIntentos(
|
||||
long cveCfdiDocumento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryList<CfdiTimbradoIntentoModel>(
|
||||
return QueryList<ModeloIntentoTimbradoCfdi>(
|
||||
"dbo.PA_Fac_CfdiTimbradoAttemptList",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
command => Add(
|
||||
command,
|
||||
comando => Agregar(
|
||||
comando,
|
||||
"@CveCfdiDocumento",
|
||||
cveCfdiDocumento,
|
||||
DbType.Int64));
|
||||
}
|
||||
|
||||
public DbResult<CfdiArchivoModel> ObtenerXml(
|
||||
public DbResult<ModeloArchivoCfdi> ObtenerXml(
|
||||
long cveCfdiDocumento,
|
||||
bool timbrado,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<CfdiArchivoModel>(
|
||||
return QueryOne<ModeloArchivoCfdi>(
|
||||
"dbo.PA_Fac_CfdiXmlGet",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
command =>
|
||||
comando =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveCfdiDocumento",
|
||||
cveCfdiDocumento,
|
||||
DbType.Int64);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Timbrado",
|
||||
timbrado,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<CfdiCancelacionInicioModel> IniciarCancelacion(
|
||||
CfdiCancelacionSolicitudModel solicitud,
|
||||
public DbResult<ModeloInicioCancelacionCfdi> IniciarCancelacion(
|
||||
ModeloSolicitudCancelacionCfdi solicitud,
|
||||
System.Guid idSolicitud,
|
||||
string proveedorPac,
|
||||
string ambiente,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<CfdiCancelacionInicioModel>(
|
||||
return QueryOne<ModeloInicioCancelacionCfdi>(
|
||||
"dbo.PA_Fac_CfdiCancelacionAttemptStart",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
@@ -488,13 +488,13 @@ namespace SIG.Web.AppCode.Repositories.Facturacion
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<CfdiCancelacionResultadoModel> FinalizarCancelacion(
|
||||
public DbResult<ModeloResultadoCancelacionCfdi> FinalizarCancelacion(
|
||||
long cveCfdiCancelacion,
|
||||
CfdiPacCancelacionResultadoModel resultadoPac,
|
||||
ModeloResultadoCancelacionPacCfdi resultadoPac,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<CfdiCancelacionResultadoModel>(
|
||||
return QueryOne<ModeloResultadoCancelacionCfdi>(
|
||||
"dbo.PA_Fac_CfdiCancelacionAttemptComplete",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
@@ -533,17 +533,17 @@ namespace SIG.Web.AppCode.Repositories.Facturacion
|
||||
});
|
||||
}
|
||||
|
||||
private static void Add(
|
||||
IDbCommand command,
|
||||
string name,
|
||||
object value,
|
||||
DbType type)
|
||||
private static void Agregar(
|
||||
IDbCommand comando,
|
||||
string nombre,
|
||||
object valor,
|
||||
DbType tipo)
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
command,
|
||||
name,
|
||||
value,
|
||||
type);
|
||||
comando,
|
||||
nombre,
|
||||
valor,
|
||||
tipo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,53 +8,53 @@ using SIG.Web.AppCode.Repositories.Database;
|
||||
|
||||
namespace SIG.Web.AppCode.Repositories.General
|
||||
{
|
||||
public sealed class ProductoCatalogRepository
|
||||
: RepositoryBase, IProductoCatalogRepository
|
||||
public sealed class RepositorioCatalogoProducto
|
||||
: RepositoryBase, IRepositorioCatalogoProducto
|
||||
{
|
||||
public ProductoCatalogRepository(IDbExecutor dbExecutor)
|
||||
: base(dbExecutor)
|
||||
public RepositorioCatalogoProducto(IDbExecutor ejecutorBaseDatos)
|
||||
: base(ejecutorBaseDatos)
|
||||
{
|
||||
}
|
||||
|
||||
public DbResult<List<ClasificacionModel>> ListClasificaciones(
|
||||
public DbResult<List<ModeloClasificacion>> ListarClasificaciones(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryList<ClasificacionModel>(
|
||||
return QueryList<ModeloClasificacion>(
|
||||
"dbo.PA_Gral_ClasificacionList",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
comando =>
|
||||
{
|
||||
Add(command, "@Texto", texto, DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(comando, "@Texto", texto, DbType.String);
|
||||
Agregar(
|
||||
comando,
|
||||
"@IncluirInactivos",
|
||||
incluirInactivos,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<ClasificacionModel> GetClasificacion(
|
||||
public DbResult<ModeloClasificacion> ObtenerClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryOne<ClasificacionModel>(
|
||||
return QueryOne<ModeloClasificacion>(
|
||||
"dbo.PA_Gral_ClasificacionGet",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(
|
||||
command,
|
||||
comando => Agregar(
|
||||
comando,
|
||||
"@CveClasificacion",
|
||||
cveClasificacion,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<int> SaveClasificacion(
|
||||
ClasificacionModel clasificacion,
|
||||
public DbResult<int> GuardarClasificacion(
|
||||
ModeloClasificacion clasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
@@ -62,35 +62,35 @@ namespace SIG.Web.AppCode.Repositories.General
|
||||
"dbo.PA_Gral_ClasificacionSave",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
comando =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveClasificacion",
|
||||
clasificacion.CveClasificacion > 0
|
||||
? (object)clasificacion.CveClasificacion
|
||||
: null,
|
||||
DbType.Int32);
|
||||
Add(command, "@Codigo", clasificacion.Codigo, DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(comando, "@Codigo", clasificacion.Codigo, DbType.String);
|
||||
Agregar(
|
||||
comando,
|
||||
"@Clasificacion",
|
||||
clasificacion.Clasificacion,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Afectable",
|
||||
clasificacion.Afectable,
|
||||
DbType.Boolean);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@EsActivo",
|
||||
clasificacion.EsActivo,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<bool> DeleteClasificacion(
|
||||
public DbResult<bool> EliminarClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
@@ -99,52 +99,52 @@ namespace SIG.Web.AppCode.Repositories.General
|
||||
"dbo.PA_Gral_ClasificacionDelete",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(
|
||||
command,
|
||||
comando => Agregar(
|
||||
comando,
|
||||
"@CveClasificacion",
|
||||
cveClasificacion,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<List<UnidadMedidaModel>> ListUnidadesMedida(
|
||||
public DbResult<List<ModeloUnidadMedida>> ListarUnidadesMedida(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryList<UnidadMedidaModel>(
|
||||
return QueryList<ModeloUnidadMedida>(
|
||||
"dbo.PA_Gral_UnidadMedidaList",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
comando =>
|
||||
{
|
||||
Add(command, "@Texto", texto, DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(comando, "@Texto", texto, DbType.String);
|
||||
Agregar(
|
||||
comando,
|
||||
"@IncluirInactivos",
|
||||
incluirInactivos,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<UnidadMedidaModel> GetUnidadMedida(
|
||||
public DbResult<ModeloUnidadMedida> ObtenerUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryOne<UnidadMedidaModel>(
|
||||
return QueryOne<ModeloUnidadMedida>(
|
||||
"dbo.PA_Gral_UnidadMedidaGet",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(
|
||||
command,
|
||||
comando => Agregar(
|
||||
comando,
|
||||
"@CveUnidadMedida",
|
||||
cveUnidadMedida,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<int> SaveUnidadMedida(
|
||||
UnidadMedidaModel unidadMedida,
|
||||
public DbResult<int> GuardarUnidadMedida(
|
||||
ModeloUnidadMedida unidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
@@ -152,34 +152,34 @@ namespace SIG.Web.AppCode.Repositories.General
|
||||
"dbo.PA_Gral_UnidadMedidaSave",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
comando =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveUnidadMedida",
|
||||
unidadMedida.CveUnidadMedida > 0
|
||||
? (object)unidadMedida.CveUnidadMedida
|
||||
: null,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@UnidadMedida",
|
||||
unidadMedida.UnidadMedida,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Abreviatura",
|
||||
unidadMedida.Abreviatura,
|
||||
DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@EsActivo",
|
||||
unidadMedida.EsActivo,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<bool> DeleteUnidadMedida(
|
||||
public DbResult<bool> EliminarUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
@@ -188,20 +188,20 @@ namespace SIG.Web.AppCode.Repositories.General
|
||||
"dbo.PA_Gral_UnidadMedidaDelete",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(
|
||||
command,
|
||||
comando => Agregar(
|
||||
comando,
|
||||
"@CveUnidadMedida",
|
||||
cveUnidadMedida,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
private static void Add(
|
||||
IDbCommand command,
|
||||
string name,
|
||||
object value,
|
||||
DbType type)
|
||||
private static void Agregar(
|
||||
IDbCommand comando,
|
||||
string nombre,
|
||||
object valor,
|
||||
DbType tipo)
|
||||
{
|
||||
StoredProcedureCommand.AddInput(command, name, value, type);
|
||||
StoredProcedureCommand.AddInput(comando, nombre, valor, tipo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,48 +9,48 @@ using SIG.Web.AppCode.Utilities;
|
||||
|
||||
namespace SIG.Web.AppCode.Repositories.General
|
||||
{
|
||||
public sealed class ProductoServicioRepository
|
||||
: RepositoryBase, IProductoServicioRepository
|
||||
public sealed class RepositorioProductoServicio
|
||||
: RepositoryBase, IRepositorioProductoServicio
|
||||
{
|
||||
public ProductoServicioRepository(IDbExecutor dbExecutor)
|
||||
: base(dbExecutor)
|
||||
public RepositorioProductoServicio(IDbExecutor ejecutorBaseDatos)
|
||||
: base(ejecutorBaseDatos)
|
||||
{
|
||||
}
|
||||
|
||||
public DbResult<List<ProductoServicioModel>> List(
|
||||
public DbResult<List<ModeloProductoServicio>> Listar(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryList<ProductoServicioModel>(
|
||||
return QueryList<ModeloProductoServicio>(
|
||||
"dbo.PA_Gral_ProductoServicioList",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
comando =>
|
||||
{
|
||||
Add(command, "@Texto", texto, DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(comando, "@Texto", texto, DbType.String);
|
||||
Agregar(
|
||||
comando,
|
||||
"@IncluirInactivos",
|
||||
incluirInactivos,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<ProductoServicioModel> Get(
|
||||
public DbResult<ModeloProductoServicio> Obtener(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryOne<ProductoServicioModel>(
|
||||
return QueryOne<ModeloProductoServicio>(
|
||||
"dbo.PA_Gral_ProductoServicioGet",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(command, "@CvePS", cvePS, DbType.Int32));
|
||||
comando => Agregar(comando, "@CvePS", cvePS, DbType.Int32));
|
||||
}
|
||||
|
||||
public DbResult<ProductoServicioOpcionesModel> ListOptions(
|
||||
public DbResult<ModeloOpcionesProductoServicio> ListarOpciones(
|
||||
int? cveClasificacionActual,
|
||||
int? cveUnidadMedidaActual,
|
||||
int usuario,
|
||||
@@ -60,39 +60,39 @@ namespace SIG.Web.AppCode.Repositories.General
|
||||
"dbo.PA_Gral_ProductoServicioOpcionesList",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
comando =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveClasificacionActual",
|
||||
cveClasificacionActual,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveUnidadMedidaActual",
|
||||
cveUnidadMedidaActual,
|
||||
DbType.Int32);
|
||||
},
|
||||
reader =>
|
||||
lector =>
|
||||
{
|
||||
var options = new ProductoServicioOpcionesModel
|
||||
var opciones = new ModeloOpcionesProductoServicio
|
||||
{
|
||||
Clasificaciones =
|
||||
reader.ToList<ClasificacionProductoOpcionModel>()
|
||||
lector.ToList<ModeloOpcionClasificacionProducto>()
|
||||
};
|
||||
|
||||
if (reader.NextResult())
|
||||
if (lector.NextResult())
|
||||
{
|
||||
options.UnidadesMedida =
|
||||
reader.ToList<UnidadMedidaOpcionModel>();
|
||||
opciones.UnidadesMedida =
|
||||
lector.ToList<ModeloOpcionUnidadMedida>();
|
||||
}
|
||||
|
||||
return options;
|
||||
return opciones;
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<int> Save(
|
||||
ProductoServicioModel productoServicio,
|
||||
public DbResult<int> Guardar(
|
||||
ModeloProductoServicio productoServicio,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
@@ -100,50 +100,50 @@ namespace SIG.Web.AppCode.Repositories.General
|
||||
"dbo.PA_Gral_ProductoServicioSave",
|
||||
usuario,
|
||||
dominio,
|
||||
command =>
|
||||
comando =>
|
||||
{
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CvePS",
|
||||
productoServicio.CvePS > 0
|
||||
? (object)productoServicio.CvePS
|
||||
: null,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Codigo",
|
||||
productoServicio.Codigo,
|
||||
DbType.String);
|
||||
Add(command, "@PS", productoServicio.PS, DbType.String);
|
||||
Add(
|
||||
command,
|
||||
Agregar(comando, "@PS", productoServicio.PS, DbType.String);
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveTipoPS",
|
||||
productoServicio.CveTipoPS,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveClasificacion",
|
||||
productoServicio.CveClasificacion,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@CveUnidadMedida",
|
||||
productoServicio.CveUnidadMedida,
|
||||
DbType.Int32);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@Precio",
|
||||
productoServicio.Precio,
|
||||
DbType.Decimal);
|
||||
Add(
|
||||
command,
|
||||
Agregar(
|
||||
comando,
|
||||
"@EsActivo",
|
||||
productoServicio.EsActivo,
|
||||
DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<bool> Delete(
|
||||
public DbResult<bool> Eliminar(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio)
|
||||
@@ -152,20 +152,20 @@ namespace SIG.Web.AppCode.Repositories.General
|
||||
"dbo.PA_Gral_ProductoServicioDelete",
|
||||
usuario,
|
||||
dominio,
|
||||
command => Add(
|
||||
command,
|
||||
comando => Agregar(
|
||||
comando,
|
||||
"@CvePS",
|
||||
cvePS,
|
||||
DbType.Int32));
|
||||
}
|
||||
|
||||
private static void Add(
|
||||
IDbCommand command,
|
||||
string name,
|
||||
object value,
|
||||
DbType type)
|
||||
private static void Agregar(
|
||||
IDbCommand comando,
|
||||
string nombre,
|
||||
object valor,
|
||||
DbType tipo)
|
||||
{
|
||||
StoredProcedureCommand.AddInput(command, name, value, type);
|
||||
StoredProcedureCommand.AddInput(comando, nombre, valor, tipo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,15 +9,15 @@ using SIG.Web.AppCode.Utilities;
|
||||
|
||||
namespace SIG.Web.AppCode.Repositories.Security
|
||||
{
|
||||
public sealed class PerfilUsuarioRepository
|
||||
: RepositoryBase, IPerfilUsuarioRepository
|
||||
public sealed class RepositorioPerfilUsuario
|
||||
: RepositoryBase, IRepositorioPerfilUsuario
|
||||
{
|
||||
public PerfilUsuarioRepository(IDbExecutor ejecutorBaseDatos)
|
||||
public RepositorioPerfilUsuario(IDbExecutor ejecutorBaseDatos)
|
||||
: base(ejecutorBaseDatos)
|
||||
{
|
||||
}
|
||||
|
||||
public DbResult<PerfilUsuarioConsultaModel> ObtenerPerfil(
|
||||
public DbResult<ModeloConsultaPerfilUsuario> ObtenerPerfil(
|
||||
int cveUsuario,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
@@ -33,41 +33,41 @@ namespace SIG.Web.AppCode.Repositories.Security
|
||||
DbType.Int32),
|
||||
lector =>
|
||||
{
|
||||
var perfil = new PerfilUsuarioConsultaModel
|
||||
var perfil = new ModeloConsultaPerfilUsuario
|
||||
{
|
||||
Sesion = lector.ToObject<PerfilSesionModel>()
|
||||
Sesion = lector.ToObject<ModeloPerfilSesion>()
|
||||
};
|
||||
|
||||
if (lector.NextResult())
|
||||
{
|
||||
perfil.Cliente =
|
||||
lector.ToObject<PerfilClienteModel>();
|
||||
lector.ToObject<ModeloPerfilCliente>();
|
||||
}
|
||||
|
||||
if (lector.NextResult())
|
||||
{
|
||||
perfil.RegimenesFiscales = lector.ToList<
|
||||
RegimenFiscalPerfilOpcionModel>();
|
||||
ModeloOpcionRegimenFiscalPerfil>();
|
||||
}
|
||||
|
||||
if (lector.NextResult())
|
||||
{
|
||||
perfil.UsosCfdi =
|
||||
lector.ToList<UsoCfdiPerfilOpcionModel>();
|
||||
lector.ToList<ModeloOpcionUsoCfdiPerfil>();
|
||||
}
|
||||
|
||||
return perfil;
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<PerfilSesionModel> ActualizarSesion(
|
||||
public DbResult<ModeloPerfilSesion> ActualizarSesion(
|
||||
int cveUsuario,
|
||||
string nombreUsuario,
|
||||
string hashContrasena,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<PerfilSesionModel>(
|
||||
return QueryOne<ModeloPerfilSesion>(
|
||||
"dbo.PA_Sis_PerfilSesionUpdate",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
@@ -92,7 +92,7 @@ namespace SIG.Web.AppCode.Repositories.Security
|
||||
}
|
||||
|
||||
public DbResult<bool> ActualizarCliente(
|
||||
PerfilClienteModel cliente,
|
||||
ModeloPerfilCliente cliente,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
@@ -106,13 +106,13 @@ namespace SIG.Web.AppCode.Repositories.Security
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<List<UsuarioCambioContextoModel>>
|
||||
public DbResult<List<ModeloUsuarioCambioContexto>>
|
||||
ListarUsuariosCambio(
|
||||
string texto,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryList<UsuarioCambioContextoModel>(
|
||||
return QueryList<ModeloUsuarioCambioContexto>(
|
||||
"dbo.PA_Sis_UsuarioContextoList",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
@@ -123,12 +123,12 @@ namespace SIG.Web.AppCode.Repositories.Security
|
||||
DbType.String));
|
||||
}
|
||||
|
||||
public DbResult<UsuarioCambioContextoModel> ObtenerUsuarioContexto(
|
||||
public DbResult<ModeloUsuarioCambioContexto> ObtenerUsuarioContexto(
|
||||
int cveUsuario,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return QueryOne<UsuarioCambioContextoModel>(
|
||||
return QueryOne<ModeloUsuarioCambioContexto>(
|
||||
"dbo.PA_Sis_UsuarioContextoGet",
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio,
|
||||
@@ -141,7 +141,7 @@ namespace SIG.Web.AppCode.Repositories.Security
|
||||
|
||||
private static void AgregarDatosCliente(
|
||||
IDbCommand comando,
|
||||
PerfilClienteModel cliente)
|
||||
ModeloPerfilCliente cliente)
|
||||
{
|
||||
StoredProcedureCommand.AddInput(
|
||||
comando,
|
||||
@@ -314,22 +314,22 @@ namespace SIG.Web.AppCode.Repositories.Tramites
|
||||
return Delete("dbo.PA_Tra_PagoDetalleDelete", "@CveTramitePagoDetalle", id, usuario, dominio);
|
||||
}
|
||||
|
||||
public DbResult<List<ProductoServicioTramiteModel>> ListProductosServicios(
|
||||
public DbResult<List<ModeloProductoServicioTramite>> ListProductosServicios(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return QueryList<ProductoServicioTramiteModel>("dbo.PA_Tra_ProductoServicioList", usuario, dominio, command =>
|
||||
return QueryList<ModeloProductoServicioTramite>("dbo.PA_Tra_ProductoServicioList", usuario, dominio, command =>
|
||||
{
|
||||
Add(command, "@Texto", texto, DbType.String);
|
||||
Add(command, "@IncluirInactivos", incluirInactivos, DbType.Boolean);
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<ProductoServicioTramiteModel> GetProductoServicio(int id, int usuario, string dominio)
|
||||
public DbResult<ModeloProductoServicioTramite> GetProductoServicio(int id, int usuario, string dominio)
|
||||
{
|
||||
return QueryOne<ProductoServicioTramiteModel>("dbo.PA_Tra_ProductoServicioGet", usuario, dominio, command =>
|
||||
return QueryOne<ModeloProductoServicioTramite>("dbo.PA_Tra_ProductoServicioGet", usuario, dominio, command =>
|
||||
Add(command, "@CvePS", id, DbType.Int32));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
public sealed class AlmacenArchivosCfdi : IAlmacenArchivosCfdi
|
||||
{
|
||||
public DbResult<string> GuardarXmlTimbrado(
|
||||
CfdiDocumentoModel documento,
|
||||
CfdiTimbradoIntentoModel intento)
|
||||
ModeloDocumentoCfdi documento,
|
||||
ModeloIntentoTimbradoCfdi intento)
|
||||
{
|
||||
if (documento == null || intento == null)
|
||||
{
|
||||
@@ -101,24 +101,24 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
return DbResult<string>.Ok(
|
||||
rutaRelativaDirectorio + nombreArchivo);
|
||||
}
|
||||
catch (Exception exception)
|
||||
catch (Exception excepcion)
|
||||
{
|
||||
return Error(
|
||||
"No fue posible crear el archivo XML timbrado.",
|
||||
exception);
|
||||
excepcion);
|
||||
}
|
||||
}
|
||||
|
||||
private static DbResult<string> Error(
|
||||
string mensaje,
|
||||
Exception exception)
|
||||
Exception excepcion)
|
||||
{
|
||||
return DbResult<string>.Fail(
|
||||
mensaje,
|
||||
exception == null
|
||||
excepcion == null
|
||||
? mensaje
|
||||
: exception.ToString(),
|
||||
exception);
|
||||
: excepcion.ToString(),
|
||||
excepcion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ using SIG.Web.AppCode.Models.Facturacion;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.Facturacion
|
||||
{
|
||||
public sealed class ConfigurationPacCredentialProvider
|
||||
: IPacCredentialProvider
|
||||
public sealed class ProveedorCredencialPacConfiguracion
|
||||
: IProveedorCredencialPac
|
||||
{
|
||||
public string ObtenerCredencial(string referencia)
|
||||
{
|
||||
@@ -22,13 +22,13 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
return null;
|
||||
}
|
||||
|
||||
string environmentValue =
|
||||
string valorAmbiente =
|
||||
Environment.GetEnvironmentVariable(
|
||||
referencia.Trim());
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(environmentValue))
|
||||
if (!string.IsNullOrWhiteSpace(valorAmbiente))
|
||||
{
|
||||
return environmentValue;
|
||||
return valorAmbiente;
|
||||
}
|
||||
|
||||
return ConfigurationManager.AppSettings[
|
||||
@@ -36,15 +36,15 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ProfactPacTimbradoClient
|
||||
: IPacTimbradoClient, IPacCancelacionClient
|
||||
public sealed class ClienteTimbradoPacProfact
|
||||
: IClienteTimbradoPac, IClienteCancelacionPac
|
||||
{
|
||||
private readonly IPacCredentialProvider _credentialProvider;
|
||||
private readonly IProveedorCredencialPac _proveedorCredencial;
|
||||
|
||||
public ProfactPacTimbradoClient(
|
||||
IPacCredentialProvider credentialProvider)
|
||||
public ClienteTimbradoPacProfact(
|
||||
IProveedorCredencialPac proveedorCredencial)
|
||||
{
|
||||
_credentialProvider = credentialProvider;
|
||||
_proveedorCredencial = proveedorCredencial;
|
||||
}
|
||||
|
||||
public string Proveedor
|
||||
@@ -52,8 +52,8 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
get { return "PROFACT"; }
|
||||
}
|
||||
|
||||
public CfdiPacResultadoModel Timbrar(
|
||||
CfdiPacSolicitudModel solicitud)
|
||||
public ModeloResultadoPacCfdi Timbrar(
|
||||
ModeloSolicitudPacCfdi solicitud)
|
||||
{
|
||||
if (solicitud == null
|
||||
|| solicitud.XmlSinTimbrar == null
|
||||
@@ -64,11 +64,11 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
"El documento no contiene un XML para timbrar.");
|
||||
}
|
||||
|
||||
string credential =
|
||||
_credentialProvider.ObtenerCredencial(
|
||||
string credencial =
|
||||
_proveedorCredencial.ObtenerCredencial(
|
||||
solicitud.ReferenciaCredencialPac);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(credential))
|
||||
if (string.IsNullOrWhiteSpace(credencial))
|
||||
{
|
||||
return Fallo(
|
||||
"PAC_NO_CONFIGURADO",
|
||||
@@ -82,16 +82,16 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
|
||||
var conector = new ProfactConnector40(
|
||||
solicitud.AmbienteProduccion);
|
||||
conector.EstableceCredenciales(credential);
|
||||
conector.EstableceCredenciales(credencial);
|
||||
|
||||
ResultadoTimbre resultado =
|
||||
conector.TimbraCFDI(xml, false);
|
||||
|
||||
return ConvertirResultado(resultado);
|
||||
}
|
||||
catch (FaultException exception)
|
||||
catch (FaultException excepcion)
|
||||
{
|
||||
return new CfdiPacResultadoModel
|
||||
return new ModeloResultadoPacCfdi
|
||||
{
|
||||
Exitoso = false,
|
||||
ResultadoIndeterminado = false,
|
||||
@@ -99,20 +99,20 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
MensajeRespuesta =
|
||||
"El PAC rechazó la solicitud de timbrado.",
|
||||
TipoExcepcion =
|
||||
exception.GetType().FullName
|
||||
excepcion.GetType().FullName
|
||||
};
|
||||
}
|
||||
catch (TimeoutException exception)
|
||||
catch (TimeoutException excepcion)
|
||||
{
|
||||
return Indeterminado(exception);
|
||||
return Indeterminado(excepcion);
|
||||
}
|
||||
catch (CommunicationException exception)
|
||||
catch (CommunicationException excepcion)
|
||||
{
|
||||
return Indeterminado(exception);
|
||||
return Indeterminado(excepcion);
|
||||
}
|
||||
catch (Exception exception)
|
||||
catch (Exception excepcion)
|
||||
{
|
||||
return new CfdiPacResultadoModel
|
||||
return new ModeloResultadoPacCfdi
|
||||
{
|
||||
Exitoso = false,
|
||||
ResultadoIndeterminado = false,
|
||||
@@ -120,13 +120,13 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
MensajeRespuesta =
|
||||
"El PAC rechazó la solicitud o no pudo procesarla.",
|
||||
TipoExcepcion =
|
||||
exception.GetType().FullName
|
||||
excepcion.GetType().FullName
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public CfdiPacCancelacionResultadoModel Cancelar(
|
||||
CfdiPacCancelacionSolicitudModel solicitud)
|
||||
public ModeloResultadoCancelacionPacCfdi Cancelar(
|
||||
ModeloSolicitudCancelacionPacCfdi solicitud)
|
||||
{
|
||||
if (solicitud == null ||
|
||||
string.IsNullOrWhiteSpace(solicitud.RfcEmisor) ||
|
||||
@@ -139,7 +139,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
}
|
||||
|
||||
string credencial =
|
||||
_credentialProvider.ObtenerCredencial(
|
||||
_proveedorCredencial.ObtenerCredencial(
|
||||
solicitud.ReferenciaCredencialPac);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(credencial))
|
||||
@@ -166,7 +166,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
? FalloCancelacion(
|
||||
"PAC_SIN_RESPUESTA",
|
||||
"El PAC no devolvió una respuesta de cancelación.")
|
||||
: new CfdiPacCancelacionResultadoModel
|
||||
: new ModeloResultadoCancelacionPacCfdi
|
||||
{
|
||||
Exitoso = resultado.Exitoso,
|
||||
CodigoRespuesta = Texto(resultado.NumeroError),
|
||||
@@ -178,33 +178,33 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
TipoExcepcion = Texto(resultado.TipoExcepcion)
|
||||
};
|
||||
}
|
||||
catch (TimeoutException exception)
|
||||
catch (TimeoutException excepcion)
|
||||
{
|
||||
return CancelacionIndeterminada(exception);
|
||||
return CancelacionIndeterminada(excepcion);
|
||||
}
|
||||
catch (CommunicationException exception)
|
||||
catch (CommunicationException excepcion)
|
||||
{
|
||||
return CancelacionIndeterminada(exception);
|
||||
return CancelacionIndeterminada(excepcion);
|
||||
}
|
||||
catch (Exception exception)
|
||||
catch (Exception excepcion)
|
||||
{
|
||||
return new CfdiPacCancelacionResultadoModel
|
||||
return new ModeloResultadoCancelacionPacCfdi
|
||||
{
|
||||
Exitoso = false,
|
||||
ResultadoIndeterminado = false,
|
||||
CodigoRespuesta = "PAC_EXCEPCION",
|
||||
MensajeRespuesta =
|
||||
"El PAC rechazó la cancelación o no pudo procesarla.",
|
||||
TipoExcepcion = exception.GetType().FullName
|
||||
TipoExcepcion = excepcion.GetType().FullName
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static CfdiPacCancelacionResultadoModel FalloCancelacion(
|
||||
private static ModeloResultadoCancelacionPacCfdi FalloCancelacion(
|
||||
string codigo,
|
||||
string mensaje)
|
||||
{
|
||||
return new CfdiPacCancelacionResultadoModel
|
||||
return new ModeloResultadoCancelacionPacCfdi
|
||||
{
|
||||
Exitoso = false,
|
||||
ResultadoIndeterminado = false,
|
||||
@@ -213,21 +213,21 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
};
|
||||
}
|
||||
|
||||
private static CfdiPacCancelacionResultadoModel CancelacionIndeterminada(
|
||||
Exception exception)
|
||||
private static ModeloResultadoCancelacionPacCfdi CancelacionIndeterminada(
|
||||
Exception excepcion)
|
||||
{
|
||||
return new CfdiPacCancelacionResultadoModel
|
||||
return new ModeloResultadoCancelacionPacCfdi
|
||||
{
|
||||
Exitoso = false,
|
||||
ResultadoIndeterminado = true,
|
||||
CodigoRespuesta = "PAC_RESULTADO_INDETERMINADO",
|
||||
MensajeRespuesta =
|
||||
"El PAC no confirmó la cancelación. Debe consultarse antes de reenviar.",
|
||||
TipoExcepcion = exception.GetType().FullName
|
||||
TipoExcepcion = excepcion.GetType().FullName
|
||||
};
|
||||
}
|
||||
|
||||
private static CfdiPacResultadoModel ConvertirResultado(
|
||||
private static ModeloResultadoPacCfdi ConvertirResultado(
|
||||
ResultadoTimbre resultado)
|
||||
{
|
||||
if (resultado == null)
|
||||
@@ -242,7 +242,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
? null
|
||||
: ConvertirXmlAUtf8(resultado.Xml);
|
||||
|
||||
var converted = new CfdiPacResultadoModel
|
||||
var convertido = new ModeloResultadoPacCfdi
|
||||
{
|
||||
Exitoso = resultado.Exitoso,
|
||||
ResultadoIndeterminado = false,
|
||||
@@ -274,12 +274,12 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
resultado.CodigoBidimensional
|
||||
};
|
||||
|
||||
CompletarDesdeTimbreFiscal(converted);
|
||||
return converted;
|
||||
CompletarDesdeTimbreFiscal(convertido);
|
||||
return convertido;
|
||||
}
|
||||
|
||||
private static void CompletarDesdeTimbreFiscal(
|
||||
CfdiPacResultadoModel resultado)
|
||||
ModeloResultadoPacCfdi resultado)
|
||||
{
|
||||
if (resultado.XmlTimbrado == null
|
||||
|| resultado.XmlTimbrado.Length == 0)
|
||||
@@ -289,15 +289,15 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
|
||||
try
|
||||
{
|
||||
var document = new XmlDocument
|
||||
var documentoXml = new XmlDocument
|
||||
{
|
||||
PreserveWhitespace = true
|
||||
};
|
||||
document.LoadXml(
|
||||
documentoXml.LoadXml(
|
||||
Encoding.UTF8.GetString(
|
||||
resultado.XmlTimbrado));
|
||||
|
||||
XmlNode timbre = document.SelectSingleNode(
|
||||
XmlNode timbre = documentoXml.SelectSingleNode(
|
||||
"//*[local-name()='TimbreFiscalDigital']");
|
||||
|
||||
if (timbre == null)
|
||||
@@ -341,38 +341,38 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
}
|
||||
|
||||
private static string ValorAtributo(
|
||||
XmlNode node,
|
||||
string name,
|
||||
string fallback)
|
||||
XmlNode nodo,
|
||||
string nombre,
|
||||
string valorAlternativo)
|
||||
{
|
||||
XmlAttribute attribute =
|
||||
node.Attributes == null
|
||||
XmlAttribute atributo =
|
||||
nodo.Attributes == null
|
||||
? null
|
||||
: node.Attributes[name];
|
||||
: nodo.Attributes[nombre];
|
||||
|
||||
return attribute == null
|
||||
|| string.IsNullOrWhiteSpace(attribute.Value)
|
||||
? fallback
|
||||
: attribute.Value.Trim();
|
||||
return atributo == null
|
||||
|| string.IsNullOrWhiteSpace(atributo.Value)
|
||||
? valorAlternativo
|
||||
: atributo.Value.Trim();
|
||||
}
|
||||
|
||||
private static CfdiPacResultadoModel Fallo(
|
||||
string code,
|
||||
string message)
|
||||
private static ModeloResultadoPacCfdi Fallo(
|
||||
string codigo,
|
||||
string mensaje)
|
||||
{
|
||||
return new CfdiPacResultadoModel
|
||||
return new ModeloResultadoPacCfdi
|
||||
{
|
||||
Exitoso = false,
|
||||
ResultadoIndeterminado = false,
|
||||
CodigoRespuesta = code,
|
||||
MensajeRespuesta = message
|
||||
CodigoRespuesta = codigo,
|
||||
MensajeRespuesta = mensaje
|
||||
};
|
||||
}
|
||||
|
||||
private static CfdiPacResultadoModel Indeterminado(
|
||||
Exception exception)
|
||||
private static ModeloResultadoPacCfdi Indeterminado(
|
||||
Exception excepcion)
|
||||
{
|
||||
return new CfdiPacResultadoModel
|
||||
return new ModeloResultadoPacCfdi
|
||||
{
|
||||
Exitoso = false,
|
||||
ResultadoIndeterminado = true,
|
||||
@@ -380,34 +380,34 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
MensajeRespuesta =
|
||||
"El PAC no confirmó si el CFDI fue timbrado. Debe consultarse antes de reenviar.",
|
||||
TipoExcepcion =
|
||||
exception.GetType().FullName
|
||||
excepcion.GetType().FullName
|
||||
};
|
||||
}
|
||||
|
||||
private static DateTime? ConvertirFecha(string value)
|
||||
private static DateTime? ConvertirFecha(string valor)
|
||||
{
|
||||
DateTime date;
|
||||
return DateTime.TryParse(value, out date)
|
||||
? (DateTime?)date
|
||||
DateTime fecha;
|
||||
return DateTime.TryParse(valor, out fecha)
|
||||
? (DateTime?)fecha
|
||||
: null;
|
||||
}
|
||||
|
||||
private static string Texto(string value)
|
||||
private static string Texto(string valor)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(value)
|
||||
return string.IsNullOrWhiteSpace(valor)
|
||||
? null
|
||||
: value.Trim();
|
||||
: valor.Trim();
|
||||
}
|
||||
|
||||
private static byte[] ConvertirXmlAUtf8(string xml)
|
||||
{
|
||||
string normalized = Regex.Replace(
|
||||
string normalizado = Regex.Replace(
|
||||
xml,
|
||||
"encoding\\s*=\\s*([\"'])utf-16\\1",
|
||||
"encoding=\"utf-8\"",
|
||||
RegexOptions.IgnoreCase);
|
||||
|
||||
return new UTF8Encoding(false).GetBytes(normalized);
|
||||
return new UTF8Encoding(false).GetBytes(normalizado);
|
||||
}
|
||||
|
||||
public static byte[] CalcularSha256(byte[] contenido)
|
||||
@@ -11,24 +11,24 @@ using SIG.Web.AppCode.Models.Facturacion;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.Facturacion
|
||||
{
|
||||
public sealed class ProfactCfdi40XmlBuilder : ICfdiXmlBuilder
|
||||
public sealed class ConstructorXmlCfdi40Profact : IConstructorXmlCfdi
|
||||
{
|
||||
private const int DecimalesMoneda = 2;
|
||||
private const int DecimalesConcepto = 6;
|
||||
|
||||
public DbResult<CfdiXmlBuildResultModel> Construir(
|
||||
CfdiSolicitudModel solicitud,
|
||||
CfdiEmisorFiscalModel emisor,
|
||||
CfdiReceptorFiscalModel receptor)
|
||||
public DbResult<ModeloResultadoConstruccionXmlCfdi> Construir(
|
||||
ModeloSolicitudCfdi solicitud,
|
||||
ModeloEmisorFiscalCfdi emisor,
|
||||
ModeloReceptorFiscalCfdi receptor)
|
||||
{
|
||||
string validationMessage =
|
||||
string mensajeValidacion =
|
||||
Validar(solicitud, emisor, receptor);
|
||||
|
||||
if (validationMessage != null)
|
||||
if (mensajeValidacion != null)
|
||||
{
|
||||
return DbResult<CfdiXmlBuildResultModel>.Fail(
|
||||
validationMessage,
|
||||
validationMessage,
|
||||
return DbResult<ModeloResultadoConstruccionXmlCfdi>.Fail(
|
||||
mensajeValidacion,
|
||||
mensajeValidacion,
|
||||
null);
|
||||
}
|
||||
|
||||
@@ -47,14 +47,14 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
|
||||
if (string.IsNullOrWhiteSpace(xml))
|
||||
{
|
||||
return DbResult<CfdiXmlBuildResultModel>.Fail(
|
||||
return DbResult<ModeloResultadoConstruccionXmlCfdi>.Fail(
|
||||
"No fue posible generar el XML del CFDI.",
|
||||
"Profact no devolvió contenido al generar el XML CFDI 4.0.",
|
||||
null);
|
||||
}
|
||||
|
||||
byte[] xmlUtf8 = ConvertirXmlAUtf8(xml);
|
||||
CfdiDocumentoModel documento =
|
||||
ModeloDocumentoCfdi documento =
|
||||
CrearDocumento(
|
||||
solicitud,
|
||||
emisor,
|
||||
@@ -62,26 +62,26 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
comprobante,
|
||||
xmlUtf8);
|
||||
|
||||
return DbResult<CfdiXmlBuildResultModel>.Ok(
|
||||
new CfdiXmlBuildResultModel
|
||||
return DbResult<ModeloResultadoConstruccionXmlCfdi>.Ok(
|
||||
new ModeloResultadoConstruccionXmlCfdi
|
||||
{
|
||||
Documento = documento,
|
||||
Xml = Encoding.UTF8.GetString(xmlUtf8)
|
||||
});
|
||||
}
|
||||
catch (Exception exception)
|
||||
catch (Exception excepcion)
|
||||
{
|
||||
return DbResult<CfdiXmlBuildResultModel>.Fail(
|
||||
return DbResult<ModeloResultadoConstruccionXmlCfdi>.Fail(
|
||||
"No fue posible generar el XML del CFDI.",
|
||||
exception.Message,
|
||||
exception);
|
||||
excepcion.Message,
|
||||
excepcion);
|
||||
}
|
||||
}
|
||||
|
||||
private static Comprobante CrearComprobante(
|
||||
CfdiSolicitudModel solicitud,
|
||||
CfdiEmisorFiscalModel emisor,
|
||||
CfdiReceptorFiscalModel receptor)
|
||||
ModeloSolicitudCfdi solicitud,
|
||||
ModeloEmisorFiscalCfdi emisor,
|
||||
ModeloReceptorFiscalCfdi receptor)
|
||||
{
|
||||
var comprobante = new Comprobante
|
||||
{
|
||||
@@ -181,7 +181,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
}
|
||||
|
||||
private static ComprobanteConcepto CrearConcepto(
|
||||
CfdiConceptoModel concepto)
|
||||
ModeloConceptoCfdi concepto)
|
||||
{
|
||||
decimal importe = Math.Round(
|
||||
concepto.Cantidad * concepto.ValorUnitario,
|
||||
@@ -209,11 +209,11 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
resultado.DescuentoSpecified = true;
|
||||
}
|
||||
|
||||
IList<CfdiImpuestoConceptoModel> traslados =
|
||||
IList<ModeloImpuestoConceptoCfdi> traslados =
|
||||
concepto.Impuestos
|
||||
.Where(impuesto => !impuesto.EsRetencion)
|
||||
.ToList();
|
||||
IList<CfdiImpuestoConceptoModel> retenciones =
|
||||
IList<ModeloImpuestoConceptoCfdi> retenciones =
|
||||
concepto.Impuestos
|
||||
.Where(impuesto => impuesto.EsRetencion)
|
||||
.ToList();
|
||||
@@ -241,7 +241,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
|
||||
private static ComprobanteConceptoImpuestosTraslado
|
||||
CrearTrasladoConcepto(
|
||||
CfdiImpuestoConceptoModel impuesto)
|
||||
ModeloImpuestoConceptoCfdi impuesto)
|
||||
{
|
||||
var resultado =
|
||||
new ComprobanteConceptoImpuestosTraslado
|
||||
@@ -269,7 +269,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
|
||||
private static ComprobanteConceptoImpuestosRetencion
|
||||
CrearRetencionConcepto(
|
||||
CfdiImpuestoConceptoModel impuesto)
|
||||
ModeloImpuestoConceptoCfdi impuesto)
|
||||
{
|
||||
return new ComprobanteConceptoImpuestosRetencion
|
||||
{
|
||||
@@ -282,19 +282,19 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
}
|
||||
|
||||
private static void CrearImpuestosGlobales(
|
||||
CfdiSolicitudModel solicitud,
|
||||
ModeloSolicitudCfdi solicitud,
|
||||
Comprobante comprobante,
|
||||
out decimal totalTrasladados,
|
||||
out decimal totalRetenidos)
|
||||
{
|
||||
IList<CfdiImpuestoConceptoModel> impuestos =
|
||||
IList<ModeloImpuestoConceptoCfdi> impuestos =
|
||||
solicitud.Conceptos
|
||||
.SelectMany(concepto => concepto.Impuestos)
|
||||
.ToList();
|
||||
IList<CfdiImpuestoConceptoModel> traslados =
|
||||
IList<ModeloImpuestoConceptoCfdi> traslados =
|
||||
impuestos.Where(impuesto => !impuesto.EsRetencion)
|
||||
.ToList();
|
||||
IList<CfdiImpuestoConceptoModel> retenciones =
|
||||
IList<ModeloImpuestoConceptoCfdi> retenciones =
|
||||
impuestos.Where(impuesto => impuesto.EsRetencion)
|
||||
.ToList();
|
||||
|
||||
@@ -325,7 +325,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
var traslado =
|
||||
new ComprobanteImpuestosTraslado
|
||||
{
|
||||
Base = grupo.Sum(item => item.Base),
|
||||
Base = grupo.Sum(elemento => elemento.Base),
|
||||
Impuesto = grupo.Key.Impuesto,
|
||||
TipoFactor = grupo.Key.TipoFactor
|
||||
};
|
||||
@@ -340,7 +340,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
if (!EsExento(grupo.Key.TipoFactor))
|
||||
{
|
||||
traslado.Importe =
|
||||
grupo.Sum(item => item.Importe);
|
||||
grupo.Sum(elemento => elemento.Importe);
|
||||
traslado.ImporteSpecified = true;
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
Impuesto = grupo.Key,
|
||||
Importe =
|
||||
RedondearMoneda(
|
||||
grupo.Sum(item => item.Importe))
|
||||
grupo.Sum(elemento => elemento.Importe))
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
|
||||
private static ComprobanteCfdiRelacionados[]
|
||||
CrearCfdiRelacionados(
|
||||
IEnumerable<CfdiRelacionadoModel> relacionados)
|
||||
IEnumerable<ModeloCfdiRelacionado> relacionados)
|
||||
{
|
||||
return relacionados
|
||||
.Where(relacion =>
|
||||
@@ -400,14 +400,14 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private static CfdiDocumentoModel CrearDocumento(
|
||||
CfdiSolicitudModel solicitud,
|
||||
CfdiEmisorFiscalModel emisor,
|
||||
CfdiReceptorFiscalModel receptor,
|
||||
private static ModeloDocumentoCfdi CrearDocumento(
|
||||
ModeloSolicitudCfdi solicitud,
|
||||
ModeloEmisorFiscalCfdi emisor,
|
||||
ModeloReceptorFiscalCfdi receptor,
|
||||
Comprobante comprobante,
|
||||
byte[] xmlUtf8)
|
||||
{
|
||||
return new CfdiDocumentoModel
|
||||
return new ModeloDocumentoCfdi
|
||||
{
|
||||
CveCfdiDocumento = solicitud.CveCfdiDocumento,
|
||||
CveEmpresa = solicitud.CveEmpresa,
|
||||
@@ -473,9 +473,9 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
}
|
||||
|
||||
private static string Validar(
|
||||
CfdiSolicitudModel solicitud,
|
||||
CfdiEmisorFiscalModel emisor,
|
||||
CfdiReceptorFiscalModel receptor)
|
||||
ModeloSolicitudCfdi solicitud,
|
||||
ModeloEmisorFiscalCfdi emisor,
|
||||
ModeloReceptorFiscalCfdi receptor)
|
||||
{
|
||||
if (solicitud == null)
|
||||
{
|
||||
@@ -542,7 +542,7 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
return "Agregue al menos un concepto al CFDI.";
|
||||
}
|
||||
|
||||
foreach (CfdiConceptoModel concepto in solicitud.Conceptos)
|
||||
foreach (ModeloConceptoCfdi concepto in solicitud.Conceptos)
|
||||
{
|
||||
if (concepto == null
|
||||
|| !ClaveLongitud(
|
||||
@@ -575,11 +575,11 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
}
|
||||
|
||||
private static bool ClaveLongitud(
|
||||
string value,
|
||||
int length)
|
||||
string valor,
|
||||
int longitud)
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(value)
|
||||
&& value.Trim().Length == length;
|
||||
return !string.IsNullOrWhiteSpace(valor)
|
||||
&& valor.Trim().Length == longitud;
|
||||
}
|
||||
|
||||
private static bool EsExento(string tipoFactor)
|
||||
@@ -597,30 +597,30 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
private static decimal RedondearMoneda(decimal value)
|
||||
private static decimal RedondearMoneda(decimal valor)
|
||||
{
|
||||
return Math.Round(
|
||||
value,
|
||||
valor,
|
||||
DecimalesMoneda,
|
||||
MidpointRounding.AwayFromZero);
|
||||
}
|
||||
|
||||
private static string TextoOpcional(string value)
|
||||
private static string TextoOpcional(string valor)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(value)
|
||||
return string.IsNullOrWhiteSpace(valor)
|
||||
? null
|
||||
: value.Trim();
|
||||
: valor.Trim();
|
||||
}
|
||||
|
||||
private static byte[] ConvertirXmlAUtf8(string xml)
|
||||
{
|
||||
string normalized = Regex.Replace(
|
||||
string normalizado = Regex.Replace(
|
||||
xml,
|
||||
"encoding\\s*=\\s*([\"'])utf-16\\1",
|
||||
"encoding=\"utf-8\"",
|
||||
RegexOptions.IgnoreCase);
|
||||
|
||||
return new UTF8Encoding(false).GetBytes(normalized);
|
||||
return new UTF8Encoding(false).GetBytes(normalizado);
|
||||
}
|
||||
|
||||
private static byte[] CalcularSha256(byte[] contenido)
|
||||
@@ -8,33 +8,33 @@ using SIG.Web.AppCode.Models.Facturacion;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.Facturacion
|
||||
{
|
||||
public sealed class CfdiTimbradoService
|
||||
: ICfdiTimbradoService
|
||||
public sealed class ServicioTimbradoCfdi
|
||||
: IServicioTimbradoCfdi
|
||||
{
|
||||
private readonly ICfdiRepository _repository;
|
||||
private readonly ICfdiXmlBuilder _xmlBuilder;
|
||||
private readonly IDictionary<string, IPacTimbradoClient>
|
||||
_pacClients;
|
||||
private readonly IDictionary<string, IPacCancelacionClient>
|
||||
private readonly IRepositorioCfdi _repositorio;
|
||||
private readonly IConstructorXmlCfdi _constructorXml;
|
||||
private readonly IDictionary<string, IClienteTimbradoPac>
|
||||
_clientesTimbradoPac;
|
||||
private readonly IDictionary<string, IClienteCancelacionPac>
|
||||
_clientesCancelacionPac;
|
||||
private readonly IAlmacenArchivosCfdi _almacenArchivosCfdi;
|
||||
|
||||
public CfdiTimbradoService(
|
||||
ICfdiRepository repository,
|
||||
ICfdiXmlBuilder xmlBuilder,
|
||||
IEnumerable<IPacTimbradoClient> pacClients,
|
||||
IEnumerable<IPacCancelacionClient> clientesCancelacionPac,
|
||||
public ServicioTimbradoCfdi(
|
||||
IRepositorioCfdi repositorio,
|
||||
IConstructorXmlCfdi constructorXml,
|
||||
IEnumerable<IClienteTimbradoPac> clientesTimbradoPac,
|
||||
IEnumerable<IClienteCancelacionPac> clientesCancelacionPac,
|
||||
IAlmacenArchivosCfdi almacenArchivosCfdi)
|
||||
{
|
||||
_repository = repository;
|
||||
_xmlBuilder = xmlBuilder;
|
||||
_pacClients = (pacClients
|
||||
?? Enumerable.Empty<IPacTimbradoClient>())
|
||||
_repositorio = repositorio;
|
||||
_constructorXml = constructorXml;
|
||||
_clientesTimbradoPac = (clientesTimbradoPac
|
||||
?? Enumerable.Empty<IClienteTimbradoPac>())
|
||||
.ToDictionary(
|
||||
client => client.Proveedor,
|
||||
cliente => cliente.Proveedor,
|
||||
StringComparer.OrdinalIgnoreCase);
|
||||
_clientesCancelacionPac = (clientesCancelacionPac
|
||||
?? Enumerable.Empty<IPacCancelacionClient>())
|
||||
?? Enumerable.Empty<IClienteCancelacionPac>())
|
||||
.ToDictionary(
|
||||
cliente => cliente.Proveedor,
|
||||
StringComparer.OrdinalIgnoreCase);
|
||||
@@ -44,73 +44,73 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
}
|
||||
|
||||
public DbResult<long> GuardarBorrador(
|
||||
CfdiSolicitudModel solicitud,
|
||||
ModeloSolicitudCfdi solicitud,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (solicitud == null)
|
||||
{
|
||||
return Fail<long>(
|
||||
return Fallar<long>(
|
||||
"No se recibieron los datos del CFDI.");
|
||||
}
|
||||
|
||||
DbResult<CfdiEmisorFiscalModel> emisorResult =
|
||||
_repository.ObtenerEmisor(
|
||||
DbResult<ModeloEmisorFiscalCfdi> resultadoEmisor =
|
||||
_repositorio.ObtenerEmisor(
|
||||
solicitud.CveEmpresa,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!emisorResult.Success)
|
||||
if (!resultadoEmisor.Success)
|
||||
{
|
||||
return CopyFailure<
|
||||
CfdiEmisorFiscalModel,
|
||||
long>(emisorResult);
|
||||
return CopiarFallo<
|
||||
ModeloEmisorFiscalCfdi,
|
||||
long>(resultadoEmisor);
|
||||
}
|
||||
|
||||
DbResult<CfdiReceptorFiscalModel> receptorResult =
|
||||
_repository.ObtenerReceptor(
|
||||
DbResult<ModeloReceptorFiscalCfdi> resultadoReceptor =
|
||||
_repositorio.ObtenerReceptor(
|
||||
solicitud.CveCliente,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!receptorResult.Success)
|
||||
if (!resultadoReceptor.Success)
|
||||
{
|
||||
return CopyFailure<
|
||||
CfdiReceptorFiscalModel,
|
||||
long>(receptorResult);
|
||||
return CopiarFallo<
|
||||
ModeloReceptorFiscalCfdi,
|
||||
long>(resultadoReceptor);
|
||||
}
|
||||
|
||||
DbResult<CfdiXmlBuildResultModel> buildResult =
|
||||
_xmlBuilder.Construir(
|
||||
DbResult<ModeloResultadoConstruccionXmlCfdi> resultadoConstruccion =
|
||||
_constructorXml.Construir(
|
||||
solicitud,
|
||||
emisorResult.Data,
|
||||
receptorResult.Data);
|
||||
resultadoEmisor.Data,
|
||||
resultadoReceptor.Data);
|
||||
|
||||
if (!buildResult.Success)
|
||||
if (!resultadoConstruccion.Success)
|
||||
{
|
||||
return CopyFailure<
|
||||
CfdiXmlBuildResultModel,
|
||||
long>(buildResult);
|
||||
return CopiarFallo<
|
||||
ModeloResultadoConstruccionXmlCfdi,
|
||||
long>(resultadoConstruccion);
|
||||
}
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
DbResult<long> saveResult =
|
||||
_repository.GuardarBorrador(
|
||||
buildResult.Data.Documento,
|
||||
DbResult<long> resultadoGuardado =
|
||||
_repositorio.GuardarBorrador(
|
||||
resultadoConstruccion.Data.Documento,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (saveResult.Success)
|
||||
if (resultadoGuardado.Success)
|
||||
{
|
||||
transaction.Commit();
|
||||
transaccion.Commit();
|
||||
}
|
||||
|
||||
return saveResult;
|
||||
return resultadoGuardado;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<CfdiTimbradoResultadoModel> Timbrar(
|
||||
public DbResult<ModeloResultadoTimbradoCfdi> Timbrar(
|
||||
long cveCfdiDocumento,
|
||||
Guid? idSolicitud,
|
||||
int cveUsuarioEjecuta,
|
||||
@@ -118,29 +118,29 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
{
|
||||
if (cveCfdiDocumento <= 0)
|
||||
{
|
||||
return Fail<CfdiTimbradoResultadoModel>(
|
||||
return Fallar<ModeloResultadoTimbradoCfdi>(
|
||||
"Seleccione un CFDI válido.");
|
||||
}
|
||||
|
||||
DbResult<CfdiDocumentoModel> documentResult =
|
||||
_repository.ObtenerDocumento(
|
||||
DbResult<ModeloDocumentoCfdi> resultadoDocumento =
|
||||
_repositorio.ObtenerDocumento(
|
||||
cveCfdiDocumento,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!documentResult.Success)
|
||||
if (!resultadoDocumento.Success)
|
||||
{
|
||||
return CopyFailure<
|
||||
CfdiDocumentoModel,
|
||||
CfdiTimbradoResultadoModel>(
|
||||
documentResult);
|
||||
return CopiarFallo<
|
||||
ModeloDocumentoCfdi,
|
||||
ModeloResultadoTimbradoCfdi>(
|
||||
resultadoDocumento);
|
||||
}
|
||||
|
||||
CfdiDocumentoModel documento = documentResult.Data;
|
||||
ModeloDocumentoCfdi documento = resultadoDocumento.Data;
|
||||
|
||||
if (documento == null)
|
||||
{
|
||||
return Fail<CfdiTimbradoResultadoModel>(
|
||||
return Fallar<ModeloResultadoTimbradoCfdi>(
|
||||
"No se encontró el CFDI solicitado.");
|
||||
}
|
||||
|
||||
@@ -149,14 +149,14 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
CfdiEstados.Revisar,
|
||||
StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return Fail<CfdiTimbradoResultadoModel>(
|
||||
return Fallar<ModeloResultadoTimbradoCfdi>(
|
||||
"El resultado anterior es indeterminado. Consulte el PAC antes de reenviar el CFDI.");
|
||||
}
|
||||
|
||||
if (documento.CveCfdiTimbradoVigente.HasValue)
|
||||
{
|
||||
return DbResult<CfdiTimbradoResultadoModel>.Ok(
|
||||
new CfdiTimbradoResultadoModel
|
||||
return DbResult<ModeloResultadoTimbradoCfdi>.Ok(
|
||||
new ModeloResultadoTimbradoCfdi
|
||||
{
|
||||
CveCfdiDocumento =
|
||||
documento.CveCfdiDocumento,
|
||||
@@ -173,117 +173,117 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
if (documento.XmlSinTimbrar == null
|
||||
|| documento.XmlSinTimbrar.Length == 0)
|
||||
{
|
||||
return Fail<CfdiTimbradoResultadoModel>(
|
||||
return Fallar<ModeloResultadoTimbradoCfdi>(
|
||||
"El CFDI no contiene un XML listo para timbrar.");
|
||||
}
|
||||
|
||||
DbResult<CfdiEmisorFiscalModel> emitterResult =
|
||||
_repository.ObtenerEmisor(
|
||||
DbResult<ModeloEmisorFiscalCfdi> resultadoEmisor =
|
||||
_repositorio.ObtenerEmisor(
|
||||
documento.CveEmpresa,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (!emitterResult.Success)
|
||||
if (!resultadoEmisor.Success)
|
||||
{
|
||||
return CopyFailure<
|
||||
CfdiEmisorFiscalModel,
|
||||
CfdiTimbradoResultadoModel>(
|
||||
emitterResult);
|
||||
return CopiarFallo<
|
||||
ModeloEmisorFiscalCfdi,
|
||||
ModeloResultadoTimbradoCfdi>(
|
||||
resultadoEmisor);
|
||||
}
|
||||
|
||||
CfdiEmisorFiscalModel emisor = emitterResult.Data;
|
||||
Guid requestId = idSolicitud ?? Guid.NewGuid();
|
||||
string environment = emisor.AmbienteProduccion
|
||||
ModeloEmisorFiscalCfdi emisor = resultadoEmisor.Data;
|
||||
Guid identificadorSolicitud = idSolicitud ?? Guid.NewGuid();
|
||||
string ambiente = emisor.AmbienteProduccion
|
||||
? "PRODUCCION"
|
||||
: "PRUEBAS";
|
||||
|
||||
DbResult<CfdiTimbradoInicioModel> startResult;
|
||||
DbResult<ModeloInicioTimbradoCfdi> resultadoInicio;
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
startResult = _repository.IniciarIntento(
|
||||
resultadoInicio = _repositorio.IniciarIntento(
|
||||
cveCfdiDocumento,
|
||||
requestId,
|
||||
identificadorSolicitud,
|
||||
emisor.ProveedorPac,
|
||||
environment,
|
||||
ambiente,
|
||||
emisor.ReferenciaContratoPac,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (startResult.Success)
|
||||
if (resultadoInicio.Success)
|
||||
{
|
||||
transaction.Commit();
|
||||
transaccion.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
if (!startResult.Success)
|
||||
if (!resultadoInicio.Success)
|
||||
{
|
||||
return CopyFailure<
|
||||
CfdiTimbradoInicioModel,
|
||||
CfdiTimbradoResultadoModel>(
|
||||
startResult);
|
||||
return CopiarFallo<
|
||||
ModeloInicioTimbradoCfdi,
|
||||
ModeloResultadoTimbradoCfdi>(
|
||||
resultadoInicio);
|
||||
}
|
||||
|
||||
if (startResult.Data == null)
|
||||
if (resultadoInicio.Data == null)
|
||||
{
|
||||
return Fail<CfdiTimbradoResultadoModel>(
|
||||
return Fallar<ModeloResultadoTimbradoCfdi>(
|
||||
"No fue posible registrar el intento de timbrado.");
|
||||
}
|
||||
|
||||
if (!startResult.Data.PuedeEnviar)
|
||||
if (!resultadoInicio.Data.PuedeEnviar)
|
||||
{
|
||||
return DbResult<CfdiTimbradoResultadoModel>.Ok(
|
||||
new CfdiTimbradoResultadoModel
|
||||
return DbResult<ModeloResultadoTimbradoCfdi>.Ok(
|
||||
new ModeloResultadoTimbradoCfdi
|
||||
{
|
||||
CveCfdiDocumento = cveCfdiDocumento,
|
||||
CveCfdiTimbrado =
|
||||
startResult.Data.CveCfdiTimbrado,
|
||||
resultadoInicio.Data.CveCfdiTimbrado,
|
||||
NumeroIntento =
|
||||
startResult.Data.NumeroIntento,
|
||||
resultadoInicio.Data.NumeroIntento,
|
||||
TimbradoExitoso =
|
||||
string.Equals(
|
||||
startResult.Data.Estado,
|
||||
resultadoInicio.Data.Estado,
|
||||
CfdiIntentoEstados.Exitoso,
|
||||
StringComparison.OrdinalIgnoreCase),
|
||||
Estado = startResult.Data.Estado,
|
||||
Estado = resultadoInicio.Data.Estado,
|
||||
Mensaje =
|
||||
"La solicitud ya fue registrada y no se enviará nuevamente al PAC."
|
||||
});
|
||||
}
|
||||
|
||||
CfdiPacResultadoModel pacResult =
|
||||
ModeloResultadoPacCfdi resultadoPac =
|
||||
EnviarAlPac(
|
||||
documento,
|
||||
emisor,
|
||||
startResult.Data);
|
||||
resultadoInicio.Data);
|
||||
|
||||
DbResult<CfdiTimbradoIntentoModel> completeResult;
|
||||
DbResult<ModeloIntentoTimbradoCfdi> resultadoFinalizacion;
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
completeResult = _repository.FinalizarIntento(
|
||||
startResult.Data.CveCfdiTimbrado,
|
||||
pacResult,
|
||||
resultadoFinalizacion = _repositorio.FinalizarIntento(
|
||||
resultadoInicio.Data.CveCfdiTimbrado,
|
||||
resultadoPac,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
|
||||
if (completeResult.Success)
|
||||
if (resultadoFinalizacion.Success)
|
||||
{
|
||||
transaction.Commit();
|
||||
transaccion.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
if (!completeResult.Success)
|
||||
if (!resultadoFinalizacion.Success)
|
||||
{
|
||||
return DbResult<CfdiTimbradoResultadoModel>.Fail(
|
||||
return DbResult<ModeloResultadoTimbradoCfdi>.Fail(
|
||||
"El PAC respondió, pero no fue posible guardar el resultado. No reenvíe el CFDI hasta revisar el intento registrado.",
|
||||
completeResult.TechnicalMessage,
|
||||
completeResult.Exception);
|
||||
resultadoFinalizacion.TechnicalMessage,
|
||||
resultadoFinalizacion.Exception);
|
||||
}
|
||||
|
||||
CfdiTimbradoIntentoModel intento =
|
||||
completeResult.Data;
|
||||
string message = intento.MensajeRespuesta;
|
||||
ModeloIntentoTimbradoCfdi intento =
|
||||
resultadoFinalizacion.Data;
|
||||
string mensaje = intento.MensajeRespuesta;
|
||||
|
||||
if (intento.Exitoso)
|
||||
{
|
||||
@@ -297,14 +297,14 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
const string advertenciaArchivo =
|
||||
"El timbre quedó guardado, pero el archivo XML requiere revisión.";
|
||||
|
||||
message = string.IsNullOrWhiteSpace(message)
|
||||
mensaje = string.IsNullOrWhiteSpace(mensaje)
|
||||
? advertenciaArchivo
|
||||
: message + " " + advertenciaArchivo;
|
||||
: mensaje + " " + advertenciaArchivo;
|
||||
}
|
||||
}
|
||||
|
||||
return DbResult<CfdiTimbradoResultadoModel>.Ok(
|
||||
new CfdiTimbradoResultadoModel
|
||||
return DbResult<ModeloResultadoTimbradoCfdi>.Ok(
|
||||
new ModeloResultadoTimbradoCfdi
|
||||
{
|
||||
CveCfdiDocumento =
|
||||
intento.CveCfdiDocumento,
|
||||
@@ -323,60 +323,60 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
CodigoRespuesta =
|
||||
intento.CodigoRespuesta,
|
||||
Mensaje =
|
||||
message
|
||||
mensaje
|
||||
});
|
||||
}
|
||||
|
||||
public DbResult<CfdiDocumentoModel> ObtenerDocumento(
|
||||
public DbResult<ModeloDocumentoCfdi> ObtenerDocumento(
|
||||
long cveCfdiDocumento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return _repository.ObtenerDocumento(
|
||||
return _repositorio.ObtenerDocumento(
|
||||
cveCfdiDocumento,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
}
|
||||
|
||||
public DbResult<List<CfdiTimbradoIntentoModel>>
|
||||
public DbResult<List<ModeloIntentoTimbradoCfdi>>
|
||||
ListarIntentos(
|
||||
long cveCfdiDocumento,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return _repository.ListarIntentos(
|
||||
return _repositorio.ListarIntentos(
|
||||
cveCfdiDocumento,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
}
|
||||
|
||||
public DbResult<CfdiArchivoModel> ObtenerXml(
|
||||
public DbResult<ModeloArchivoCfdi> ObtenerXml(
|
||||
long cveCfdiDocumento,
|
||||
bool timbrado,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
return _repository.ObtenerXml(
|
||||
return _repositorio.ObtenerXml(
|
||||
cveCfdiDocumento,
|
||||
timbrado,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
}
|
||||
|
||||
public DbResult<CfdiCancelacionResultadoModel> Cancelar(
|
||||
CfdiCancelacionSolicitudModel solicitud,
|
||||
public DbResult<ModeloResultadoCancelacionCfdi> Cancelar(
|
||||
ModeloSolicitudCancelacionCfdi solicitud,
|
||||
Guid? idSolicitud,
|
||||
int cveUsuarioEjecuta,
|
||||
string nombreDominio)
|
||||
{
|
||||
if (solicitud == null || solicitud.CveCfdiDocumento <= 0)
|
||||
{
|
||||
return Fail<CfdiCancelacionResultadoModel>(
|
||||
return Fallar<ModeloResultadoCancelacionCfdi>(
|
||||
"Seleccione un timbre válido para cancelar.");
|
||||
}
|
||||
|
||||
DbResult<CfdiDocumentoModel> documentoResultado =
|
||||
_repository.ObtenerDocumento(
|
||||
DbResult<ModeloDocumentoCfdi> documentoResultado =
|
||||
_repositorio.ObtenerDocumento(
|
||||
solicitud.CveCfdiDocumento,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
@@ -384,23 +384,23 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
if (!documentoResultado.Success || documentoResultado.Data == null)
|
||||
{
|
||||
return documentoResultado.Success
|
||||
? Fail<CfdiCancelacionResultadoModel>(
|
||||
? Fallar<ModeloResultadoCancelacionCfdi>(
|
||||
"No se encontró el CFDI solicitado.")
|
||||
: CopyFailure<CfdiDocumentoModel, CfdiCancelacionResultadoModel>(
|
||||
: CopiarFallo<ModeloDocumentoCfdi, ModeloResultadoCancelacionCfdi>(
|
||||
documentoResultado);
|
||||
}
|
||||
|
||||
CfdiDocumentoModel documento = documentoResultado.Data;
|
||||
ModeloDocumentoCfdi documento = documentoResultado.Data;
|
||||
|
||||
if (!documento.CveCfdiTimbradoVigente.HasValue ||
|
||||
string.IsNullOrWhiteSpace(documento.UuidVigente))
|
||||
{
|
||||
return Fail<CfdiCancelacionResultadoModel>(
|
||||
return Fallar<ModeloResultadoCancelacionCfdi>(
|
||||
"La venta no tiene un timbre vigente para cancelar.");
|
||||
}
|
||||
|
||||
DbResult<CfdiEmisorFiscalModel> emisorResultado =
|
||||
_repository.ObtenerEmisor(
|
||||
DbResult<ModeloEmisorFiscalCfdi> emisorResultado =
|
||||
_repositorio.ObtenerEmisor(
|
||||
documento.CveEmpresa,
|
||||
cveUsuarioEjecuta,
|
||||
nombreDominio);
|
||||
@@ -408,29 +408,29 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
if (!emisorResultado.Success || emisorResultado.Data == null)
|
||||
{
|
||||
return emisorResultado.Success
|
||||
? Fail<CfdiCancelacionResultadoModel>(
|
||||
? Fallar<ModeloResultadoCancelacionCfdi>(
|
||||
"La empresa no tiene un emisor fiscal activo.")
|
||||
: CopyFailure<CfdiEmisorFiscalModel, CfdiCancelacionResultadoModel>(
|
||||
: CopiarFallo<ModeloEmisorFiscalCfdi, ModeloResultadoCancelacionCfdi>(
|
||||
emisorResultado);
|
||||
}
|
||||
|
||||
CfdiEmisorFiscalModel emisor = emisorResultado.Data;
|
||||
IPacCancelacionClient clienteCancelacion;
|
||||
ModeloEmisorFiscalCfdi emisor = emisorResultado.Data;
|
||||
IClienteCancelacionPac clienteCancelacion;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(emisor.ProveedorPac) ||
|
||||
!_clientesCancelacionPac.TryGetValue(
|
||||
emisor.ProveedorPac.Trim(),
|
||||
out clienteCancelacion))
|
||||
{
|
||||
return Fail<CfdiCancelacionResultadoModel>(
|
||||
return Fallar<ModeloResultadoCancelacionCfdi>(
|
||||
"El proveedor PAC configurado no permite cancelar el timbre desde la aplicación.");
|
||||
}
|
||||
|
||||
DbResult<CfdiCancelacionInicioModel> inicioResultado;
|
||||
DbResult<ModeloInicioCancelacionCfdi> inicioResultado;
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
inicioResultado = _repository.IniciarCancelacion(
|
||||
inicioResultado = _repositorio.IniciarCancelacion(
|
||||
solicitud,
|
||||
idSolicitud ?? Guid.NewGuid(),
|
||||
emisor.ProveedorPac,
|
||||
@@ -447,23 +447,23 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
if (!inicioResultado.Success || inicioResultado.Data == null)
|
||||
{
|
||||
return inicioResultado.Success
|
||||
? Fail<CfdiCancelacionResultadoModel>(
|
||||
? Fallar<ModeloResultadoCancelacionCfdi>(
|
||||
"No fue posible registrar la solicitud de cancelación.")
|
||||
: CopyFailure<CfdiCancelacionInicioModel, CfdiCancelacionResultadoModel>(
|
||||
: CopiarFallo<ModeloInicioCancelacionCfdi, ModeloResultadoCancelacionCfdi>(
|
||||
inicioResultado);
|
||||
}
|
||||
|
||||
CfdiCancelacionInicioModel inicio = inicioResultado.Data;
|
||||
ModeloInicioCancelacionCfdi inicio = inicioResultado.Data;
|
||||
|
||||
if (!inicio.PuedeEnviar)
|
||||
{
|
||||
return Fail<CfdiCancelacionResultadoModel>(
|
||||
return Fallar<ModeloResultadoCancelacionCfdi>(
|
||||
"La solicitud de cancelación ya fue procesada.");
|
||||
}
|
||||
|
||||
CfdiPacCancelacionResultadoModel resultadoPac =
|
||||
ModeloResultadoCancelacionPacCfdi resultadoPac =
|
||||
clienteCancelacion.Cancelar(
|
||||
new CfdiPacCancelacionSolicitudModel
|
||||
new ModeloSolicitudCancelacionPacCfdi
|
||||
{
|
||||
RfcEmisor = inicio.RfcEmisor,
|
||||
Uuid = inicio.Uuid,
|
||||
@@ -474,11 +474,11 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
emisor.ReferenciaCredencialPac
|
||||
});
|
||||
|
||||
DbResult<CfdiCancelacionResultadoModel> finResultado;
|
||||
DbResult<ModeloResultadoCancelacionCfdi> finResultado;
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
finResultado = _repository.FinalizarCancelacion(
|
||||
finResultado = _repositorio.FinalizarCancelacion(
|
||||
inicio.CveCfdiCancelacion,
|
||||
resultadoPac,
|
||||
cveUsuarioEjecuta,
|
||||
@@ -493,19 +493,19 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
return finResultado;
|
||||
}
|
||||
|
||||
private CfdiPacResultadoModel EnviarAlPac(
|
||||
CfdiDocumentoModel documento,
|
||||
CfdiEmisorFiscalModel emisor,
|
||||
CfdiTimbradoInicioModel intento)
|
||||
private ModeloResultadoPacCfdi EnviarAlPac(
|
||||
ModeloDocumentoCfdi documento,
|
||||
ModeloEmisorFiscalCfdi emisor,
|
||||
ModeloInicioTimbradoCfdi intento)
|
||||
{
|
||||
IPacTimbradoClient pacClient;
|
||||
IClienteTimbradoPac clientePac;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(emisor.ProveedorPac)
|
||||
|| !_pacClients.TryGetValue(
|
||||
|| !_clientesTimbradoPac.TryGetValue(
|
||||
emisor.ProveedorPac.Trim(),
|
||||
out pacClient))
|
||||
out clientePac))
|
||||
{
|
||||
return new CfdiPacResultadoModel
|
||||
return new ModeloResultadoPacCfdi
|
||||
{
|
||||
Exitoso = false,
|
||||
CodigoRespuesta = "PAC_NO_SOPORTADO",
|
||||
@@ -514,8 +514,8 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
};
|
||||
}
|
||||
|
||||
return pacClient.Timbrar(
|
||||
new CfdiPacSolicitudModel
|
||||
return clientePac.Timbrar(
|
||||
new ModeloSolicitudPacCfdi
|
||||
{
|
||||
CveCfdiDocumento =
|
||||
documento.CveCfdiDocumento,
|
||||
@@ -538,23 +538,23 @@ namespace SIG.Web.AppCode.Services.Facturacion
|
||||
});
|
||||
}
|
||||
|
||||
private static DbResult<T> Fail<T>(string message)
|
||||
private static DbResult<T> Fallar<T>(string mensaje)
|
||||
{
|
||||
return DbResult<T>.Fail(
|
||||
message,
|
||||
message,
|
||||
mensaje,
|
||||
mensaje,
|
||||
null);
|
||||
}
|
||||
|
||||
private static DbResult<TTarget> CopyFailure<
|
||||
TSource,
|
||||
TTarget>(
|
||||
DbResult<TSource> source)
|
||||
private static DbResult<TDestino> CopiarFallo<
|
||||
TOrigen,
|
||||
TDestino>(
|
||||
DbResult<TOrigen> origen)
|
||||
{
|
||||
return DbResult<TTarget>.Fail(
|
||||
source.UserMessage,
|
||||
source.TechnicalMessage,
|
||||
source.Exception);
|
||||
return DbResult<TDestino>.Fail(
|
||||
origen.UserMessage,
|
||||
origen.TechnicalMessage,
|
||||
origen.Exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
internal static class FabricaBitacoraCatalogoProducto
|
||||
{
|
||||
public static BitacoraEventoModel CrearClasificacion(
|
||||
ModeloClasificacion anterior,
|
||||
ModeloClasificacion actual,
|
||||
int cveClasificacion,
|
||||
BitacoraTipoMovimiento movimiento)
|
||||
{
|
||||
ModeloClasificacion valor = actual ?? anterior;
|
||||
var eventoBitacora = CrearEvento(
|
||||
"Clasificaciones",
|
||||
"CveClasificacion",
|
||||
cveClasificacion,
|
||||
movimiento,
|
||||
CrearDescripcion(
|
||||
movimiento,
|
||||
"la clasificación",
|
||||
valor.Clasificacion),
|
||||
movimiento == BitacoraTipoMovimiento.Eliminado
|
||||
? new List<BitacoraCampoEventoModel>()
|
||||
: new List<BitacoraCampoEventoModel>
|
||||
{
|
||||
CrearCampo(
|
||||
"Codigo",
|
||||
anterior == null ? null : anterior.Codigo,
|
||||
actual.Codigo),
|
||||
CrearCampo(
|
||||
"Clasificacion",
|
||||
anterior == null
|
||||
? null
|
||||
: anterior.Clasificacion,
|
||||
actual.Clasificacion),
|
||||
CrearCampo(
|
||||
"Afectable",
|
||||
anterior == null
|
||||
? (object)null
|
||||
: anterior.Afectable,
|
||||
actual.Afectable),
|
||||
CrearCampo(
|
||||
"Estado",
|
||||
anterior == null
|
||||
? (object)null
|
||||
: anterior.EsActivo,
|
||||
actual.EsActivo)
|
||||
});
|
||||
|
||||
return eventoBitacora;
|
||||
}
|
||||
|
||||
public static BitacoraEventoModel CrearUnidadMedida(
|
||||
ModeloUnidadMedida anterior,
|
||||
ModeloUnidadMedida actual,
|
||||
int cveUnidadMedida,
|
||||
BitacoraTipoMovimiento movimiento)
|
||||
{
|
||||
ModeloUnidadMedida valor = actual ?? anterior;
|
||||
return CrearEvento(
|
||||
"UnidadesMedida",
|
||||
"CveUnidadMedida",
|
||||
cveUnidadMedida,
|
||||
movimiento,
|
||||
CrearDescripcion(
|
||||
movimiento,
|
||||
"la unidad de medida",
|
||||
valor.UnidadMedida),
|
||||
movimiento == BitacoraTipoMovimiento.Eliminado
|
||||
? new List<BitacoraCampoEventoModel>()
|
||||
: new List<BitacoraCampoEventoModel>
|
||||
{
|
||||
CrearCampo(
|
||||
"UnidadMedida",
|
||||
anterior == null
|
||||
? null
|
||||
: anterior.UnidadMedida,
|
||||
actual.UnidadMedida),
|
||||
CrearCampo(
|
||||
"Abreviatura",
|
||||
anterior == null
|
||||
? null
|
||||
: anterior.Abreviatura,
|
||||
actual.Abreviatura),
|
||||
CrearCampo(
|
||||
"Estado",
|
||||
anterior == null
|
||||
? (object)null
|
||||
: anterior.EsActivo,
|
||||
actual.EsActivo)
|
||||
});
|
||||
}
|
||||
|
||||
private static BitacoraEventoModel CrearEvento(
|
||||
string tabla,
|
||||
string campoLlave,
|
||||
int llave,
|
||||
BitacoraTipoMovimiento movimiento,
|
||||
string descripcion,
|
||||
IList<BitacoraCampoEventoModel> campos)
|
||||
{
|
||||
var eventoBitacora = new BitacoraEventoModel
|
||||
{
|
||||
NombreTablaSQL = tabla,
|
||||
TipoMovimiento = movimiento,
|
||||
LlaveRegistro = llave.ToString(),
|
||||
DescripcionMovimiento = descripcion,
|
||||
DiscriminarCamposSinCambios = movimiento !=
|
||||
BitacoraTipoMovimiento.Agregado,
|
||||
Campos = campos
|
||||
};
|
||||
|
||||
eventoBitacora.Relaciones.Add(
|
||||
new BitacoraRelacionEventoModel
|
||||
{
|
||||
TipoRelacion = BitacoraTipoRelacion.Directa,
|
||||
NombreTablaSQL = tabla,
|
||||
NombreCampoSQL = campoLlave,
|
||||
Valor = llave,
|
||||
VisibleDesarrollador = false,
|
||||
DescripcionRelacion = "Registro de catálogo afectado."
|
||||
});
|
||||
|
||||
return eventoBitacora;
|
||||
}
|
||||
|
||||
private static BitacoraCampoEventoModel CrearCampo(
|
||||
string nombre,
|
||||
object anterior,
|
||||
object actual)
|
||||
{
|
||||
return new BitacoraCampoEventoModel
|
||||
{
|
||||
NombreCampoSQL = nombre,
|
||||
ValorAnterior = anterior,
|
||||
ValorNuevo = actual
|
||||
};
|
||||
}
|
||||
|
||||
private static string CrearDescripcion(
|
||||
BitacoraTipoMovimiento movimiento,
|
||||
string entidad,
|
||||
string nombre)
|
||||
{
|
||||
if (movimiento == BitacoraTipoMovimiento.Agregado)
|
||||
{
|
||||
return "Se agregó " + entidad + " " + nombre + ".";
|
||||
}
|
||||
|
||||
if (movimiento == BitacoraTipoMovimiento.Editado)
|
||||
{
|
||||
return "Se modificó " + entidad + " " + nombre + ".";
|
||||
}
|
||||
|
||||
return "Se eliminó " + entidad + " " + nombre + ".";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
internal static class FabricaBitacoraProductoServicio
|
||||
{
|
||||
public static BitacoraEventoModel Crear(
|
||||
ModeloProductoServicio anterior,
|
||||
ModeloProductoServicio actual,
|
||||
int cvePS,
|
||||
BitacoraTipoMovimiento movimiento)
|
||||
{
|
||||
ModeloProductoServicio valor = actual ?? anterior;
|
||||
var eventoBitacora = new BitacoraEventoModel
|
||||
{
|
||||
NombreTablaSQL = "ProductosServicios",
|
||||
TipoMovimiento = movimiento,
|
||||
LlaveRegistro = cvePS.ToString(),
|
||||
DescripcionMovimiento = CrearDescripcion(movimiento, valor.PS),
|
||||
DiscriminarCamposSinCambios = movimiento !=
|
||||
BitacoraTipoMovimiento.Agregado,
|
||||
Campos = movimiento == BitacoraTipoMovimiento.Eliminado
|
||||
? new List<BitacoraCampoEventoModel>()
|
||||
: CrearCampos(anterior, actual)
|
||||
};
|
||||
|
||||
eventoBitacora.Relaciones.Add(
|
||||
new BitacoraRelacionEventoModel
|
||||
{
|
||||
TipoRelacion = BitacoraTipoRelacion.Directa,
|
||||
NombreTablaSQL = "ProductosServicios",
|
||||
NombreCampoSQL = "CvePS",
|
||||
Valor = cvePS,
|
||||
VisibleDesarrollador = false,
|
||||
DescripcionRelacion =
|
||||
"Producto o servicio afectado."
|
||||
});
|
||||
|
||||
return eventoBitacora;
|
||||
}
|
||||
|
||||
private static string CrearDescripcion(
|
||||
BitacoraTipoMovimiento movimiento,
|
||||
string nombreProducto)
|
||||
{
|
||||
if (movimiento == BitacoraTipoMovimiento.Agregado)
|
||||
{
|
||||
return "Se agregó el producto o servicio " +
|
||||
nombreProducto + ".";
|
||||
}
|
||||
|
||||
if (movimiento == BitacoraTipoMovimiento.Editado)
|
||||
{
|
||||
return "Se modificó el producto o servicio " +
|
||||
nombreProducto + ".";
|
||||
}
|
||||
|
||||
return "Se eliminó el producto o servicio " +
|
||||
nombreProducto + ".";
|
||||
}
|
||||
|
||||
private static IList<BitacoraCampoEventoModel> CrearCampos(
|
||||
ModeloProductoServicio anterior,
|
||||
ModeloProductoServicio actual)
|
||||
{
|
||||
return new List<BitacoraCampoEventoModel>
|
||||
{
|
||||
CrearCampo(
|
||||
"Codigo",
|
||||
ObtenerValor(anterior, elemento => elemento.Codigo),
|
||||
actual.Codigo),
|
||||
CrearCampo(
|
||||
"PS",
|
||||
ObtenerValor(anterior, elemento => elemento.PS),
|
||||
actual.PS),
|
||||
CrearCampo(
|
||||
"CveTipoPS",
|
||||
ObtenerValor(anterior, elemento => elemento.CveTipoPS),
|
||||
actual.CveTipoPS),
|
||||
CrearCampo(
|
||||
"CveClasificacion",
|
||||
ObtenerValor(anterior, elemento => elemento.CveClasificacion),
|
||||
actual.CveClasificacion),
|
||||
CrearCampo(
|
||||
"CveUnidadMedida",
|
||||
ObtenerValor(anterior, elemento => elemento.CveUnidadMedida),
|
||||
actual.CveUnidadMedida),
|
||||
CrearCampo(
|
||||
"Precio",
|
||||
ObtenerValor(anterior, elemento => elemento.Precio),
|
||||
actual.Precio),
|
||||
CrearCampo(
|
||||
"Estado",
|
||||
ObtenerValor(anterior, elemento => elemento.EsActivo),
|
||||
actual.EsActivo)
|
||||
};
|
||||
}
|
||||
|
||||
private static BitacoraCampoEventoModel CrearCampo(
|
||||
string nombre,
|
||||
object anterior,
|
||||
object actual)
|
||||
{
|
||||
return new BitacoraCampoEventoModel
|
||||
{
|
||||
NombreCampoSQL = nombre,
|
||||
ValorAnterior = anterior,
|
||||
ValorNuevo = actual
|
||||
};
|
||||
}
|
||||
|
||||
private static object ObtenerValor<TValor>(
|
||||
ModeloProductoServicio modelo,
|
||||
Func<ModeloProductoServicio, TValor> selectorValor)
|
||||
{
|
||||
return modelo == null
|
||||
? null
|
||||
: (object)selectorValor(modelo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
internal static class ProductoCatalogBitacoraFactory
|
||||
{
|
||||
public static BitacoraEventoModel CreateClasificacion(
|
||||
ClasificacionModel previous,
|
||||
ClasificacionModel current,
|
||||
int cveClasificacion,
|
||||
BitacoraTipoMovimiento movement)
|
||||
{
|
||||
ClasificacionModel value = current ?? previous;
|
||||
var auditEvent = CreateEvent(
|
||||
"Clasificaciones",
|
||||
"CveClasificacion",
|
||||
cveClasificacion,
|
||||
movement,
|
||||
Description(
|
||||
movement,
|
||||
"la clasificación",
|
||||
value.Clasificacion),
|
||||
movement == BitacoraTipoMovimiento.Eliminado
|
||||
? new List<BitacoraCampoEventoModel>()
|
||||
: new List<BitacoraCampoEventoModel>
|
||||
{
|
||||
Field(
|
||||
"Codigo",
|
||||
previous == null ? null : previous.Codigo,
|
||||
current.Codigo),
|
||||
Field(
|
||||
"Clasificacion",
|
||||
previous == null
|
||||
? null
|
||||
: previous.Clasificacion,
|
||||
current.Clasificacion),
|
||||
Field(
|
||||
"Afectable",
|
||||
previous == null
|
||||
? (object)null
|
||||
: previous.Afectable,
|
||||
current.Afectable),
|
||||
Field(
|
||||
"Estado",
|
||||
previous == null
|
||||
? (object)null
|
||||
: previous.EsActivo,
|
||||
current.EsActivo)
|
||||
});
|
||||
|
||||
return auditEvent;
|
||||
}
|
||||
|
||||
public static BitacoraEventoModel CreateUnidadMedida(
|
||||
UnidadMedidaModel previous,
|
||||
UnidadMedidaModel current,
|
||||
int cveUnidadMedida,
|
||||
BitacoraTipoMovimiento movement)
|
||||
{
|
||||
UnidadMedidaModel value = current ?? previous;
|
||||
return CreateEvent(
|
||||
"UnidadesMedida",
|
||||
"CveUnidadMedida",
|
||||
cveUnidadMedida,
|
||||
movement,
|
||||
Description(
|
||||
movement,
|
||||
"la unidad de medida",
|
||||
value.UnidadMedida),
|
||||
movement == BitacoraTipoMovimiento.Eliminado
|
||||
? new List<BitacoraCampoEventoModel>()
|
||||
: new List<BitacoraCampoEventoModel>
|
||||
{
|
||||
Field(
|
||||
"UnidadMedida",
|
||||
previous == null
|
||||
? null
|
||||
: previous.UnidadMedida,
|
||||
current.UnidadMedida),
|
||||
Field(
|
||||
"Abreviatura",
|
||||
previous == null
|
||||
? null
|
||||
: previous.Abreviatura,
|
||||
current.Abreviatura),
|
||||
Field(
|
||||
"Estado",
|
||||
previous == null
|
||||
? (object)null
|
||||
: previous.EsActivo,
|
||||
current.EsActivo)
|
||||
});
|
||||
}
|
||||
|
||||
private static BitacoraEventoModel CreateEvent(
|
||||
string table,
|
||||
string keyField,
|
||||
int key,
|
||||
BitacoraTipoMovimiento movement,
|
||||
string description,
|
||||
IList<BitacoraCampoEventoModel> fields)
|
||||
{
|
||||
var auditEvent = new BitacoraEventoModel
|
||||
{
|
||||
NombreTablaSQL = table,
|
||||
TipoMovimiento = movement,
|
||||
LlaveRegistro = key.ToString(),
|
||||
DescripcionMovimiento = description,
|
||||
DiscriminarCamposSinCambios = movement !=
|
||||
BitacoraTipoMovimiento.Agregado,
|
||||
Campos = fields
|
||||
};
|
||||
|
||||
auditEvent.Relaciones.Add(
|
||||
new BitacoraRelacionEventoModel
|
||||
{
|
||||
TipoRelacion = BitacoraTipoRelacion.Directa,
|
||||
NombreTablaSQL = table,
|
||||
NombreCampoSQL = keyField,
|
||||
Valor = key,
|
||||
VisibleDesarrollador = false,
|
||||
DescripcionRelacion = "Registro de catálogo afectado."
|
||||
});
|
||||
|
||||
return auditEvent;
|
||||
}
|
||||
|
||||
private static BitacoraCampoEventoModel Field(
|
||||
string name,
|
||||
object previous,
|
||||
object current)
|
||||
{
|
||||
return new BitacoraCampoEventoModel
|
||||
{
|
||||
NombreCampoSQL = name,
|
||||
ValorAnterior = previous,
|
||||
ValorNuevo = current
|
||||
};
|
||||
}
|
||||
|
||||
private static string Description(
|
||||
BitacoraTipoMovimiento movement,
|
||||
string entity,
|
||||
string name)
|
||||
{
|
||||
if (movement == BitacoraTipoMovimiento.Agregado)
|
||||
{
|
||||
return "Se agregó " + entity + " " + name + ".";
|
||||
}
|
||||
|
||||
if (movement == BitacoraTipoMovimiento.Editado)
|
||||
{
|
||||
return "Se modificó " + entity + " " + name + ".";
|
||||
}
|
||||
|
||||
return "Se eliminó " + entity + " " + name + ".";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,438 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Contracts.Bitacora;
|
||||
using SIG.Web.AppCode.Contracts.General;
|
||||
using SIG.Web.AppCode.Infrastructure.Transactions;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
public sealed class ProductoCatalogService : IProductoCatalogService
|
||||
{
|
||||
private readonly IProductoCatalogRepository _repository;
|
||||
private readonly IBitacoraService _bitacora;
|
||||
|
||||
public ProductoCatalogService(
|
||||
IProductoCatalogRepository repository,
|
||||
IBitacoraService bitacora)
|
||||
{
|
||||
_repository = repository ??
|
||||
throw new ArgumentNullException("repository");
|
||||
_bitacora = bitacora ??
|
||||
throw new ArgumentNullException("bitacora");
|
||||
}
|
||||
|
||||
public DbResult<List<ClasificacionModel>> ListClasificaciones(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repository.ListClasificaciones(
|
||||
TrimOrNull(texto),
|
||||
incluirInactivos,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<ClasificacionModel> GetClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return cveClasificacion > 0
|
||||
? _repository.GetClasificacion(
|
||||
cveClasificacion,
|
||||
usuario,
|
||||
dominio)
|
||||
: Fail<ClasificacionModel>(
|
||||
"Seleccione una clasificación válida.");
|
||||
}
|
||||
|
||||
public DbResult<int> SaveClasificacion(
|
||||
ClasificacionModel clasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
DbResult<int> validation = Validate(clasificacion);
|
||||
|
||||
if (!validation.Success)
|
||||
{
|
||||
return validation;
|
||||
}
|
||||
|
||||
clasificacion.Codigo = TrimOrNull(clasificacion.Codigo);
|
||||
clasificacion.Clasificacion = clasificacion.Clasificacion.Trim();
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
ClasificacionModel previous = null;
|
||||
|
||||
if (clasificacion.CveClasificacion > 0)
|
||||
{
|
||||
DbResult<ClasificacionModel> previousResult =
|
||||
_repository.GetClasificacion(
|
||||
clasificacion.CveClasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!previousResult.Success || previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<ClasificacionModel, int>(
|
||||
previousResult,
|
||||
"La clasificación seleccionada no existe.");
|
||||
}
|
||||
|
||||
previous = previousResult.Data;
|
||||
}
|
||||
|
||||
DbResult<int> result = _repository.SaveClasificacion(
|
||||
clasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<ClasificacionModel> currentResult =
|
||||
_repository.GetClasificacion(
|
||||
result.Data,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!currentResult.Success || currentResult.Data == null)
|
||||
{
|
||||
return FailFrom<ClasificacionModel, int>(
|
||||
currentResult,
|
||||
"No fue posible recuperar la clasificación guardada.");
|
||||
}
|
||||
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoCatalogBitacoraFactory.CreateClasificacion(
|
||||
previous,
|
||||
currentResult.Data,
|
||||
result.Data,
|
||||
previous == null
|
||||
? BitacoraTipoMovimiento.Agregado
|
||||
: BitacoraTipoMovimiento.Editado));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return FailFrom<long, int>(
|
||||
auditResult,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<bool> DeleteClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
if (cveClasificacion <= 0)
|
||||
{
|
||||
return Fail<bool>("Seleccione una clasificación válida.");
|
||||
}
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
DbResult<ClasificacionModel> previousResult =
|
||||
_repository.GetClasificacion(
|
||||
cveClasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!previousResult.Success || previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<ClasificacionModel, bool>(
|
||||
previousResult,
|
||||
"La clasificación seleccionada no existe.");
|
||||
}
|
||||
|
||||
DbResult<bool> result = _repository.DeleteClasificacion(
|
||||
cveClasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoCatalogBitacoraFactory.CreateClasificacion(
|
||||
previousResult.Data,
|
||||
null,
|
||||
cveClasificacion,
|
||||
BitacoraTipoMovimiento.Eliminado));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return FailFrom<long, bool>(
|
||||
auditResult,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<List<UnidadMedidaModel>> ListUnidadesMedida(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repository.ListUnidadesMedida(
|
||||
TrimOrNull(texto),
|
||||
incluirInactivos,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<UnidadMedidaModel> GetUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return cveUnidadMedida > 0
|
||||
? _repository.GetUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
usuario,
|
||||
dominio)
|
||||
: Fail<UnidadMedidaModel>(
|
||||
"Seleccione una unidad de medida válida.");
|
||||
}
|
||||
|
||||
public DbResult<int> SaveUnidadMedida(
|
||||
UnidadMedidaModel unidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
DbResult<int> validation = Validate(unidadMedida);
|
||||
|
||||
if (!validation.Success)
|
||||
{
|
||||
return validation;
|
||||
}
|
||||
|
||||
unidadMedida.UnidadMedida = unidadMedida.UnidadMedida.Trim();
|
||||
unidadMedida.Abreviatura = unidadMedida.Abreviatura.Trim();
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
UnidadMedidaModel previous = null;
|
||||
|
||||
if (unidadMedida.CveUnidadMedida > 0)
|
||||
{
|
||||
DbResult<UnidadMedidaModel> previousResult =
|
||||
_repository.GetUnidadMedida(
|
||||
unidadMedida.CveUnidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!previousResult.Success || previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<UnidadMedidaModel, int>(
|
||||
previousResult,
|
||||
"La unidad de medida seleccionada no existe.");
|
||||
}
|
||||
|
||||
previous = previousResult.Data;
|
||||
}
|
||||
|
||||
DbResult<int> result = _repository.SaveUnidadMedida(
|
||||
unidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<UnidadMedidaModel> currentResult =
|
||||
_repository.GetUnidadMedida(
|
||||
result.Data,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!currentResult.Success || currentResult.Data == null)
|
||||
{
|
||||
return FailFrom<UnidadMedidaModel, int>(
|
||||
currentResult,
|
||||
"No fue posible recuperar la unidad de medida guardada.");
|
||||
}
|
||||
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoCatalogBitacoraFactory.CreateUnidadMedida(
|
||||
previous,
|
||||
currentResult.Data,
|
||||
result.Data,
|
||||
previous == null
|
||||
? BitacoraTipoMovimiento.Agregado
|
||||
: BitacoraTipoMovimiento.Editado));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return FailFrom<long, int>(
|
||||
auditResult,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<bool> DeleteUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
if (cveUnidadMedida <= 0)
|
||||
{
|
||||
return Fail<bool>(
|
||||
"Seleccione una unidad de medida válida.");
|
||||
}
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
DbResult<UnidadMedidaModel> previousResult =
|
||||
_repository.GetUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!previousResult.Success || previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<UnidadMedidaModel, bool>(
|
||||
previousResult,
|
||||
"La unidad de medida seleccionada no existe.");
|
||||
}
|
||||
|
||||
DbResult<bool> result = _repository.DeleteUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoCatalogBitacoraFactory.CreateUnidadMedida(
|
||||
previousResult.Data,
|
||||
null,
|
||||
cveUnidadMedida,
|
||||
BitacoraTipoMovimiento.Eliminado));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return FailFrom<long, bool>(
|
||||
auditResult,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private static DbResult<int> Validate(
|
||||
ClasificacionModel clasificacion)
|
||||
{
|
||||
if (clasificacion == null ||
|
||||
string.IsNullOrWhiteSpace(clasificacion.Clasificacion))
|
||||
{
|
||||
return Fail<int>("Capture la clasificación.");
|
||||
}
|
||||
|
||||
if (clasificacion.Clasificacion.Trim().Length > 200)
|
||||
{
|
||||
return Fail<int>(
|
||||
"La clasificación no puede exceder 200 caracteres.");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(clasificacion.Codigo) &&
|
||||
clasificacion.Codigo.Trim().Length > 20)
|
||||
{
|
||||
return Fail<int>(
|
||||
"El código no puede exceder 20 caracteres.");
|
||||
}
|
||||
|
||||
return DbResult<int>.Ok(clasificacion.CveClasificacion);
|
||||
}
|
||||
|
||||
private static DbResult<int> Validate(
|
||||
UnidadMedidaModel unidadMedida)
|
||||
{
|
||||
if (unidadMedida == null ||
|
||||
string.IsNullOrWhiteSpace(unidadMedida.UnidadMedida))
|
||||
{
|
||||
return Fail<int>("Capture la unidad de medida.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(unidadMedida.Abreviatura))
|
||||
{
|
||||
return Fail<int>("Capture la abreviatura.");
|
||||
}
|
||||
|
||||
if (unidadMedida.UnidadMedida.Trim().Length > 50)
|
||||
{
|
||||
return Fail<int>(
|
||||
"La unidad de medida no puede exceder 50 caracteres.");
|
||||
}
|
||||
|
||||
if (unidadMedida.Abreviatura.Trim().Length > 15)
|
||||
{
|
||||
return Fail<int>(
|
||||
"La abreviatura no puede exceder 15 caracteres.");
|
||||
}
|
||||
|
||||
return DbResult<int>.Ok(unidadMedida.CveUnidadMedida);
|
||||
}
|
||||
|
||||
private static string TrimOrNull(string value)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(value)
|
||||
? null
|
||||
: value.Trim();
|
||||
}
|
||||
|
||||
private static DbResult<T> Fail<T>(string message)
|
||||
{
|
||||
return DbResult<T>.Fail(
|
||||
message,
|
||||
message,
|
||||
new ArgumentException(message));
|
||||
}
|
||||
|
||||
private static DbResult<TResult> FailFrom<TSource, TResult>(
|
||||
DbResult<TSource> source,
|
||||
string fallbackMessage)
|
||||
{
|
||||
string message = source == null ||
|
||||
string.IsNullOrWhiteSpace(source.UserMessage)
|
||||
? fallbackMessage
|
||||
: source.UserMessage;
|
||||
|
||||
return DbResult<TResult>.Fail(
|
||||
message,
|
||||
source == null
|
||||
? fallbackMessage
|
||||
: source.TechnicalMessage,
|
||||
source == null ? null : source.Exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
internal static class ProductoServicioBitacoraFactory
|
||||
{
|
||||
public static BitacoraEventoModel Create(
|
||||
ProductoServicioModel previous,
|
||||
ProductoServicioModel current,
|
||||
int cvePS,
|
||||
BitacoraTipoMovimiento movement)
|
||||
{
|
||||
ProductoServicioModel value = current ?? previous;
|
||||
var auditEvent = new BitacoraEventoModel
|
||||
{
|
||||
NombreTablaSQL = "ProductosServicios",
|
||||
TipoMovimiento = movement,
|
||||
LlaveRegistro = cvePS.ToString(),
|
||||
DescripcionMovimiento = Description(movement, value.PS),
|
||||
DiscriminarCamposSinCambios = movement !=
|
||||
BitacoraTipoMovimiento.Agregado,
|
||||
Campos = movement == BitacoraTipoMovimiento.Eliminado
|
||||
? new List<BitacoraCampoEventoModel>()
|
||||
: CreateFields(previous, current)
|
||||
};
|
||||
|
||||
auditEvent.Relaciones.Add(
|
||||
new BitacoraRelacionEventoModel
|
||||
{
|
||||
TipoRelacion = BitacoraTipoRelacion.Directa,
|
||||
NombreTablaSQL = "ProductosServicios",
|
||||
NombreCampoSQL = "CvePS",
|
||||
Valor = cvePS,
|
||||
VisibleDesarrollador = false,
|
||||
DescripcionRelacion =
|
||||
"Producto o servicio afectado."
|
||||
});
|
||||
|
||||
return auditEvent;
|
||||
}
|
||||
|
||||
private static string Description(
|
||||
BitacoraTipoMovimiento movement,
|
||||
string productName)
|
||||
{
|
||||
if (movement == BitacoraTipoMovimiento.Agregado)
|
||||
{
|
||||
return "Se agregó el producto o servicio " +
|
||||
productName + ".";
|
||||
}
|
||||
|
||||
if (movement == BitacoraTipoMovimiento.Editado)
|
||||
{
|
||||
return "Se modificó el producto o servicio " +
|
||||
productName + ".";
|
||||
}
|
||||
|
||||
return "Se eliminó el producto o servicio " +
|
||||
productName + ".";
|
||||
}
|
||||
|
||||
private static IList<BitacoraCampoEventoModel> CreateFields(
|
||||
ProductoServicioModel previous,
|
||||
ProductoServicioModel current)
|
||||
{
|
||||
return new List<BitacoraCampoEventoModel>
|
||||
{
|
||||
Field(
|
||||
"Codigo",
|
||||
Value(previous, item => item.Codigo),
|
||||
current.Codigo),
|
||||
Field(
|
||||
"PS",
|
||||
Value(previous, item => item.PS),
|
||||
current.PS),
|
||||
Field(
|
||||
"CveTipoPS",
|
||||
Value(previous, item => item.CveTipoPS),
|
||||
current.CveTipoPS),
|
||||
Field(
|
||||
"CveClasificacion",
|
||||
Value(previous, item => item.CveClasificacion),
|
||||
current.CveClasificacion),
|
||||
Field(
|
||||
"CveUnidadMedida",
|
||||
Value(previous, item => item.CveUnidadMedida),
|
||||
current.CveUnidadMedida),
|
||||
Field(
|
||||
"Precio",
|
||||
Value(previous, item => item.Precio),
|
||||
current.Precio),
|
||||
Field(
|
||||
"Estado",
|
||||
Value(previous, item => item.EsActivo),
|
||||
current.EsActivo)
|
||||
};
|
||||
}
|
||||
|
||||
private static BitacoraCampoEventoModel Field(
|
||||
string name,
|
||||
object previous,
|
||||
object current)
|
||||
{
|
||||
return new BitacoraCampoEventoModel
|
||||
{
|
||||
NombreCampoSQL = name,
|
||||
ValorAnterior = previous,
|
||||
ValorNuevo = current
|
||||
};
|
||||
}
|
||||
|
||||
private static object Value<TValue>(
|
||||
ProductoServicioModel model,
|
||||
Func<ProductoServicioModel, TValue> selector)
|
||||
{
|
||||
return model == null
|
||||
? null
|
||||
: (object)selector(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Contracts.Bitacora;
|
||||
using SIG.Web.AppCode.Contracts.General;
|
||||
using SIG.Web.AppCode.Infrastructure.Transactions;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
public sealed class ProductoServicioService : IProductoServicioService
|
||||
{
|
||||
private readonly IProductoServicioRepository _repository;
|
||||
private readonly IBitacoraService _bitacora;
|
||||
|
||||
public ProductoServicioService(
|
||||
IProductoServicioRepository repository,
|
||||
IBitacoraService bitacora)
|
||||
{
|
||||
_repository = repository ??
|
||||
throw new ArgumentNullException("repository");
|
||||
_bitacora = bitacora ??
|
||||
throw new ArgumentNullException("bitacora");
|
||||
}
|
||||
|
||||
public DbResult<List<ProductoServicioModel>> List(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repository.List(
|
||||
TrimOrNull(texto),
|
||||
incluirInactivos,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<ProductoServicioModel> Get(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return cvePS > 0
|
||||
? _repository.Get(cvePS, usuario, dominio)
|
||||
: Fail<ProductoServicioModel>(
|
||||
"Seleccione un producto o servicio válido.");
|
||||
}
|
||||
|
||||
public DbResult<ProductoServicioOpcionesModel> ListOptions(
|
||||
int? cveClasificacionActual,
|
||||
int? cveUnidadMedidaActual,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repository.ListOptions(
|
||||
cveClasificacionActual,
|
||||
cveUnidadMedidaActual,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<int> Save(
|
||||
ProductoServicioModel productoServicio,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
DbResult<int> validation = Validate(productoServicio);
|
||||
|
||||
if (!validation.Success)
|
||||
{
|
||||
return validation;
|
||||
}
|
||||
|
||||
productoServicio.Codigo = TrimOrNull(
|
||||
productoServicio.Codigo);
|
||||
productoServicio.PS = productoServicio.PS.Trim();
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
ProductoServicioModel previous = null;
|
||||
|
||||
if (productoServicio.CvePS > 0)
|
||||
{
|
||||
DbResult<ProductoServicioModel> previousResult =
|
||||
_repository.Get(
|
||||
productoServicio.CvePS,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!previousResult.Success ||
|
||||
previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<ProductoServicioModel, int>(
|
||||
previousResult,
|
||||
"El producto o servicio seleccionado no existe.");
|
||||
}
|
||||
|
||||
previous = previousResult.Data;
|
||||
}
|
||||
|
||||
DbResult<int> result = _repository.Save(
|
||||
productoServicio,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<ProductoServicioModel> currentResult =
|
||||
_repository.Get(result.Data, usuario, dominio);
|
||||
|
||||
if (!currentResult.Success || currentResult.Data == null)
|
||||
{
|
||||
return FailFrom<ProductoServicioModel, int>(
|
||||
currentResult,
|
||||
"No fue posible recuperar el producto o servicio guardado.");
|
||||
}
|
||||
|
||||
BitacoraTipoMovimiento movement = previous == null
|
||||
? BitacoraTipoMovimiento.Agregado
|
||||
: BitacoraTipoMovimiento.Editado;
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoServicioBitacoraFactory.Create(
|
||||
previous,
|
||||
currentResult.Data,
|
||||
result.Data,
|
||||
movement));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return DbResult<int>.Fail(
|
||||
auditResult.UserMessage,
|
||||
auditResult.TechnicalMessage,
|
||||
auditResult.Exception);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<bool> Delete(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
if (cvePS <= 0)
|
||||
{
|
||||
return Fail<bool>(
|
||||
"Seleccione un producto o servicio válido.");
|
||||
}
|
||||
|
||||
using (var transaction = new TransactionLogic())
|
||||
{
|
||||
DbResult<ProductoServicioModel> previousResult =
|
||||
_repository.Get(cvePS, usuario, dominio);
|
||||
|
||||
if (!previousResult.Success || previousResult.Data == null)
|
||||
{
|
||||
return FailFrom<ProductoServicioModel, bool>(
|
||||
previousResult,
|
||||
"El producto o servicio seleccionado no existe.");
|
||||
}
|
||||
|
||||
DbResult<bool> result = _repository.Delete(
|
||||
cvePS,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
DbResult<long> auditResult = _bitacora.Registrar(
|
||||
ProductoServicioBitacoraFactory.Create(
|
||||
previousResult.Data,
|
||||
null,
|
||||
cvePS,
|
||||
BitacoraTipoMovimiento.Eliminado));
|
||||
|
||||
if (!auditResult.Success)
|
||||
{
|
||||
return DbResult<bool>.Fail(
|
||||
auditResult.UserMessage,
|
||||
auditResult.TechnicalMessage,
|
||||
auditResult.Exception);
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private static DbResult<int> Validate(
|
||||
ProductoServicioModel productoServicio)
|
||||
{
|
||||
if (productoServicio == null ||
|
||||
string.IsNullOrWhiteSpace(productoServicio.PS))
|
||||
{
|
||||
return Fail<int>(
|
||||
"Capture la descripción del producto o servicio.");
|
||||
}
|
||||
|
||||
if (productoServicio.PS.Trim().Length > 846)
|
||||
{
|
||||
return Fail<int>(
|
||||
"La descripción no puede exceder 846 caracteres.");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(productoServicio.Codigo) &&
|
||||
productoServicio.Codigo.Trim().Length > 50)
|
||||
{
|
||||
return Fail<int>(
|
||||
"El código no puede exceder 50 caracteres.");
|
||||
}
|
||||
|
||||
if (productoServicio.CveTipoPS != 1 &&
|
||||
productoServicio.CveTipoPS != 2)
|
||||
{
|
||||
return Fail<int>(
|
||||
"Seleccione si el registro es producto o servicio.");
|
||||
}
|
||||
|
||||
if (productoServicio.CveClasificacion <= 0 ||
|
||||
productoServicio.CveUnidadMedida <= 0)
|
||||
{
|
||||
return Fail<int>(
|
||||
"Seleccione la clasificación y la unidad de medida.");
|
||||
}
|
||||
|
||||
if (productoServicio.Precio < 0)
|
||||
{
|
||||
return Fail<int>("El precio no puede ser negativo.");
|
||||
}
|
||||
|
||||
return DbResult<int>.Ok(productoServicio.CvePS);
|
||||
}
|
||||
|
||||
private static string TrimOrNull(string value)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(value)
|
||||
? null
|
||||
: value.Trim();
|
||||
}
|
||||
|
||||
private static DbResult<T> Fail<T>(string message)
|
||||
{
|
||||
return DbResult<T>.Fail(
|
||||
message,
|
||||
message,
|
||||
new ArgumentException(message));
|
||||
}
|
||||
|
||||
private static DbResult<TResult> FailFrom<TSource, TResult>(
|
||||
DbResult<TSource> source,
|
||||
string fallbackMessage)
|
||||
{
|
||||
string message = source == null ||
|
||||
string.IsNullOrWhiteSpace(source.UserMessage)
|
||||
? fallbackMessage
|
||||
: source.UserMessage;
|
||||
|
||||
return DbResult<TResult>.Fail(
|
||||
message,
|
||||
source == null
|
||||
? fallbackMessage
|
||||
: source.TechnicalMessage,
|
||||
source == null ? null : source.Exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
438
SIG.Web/App_Code/Services/General/ServicioCatalogoProducto.cs
Normal file
438
SIG.Web/App_Code/Services/General/ServicioCatalogoProducto.cs
Normal file
@@ -0,0 +1,438 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Contracts.Bitacora;
|
||||
using SIG.Web.AppCode.Contracts.General;
|
||||
using SIG.Web.AppCode.Infrastructure.Transactions;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
public sealed class ServicioCatalogoProducto : IServicioCatalogoProducto
|
||||
{
|
||||
private readonly IRepositorioCatalogoProducto _repositorio;
|
||||
private readonly IBitacoraService _bitacora;
|
||||
|
||||
public ServicioCatalogoProducto(
|
||||
IRepositorioCatalogoProducto repositorio,
|
||||
IBitacoraService bitacora)
|
||||
{
|
||||
_repositorio = repositorio ??
|
||||
throw new ArgumentNullException("repositorio");
|
||||
_bitacora = bitacora ??
|
||||
throw new ArgumentNullException("bitacora");
|
||||
}
|
||||
|
||||
public DbResult<List<ModeloClasificacion>> ListarClasificaciones(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repositorio.ListarClasificaciones(
|
||||
RecortarONulo(texto),
|
||||
incluirInactivos,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<ModeloClasificacion> ObtenerClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return cveClasificacion > 0
|
||||
? _repositorio.ObtenerClasificacion(
|
||||
cveClasificacion,
|
||||
usuario,
|
||||
dominio)
|
||||
: Fallar<ModeloClasificacion>(
|
||||
"Seleccione una clasificación válida.");
|
||||
}
|
||||
|
||||
public DbResult<int> GuardarClasificacion(
|
||||
ModeloClasificacion clasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
DbResult<int> validacion = Validar(clasificacion);
|
||||
|
||||
if (!validacion.Success)
|
||||
{
|
||||
return validacion;
|
||||
}
|
||||
|
||||
clasificacion.Codigo = RecortarONulo(clasificacion.Codigo);
|
||||
clasificacion.Clasificacion = clasificacion.Clasificacion.Trim();
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
ModeloClasificacion anterior = null;
|
||||
|
||||
if (clasificacion.CveClasificacion > 0)
|
||||
{
|
||||
DbResult<ModeloClasificacion> resultadoAnterior =
|
||||
_repositorio.ObtenerClasificacion(
|
||||
clasificacion.CveClasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultadoAnterior.Success || resultadoAnterior.Data == null)
|
||||
{
|
||||
return FallarDesde<ModeloClasificacion, int>(
|
||||
resultadoAnterior,
|
||||
"La clasificación seleccionada no existe.");
|
||||
}
|
||||
|
||||
anterior = resultadoAnterior.Data;
|
||||
}
|
||||
|
||||
DbResult<int> resultado = _repositorio.GuardarClasificacion(
|
||||
clasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
|
||||
DbResult<ModeloClasificacion> resultadoActual =
|
||||
_repositorio.ObtenerClasificacion(
|
||||
resultado.Data,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultadoActual.Success || resultadoActual.Data == null)
|
||||
{
|
||||
return FallarDesde<ModeloClasificacion, int>(
|
||||
resultadoActual,
|
||||
"No fue posible recuperar la clasificación guardada.");
|
||||
}
|
||||
|
||||
DbResult<long> resultadoBitacora = _bitacora.Registrar(
|
||||
FabricaBitacoraCatalogoProducto.CrearClasificacion(
|
||||
anterior,
|
||||
resultadoActual.Data,
|
||||
resultado.Data,
|
||||
anterior == null
|
||||
? BitacoraTipoMovimiento.Agregado
|
||||
: BitacoraTipoMovimiento.Editado));
|
||||
|
||||
if (!resultadoBitacora.Success)
|
||||
{
|
||||
return FallarDesde<long, int>(
|
||||
resultadoBitacora,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<bool> EliminarClasificacion(
|
||||
int cveClasificacion,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
if (cveClasificacion <= 0)
|
||||
{
|
||||
return Fallar<bool>("Seleccione una clasificación válida.");
|
||||
}
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
DbResult<ModeloClasificacion> resultadoAnterior =
|
||||
_repositorio.ObtenerClasificacion(
|
||||
cveClasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultadoAnterior.Success || resultadoAnterior.Data == null)
|
||||
{
|
||||
return FallarDesde<ModeloClasificacion, bool>(
|
||||
resultadoAnterior,
|
||||
"La clasificación seleccionada no existe.");
|
||||
}
|
||||
|
||||
DbResult<bool> resultado = _repositorio.EliminarClasificacion(
|
||||
cveClasificacion,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
|
||||
DbResult<long> resultadoBitacora = _bitacora.Registrar(
|
||||
FabricaBitacoraCatalogoProducto.CrearClasificacion(
|
||||
resultadoAnterior.Data,
|
||||
null,
|
||||
cveClasificacion,
|
||||
BitacoraTipoMovimiento.Eliminado));
|
||||
|
||||
if (!resultadoBitacora.Success)
|
||||
{
|
||||
return FallarDesde<long, bool>(
|
||||
resultadoBitacora,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<List<ModeloUnidadMedida>> ListarUnidadesMedida(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repositorio.ListarUnidadesMedida(
|
||||
RecortarONulo(texto),
|
||||
incluirInactivos,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<ModeloUnidadMedida> ObtenerUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return cveUnidadMedida > 0
|
||||
? _repositorio.ObtenerUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
usuario,
|
||||
dominio)
|
||||
: Fallar<ModeloUnidadMedida>(
|
||||
"Seleccione una unidad de medida válida.");
|
||||
}
|
||||
|
||||
public DbResult<int> GuardarUnidadMedida(
|
||||
ModeloUnidadMedida unidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
DbResult<int> validacion = Validar(unidadMedida);
|
||||
|
||||
if (!validacion.Success)
|
||||
{
|
||||
return validacion;
|
||||
}
|
||||
|
||||
unidadMedida.UnidadMedida = unidadMedida.UnidadMedida.Trim();
|
||||
unidadMedida.Abreviatura = unidadMedida.Abreviatura.Trim();
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
ModeloUnidadMedida anterior = null;
|
||||
|
||||
if (unidadMedida.CveUnidadMedida > 0)
|
||||
{
|
||||
DbResult<ModeloUnidadMedida> resultadoAnterior =
|
||||
_repositorio.ObtenerUnidadMedida(
|
||||
unidadMedida.CveUnidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultadoAnterior.Success || resultadoAnterior.Data == null)
|
||||
{
|
||||
return FallarDesde<ModeloUnidadMedida, int>(
|
||||
resultadoAnterior,
|
||||
"La unidad de medida seleccionada no existe.");
|
||||
}
|
||||
|
||||
anterior = resultadoAnterior.Data;
|
||||
}
|
||||
|
||||
DbResult<int> resultado = _repositorio.GuardarUnidadMedida(
|
||||
unidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
|
||||
DbResult<ModeloUnidadMedida> resultadoActual =
|
||||
_repositorio.ObtenerUnidadMedida(
|
||||
resultado.Data,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultadoActual.Success || resultadoActual.Data == null)
|
||||
{
|
||||
return FallarDesde<ModeloUnidadMedida, int>(
|
||||
resultadoActual,
|
||||
"No fue posible recuperar la unidad de medida guardada.");
|
||||
}
|
||||
|
||||
DbResult<long> resultadoBitacora = _bitacora.Registrar(
|
||||
FabricaBitacoraCatalogoProducto.CrearUnidadMedida(
|
||||
anterior,
|
||||
resultadoActual.Data,
|
||||
resultado.Data,
|
||||
anterior == null
|
||||
? BitacoraTipoMovimiento.Agregado
|
||||
: BitacoraTipoMovimiento.Editado));
|
||||
|
||||
if (!resultadoBitacora.Success)
|
||||
{
|
||||
return FallarDesde<long, int>(
|
||||
resultadoBitacora,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<bool> EliminarUnidadMedida(
|
||||
int cveUnidadMedida,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
if (cveUnidadMedida <= 0)
|
||||
{
|
||||
return Fallar<bool>(
|
||||
"Seleccione una unidad de medida válida.");
|
||||
}
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
DbResult<ModeloUnidadMedida> resultadoAnterior =
|
||||
_repositorio.ObtenerUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultadoAnterior.Success || resultadoAnterior.Data == null)
|
||||
{
|
||||
return FallarDesde<ModeloUnidadMedida, bool>(
|
||||
resultadoAnterior,
|
||||
"La unidad de medida seleccionada no existe.");
|
||||
}
|
||||
|
||||
DbResult<bool> resultado = _repositorio.EliminarUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
|
||||
DbResult<long> resultadoBitacora = _bitacora.Registrar(
|
||||
FabricaBitacoraCatalogoProducto.CrearUnidadMedida(
|
||||
resultadoAnterior.Data,
|
||||
null,
|
||||
cveUnidadMedida,
|
||||
BitacoraTipoMovimiento.Eliminado));
|
||||
|
||||
if (!resultadoBitacora.Success)
|
||||
{
|
||||
return FallarDesde<long, bool>(
|
||||
resultadoBitacora,
|
||||
"No fue posible registrar la bitácora.");
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
private static DbResult<int> Validar(
|
||||
ModeloClasificacion clasificacion)
|
||||
{
|
||||
if (clasificacion == null ||
|
||||
string.IsNullOrWhiteSpace(clasificacion.Clasificacion))
|
||||
{
|
||||
return Fallar<int>("Capture la clasificación.");
|
||||
}
|
||||
|
||||
if (clasificacion.Clasificacion.Trim().Length > 200)
|
||||
{
|
||||
return Fallar<int>(
|
||||
"La clasificación no puede exceder 200 caracteres.");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(clasificacion.Codigo) &&
|
||||
clasificacion.Codigo.Trim().Length > 20)
|
||||
{
|
||||
return Fallar<int>(
|
||||
"El código no puede exceder 20 caracteres.");
|
||||
}
|
||||
|
||||
return DbResult<int>.Ok(clasificacion.CveClasificacion);
|
||||
}
|
||||
|
||||
private static DbResult<int> Validar(
|
||||
ModeloUnidadMedida unidadMedida)
|
||||
{
|
||||
if (unidadMedida == null ||
|
||||
string.IsNullOrWhiteSpace(unidadMedida.UnidadMedida))
|
||||
{
|
||||
return Fallar<int>("Capture la unidad de medida.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(unidadMedida.Abreviatura))
|
||||
{
|
||||
return Fallar<int>("Capture la abreviatura.");
|
||||
}
|
||||
|
||||
if (unidadMedida.UnidadMedida.Trim().Length > 50)
|
||||
{
|
||||
return Fallar<int>(
|
||||
"La unidad de medida no puede exceder 50 caracteres.");
|
||||
}
|
||||
|
||||
if (unidadMedida.Abreviatura.Trim().Length > 15)
|
||||
{
|
||||
return Fallar<int>(
|
||||
"La abreviatura no puede exceder 15 caracteres.");
|
||||
}
|
||||
|
||||
return DbResult<int>.Ok(unidadMedida.CveUnidadMedida);
|
||||
}
|
||||
|
||||
private static string RecortarONulo(string valor)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(valor)
|
||||
? null
|
||||
: valor.Trim();
|
||||
}
|
||||
|
||||
private static DbResult<T> Fallar<T>(string mensaje)
|
||||
{
|
||||
return DbResult<T>.Fail(
|
||||
mensaje,
|
||||
mensaje,
|
||||
new ArgumentException(mensaje));
|
||||
}
|
||||
|
||||
private static DbResult<TDestino> FallarDesde<TOrigen, TDestino>(
|
||||
DbResult<TOrigen> origen,
|
||||
string mensajeAlternativo)
|
||||
{
|
||||
string mensaje = origen == null ||
|
||||
string.IsNullOrWhiteSpace(origen.UserMessage)
|
||||
? mensajeAlternativo
|
||||
: origen.UserMessage;
|
||||
|
||||
return DbResult<TDestino>.Fail(
|
||||
mensaje,
|
||||
origen == null
|
||||
? mensajeAlternativo
|
||||
: origen.TechnicalMessage,
|
||||
origen == null ? null : origen.Exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
276
SIG.Web/App_Code/Services/General/ServicioProductoServicio.cs
Normal file
276
SIG.Web/App_Code/Services/General/ServicioProductoServicio.cs
Normal file
@@ -0,0 +1,276 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SIG.Web.AppCode.Contracts.Bitacora;
|
||||
using SIG.Web.AppCode.Contracts.General;
|
||||
using SIG.Web.AppCode.Infrastructure.Transactions;
|
||||
using SIG.Web.AppCode.Models.Bitacora;
|
||||
using SIG.Web.AppCode.Models.Common;
|
||||
using SIG.Web.AppCode.Models.General;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.General
|
||||
{
|
||||
public sealed class ServicioProductoServicio : IServicioProductoServicio
|
||||
{
|
||||
private readonly IRepositorioProductoServicio _repositorio;
|
||||
private readonly IBitacoraService _bitacora;
|
||||
|
||||
public ServicioProductoServicio(
|
||||
IRepositorioProductoServicio repositorio,
|
||||
IBitacoraService bitacora)
|
||||
{
|
||||
_repositorio = repositorio ??
|
||||
throw new ArgumentNullException("repositorio");
|
||||
_bitacora = bitacora ??
|
||||
throw new ArgumentNullException("bitacora");
|
||||
}
|
||||
|
||||
public DbResult<List<ModeloProductoServicio>> Listar(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repositorio.Listar(
|
||||
RecortarONulo(texto),
|
||||
incluirInactivos,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<ModeloProductoServicio> Obtener(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return cvePS > 0
|
||||
? _repositorio.Obtener(cvePS, usuario, dominio)
|
||||
: Fallar<ModeloProductoServicio>(
|
||||
"Seleccione un producto o servicio válido.");
|
||||
}
|
||||
|
||||
public DbResult<ModeloOpcionesProductoServicio> ListarOpciones(
|
||||
int? cveClasificacionActual,
|
||||
int? cveUnidadMedidaActual,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return _repositorio.ListarOpciones(
|
||||
cveClasificacionActual,
|
||||
cveUnidadMedidaActual,
|
||||
usuario,
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<int> Guardar(
|
||||
ModeloProductoServicio productoServicio,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
DbResult<int> validacion = Validar(productoServicio);
|
||||
|
||||
if (!validacion.Success)
|
||||
{
|
||||
return validacion;
|
||||
}
|
||||
|
||||
productoServicio.Codigo = RecortarONulo(
|
||||
productoServicio.Codigo);
|
||||
productoServicio.PS = productoServicio.PS.Trim();
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
ModeloProductoServicio anterior = null;
|
||||
|
||||
if (productoServicio.CvePS > 0)
|
||||
{
|
||||
DbResult<ModeloProductoServicio> resultadoAnterior =
|
||||
_repositorio.Obtener(
|
||||
productoServicio.CvePS,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultadoAnterior.Success ||
|
||||
resultadoAnterior.Data == null)
|
||||
{
|
||||
return FallarDesde<ModeloProductoServicio, int>(
|
||||
resultadoAnterior,
|
||||
"El producto o servicio seleccionado no existe.");
|
||||
}
|
||||
|
||||
anterior = resultadoAnterior.Data;
|
||||
}
|
||||
|
||||
DbResult<int> resultado = _repositorio.Guardar(
|
||||
productoServicio,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
|
||||
DbResult<ModeloProductoServicio> resultadoActual =
|
||||
_repositorio.Obtener(resultado.Data, usuario, dominio);
|
||||
|
||||
if (!resultadoActual.Success || resultadoActual.Data == null)
|
||||
{
|
||||
return FallarDesde<ModeloProductoServicio, int>(
|
||||
resultadoActual,
|
||||
"No fue posible recuperar el producto o servicio guardado.");
|
||||
}
|
||||
|
||||
BitacoraTipoMovimiento movimiento = anterior == null
|
||||
? BitacoraTipoMovimiento.Agregado
|
||||
: BitacoraTipoMovimiento.Editado;
|
||||
DbResult<long> resultadoBitacora = _bitacora.Registrar(
|
||||
FabricaBitacoraProductoServicio.Crear(
|
||||
anterior,
|
||||
resultadoActual.Data,
|
||||
resultado.Data,
|
||||
movimiento));
|
||||
|
||||
if (!resultadoBitacora.Success)
|
||||
{
|
||||
return DbResult<int>.Fail(
|
||||
resultadoBitacora.UserMessage,
|
||||
resultadoBitacora.TechnicalMessage,
|
||||
resultadoBitacora.Exception);
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
public DbResult<bool> Eliminar(
|
||||
int cvePS,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
if (cvePS <= 0)
|
||||
{
|
||||
return Fallar<bool>(
|
||||
"Seleccione un producto o servicio válido.");
|
||||
}
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
DbResult<ModeloProductoServicio> resultadoAnterior =
|
||||
_repositorio.Obtener(cvePS, usuario, dominio);
|
||||
|
||||
if (!resultadoAnterior.Success || resultadoAnterior.Data == null)
|
||||
{
|
||||
return FallarDesde<ModeloProductoServicio, bool>(
|
||||
resultadoAnterior,
|
||||
"El producto o servicio seleccionado no existe.");
|
||||
}
|
||||
|
||||
DbResult<bool> resultado = _repositorio.Eliminar(
|
||||
cvePS,
|
||||
usuario,
|
||||
dominio);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
return resultado;
|
||||
}
|
||||
|
||||
DbResult<long> resultadoBitacora = _bitacora.Registrar(
|
||||
FabricaBitacoraProductoServicio.Crear(
|
||||
resultadoAnterior.Data,
|
||||
null,
|
||||
cvePS,
|
||||
BitacoraTipoMovimiento.Eliminado));
|
||||
|
||||
if (!resultadoBitacora.Success)
|
||||
{
|
||||
return DbResult<bool>.Fail(
|
||||
resultadoBitacora.UserMessage,
|
||||
resultadoBitacora.TechnicalMessage,
|
||||
resultadoBitacora.Exception);
|
||||
}
|
||||
|
||||
transaccion.Commit();
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
private static DbResult<int> Validar(
|
||||
ModeloProductoServicio productoServicio)
|
||||
{
|
||||
if (productoServicio == null ||
|
||||
string.IsNullOrWhiteSpace(productoServicio.PS))
|
||||
{
|
||||
return Fallar<int>(
|
||||
"Capture la descripción del producto o servicio.");
|
||||
}
|
||||
|
||||
if (productoServicio.PS.Trim().Length > 846)
|
||||
{
|
||||
return Fallar<int>(
|
||||
"La descripción no puede exceder 846 caracteres.");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(productoServicio.Codigo) &&
|
||||
productoServicio.Codigo.Trim().Length > 50)
|
||||
{
|
||||
return Fallar<int>(
|
||||
"El código no puede exceder 50 caracteres.");
|
||||
}
|
||||
|
||||
if (productoServicio.CveTipoPS != 1 &&
|
||||
productoServicio.CveTipoPS != 2)
|
||||
{
|
||||
return Fallar<int>(
|
||||
"Seleccione si el registro es producto o servicio.");
|
||||
}
|
||||
|
||||
if (productoServicio.CveClasificacion <= 0 ||
|
||||
productoServicio.CveUnidadMedida <= 0)
|
||||
{
|
||||
return Fallar<int>(
|
||||
"Seleccione la clasificación y la unidad de medida.");
|
||||
}
|
||||
|
||||
if (productoServicio.Precio < 0)
|
||||
{
|
||||
return Fallar<int>("El precio no puede ser negativo.");
|
||||
}
|
||||
|
||||
return DbResult<int>.Ok(productoServicio.CvePS);
|
||||
}
|
||||
|
||||
private static string RecortarONulo(string valor)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(valor)
|
||||
? null
|
||||
: valor.Trim();
|
||||
}
|
||||
|
||||
private static DbResult<T> Fallar<T>(string mensaje)
|
||||
{
|
||||
return DbResult<T>.Fail(
|
||||
mensaje,
|
||||
mensaje,
|
||||
new ArgumentException(mensaje));
|
||||
}
|
||||
|
||||
private static DbResult<TDestino> FallarDesde<TOrigen, TDestino>(
|
||||
DbResult<TOrigen> origen,
|
||||
string mensajeAlternativo)
|
||||
{
|
||||
string mensaje = origen == null ||
|
||||
string.IsNullOrWhiteSpace(origen.UserMessage)
|
||||
? mensajeAlternativo
|
||||
: origen.UserMessage;
|
||||
|
||||
return DbResult<TDestino>.Fail(
|
||||
mensaje,
|
||||
origen == null
|
||||
? mensajeAlternativo
|
||||
: origen.TechnicalMessage,
|
||||
origen == null ? null : origen.Exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,13 @@ using SIG.Web.AppCode.Session;
|
||||
|
||||
namespace SIG.Web.AppCode.Services.Security
|
||||
{
|
||||
public sealed class PerfilUsuarioService : IPerfilUsuarioService
|
||||
public sealed class ServicioPerfilUsuario : IServicioPerfilUsuario
|
||||
{
|
||||
private readonly IPerfilUsuarioRepository _repositorio;
|
||||
private readonly IRepositorioPerfilUsuario _repositorio;
|
||||
private readonly IPasswordHasher _generadorHashContrasena;
|
||||
|
||||
public PerfilUsuarioService(
|
||||
IPerfilUsuarioRepository repositorio,
|
||||
public ServicioPerfilUsuario(
|
||||
IRepositorioPerfilUsuario repositorio,
|
||||
IPasswordHasher generadorHashContrasena)
|
||||
{
|
||||
_repositorio = repositorio ??
|
||||
@@ -24,12 +24,12 @@ namespace SIG.Web.AppCode.Services.Security
|
||||
"generadorHashContrasena");
|
||||
}
|
||||
|
||||
public DbResult<PerfilUsuarioConsultaModel> ObtenerPerfil(
|
||||
public DbResult<ModeloConsultaPerfilUsuario> ObtenerPerfil(
|
||||
UserSessionModel usuarioSesion)
|
||||
{
|
||||
if (usuarioSesion == null || usuarioSesion.CveUsuario <= 0)
|
||||
{
|
||||
return Error<PerfilUsuarioConsultaModel>(
|
||||
return Error<ModeloConsultaPerfilUsuario>(
|
||||
"No se encontró la sesión del usuario.");
|
||||
}
|
||||
|
||||
@@ -39,14 +39,14 @@ namespace SIG.Web.AppCode.Services.Security
|
||||
usuarioSesion.NombreDominio);
|
||||
}
|
||||
|
||||
public DbResult<PerfilSesionModel> ActualizarSesion(
|
||||
public DbResult<ModeloPerfilSesion> ActualizarSesion(
|
||||
UserSessionModel usuarioSesion,
|
||||
string nombreUsuario,
|
||||
string contrasena)
|
||||
{
|
||||
if (usuarioSesion == null || usuarioSesion.CveUsuario <= 0)
|
||||
{
|
||||
return Error<PerfilSesionModel>(
|
||||
return Error<ModeloPerfilSesion>(
|
||||
"No se encontró la sesión del usuario.");
|
||||
}
|
||||
|
||||
@@ -56,21 +56,21 @@ namespace SIG.Web.AppCode.Services.Security
|
||||
|
||||
if (nombreUsuario.Length < 3)
|
||||
{
|
||||
return Error<PerfilSesionModel>(
|
||||
return Error<ModeloPerfilSesion>(
|
||||
"El nombre de usuario debe contener al menos tres caracteres.");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(contrasena) &&
|
||||
contrasena.Length < 8)
|
||||
{
|
||||
return Error<PerfilSesionModel>(
|
||||
return Error<ModeloPerfilSesion>(
|
||||
"La contraseña debe contener al menos ocho caracteres.");
|
||||
}
|
||||
|
||||
string hashContrasena = string.IsNullOrEmpty(contrasena)
|
||||
? null
|
||||
: _generadorHashContrasena.HashPassword(contrasena);
|
||||
DbResult<PerfilSesionModel> resultado;
|
||||
DbResult<ModeloPerfilSesion> resultado;
|
||||
|
||||
using (var transaccion = new TransactionLogic())
|
||||
{
|
||||
@@ -92,7 +92,7 @@ namespace SIG.Web.AppCode.Services.Security
|
||||
|
||||
public DbResult<bool> ActualizarCliente(
|
||||
UserSessionModel usuarioSesion,
|
||||
PerfilClienteModel cliente)
|
||||
ModeloPerfilCliente cliente)
|
||||
{
|
||||
if (usuarioSesion == null ||
|
||||
!usuarioSesion.EsDesarrollador ||
|
||||
@@ -127,14 +127,14 @@ namespace SIG.Web.AppCode.Services.Security
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public DbResult<List<UsuarioCambioContextoModel>>
|
||||
public DbResult<List<ModeloUsuarioCambioContexto>>
|
||||
ListarUsuariosCambio(
|
||||
UserSessionModel usuarioSesion,
|
||||
string texto)
|
||||
{
|
||||
if (!PuedeCambiarUsuario(usuarioSesion))
|
||||
{
|
||||
return Error<List<UsuarioCambioContextoModel>>(
|
||||
return Error<List<ModeloUsuarioCambioContexto>>(
|
||||
"La sesión no permite cambiar de usuario.");
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace SIG.Web.AppCode.Services.Security
|
||||
"Seleccione un usuario válido.");
|
||||
}
|
||||
|
||||
DbResult<UsuarioCambioContextoModel> resultadoUsuario =
|
||||
DbResult<ModeloUsuarioCambioContexto> resultadoUsuario =
|
||||
_repositorio.ObtenerUsuarioContexto(
|
||||
cveUsuarioSeleccionado,
|
||||
UsuarioAdministrador(usuarioSesion),
|
||||
@@ -178,7 +178,7 @@ namespace SIG.Web.AppCode.Services.Security
|
||||
resultadoUsuario.Exception);
|
||||
}
|
||||
|
||||
UsuarioCambioContextoModel usuario = resultadoUsuario.Data;
|
||||
ModeloUsuarioCambioContexto usuario = resultadoUsuario.Data;
|
||||
|
||||
return DbResult<UserSessionModel>.Ok(
|
||||
new UserSessionModel
|
||||
@@ -201,12 +201,12 @@ namespace SIG.Web.AppCode.Services.Tramites
|
||||
}
|
||||
|
||||
public static BitacoraEventoModel ProductoServicioPrecio(
|
||||
ProductoServicioTramiteModel anterior,
|
||||
ProductoServicioTramiteModel actual,
|
||||
ModeloProductoServicioTramite anterior,
|
||||
ModeloProductoServicioTramite actual,
|
||||
int id,
|
||||
BitacoraTipoMovimiento movimiento)
|
||||
{
|
||||
ProductoServicioTramiteModel valor = actual ?? anterior;
|
||||
ModeloProductoServicioTramite valor = actual ?? anterior;
|
||||
return Create(
|
||||
"ProductosServicios",
|
||||
"CvePS",
|
||||
|
||||
@@ -357,7 +357,7 @@ namespace SIG.Web.AppCode.Services.Tramites
|
||||
BitacoraTipoMovimiento.Eliminado));
|
||||
}
|
||||
|
||||
public DbResult<List<ProductoServicioTramiteModel>> ListProductosServicios(
|
||||
public DbResult<List<ModeloProductoServicioTramite>> ListProductosServicios(
|
||||
string texto,
|
||||
bool incluirInactivos,
|
||||
int usuario,
|
||||
@@ -370,14 +370,14 @@ namespace SIG.Web.AppCode.Services.Tramites
|
||||
dominio);
|
||||
}
|
||||
|
||||
public DbResult<ProductoServicioTramiteModel> GetProductoServicio(
|
||||
public DbResult<ModeloProductoServicioTramite> GetProductoServicio(
|
||||
int id,
|
||||
int usuario,
|
||||
string dominio)
|
||||
{
|
||||
return id > 0
|
||||
? _repository.GetProductoServicio(id, usuario, dominio)
|
||||
: Fail<ProductoServicioTramiteModel>("Seleccione un producto o servicio válido.");
|
||||
: Fail<ModeloProductoServicioTramite>("Seleccione un producto o servicio válido.");
|
||||
}
|
||||
|
||||
public DbResult<int> UpdateProductoServicioPrecio(
|
||||
|
||||
@@ -12,11 +12,11 @@ namespace SIG.Web.AppCode.Services.Ventas
|
||||
public sealed class ServicioVentaTramite : IServicioVentaTramite
|
||||
{
|
||||
private readonly IRepositorioVentaTramite _repositorio;
|
||||
private readonly ICfdiTimbradoService _servicioTimbrado;
|
||||
private readonly IServicioTimbradoCfdi _servicioTimbrado;
|
||||
|
||||
public ServicioVentaTramite(
|
||||
IRepositorioVentaTramite repositorio,
|
||||
ICfdiTimbradoService servicioTimbrado)
|
||||
IServicioTimbradoCfdi servicioTimbrado)
|
||||
{
|
||||
if (repositorio == null)
|
||||
{
|
||||
@@ -348,7 +348,7 @@ namespace SIG.Web.AppCode.Services.Ventas
|
||||
}
|
||||
|
||||
ModeloDatosCfdiVentaTramite datos = datosResultado.Data;
|
||||
CfdiSolicitudModel solicitud = CrearSolicitudCfdi(
|
||||
ModeloSolicitudCfdi solicitud = CrearSolicitudCfdi(
|
||||
datos,
|
||||
timbrado.CveEmpresa);
|
||||
DbResult<long> borradorResultado =
|
||||
@@ -362,7 +362,7 @@ namespace SIG.Web.AppCode.Services.Ventas
|
||||
return CopiarFallo<long, string>(borradorResultado);
|
||||
}
|
||||
|
||||
DbResult<CfdiTimbradoResultadoModel> timbradoResultado =
|
||||
DbResult<ModeloResultadoTimbradoCfdi> timbradoResultado =
|
||||
_servicioTimbrado.Timbrar(
|
||||
borradorResultado.Data,
|
||||
null,
|
||||
@@ -379,7 +379,7 @@ namespace SIG.Web.AppCode.Services.Ventas
|
||||
string.IsNullOrWhiteSpace(timbradoResultado.Data.Mensaje)
|
||||
? "El PAC no confirmó el timbrado."
|
||||
: timbradoResultado.Data.Mensaje)
|
||||
: CopiarFallo<CfdiTimbradoResultadoModel, string>(
|
||||
: CopiarFallo<ModeloResultadoTimbradoCfdi, string>(
|
||||
timbradoResultado);
|
||||
}
|
||||
|
||||
@@ -450,9 +450,9 @@ namespace SIG.Web.AppCode.Services.Ventas
|
||||
}
|
||||
|
||||
ModeloContextoVentaTramite contexto = contextoResultado.Data;
|
||||
DbResult<CfdiCancelacionResultadoModel> resultado =
|
||||
DbResult<ModeloResultadoCancelacionCfdi> resultado =
|
||||
_servicioTimbrado.Cancelar(
|
||||
new CfdiCancelacionSolicitudModel
|
||||
new ModeloSolicitudCancelacionCfdi
|
||||
{
|
||||
CveCfdiDocumento =
|
||||
contexto.CveCfdiDocumento.Value,
|
||||
@@ -473,7 +473,7 @@ namespace SIG.Web.AppCode.Services.Ventas
|
||||
string.IsNullOrWhiteSpace(resultado.Data.Mensaje)
|
||||
? "El PAC no confirmó la cancelación."
|
||||
: resultado.Data.Mensaje)
|
||||
: CopiarFallo<CfdiCancelacionResultadoModel, string>(
|
||||
: CopiarFallo<ModeloResultadoCancelacionCfdi, string>(
|
||||
resultado);
|
||||
}
|
||||
|
||||
@@ -498,11 +498,11 @@ namespace SIG.Web.AppCode.Services.Ventas
|
||||
return DbResult<string>.Ok(resultado.Data.Mensaje);
|
||||
}
|
||||
|
||||
private static CfdiSolicitudModel CrearSolicitudCfdi(
|
||||
private static ModeloSolicitudCfdi CrearSolicitudCfdi(
|
||||
ModeloDatosCfdiVentaTramite datos,
|
||||
int cveEmpresa)
|
||||
{
|
||||
var solicitud = new CfdiSolicitudModel
|
||||
var solicitud = new ModeloSolicitudCfdi
|
||||
{
|
||||
CveCfdiDocumento = datos.CveCfdiDocumento ?? 0,
|
||||
CveEmpresa = cveEmpresa,
|
||||
@@ -523,7 +523,7 @@ namespace SIG.Web.AppCode.Services.Ventas
|
||||
|
||||
foreach (ModeloConceptoCfdiVentaTramite origen in datos.Conceptos)
|
||||
{
|
||||
var concepto = new CfdiConceptoModel
|
||||
var concepto = new ModeloConceptoCfdi
|
||||
{
|
||||
ClaveProductoServicio = origen.ClaveProductoServicio,
|
||||
NumeroIdentificacion = origen.NumeroIdentificacion,
|
||||
@@ -539,7 +539,7 @@ namespace SIG.Web.AppCode.Services.Ventas
|
||||
if (origen.ObjetoImpuesto != "01")
|
||||
{
|
||||
concepto.Impuestos.Add(
|
||||
new CfdiImpuestoConceptoModel
|
||||
new ModeloImpuestoConceptoCfdi
|
||||
{
|
||||
EsRetencion = false,
|
||||
Base = origen.BaseIVA,
|
||||
@@ -5,36 +5,36 @@
|
||||
CodeFile="Clasificaciones.aspx.cs"
|
||||
Inherits="SIG.Web.Pages.Catalogos.Clasificaciones" %>
|
||||
|
||||
<asp:Content ID="ContentHead" ContentPlaceHolderID="H" runat="server">
|
||||
<asp:Content ID="ContenidoEncabezado" ContentPlaceHolderID="H" runat="server">
|
||||
<link href='<%= ResolveUrl("~/Styles/CatalogosTramites.css") %>'
|
||||
rel="stylesheet"
|
||||
type="text/css" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentActions" ContentPlaceHolderID="A" runat="server">
|
||||
<asp:UpdatePanel ID="UpActions"
|
||||
<asp:Content ID="ContenidoAcciones" ContentPlaceHolderID="A" runat="server">
|
||||
<asp:UpdatePanel ID="UpAcciones"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="BtnNew"
|
||||
<asp:LinkButton ID="BtnNuevo"
|
||||
runat="server"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnNew_Click">
|
||||
OnClick="BtnNuevo_Click">
|
||||
<i class="fa fa-plus"></i>
|
||||
Nueva clasificación
|
||||
</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnNew" EventName="Click" />
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnNuevo" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentMain" ContentPlaceHolderID="C" runat="server">
|
||||
<asp:UpdatePanel ID="UpCatalog"
|
||||
<asp:Content ID="ContenidoPrincipal" ContentPlaceHolderID="C" runat="server">
|
||||
<asp:UpdatePanel ID="UpCatalogo"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
@@ -62,7 +62,7 @@
|
||||
<asp:CheckBoxField DataField="EsActivo" HeaderText="Activo" />
|
||||
<asp:TemplateField HeaderText="Acciones">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnViewAudit"
|
||||
<asp:LinkButton ID="BtnVerBitacora"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm default"
|
||||
CommandName="VerBitacora"
|
||||
@@ -72,7 +72,7 @@
|
||||
aria-label="Ver bitácora">
|
||||
<i class="fa fa-history" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnEdit"
|
||||
<asp:LinkButton ID="BtnEditar"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm blue"
|
||||
CommandName="Editar"
|
||||
@@ -82,7 +82,7 @@
|
||||
aria-label="Editar clasificación">
|
||||
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnDelete"
|
||||
<asp:LinkButton ID="BtnEliminar"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm red"
|
||||
CommandName="Eliminar"
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
<div id="ModalFilters" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpFilters"
|
||||
<asp:UpdatePanel ID="UpFiltros"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
@@ -126,15 +126,15 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtSearch.ClientID %>">
|
||||
<label for="<%= TxtBusqueda.ClientID %>">
|
||||
Código o clasificación
|
||||
</label>
|
||||
<asp:TextBox ID="TxtSearch"
|
||||
<asp:TextBox ID="TxtBusqueda"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="200" />
|
||||
</div>
|
||||
<asp:CheckBox ID="ChkInactive"
|
||||
<asp:CheckBox ID="ChkInactivos"
|
||||
runat="server"
|
||||
Text=" Incluir inactivas" />
|
||||
</div>
|
||||
@@ -144,16 +144,16 @@
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnApplyFilters"
|
||||
<asp:Button ID="BtnAplicarFiltros"
|
||||
runat="server"
|
||||
CssClass="btn blue"
|
||||
Text="Aplicar filtros"
|
||||
OnClick="BtnApplyFilters_Click" />
|
||||
OnClick="BtnAplicarFiltros_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnApplyFilters"
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnAplicarFiltros"
|
||||
EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
@@ -162,7 +162,7 @@
|
||||
|
||||
<div id="ModalEdit" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpEdit"
|
||||
<asp:UpdatePanel ID="UpEdicion"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
@@ -176,13 +176,13 @@
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Literal ID="LitModalTitle" runat="server" />
|
||||
<asp:Literal ID="LitTituloModal" runat="server" />
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtCode.ClientID %>">Código</label>
|
||||
<asp:TextBox ID="TxtCode"
|
||||
<label for="<%= TxtCodigo.ClientID %>">Código</label>
|
||||
<asp:TextBox ID="TxtCodigo"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="20" />
|
||||
@@ -200,7 +200,7 @@
|
||||
runat="server"
|
||||
Text=" Afectable" />
|
||||
<br />
|
||||
<asp:CheckBox ID="ChkActive"
|
||||
<asp:CheckBox ID="ChkActivo"
|
||||
runat="server"
|
||||
Text=" Activa" />
|
||||
</div>
|
||||
@@ -210,16 +210,16 @@
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnSave"
|
||||
<asp:Button ID="BtnGuardar"
|
||||
runat="server"
|
||||
CssClass="btn green"
|
||||
Text="Guardar"
|
||||
OnClick="BtnSave_Click" />
|
||||
OnClick="BtnGuardar_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnSave" EventName="Click" />
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnGuardar" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
@@ -235,7 +235,7 @@
|
||||
OnAccionClick="UcBitacoraCatalogo_AccionClick" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<asp:Content ID="ContenidoScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<script src='<%= ResolveUrl("~/Scripts/CatalogosTramites.js") %>'
|
||||
type="text/javascript"></script>
|
||||
</asp:Content>
|
||||
|
||||
@@ -57,218 +57,218 @@ namespace SIG.Web.Pages.Catalogos
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
protected void Page_Load(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
if (IsPostBack)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
BindBitacora();
|
||||
SyncFilters();
|
||||
CargarGrid();
|
||||
CargarBitacora();
|
||||
SincronizarFiltros();
|
||||
}
|
||||
|
||||
protected void UcFiltros_MostrarFiltros(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
ShowModal("ModalFilters");
|
||||
MostrarModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void UcFiltros_Consultar(object sender, EventArgs e)
|
||||
protected void UcFiltros_Consultar(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
}
|
||||
|
||||
protected void UcFiltros_FiltrosChanged(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
List<string> names = UcFiltros.GetFiltros()
|
||||
.Select(item => item.Nombre)
|
||||
List<string> nombres = UcFiltros.GetFiltros()
|
||||
.Select(elemento => elemento.Nombre)
|
||||
.ToList();
|
||||
|
||||
if (!names.Contains("Texto"))
|
||||
if (!nombres.Contains("Texto"))
|
||||
{
|
||||
TxtSearch.Text = string.Empty;
|
||||
TxtBusqueda.Text = string.Empty;
|
||||
}
|
||||
|
||||
if (!names.Contains("Inactivos"))
|
||||
if (!nombres.Contains("Inactivos"))
|
||||
{
|
||||
ChkInactive.Checked = false;
|
||||
ChkInactivos.Checked = false;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
}
|
||||
|
||||
protected void BtnApplyFilters_Click(object sender, EventArgs e)
|
||||
protected void BtnAplicarFiltros_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalFilters");
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
UpCatalogo.Update();
|
||||
OcultarModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void BtnNew_Click(object sender, EventArgs e)
|
||||
protected void BtnNuevo_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
CveClasificacionActual = 0;
|
||||
LitModalTitle.Text = "Nueva clasificación";
|
||||
TxtCode.Text = string.Empty;
|
||||
LitTituloModal.Text = "Nueva clasificación";
|
||||
TxtCodigo.Text = string.Empty;
|
||||
TxtClassification.Text = string.Empty;
|
||||
ChkAffectable.Checked = true;
|
||||
ChkActive.Checked = true;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
ChkActivo.Checked = true;
|
||||
UpEdicion.Update();
|
||||
MostrarModal("ModalEdit");
|
||||
}
|
||||
|
||||
protected void GvClasificaciones_RowDataBound(
|
||||
object sender,
|
||||
GridViewRowEventArgs e)
|
||||
object origenEvento,
|
||||
GridViewRowEventArgs argumentos)
|
||||
{
|
||||
if (e.Row.RowType != DataControlRowType.DataRow)
|
||||
if (argumentos.Row.RowType != DataControlRowType.DataRow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
|
||||
ScriptManager administradorScripts = ScriptManager.GetCurrent(Page);
|
||||
|
||||
if (scriptManager == null)
|
||||
if (administradorScripts == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnViewAudit");
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnEdit");
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnDelete");
|
||||
RegistrarControlAsincrono(administradorScripts, argumentos.Row, "BtnVerBitacora");
|
||||
RegistrarControlAsincrono(administradorScripts, argumentos.Row, "BtnEditar");
|
||||
RegistrarControlAsincrono(administradorScripts, argumentos.Row, "BtnEliminar");
|
||||
}
|
||||
|
||||
protected void GvClasificaciones_RowCommand(
|
||||
object sender,
|
||||
GridViewCommandEventArgs e)
|
||||
object origenEvento,
|
||||
GridViewCommandEventArgs argumentos)
|
||||
{
|
||||
int cveClasificacion;
|
||||
|
||||
if (!int.TryParse(
|
||||
Convert.ToString(e.CommandArgument),
|
||||
Convert.ToString(argumentos.CommandArgument),
|
||||
out cveClasificacion))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.CommandName == "Editar")
|
||||
if (argumentos.CommandName == "Editar")
|
||||
{
|
||||
LoadEdit(cveClasificacion);
|
||||
CargarEdicion(cveClasificacion);
|
||||
}
|
||||
else if (e.CommandName == "VerBitacora")
|
||||
else if (argumentos.CommandName == "VerBitacora")
|
||||
{
|
||||
SelectBitacora(cveClasificacion);
|
||||
SeleccionarBitacora(cveClasificacion);
|
||||
}
|
||||
else if (e.CommandName == "Eliminar")
|
||||
else if (argumentos.CommandName == "Eliminar")
|
||||
{
|
||||
Delete(cveClasificacion);
|
||||
Eliminar(cveClasificacion);
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnSave_Click(object sender, EventArgs e)
|
||||
protected void BtnGuardar_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
var clasificacion = new ClasificacionModel
|
||||
var clasificacion = new ModeloClasificacion
|
||||
{
|
||||
CveClasificacion = CveClasificacionActual,
|
||||
Codigo = TxtCode.Text,
|
||||
Codigo = TxtCodigo.Text,
|
||||
Clasificacion = TxtClassification.Text,
|
||||
Afectable = ChkAffectable.Checked,
|
||||
EsActivo = ChkActive.Checked
|
||||
EsActivo = ChkActivo.Checked
|
||||
};
|
||||
|
||||
DbResult<int> result =
|
||||
AppServices.ProductoCatalogService.SaveClasificacion(
|
||||
DbResult<int> resultado =
|
||||
AppServices.ServicioCatalogoProducto.GuardarClasificacion(
|
||||
clasificacion,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
if (!resultado.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
ShowModal("ModalEdit");
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
MostrarModal("ModalEdit");
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalEdit");
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
CargarBitacora();
|
||||
UpCatalogo.Update();
|
||||
OcultarModal("ModalEdit");
|
||||
Alert(
|
||||
"Clasificación guardada correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
protected void UcBitacoraCatalogo_AccionClick(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
CveClasificacionBitacoraActual = 0;
|
||||
NombreClasificacionBitacoraActual = string.Empty;
|
||||
BindBitacora();
|
||||
CargarBitacora();
|
||||
}
|
||||
|
||||
private void LoadEdit(int cveClasificacion)
|
||||
private void CargarEdicion(int cveClasificacion)
|
||||
{
|
||||
DbResult<ClasificacionModel> result =
|
||||
AppServices.ProductoCatalogService.GetClasificacion(
|
||||
DbResult<ModeloClasificacion> resultado =
|
||||
AppServices.ServicioCatalogoProducto.ObtenerClasificacion(
|
||||
cveClasificacion,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
if (!resultado.Success || resultado.Data == null)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
CveClasificacionActual = result.Data.CveClasificacion;
|
||||
LitModalTitle.Text = "Editar clasificación";
|
||||
TxtCode.Text = result.Data.Codigo;
|
||||
TxtClassification.Text = result.Data.Clasificacion;
|
||||
ChkAffectable.Checked = result.Data.Afectable;
|
||||
ChkActive.Checked = result.Data.EsActivo;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
CveClasificacionActual = resultado.Data.CveClasificacion;
|
||||
LitTituloModal.Text = "Editar clasificación";
|
||||
TxtCodigo.Text = resultado.Data.Codigo;
|
||||
TxtClassification.Text = resultado.Data.Clasificacion;
|
||||
ChkAffectable.Checked = resultado.Data.Afectable;
|
||||
ChkActivo.Checked = resultado.Data.EsActivo;
|
||||
UpEdicion.Update();
|
||||
MostrarModal("ModalEdit");
|
||||
}
|
||||
|
||||
private void SelectBitacora(int cveClasificacion)
|
||||
private void SeleccionarBitacora(int cveClasificacion)
|
||||
{
|
||||
DbResult<ClasificacionModel> result =
|
||||
AppServices.ProductoCatalogService.GetClasificacion(
|
||||
DbResult<ModeloClasificacion> resultado =
|
||||
AppServices.ServicioCatalogoProducto.ObtenerClasificacion(
|
||||
cveClasificacion,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
if (!resultado.Success || resultado.Data == null)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
CveClasificacionBitacoraActual = cveClasificacion;
|
||||
NombreClasificacionBitacoraActual = result.Data.Clasificacion;
|
||||
BindBitacora();
|
||||
NombreClasificacionBitacoraActual = resultado.Data.Clasificacion;
|
||||
CargarBitacora();
|
||||
}
|
||||
|
||||
private void Delete(int cveClasificacion)
|
||||
private void Eliminar(int cveClasificacion)
|
||||
{
|
||||
DbResult<bool> result =
|
||||
AppServices.ProductoCatalogService.DeleteClasificacion(
|
||||
DbResult<bool> resultado =
|
||||
AppServices.ServicioCatalogoProducto.EliminarClasificacion(
|
||||
cveClasificacion,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
if (!resultado.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -278,43 +278,43 @@ namespace SIG.Web.Pages.Catalogos
|
||||
NombreClasificacionBitacoraActual = string.Empty;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
CargarBitacora();
|
||||
UpCatalogo.Update();
|
||||
Alert(
|
||||
"Clasificación eliminada correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
private void BindGrid()
|
||||
private void CargarGrid()
|
||||
{
|
||||
DbResult<List<ClasificacionModel>> result =
|
||||
AppServices.ProductoCatalogService.ListClasificaciones(
|
||||
TxtSearch.Text,
|
||||
ChkInactive.Checked,
|
||||
DbResult<List<ModeloClasificacion>> resultado =
|
||||
AppServices.ServicioCatalogoProducto.ListarClasificaciones(
|
||||
TxtBusqueda.Text,
|
||||
ChkInactivos.Checked,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
if (!resultado.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgError);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
||||
return;
|
||||
}
|
||||
|
||||
GvClasificaciones.DataSource =
|
||||
result.Data ?? new List<ClasificacionModel>();
|
||||
resultado.Data ?? new List<ModeloClasificacion>();
|
||||
GvClasificaciones.DataBind();
|
||||
}
|
||||
|
||||
private void BindBitacora()
|
||||
private void CargarBitacora()
|
||||
{
|
||||
bool hasClassification = CveClasificacionBitacoraActual > 0;
|
||||
bool tieneClasificacion = CveClasificacionBitacoraActual > 0;
|
||||
|
||||
UcBitacoraCatalogo.Descripcion = hasClassification
|
||||
UcBitacoraCatalogo.Descripcion = tieneClasificacion
|
||||
? "Historial de " + NombreClasificacionBitacoraActual
|
||||
: "Historial de clasificaciones";
|
||||
UcBitacoraCatalogo.AccionVisible = hasClassification;
|
||||
UcBitacoraCatalogo.AccionVisible = tieneClasificacion;
|
||||
UcBitacoraCatalogo.ConfigurarConsulta(
|
||||
new List<BitacoraCampoFiltroModel>
|
||||
{
|
||||
@@ -322,11 +322,11 @@ namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
NombreTablaSQL = "Clasificaciones",
|
||||
NombreCampoSQL = "CveClasificacion",
|
||||
Valor = hasClassification
|
||||
Valor = tieneClasificacion
|
||||
? CveClasificacionBitacoraActual.ToString(
|
||||
CultureInfo.InvariantCulture)
|
||||
: string.Empty,
|
||||
SoloExistencia = !hasClassification
|
||||
SoloExistencia = !tieneClasificacion
|
||||
}
|
||||
},
|
||||
new List<BitacoraRelacionMostrarModel>
|
||||
@@ -341,25 +341,25 @@ namespace SIG.Web.Pages.Catalogos
|
||||
UcBitacoraCatalogo.Consultar(true);
|
||||
}
|
||||
|
||||
private void SyncFilters()
|
||||
private void SincronizarFiltros()
|
||||
{
|
||||
var filters = new List<FiltroActivo>();
|
||||
var filtros = new List<FiltroActivo>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(TxtSearch.Text))
|
||||
if (!string.IsNullOrWhiteSpace(TxtBusqueda.Text))
|
||||
{
|
||||
filters.Add(
|
||||
filtros.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Texto",
|
||||
Titulo = "Búsqueda",
|
||||
Descripcion = TxtSearch.Text.Trim(),
|
||||
Descripcion = TxtBusqueda.Text.Trim(),
|
||||
Orden = 1
|
||||
});
|
||||
}
|
||||
|
||||
if (ChkInactive.Checked)
|
||||
if (ChkInactivos.Checked)
|
||||
{
|
||||
filters.Add(
|
||||
filtros.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Inactivos",
|
||||
@@ -369,34 +369,34 @@ namespace SIG.Web.Pages.Catalogos
|
||||
});
|
||||
}
|
||||
|
||||
UcFiltros.SetFiltros(filters);
|
||||
UcFiltros.SetFiltros(filtros);
|
||||
}
|
||||
|
||||
private static void RegisterAsyncControl(
|
||||
ScriptManager scriptManager,
|
||||
GridViewRow row,
|
||||
string controlId)
|
||||
private static void RegistrarControlAsincrono(
|
||||
ScriptManager administradorScripts,
|
||||
GridViewRow fila,
|
||||
string identificadorControl)
|
||||
{
|
||||
Control control = row.FindControl(controlId);
|
||||
Control control = fila.FindControl(identificadorControl);
|
||||
|
||||
if (control != null)
|
||||
{
|
||||
scriptManager.RegisterAsyncPostBackControl(control);
|
||||
administradorScripts.RegisterAsyncPostBackControl(control);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowModal(string id)
|
||||
private void MostrarModal(string identificador)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.show('" + id + "');",
|
||||
"Show_" + id);
|
||||
"window.SIGTramiteCatalog.show('" + identificador + "');",
|
||||
"Mostrar_" + identificador);
|
||||
}
|
||||
|
||||
private void HideModal(string id)
|
||||
private void OcultarModal(string identificador)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.hide('" + id + "');",
|
||||
"Hide_" + id);
|
||||
"window.SIGTramiteCatalog.hide('" + identificador + "');",
|
||||
"Ocultar_" + identificador);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,22 +2,22 @@ namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
public partial class Clasificaciones
|
||||
{
|
||||
protected global::System.Web.UI.UpdatePanel UpActions;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNew;
|
||||
protected global::System.Web.UI.UpdatePanel UpCatalog;
|
||||
protected global::System.Web.UI.UpdatePanel UpAcciones;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNuevo;
|
||||
protected global::System.Web.UI.UpdatePanel UpCatalogo;
|
||||
protected global::SIG.Web.AppCode.SigControls.Filtros UcFiltros;
|
||||
protected global::System.Web.UI.WebControls.GridView GvClasificaciones;
|
||||
protected global::System.Web.UI.UpdatePanel UpFilters;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtSearch;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkInactive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnApplyFilters;
|
||||
protected global::System.Web.UI.UpdatePanel UpEdit;
|
||||
protected global::System.Web.UI.WebControls.Literal LitModalTitle;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtCode;
|
||||
protected global::System.Web.UI.UpdatePanel UpFiltros;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtBusqueda;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkInactivos;
|
||||
protected global::System.Web.UI.WebControls.Button BtnAplicarFiltros;
|
||||
protected global::System.Web.UI.UpdatePanel UpEdicion;
|
||||
protected global::System.Web.UI.WebControls.Literal LitTituloModal;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtCodigo;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtClassification;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkAffectable;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkActive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSave;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkActivo;
|
||||
protected global::System.Web.UI.WebControls.Button BtnGuardar;
|
||||
protected global::SIG.Web.AppCode.SigControls.BitacoraGrid
|
||||
UcBitacoraCatalogo;
|
||||
}
|
||||
|
||||
@@ -5,36 +5,36 @@
|
||||
CodeFile="ProductosServicios.aspx.cs"
|
||||
Inherits="SIG.Web.Pages.Catalogos.ProductosServicios" %>
|
||||
|
||||
<asp:Content ID="ContentHead" ContentPlaceHolderID="H" runat="server">
|
||||
<asp:Content ID="ContenidoEncabezado" ContentPlaceHolderID="H" runat="server">
|
||||
<link href='<%= ResolveUrl("~/Styles/CatalogosTramites.css") %>'
|
||||
rel="stylesheet"
|
||||
type="text/css" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentActions" ContentPlaceHolderID="A" runat="server">
|
||||
<asp:UpdatePanel ID="UpActions"
|
||||
<asp:Content ID="ContenidoAcciones" ContentPlaceHolderID="A" runat="server">
|
||||
<asp:UpdatePanel ID="UpAcciones"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="BtnNew"
|
||||
<asp:LinkButton ID="BtnNuevo"
|
||||
runat="server"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnNew_Click">
|
||||
OnClick="BtnNuevo_Click">
|
||||
<i class="fa fa-plus"></i>
|
||||
Nuevo producto o servicio
|
||||
</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnNew" EventName="Click" />
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnNuevo" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentMain" ContentPlaceHolderID="C" runat="server">
|
||||
<asp:UpdatePanel ID="UpCatalog"
|
||||
<asp:Content ID="ContenidoPrincipal" ContentPlaceHolderID="C" runat="server">
|
||||
<asp:UpdatePanel ID="UpCatalogo"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
@@ -68,7 +68,7 @@
|
||||
<asp:CheckBoxField DataField="EsActivo" HeaderText="Activo" />
|
||||
<asp:TemplateField HeaderText="Acciones">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnViewAudit"
|
||||
<asp:LinkButton ID="BtnVerBitacora"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm default"
|
||||
CommandName="VerBitacora"
|
||||
@@ -78,7 +78,7 @@
|
||||
aria-label="Ver bitácora">
|
||||
<i class="fa fa-history" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnEdit"
|
||||
<asp:LinkButton ID="BtnEditar"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm blue"
|
||||
CommandName="Editar"
|
||||
@@ -88,7 +88,7 @@
|
||||
aria-label="Editar producto o servicio">
|
||||
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnDelete"
|
||||
<asp:LinkButton ID="BtnEliminar"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm red"
|
||||
CommandName="Eliminar"
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
<div id="ModalFilters" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpFilters"
|
||||
<asp:UpdatePanel ID="UpFiltros"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
@@ -132,15 +132,15 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtSearch.ClientID %>">
|
||||
<label for="<%= TxtBusqueda.ClientID %>">
|
||||
Código o descripción
|
||||
</label>
|
||||
<asp:TextBox ID="TxtSearch"
|
||||
<asp:TextBox ID="TxtBusqueda"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="200" />
|
||||
</div>
|
||||
<asp:CheckBox ID="ChkInactive"
|
||||
<asp:CheckBox ID="ChkInactivos"
|
||||
runat="server"
|
||||
Text=" Incluir inactivos" />
|
||||
</div>
|
||||
@@ -150,16 +150,16 @@
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnApplyFilters"
|
||||
<asp:Button ID="BtnAplicarFiltros"
|
||||
runat="server"
|
||||
CssClass="btn blue"
|
||||
Text="Aplicar filtros"
|
||||
OnClick="BtnApplyFilters_Click" />
|
||||
OnClick="BtnAplicarFiltros_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnApplyFilters"
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnAplicarFiltros"
|
||||
EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
@@ -168,7 +168,7 @@
|
||||
|
||||
<div id="ModalEdit" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpEdit"
|
||||
<asp:UpdatePanel ID="UpEdicion"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
@@ -182,17 +182,17 @@
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Literal ID="LitModalTitle" runat="server" />
|
||||
<asp:Literal ID="LitTituloModal" runat="server" />
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtCode.ClientID %>">
|
||||
<label for="<%= TxtCodigo.ClientID %>">
|
||||
Código
|
||||
</label>
|
||||
<asp:TextBox ID="TxtCode"
|
||||
<asp:TextBox ID="TxtCodigo"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="50" />
|
||||
@@ -200,10 +200,10 @@
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= DdlType.ClientID %>">
|
||||
<label for="<%= DdlTipo.ClientID %>">
|
||||
Tipo *
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlType"
|
||||
<asp:DropDownList ID="DdlTipo"
|
||||
runat="server"
|
||||
CssClass="form-control input-sm select2me">
|
||||
<asp:ListItem Text="Seleccione" Value="" />
|
||||
@@ -215,10 +215,10 @@
|
||||
</div>
|
||||
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtDescription.ClientID %>">
|
||||
<label for="<%= TxtDescripcion.ClientID %>">
|
||||
Descripción *
|
||||
</label>
|
||||
<asp:TextBox ID="TxtDescription"
|
||||
<asp:TextBox ID="TxtDescripcion"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="846"
|
||||
@@ -229,10 +229,10 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= DdlClassification.ClientID %>">
|
||||
<label for="<%= DdlClasificacion.ClientID %>">
|
||||
Clasificación *
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlClassification"
|
||||
<asp:DropDownList ID="DdlClasificacion"
|
||||
runat="server"
|
||||
CssClass="form-control input-sm select2me"
|
||||
DataTextField="Clasificacion"
|
||||
@@ -241,10 +241,10 @@
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= DdlMeasurementUnit.ClientID %>">
|
||||
<label for="<%= DdlUnidadMedida.ClientID %>">
|
||||
Unidad de medida *
|
||||
</label>
|
||||
<asp:DropDownList ID="DdlMeasurementUnit"
|
||||
<asp:DropDownList ID="DdlUnidadMedida"
|
||||
runat="server"
|
||||
CssClass="form-control input-sm select2me"
|
||||
DataTextField="UnidadMedida"
|
||||
@@ -256,10 +256,10 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtPrice.ClientID %>">
|
||||
<label for="<%= TxtPrecio.ClientID %>">
|
||||
Precio *
|
||||
</label>
|
||||
<asp:TextBox ID="TxtPrice"
|
||||
<asp:TextBox ID="TxtPrecio"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="20" />
|
||||
@@ -269,7 +269,7 @@
|
||||
<div class="tra-modal-field">
|
||||
<label>Estado</label>
|
||||
<div>
|
||||
<asp:CheckBox ID="ChkActive"
|
||||
<asp:CheckBox ID="ChkActivo"
|
||||
runat="server"
|
||||
Text=" Activo" />
|
||||
</div>
|
||||
@@ -283,16 +283,16 @@
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnSave"
|
||||
<asp:Button ID="BtnGuardar"
|
||||
runat="server"
|
||||
CssClass="btn green"
|
||||
Text="Guardar"
|
||||
OnClick="BtnSave_Click" />
|
||||
OnClick="BtnGuardar_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnSave" EventName="Click" />
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnGuardar" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
@@ -308,7 +308,7 @@
|
||||
OnAccionClick="UcBitacoraCatalogo_AccionClick" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<asp:Content ID="ContenidoScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<script src='<%= ResolveUrl("~/Scripts/CatalogosTramites.js") %>'
|
||||
type="text/javascript"></script>
|
||||
</asp:Content>
|
||||
|
||||
@@ -57,244 +57,244 @@ namespace SIG.Web.Pages.Catalogos
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
protected void Page_Load(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
if (IsPostBack)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
BindBitacora();
|
||||
SyncFilters();
|
||||
CargarGrid();
|
||||
CargarBitacora();
|
||||
SincronizarFiltros();
|
||||
}
|
||||
|
||||
protected void UcFiltros_MostrarFiltros(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
ShowModal("ModalFilters");
|
||||
MostrarModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void UcFiltros_Consultar(object sender, EventArgs e)
|
||||
protected void UcFiltros_Consultar(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
}
|
||||
|
||||
protected void UcFiltros_FiltrosChanged(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
List<string> names = UcFiltros.GetFiltros()
|
||||
.Select(item => item.Nombre)
|
||||
List<string> nombres = UcFiltros.GetFiltros()
|
||||
.Select(elemento => elemento.Nombre)
|
||||
.ToList();
|
||||
|
||||
if (!names.Contains("Texto"))
|
||||
if (!nombres.Contains("Texto"))
|
||||
{
|
||||
TxtSearch.Text = string.Empty;
|
||||
TxtBusqueda.Text = string.Empty;
|
||||
}
|
||||
|
||||
if (!names.Contains("Inactivos"))
|
||||
if (!nombres.Contains("Inactivos"))
|
||||
{
|
||||
ChkInactive.Checked = false;
|
||||
ChkInactivos.Checked = false;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
}
|
||||
|
||||
protected void BtnApplyFilters_Click(object sender, EventArgs e)
|
||||
protected void BtnAplicarFiltros_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalFilters");
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
UpCatalogo.Update();
|
||||
OcultarModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void BtnNew_Click(object sender, EventArgs e)
|
||||
protected void BtnNuevo_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
CveProductoServicioActual = 0;
|
||||
|
||||
if (!BindOptions(null, null))
|
||||
if (!CargarOpciones(null, null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LitModalTitle.Text = "Nuevo producto o servicio";
|
||||
TxtCode.Text = string.Empty;
|
||||
TxtDescription.Text = string.Empty;
|
||||
DdlType.SelectedValue = string.Empty;
|
||||
TxtPrice.Text = "0.00";
|
||||
ChkActive.Checked = true;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
LitTituloModal.Text = "Nuevo producto o servicio";
|
||||
TxtCodigo.Text = string.Empty;
|
||||
TxtDescripcion.Text = string.Empty;
|
||||
DdlTipo.SelectedValue = string.Empty;
|
||||
TxtPrecio.Text = "0.00";
|
||||
ChkActivo.Checked = true;
|
||||
UpEdicion.Update();
|
||||
MostrarModal("ModalEdit");
|
||||
}
|
||||
|
||||
protected void GvProductosServicios_RowDataBound(
|
||||
object sender,
|
||||
GridViewRowEventArgs e)
|
||||
object origenEvento,
|
||||
GridViewRowEventArgs argumentos)
|
||||
{
|
||||
if (e.Row.RowType != DataControlRowType.DataRow)
|
||||
if (argumentos.Row.RowType != DataControlRowType.DataRow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
|
||||
ScriptManager administradorScripts = ScriptManager.GetCurrent(Page);
|
||||
|
||||
if (scriptManager == null)
|
||||
if (administradorScripts == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LinkButton auditButton = e.Row.FindControl("BtnViewAudit")
|
||||
LinkButton botonBitacora = argumentos.Row.FindControl("BtnVerBitacora")
|
||||
as LinkButton;
|
||||
LinkButton editButton = e.Row.FindControl("BtnEdit")
|
||||
LinkButton botonEditar = argumentos.Row.FindControl("BtnEditar")
|
||||
as LinkButton;
|
||||
LinkButton deleteButton = e.Row.FindControl("BtnDelete")
|
||||
LinkButton botonEliminar = argumentos.Row.FindControl("BtnEliminar")
|
||||
as LinkButton;
|
||||
|
||||
if (auditButton != null)
|
||||
if (botonBitacora != null)
|
||||
{
|
||||
scriptManager.RegisterAsyncPostBackControl(auditButton);
|
||||
administradorScripts.RegisterAsyncPostBackControl(botonBitacora);
|
||||
}
|
||||
|
||||
if (editButton != null)
|
||||
if (botonEditar != null)
|
||||
{
|
||||
scriptManager.RegisterAsyncPostBackControl(editButton);
|
||||
administradorScripts.RegisterAsyncPostBackControl(botonEditar);
|
||||
}
|
||||
|
||||
if (deleteButton != null)
|
||||
if (botonEliminar != null)
|
||||
{
|
||||
scriptManager.RegisterAsyncPostBackControl(deleteButton);
|
||||
administradorScripts.RegisterAsyncPostBackControl(botonEliminar);
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvProductosServicios_RowCommand(
|
||||
object sender,
|
||||
GridViewCommandEventArgs e)
|
||||
object origenEvento,
|
||||
GridViewCommandEventArgs argumentos)
|
||||
{
|
||||
int cvePS;
|
||||
|
||||
if (!int.TryParse(Convert.ToString(e.CommandArgument), out cvePS))
|
||||
if (!int.TryParse(Convert.ToString(argumentos.CommandArgument), out cvePS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.Equals(
|
||||
e.CommandName,
|
||||
argumentos.CommandName,
|
||||
"Editar",
|
||||
StringComparison.Ordinal))
|
||||
{
|
||||
LoadEdit(cvePS);
|
||||
CargarEdicion(cvePS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.Equals(
|
||||
e.CommandName,
|
||||
argumentos.CommandName,
|
||||
"VerBitacora",
|
||||
StringComparison.Ordinal))
|
||||
{
|
||||
SelectBitacora(cvePS);
|
||||
SeleccionarBitacora(cvePS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.Equals(
|
||||
e.CommandName,
|
||||
argumentos.CommandName,
|
||||
"Eliminar",
|
||||
StringComparison.Ordinal))
|
||||
{
|
||||
Delete(cvePS);
|
||||
Eliminar(cvePS);
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnSave_Click(object sender, EventArgs e)
|
||||
protected void BtnGuardar_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
decimal price;
|
||||
decimal precio;
|
||||
|
||||
if (!TryParsePrice(TxtPrice.Text, out price))
|
||||
if (!IntentarObtenerPrecio(TxtPrecio.Text, out precio))
|
||||
{
|
||||
Alert(
|
||||
"Capture un precio válido.",
|
||||
TipoMensaje.MsgAdvertencia);
|
||||
ShowModal("ModalEdit");
|
||||
MostrarModal("ModalEdit");
|
||||
return;
|
||||
}
|
||||
|
||||
int type;
|
||||
int classification;
|
||||
int measurementUnit;
|
||||
int tipo;
|
||||
int clasificacion;
|
||||
int unidadMedida;
|
||||
|
||||
int.TryParse(DdlType.SelectedValue, out type);
|
||||
int.TryParse(DdlClassification.SelectedValue, out classification);
|
||||
int.TryParse(DdlTipo.SelectedValue, out tipo);
|
||||
int.TryParse(DdlClasificacion.SelectedValue, out clasificacion);
|
||||
int.TryParse(
|
||||
DdlMeasurementUnit.SelectedValue,
|
||||
out measurementUnit);
|
||||
DdlUnidadMedida.SelectedValue,
|
||||
out unidadMedida);
|
||||
|
||||
var productoServicio = new ProductoServicioModel
|
||||
var productoServicio = new ModeloProductoServicio
|
||||
{
|
||||
CvePS = CveProductoServicioActual,
|
||||
Codigo = TxtCode.Text,
|
||||
PS = TxtDescription.Text,
|
||||
CveTipoPS = type,
|
||||
CveClasificacion = classification,
|
||||
CveUnidadMedida = measurementUnit,
|
||||
Precio = price,
|
||||
EsActivo = ChkActive.Checked
|
||||
Codigo = TxtCodigo.Text,
|
||||
PS = TxtDescripcion.Text,
|
||||
CveTipoPS = tipo,
|
||||
CveClasificacion = clasificacion,
|
||||
CveUnidadMedida = unidadMedida,
|
||||
Precio = precio,
|
||||
EsActivo = ChkActivo.Checked
|
||||
};
|
||||
|
||||
DbResult<int> result = AppServices.ProductoServicioService.Save(
|
||||
DbResult<int> resultado = AppServices.ServicioProductoServicio.Guardar(
|
||||
productoServicio,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
if (!resultado.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
ShowModal("ModalEdit");
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
MostrarModal("ModalEdit");
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalEdit");
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
CargarBitacora();
|
||||
UpCatalogo.Update();
|
||||
OcultarModal("ModalEdit");
|
||||
Alert(
|
||||
"Producto o servicio guardado correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
protected void UcBitacoraCatalogo_AccionClick(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
CveProductoServicioBitacoraActual = 0;
|
||||
NombreProductoServicioBitacoraActual = string.Empty;
|
||||
BindBitacora();
|
||||
CargarBitacora();
|
||||
}
|
||||
|
||||
private void LoadEdit(int cvePS)
|
||||
private void CargarEdicion(int cvePS)
|
||||
{
|
||||
DbResult<ProductoServicioModel> result =
|
||||
AppServices.ProductoServicioService.Get(
|
||||
DbResult<ModeloProductoServicio> resultado =
|
||||
AppServices.ServicioProductoServicio.Obtener(
|
||||
cvePS,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
if (!resultado.Success || resultado.Data == null)
|
||||
{
|
||||
Alert(
|
||||
string.IsNullOrWhiteSpace(result.UserMessage)
|
||||
string.IsNullOrWhiteSpace(resultado.UserMessage)
|
||||
? "No fue posible consultar el producto o servicio."
|
||||
: result.UserMessage,
|
||||
: resultado.UserMessage,
|
||||
TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
ProductoServicioModel productoServicio = result.Data;
|
||||
ModeloProductoServicio productoServicio = resultado.Data;
|
||||
|
||||
if (!BindOptions(
|
||||
if (!CargarOpciones(
|
||||
productoServicio.CveClasificacion,
|
||||
productoServicio.CveUnidadMedida))
|
||||
{
|
||||
@@ -302,93 +302,93 @@ namespace SIG.Web.Pages.Catalogos
|
||||
}
|
||||
|
||||
CveProductoServicioActual = productoServicio.CvePS;
|
||||
LitModalTitle.Text = "Editar producto o servicio";
|
||||
TxtCode.Text = productoServicio.Codigo;
|
||||
TxtDescription.Text = productoServicio.PS;
|
||||
SelectValue(
|
||||
DdlType,
|
||||
LitTituloModal.Text = "Editar producto o servicio";
|
||||
TxtCodigo.Text = productoServicio.Codigo;
|
||||
TxtDescripcion.Text = productoServicio.PS;
|
||||
SeleccionarValor(
|
||||
DdlTipo,
|
||||
productoServicio.CveTipoPS.ToString(
|
||||
CultureInfo.InvariantCulture));
|
||||
SelectValue(
|
||||
DdlClassification,
|
||||
SeleccionarValor(
|
||||
DdlClasificacion,
|
||||
productoServicio.CveClasificacion.ToString(
|
||||
CultureInfo.InvariantCulture));
|
||||
SelectValue(
|
||||
DdlMeasurementUnit,
|
||||
SeleccionarValor(
|
||||
DdlUnidadMedida,
|
||||
productoServicio.CveUnidadMedida.ToString(
|
||||
CultureInfo.InvariantCulture));
|
||||
TxtPrice.Text = productoServicio.Precio.ToString(
|
||||
TxtPrecio.Text = productoServicio.Precio.ToString(
|
||||
"0.00",
|
||||
CultureInfo.CurrentCulture);
|
||||
ChkActive.Checked = productoServicio.EsActivo;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
ChkActivo.Checked = productoServicio.EsActivo;
|
||||
UpEdicion.Update();
|
||||
MostrarModal("ModalEdit");
|
||||
}
|
||||
|
||||
private bool BindOptions(
|
||||
private bool CargarOpciones(
|
||||
int? cveClasificacionActual,
|
||||
int? cveUnidadMedidaActual)
|
||||
{
|
||||
DbResult<ProductoServicioOpcionesModel> result =
|
||||
AppServices.ProductoServicioService.ListOptions(
|
||||
DbResult<ModeloOpcionesProductoServicio> resultado =
|
||||
AppServices.ServicioProductoServicio.ListarOpciones(
|
||||
cveClasificacionActual,
|
||||
cveUnidadMedidaActual,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
if (!resultado.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgError);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
||||
return false;
|
||||
}
|
||||
|
||||
ProductoServicioOpcionesModel options = result.Data ??
|
||||
new ProductoServicioOpcionesModel();
|
||||
ModeloOpcionesProductoServicio opciones = resultado.Data ??
|
||||
new ModeloOpcionesProductoServicio();
|
||||
|
||||
DdlClassification.DataSource = options.Clasificaciones;
|
||||
DdlClassification.DataBind();
|
||||
DdlClassification.Items.Insert(
|
||||
DdlClasificacion.DataSource = opciones.Clasificaciones;
|
||||
DdlClasificacion.DataBind();
|
||||
DdlClasificacion.Items.Insert(
|
||||
0,
|
||||
new ListItem("Seleccione", string.Empty));
|
||||
|
||||
DdlMeasurementUnit.DataSource = options.UnidadesMedida;
|
||||
DdlMeasurementUnit.DataBind();
|
||||
DdlMeasurementUnit.Items.Insert(
|
||||
DdlUnidadMedida.DataSource = opciones.UnidadesMedida;
|
||||
DdlUnidadMedida.DataBind();
|
||||
DdlUnidadMedida.Items.Insert(
|
||||
0,
|
||||
new ListItem("Seleccione", string.Empty));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SelectBitacora(int cvePS)
|
||||
private void SeleccionarBitacora(int cvePS)
|
||||
{
|
||||
DbResult<ProductoServicioModel> result =
|
||||
AppServices.ProductoServicioService.Get(
|
||||
DbResult<ModeloProductoServicio> resultado =
|
||||
AppServices.ServicioProductoServicio.Obtener(
|
||||
cvePS,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
if (!resultado.Success || resultado.Data == null)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
CveProductoServicioBitacoraActual = cvePS;
|
||||
NombreProductoServicioBitacoraActual = result.Data.PS;
|
||||
BindBitacora();
|
||||
NombreProductoServicioBitacoraActual = resultado.Data.PS;
|
||||
CargarBitacora();
|
||||
}
|
||||
|
||||
private void Delete(int cvePS)
|
||||
private void Eliminar(int cvePS)
|
||||
{
|
||||
DbResult<bool> result = AppServices.ProductoServicioService.Delete(
|
||||
DbResult<bool> resultado = AppServices.ServicioProductoServicio.Eliminar(
|
||||
cvePS,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
if (!resultado.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -398,46 +398,46 @@ namespace SIG.Web.Pages.Catalogos
|
||||
NombreProductoServicioBitacoraActual = string.Empty;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
CargarBitacora();
|
||||
UpCatalogo.Update();
|
||||
Alert(
|
||||
"Producto o servicio eliminado correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
private void BindGrid()
|
||||
private void CargarGrid()
|
||||
{
|
||||
DbResult<List<ProductoServicioModel>> result =
|
||||
AppServices.ProductoServicioService.List(
|
||||
TxtSearch.Text,
|
||||
ChkInactive.Checked,
|
||||
DbResult<List<ModeloProductoServicio>> resultado =
|
||||
AppServices.ServicioProductoServicio.Listar(
|
||||
TxtBusqueda.Text,
|
||||
ChkInactivos.Checked,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
if (!resultado.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgError);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
||||
return;
|
||||
}
|
||||
|
||||
GvProductosServicios.DataSource =
|
||||
result.Data ?? new List<ProductoServicioModel>();
|
||||
resultado.Data ?? new List<ModeloProductoServicio>();
|
||||
GvProductosServicios.DataBind();
|
||||
}
|
||||
|
||||
private void BindBitacora()
|
||||
private void CargarBitacora()
|
||||
{
|
||||
bool hasProduct = CveProductoServicioBitacoraActual > 0;
|
||||
bool tieneProducto = CveProductoServicioBitacoraActual > 0;
|
||||
|
||||
UcBitacoraCatalogo.Descripcion = hasProduct &&
|
||||
UcBitacoraCatalogo.Descripcion = tieneProducto &&
|
||||
!string.IsNullOrWhiteSpace(
|
||||
NombreProductoServicioBitacoraActual)
|
||||
? "Historial de " +
|
||||
NombreProductoServicioBitacoraActual
|
||||
: "Historial de productos y servicios";
|
||||
UcBitacoraCatalogo.AccionVisible = hasProduct;
|
||||
UcBitacoraCatalogo.AccionVisible = tieneProducto;
|
||||
|
||||
UcBitacoraCatalogo.ConfigurarConsulta(
|
||||
new List<BitacoraCampoFiltroModel>
|
||||
@@ -446,11 +446,11 @@ namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
NombreTablaSQL = "ProductosServicios",
|
||||
NombreCampoSQL = "CvePS",
|
||||
Valor = hasProduct
|
||||
Valor = tieneProducto
|
||||
? CveProductoServicioBitacoraActual.ToString(
|
||||
CultureInfo.InvariantCulture)
|
||||
: string.Empty,
|
||||
SoloExistencia = !hasProduct
|
||||
SoloExistencia = !tieneProducto
|
||||
}
|
||||
},
|
||||
new List<BitacoraRelacionMostrarModel>
|
||||
@@ -466,25 +466,25 @@ namespace SIG.Web.Pages.Catalogos
|
||||
UcBitacoraCatalogo.Consultar(true);
|
||||
}
|
||||
|
||||
private void SyncFilters()
|
||||
private void SincronizarFiltros()
|
||||
{
|
||||
var filters = new List<FiltroActivo>();
|
||||
var filtros = new List<FiltroActivo>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(TxtSearch.Text))
|
||||
if (!string.IsNullOrWhiteSpace(TxtBusqueda.Text))
|
||||
{
|
||||
filters.Add(
|
||||
filtros.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Texto",
|
||||
Titulo = "Búsqueda",
|
||||
Descripcion = TxtSearch.Text.Trim(),
|
||||
Descripcion = TxtBusqueda.Text.Trim(),
|
||||
Orden = 1
|
||||
});
|
||||
}
|
||||
|
||||
if (ChkInactive.Checked)
|
||||
if (ChkInactivos.Checked)
|
||||
{
|
||||
filters.Add(
|
||||
filtros.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Inactivos",
|
||||
@@ -494,48 +494,48 @@ namespace SIG.Web.Pages.Catalogos
|
||||
});
|
||||
}
|
||||
|
||||
UcFiltros.SetFiltros(filters);
|
||||
UcFiltros.SetFiltros(filtros);
|
||||
}
|
||||
|
||||
private static bool TryParsePrice(string value, out decimal price)
|
||||
private static bool IntentarObtenerPrecio(string valor, out decimal precio)
|
||||
{
|
||||
return decimal.TryParse(
|
||||
value,
|
||||
valor,
|
||||
NumberStyles.Number,
|
||||
CultureInfo.CurrentCulture,
|
||||
out price) ||
|
||||
out precio) ||
|
||||
decimal.TryParse(
|
||||
value,
|
||||
valor,
|
||||
NumberStyles.Number,
|
||||
CultureInfo.InvariantCulture,
|
||||
out price);
|
||||
out precio);
|
||||
}
|
||||
|
||||
private static void SelectValue(
|
||||
private static void SeleccionarValor(
|
||||
ListControl control,
|
||||
string value)
|
||||
string valor)
|
||||
{
|
||||
ListItem item = control.Items.FindByValue(value);
|
||||
ListItem elemento = control.Items.FindByValue(valor);
|
||||
|
||||
if (item != null)
|
||||
if (elemento != null)
|
||||
{
|
||||
control.ClearSelection();
|
||||
item.Selected = true;
|
||||
elemento.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowModal(string id)
|
||||
private void MostrarModal(string identificador)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.show('" + id + "');",
|
||||
"Show_" + id);
|
||||
"window.SIGTramiteCatalog.show('" + identificador + "');",
|
||||
"Mostrar_" + identificador);
|
||||
}
|
||||
|
||||
private void HideModal(string id)
|
||||
private void OcultarModal(string identificador)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.hide('" + id + "');",
|
||||
"Hide_" + id);
|
||||
"window.SIGTramiteCatalog.hide('" + identificador + "');",
|
||||
"Ocultar_" + identificador);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,14 +71,14 @@ namespace SIG.Web.Pages.Catalogos
|
||||
set { ViewState["CveProductoPrecioActual"] = value; }
|
||||
}
|
||||
|
||||
private List<ProductoServicioTramiteModel>
|
||||
private List<ModeloProductoServicioTramite>
|
||||
ProductosServiciosDisponibles
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["ProductosServiciosDisponibles"]
|
||||
as List<ProductoServicioTramiteModel>
|
||||
?? new List<ProductoServicioTramiteModel>();
|
||||
as List<ModeloProductoServicioTramite>
|
||||
?? new List<ModeloProductoServicioTramite>();
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -804,7 +804,7 @@ namespace SIG.Web.Pages.Catalogos
|
||||
return;
|
||||
}
|
||||
|
||||
ProductoServicioTramiteModel productoServicio =
|
||||
ModeloProductoServicioTramite productoServicio =
|
||||
ProductosServiciosDisponibles.FirstOrDefault(
|
||||
producto =>
|
||||
producto.CvePS == cveProductoServicio);
|
||||
@@ -951,7 +951,7 @@ namespace SIG.Web.Pages.Catalogos
|
||||
|
||||
private void BindProducts()
|
||||
{
|
||||
DbResult<List<ProductoServicioTramiteModel>> result =
|
||||
DbResult<List<ModeloProductoServicioTramite>> result =
|
||||
AppServices.TramiteCatalogService.ListProductosServicios(
|
||||
null,
|
||||
true,
|
||||
@@ -964,8 +964,8 @@ namespace SIG.Web.Pages.Catalogos
|
||||
return;
|
||||
}
|
||||
|
||||
List<ProductoServicioTramiteModel> productos =
|
||||
result.Data ?? new List<ProductoServicioTramiteModel>();
|
||||
List<ModeloProductoServicioTramite> productos =
|
||||
result.Data ?? new List<ModeloProductoServicioTramite>();
|
||||
ProductosServiciosDisponibles = productos;
|
||||
|
||||
BindDropDown(
|
||||
@@ -978,8 +978,8 @@ namespace SIG.Web.Pages.Catalogos
|
||||
|
||||
private void CargarUnidadesMedida()
|
||||
{
|
||||
DbResult<List<UnidadMedidaModel>> result =
|
||||
AppServices.ProductoCatalogService.ListUnidadesMedida(
|
||||
DbResult<List<ModeloUnidadMedida>> result =
|
||||
AppServices.ServicioCatalogoProducto.ListarUnidadesMedida(
|
||||
null,
|
||||
true,
|
||||
CurrentUser.CveUsuario,
|
||||
@@ -995,8 +995,8 @@ namespace SIG.Web.Pages.Catalogos
|
||||
DdlUnidadMedidaDetallePago.Items.Add(
|
||||
new ListItem("Seleccione una unidad de medida", string.Empty));
|
||||
|
||||
foreach (UnidadMedidaModel unidadMedida in
|
||||
result.Data ?? new List<UnidadMedidaModel>())
|
||||
foreach (ModeloUnidadMedida unidadMedida in
|
||||
result.Data ?? new List<ModeloUnidadMedida>())
|
||||
{
|
||||
string textoUnidadMedida =
|
||||
string.IsNullOrWhiteSpace(unidadMedida.Abreviatura)
|
||||
@@ -1469,7 +1469,7 @@ namespace SIG.Web.Pages.Catalogos
|
||||
return;
|
||||
}
|
||||
|
||||
DbResult<ProductoServicioTramiteModel> productResult =
|
||||
DbResult<ModeloProductoServicioTramite> productResult =
|
||||
AppServices.TramiteCatalogService.GetProductoServicio(
|
||||
detailResult.Data.CvePS,
|
||||
CurrentUser.CveUsuario,
|
||||
|
||||
@@ -5,36 +5,36 @@
|
||||
CodeFile="UnidadesMedida.aspx.cs"
|
||||
Inherits="SIG.Web.Pages.Catalogos.UnidadesMedida" %>
|
||||
|
||||
<asp:Content ID="ContentHead" ContentPlaceHolderID="H" runat="server">
|
||||
<asp:Content ID="ContenidoEncabezado" ContentPlaceHolderID="H" runat="server">
|
||||
<link href='<%= ResolveUrl("~/Styles/CatalogosTramites.css") %>'
|
||||
rel="stylesheet"
|
||||
type="text/css" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentActions" ContentPlaceHolderID="A" runat="server">
|
||||
<asp:UpdatePanel ID="UpActions"
|
||||
<asp:Content ID="ContenidoAcciones" ContentPlaceHolderID="A" runat="server">
|
||||
<asp:UpdatePanel ID="UpAcciones"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="BtnNew"
|
||||
<asp:LinkButton ID="BtnNuevo"
|
||||
runat="server"
|
||||
CausesValidation="false"
|
||||
OnClick="BtnNew_Click">
|
||||
OnClick="BtnNuevo_Click">
|
||||
<i class="fa fa-plus"></i>
|
||||
Nueva unidad de medida
|
||||
</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnNew" EventName="Click" />
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnNuevo" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentMain" ContentPlaceHolderID="C" runat="server">
|
||||
<asp:UpdatePanel ID="UpCatalog"
|
||||
<asp:Content ID="ContenidoPrincipal" ContentPlaceHolderID="C" runat="server">
|
||||
<asp:UpdatePanel ID="UpCatalogo"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
@@ -61,7 +61,7 @@
|
||||
<asp:CheckBoxField DataField="EsActivo" HeaderText="Activo" />
|
||||
<asp:TemplateField HeaderText="Acciones">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnViewAudit"
|
||||
<asp:LinkButton ID="BtnVerBitacora"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm default"
|
||||
CommandName="VerBitacora"
|
||||
@@ -71,7 +71,7 @@
|
||||
aria-label="Ver bitácora">
|
||||
<i class="fa fa-history" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnEdit"
|
||||
<asp:LinkButton ID="BtnEditar"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm blue"
|
||||
CommandName="Editar"
|
||||
@@ -81,7 +81,7 @@
|
||||
aria-label="Editar unidad de medida">
|
||||
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
<asp:LinkButton ID="BtnDelete"
|
||||
<asp:LinkButton ID="BtnEliminar"
|
||||
runat="server"
|
||||
CssClass="btn btn-circle btn-sm red"
|
||||
CommandName="Eliminar"
|
||||
@@ -108,7 +108,7 @@
|
||||
|
||||
<div id="ModalFilters" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpFilters"
|
||||
<asp:UpdatePanel ID="UpFiltros"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
@@ -125,15 +125,15 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtSearch.ClientID %>">
|
||||
<label for="<%= TxtBusqueda.ClientID %>">
|
||||
Unidad o abreviatura
|
||||
</label>
|
||||
<asp:TextBox ID="TxtSearch"
|
||||
<asp:TextBox ID="TxtBusqueda"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="100" />
|
||||
</div>
|
||||
<asp:CheckBox ID="ChkInactive"
|
||||
<asp:CheckBox ID="ChkInactivos"
|
||||
runat="server"
|
||||
Text=" Incluir inactivas" />
|
||||
</div>
|
||||
@@ -143,16 +143,16 @@
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnApplyFilters"
|
||||
<asp:Button ID="BtnAplicarFiltros"
|
||||
runat="server"
|
||||
CssClass="btn blue"
|
||||
Text="Aplicar filtros"
|
||||
OnClick="BtnApplyFilters_Click" />
|
||||
OnClick="BtnAplicarFiltros_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnApplyFilters"
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnAplicarFiltros"
|
||||
EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
@@ -161,7 +161,7 @@
|
||||
|
||||
<div id="ModalEdit" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpEdit"
|
||||
<asp:UpdatePanel ID="UpEdicion"
|
||||
runat="server"
|
||||
UpdateMode="Conditional"
|
||||
ChildrenAsTriggers="false">
|
||||
@@ -175,29 +175,29 @@
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Literal ID="LitModalTitle" runat="server" />
|
||||
<asp:Literal ID="LitTituloModal" runat="server" />
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtMeasurementUnit.ClientID %>">
|
||||
<label for="<%= TxtUnidadMedida.ClientID %>">
|
||||
Unidad de medida *
|
||||
</label>
|
||||
<asp:TextBox ID="TxtMeasurementUnit"
|
||||
<asp:TextBox ID="TxtUnidadMedida"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="50" />
|
||||
</div>
|
||||
<div class="tra-modal-field">
|
||||
<label for="<%= TxtAbbreviation.ClientID %>">
|
||||
<label for="<%= TxtAbreviatura.ClientID %>">
|
||||
Abreviatura *
|
||||
</label>
|
||||
<asp:TextBox ID="TxtAbbreviation"
|
||||
<asp:TextBox ID="TxtAbreviatura"
|
||||
runat="server"
|
||||
CssClass="form-control"
|
||||
MaxLength="15" />
|
||||
</div>
|
||||
<asp:CheckBox ID="ChkActive"
|
||||
<asp:CheckBox ID="ChkActivo"
|
||||
runat="server"
|
||||
Text=" Activa" />
|
||||
</div>
|
||||
@@ -207,16 +207,16 @@
|
||||
data-dismiss="modal">
|
||||
Cancelar
|
||||
</button>
|
||||
<asp:Button ID="BtnSave"
|
||||
<asp:Button ID="BtnGuardar"
|
||||
runat="server"
|
||||
CssClass="btn green"
|
||||
Text="Guardar"
|
||||
OnClick="BtnSave_Click" />
|
||||
OnClick="BtnGuardar_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnSave" EventName="Click" />
|
||||
<asp:AsyncPostBackTrigger ControlID="BtnGuardar" EventName="Click" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
@@ -232,7 +232,7 @@
|
||||
OnAccionClick="UcBitacoraCatalogo_AccionClick" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<asp:Content ID="ContenidoScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<script src='<%= ResolveUrl("~/Scripts/CatalogosTramites.js") %>'
|
||||
type="text/javascript"></script>
|
||||
</asp:Content>
|
||||
|
||||
@@ -57,215 +57,215 @@ namespace SIG.Web.Pages.Catalogos
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
protected void Page_Load(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
if (IsPostBack)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
BindBitacora();
|
||||
SyncFilters();
|
||||
CargarGrid();
|
||||
CargarBitacora();
|
||||
SincronizarFiltros();
|
||||
}
|
||||
|
||||
protected void UcFiltros_MostrarFiltros(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
ShowModal("ModalFilters");
|
||||
MostrarModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void UcFiltros_Consultar(object sender, EventArgs e)
|
||||
protected void UcFiltros_Consultar(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
}
|
||||
|
||||
protected void UcFiltros_FiltrosChanged(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
List<string> names = UcFiltros.GetFiltros()
|
||||
.Select(item => item.Nombre)
|
||||
List<string> nombres = UcFiltros.GetFiltros()
|
||||
.Select(elemento => elemento.Nombre)
|
||||
.ToList();
|
||||
|
||||
if (!names.Contains("Texto"))
|
||||
if (!nombres.Contains("Texto"))
|
||||
{
|
||||
TxtSearch.Text = string.Empty;
|
||||
TxtBusqueda.Text = string.Empty;
|
||||
}
|
||||
|
||||
if (!names.Contains("Inactivos"))
|
||||
if (!nombres.Contains("Inactivos"))
|
||||
{
|
||||
ChkInactive.Checked = false;
|
||||
ChkInactivos.Checked = false;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
}
|
||||
|
||||
protected void BtnApplyFilters_Click(object sender, EventArgs e)
|
||||
protected void BtnAplicarFiltros_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalFilters");
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
UpCatalogo.Update();
|
||||
OcultarModal("ModalFilters");
|
||||
}
|
||||
|
||||
protected void BtnNew_Click(object sender, EventArgs e)
|
||||
protected void BtnNuevo_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
CveUnidadMedidaActual = 0;
|
||||
LitModalTitle.Text = "Nueva unidad de medida";
|
||||
TxtMeasurementUnit.Text = string.Empty;
|
||||
TxtAbbreviation.Text = string.Empty;
|
||||
ChkActive.Checked = true;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
LitTituloModal.Text = "Nueva unidad de medida";
|
||||
TxtUnidadMedida.Text = string.Empty;
|
||||
TxtAbreviatura.Text = string.Empty;
|
||||
ChkActivo.Checked = true;
|
||||
UpEdicion.Update();
|
||||
MostrarModal("ModalEdit");
|
||||
}
|
||||
|
||||
protected void GvUnidadesMedida_RowDataBound(
|
||||
object sender,
|
||||
GridViewRowEventArgs e)
|
||||
object origenEvento,
|
||||
GridViewRowEventArgs argumentos)
|
||||
{
|
||||
if (e.Row.RowType != DataControlRowType.DataRow)
|
||||
if (argumentos.Row.RowType != DataControlRowType.DataRow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
|
||||
ScriptManager administradorScripts = ScriptManager.GetCurrent(Page);
|
||||
|
||||
if (scriptManager == null)
|
||||
if (administradorScripts == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnViewAudit");
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnEdit");
|
||||
RegisterAsyncControl(scriptManager, e.Row, "BtnDelete");
|
||||
RegistrarControlAsincrono(administradorScripts, argumentos.Row, "BtnVerBitacora");
|
||||
RegistrarControlAsincrono(administradorScripts, argumentos.Row, "BtnEditar");
|
||||
RegistrarControlAsincrono(administradorScripts, argumentos.Row, "BtnEliminar");
|
||||
}
|
||||
|
||||
protected void GvUnidadesMedida_RowCommand(
|
||||
object sender,
|
||||
GridViewCommandEventArgs e)
|
||||
object origenEvento,
|
||||
GridViewCommandEventArgs argumentos)
|
||||
{
|
||||
int cveUnidadMedida;
|
||||
|
||||
if (!int.TryParse(
|
||||
Convert.ToString(e.CommandArgument),
|
||||
Convert.ToString(argumentos.CommandArgument),
|
||||
out cveUnidadMedida))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.CommandName == "Editar")
|
||||
if (argumentos.CommandName == "Editar")
|
||||
{
|
||||
LoadEdit(cveUnidadMedida);
|
||||
CargarEdicion(cveUnidadMedida);
|
||||
}
|
||||
else if (e.CommandName == "VerBitacora")
|
||||
else if (argumentos.CommandName == "VerBitacora")
|
||||
{
|
||||
SelectBitacora(cveUnidadMedida);
|
||||
SeleccionarBitacora(cveUnidadMedida);
|
||||
}
|
||||
else if (e.CommandName == "Eliminar")
|
||||
else if (argumentos.CommandName == "Eliminar")
|
||||
{
|
||||
Delete(cveUnidadMedida);
|
||||
Eliminar(cveUnidadMedida);
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnSave_Click(object sender, EventArgs e)
|
||||
protected void BtnGuardar_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
var unidadMedida = new UnidadMedidaModel
|
||||
var unidadMedida = new ModeloUnidadMedida
|
||||
{
|
||||
CveUnidadMedida = CveUnidadMedidaActual,
|
||||
UnidadMedida = TxtMeasurementUnit.Text,
|
||||
Abreviatura = TxtAbbreviation.Text,
|
||||
EsActivo = ChkActive.Checked
|
||||
UnidadMedida = TxtUnidadMedida.Text,
|
||||
Abreviatura = TxtAbreviatura.Text,
|
||||
EsActivo = ChkActivo.Checked
|
||||
};
|
||||
|
||||
DbResult<int> result =
|
||||
AppServices.ProductoCatalogService.SaveUnidadMedida(
|
||||
DbResult<int> resultado =
|
||||
AppServices.ServicioCatalogoProducto.GuardarUnidadMedida(
|
||||
unidadMedida,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
if (!resultado.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
ShowModal("ModalEdit");
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
MostrarModal("ModalEdit");
|
||||
return;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
HideModal("ModalEdit");
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
CargarBitacora();
|
||||
UpCatalogo.Update();
|
||||
OcultarModal("ModalEdit");
|
||||
Alert(
|
||||
"Unidad de medida guardada correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
protected void UcBitacoraCatalogo_AccionClick(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
CveUnidadMedidaBitacoraActual = 0;
|
||||
NombreUnidadMedidaBitacoraActual = string.Empty;
|
||||
BindBitacora();
|
||||
CargarBitacora();
|
||||
}
|
||||
|
||||
private void LoadEdit(int cveUnidadMedida)
|
||||
private void CargarEdicion(int cveUnidadMedida)
|
||||
{
|
||||
DbResult<UnidadMedidaModel> result =
|
||||
AppServices.ProductoCatalogService.GetUnidadMedida(
|
||||
DbResult<ModeloUnidadMedida> resultado =
|
||||
AppServices.ServicioCatalogoProducto.ObtenerUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
if (!resultado.Success || resultado.Data == null)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
CveUnidadMedidaActual = result.Data.CveUnidadMedida;
|
||||
LitModalTitle.Text = "Editar unidad de medida";
|
||||
TxtMeasurementUnit.Text = result.Data.UnidadMedida;
|
||||
TxtAbbreviation.Text = result.Data.Abreviatura;
|
||||
ChkActive.Checked = result.Data.EsActivo;
|
||||
UpEdit.Update();
|
||||
ShowModal("ModalEdit");
|
||||
CveUnidadMedidaActual = resultado.Data.CveUnidadMedida;
|
||||
LitTituloModal.Text = "Editar unidad de medida";
|
||||
TxtUnidadMedida.Text = resultado.Data.UnidadMedida;
|
||||
TxtAbreviatura.Text = resultado.Data.Abreviatura;
|
||||
ChkActivo.Checked = resultado.Data.EsActivo;
|
||||
UpEdicion.Update();
|
||||
MostrarModal("ModalEdit");
|
||||
}
|
||||
|
||||
private void SelectBitacora(int cveUnidadMedida)
|
||||
private void SeleccionarBitacora(int cveUnidadMedida)
|
||||
{
|
||||
DbResult<UnidadMedidaModel> result =
|
||||
AppServices.ProductoCatalogService.GetUnidadMedida(
|
||||
DbResult<ModeloUnidadMedida> resultado =
|
||||
AppServices.ServicioCatalogoProducto.ObtenerUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success || result.Data == null)
|
||||
if (!resultado.Success || resultado.Data == null)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
CveUnidadMedidaBitacoraActual = cveUnidadMedida;
|
||||
NombreUnidadMedidaBitacoraActual = result.Data.UnidadMedida;
|
||||
BindBitacora();
|
||||
NombreUnidadMedidaBitacoraActual = resultado.Data.UnidadMedida;
|
||||
CargarBitacora();
|
||||
}
|
||||
|
||||
private void Delete(int cveUnidadMedida)
|
||||
private void Eliminar(int cveUnidadMedida)
|
||||
{
|
||||
DbResult<bool> result =
|
||||
AppServices.ProductoCatalogService.DeleteUnidadMedida(
|
||||
DbResult<bool> resultado =
|
||||
AppServices.ServicioCatalogoProducto.EliminarUnidadMedida(
|
||||
cveUnidadMedida,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
if (!resultado.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -275,43 +275,43 @@ namespace SIG.Web.Pages.Catalogos
|
||||
NombreUnidadMedidaBitacoraActual = string.Empty;
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
SyncFilters();
|
||||
BindBitacora();
|
||||
UpCatalog.Update();
|
||||
CargarGrid();
|
||||
SincronizarFiltros();
|
||||
CargarBitacora();
|
||||
UpCatalogo.Update();
|
||||
Alert(
|
||||
"Unidad de medida eliminada correctamente.",
|
||||
TipoMensaje.ToastExito);
|
||||
}
|
||||
|
||||
private void BindGrid()
|
||||
private void CargarGrid()
|
||||
{
|
||||
DbResult<List<UnidadMedidaModel>> result =
|
||||
AppServices.ProductoCatalogService.ListUnidadesMedida(
|
||||
TxtSearch.Text,
|
||||
ChkInactive.Checked,
|
||||
DbResult<List<ModeloUnidadMedida>> resultado =
|
||||
AppServices.ServicioCatalogoProducto.ListarUnidadesMedida(
|
||||
TxtBusqueda.Text,
|
||||
ChkInactivos.Checked,
|
||||
CurrentUser.CveUsuario,
|
||||
CurrentUser.NombreDominio);
|
||||
|
||||
if (!result.Success)
|
||||
if (!resultado.Success)
|
||||
{
|
||||
Alert(result.UserMessage, TipoMensaje.MsgError);
|
||||
Alert(resultado.UserMessage, TipoMensaje.MsgError);
|
||||
return;
|
||||
}
|
||||
|
||||
GvUnidadesMedida.DataSource =
|
||||
result.Data ?? new List<UnidadMedidaModel>();
|
||||
resultado.Data ?? new List<ModeloUnidadMedida>();
|
||||
GvUnidadesMedida.DataBind();
|
||||
}
|
||||
|
||||
private void BindBitacora()
|
||||
private void CargarBitacora()
|
||||
{
|
||||
bool hasMeasurementUnit = CveUnidadMedidaBitacoraActual > 0;
|
||||
bool tieneUnidadMedida = CveUnidadMedidaBitacoraActual > 0;
|
||||
|
||||
UcBitacoraCatalogo.Descripcion = hasMeasurementUnit
|
||||
UcBitacoraCatalogo.Descripcion = tieneUnidadMedida
|
||||
? "Historial de " + NombreUnidadMedidaBitacoraActual
|
||||
: "Historial de unidades de medida";
|
||||
UcBitacoraCatalogo.AccionVisible = hasMeasurementUnit;
|
||||
UcBitacoraCatalogo.AccionVisible = tieneUnidadMedida;
|
||||
UcBitacoraCatalogo.ConfigurarConsulta(
|
||||
new List<BitacoraCampoFiltroModel>
|
||||
{
|
||||
@@ -319,11 +319,11 @@ namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
NombreTablaSQL = "UnidadesMedida",
|
||||
NombreCampoSQL = "CveUnidadMedida",
|
||||
Valor = hasMeasurementUnit
|
||||
Valor = tieneUnidadMedida
|
||||
? CveUnidadMedidaBitacoraActual.ToString(
|
||||
CultureInfo.InvariantCulture)
|
||||
: string.Empty,
|
||||
SoloExistencia = !hasMeasurementUnit
|
||||
SoloExistencia = !tieneUnidadMedida
|
||||
}
|
||||
},
|
||||
new List<BitacoraRelacionMostrarModel>
|
||||
@@ -338,25 +338,25 @@ namespace SIG.Web.Pages.Catalogos
|
||||
UcBitacoraCatalogo.Consultar(true);
|
||||
}
|
||||
|
||||
private void SyncFilters()
|
||||
private void SincronizarFiltros()
|
||||
{
|
||||
var filters = new List<FiltroActivo>();
|
||||
var filtros = new List<FiltroActivo>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(TxtSearch.Text))
|
||||
if (!string.IsNullOrWhiteSpace(TxtBusqueda.Text))
|
||||
{
|
||||
filters.Add(
|
||||
filtros.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Texto",
|
||||
Titulo = "Búsqueda",
|
||||
Descripcion = TxtSearch.Text.Trim(),
|
||||
Descripcion = TxtBusqueda.Text.Trim(),
|
||||
Orden = 1
|
||||
});
|
||||
}
|
||||
|
||||
if (ChkInactive.Checked)
|
||||
if (ChkInactivos.Checked)
|
||||
{
|
||||
filters.Add(
|
||||
filtros.Add(
|
||||
new FiltroActivo
|
||||
{
|
||||
Nombre = "Inactivos",
|
||||
@@ -366,34 +366,34 @@ namespace SIG.Web.Pages.Catalogos
|
||||
});
|
||||
}
|
||||
|
||||
UcFiltros.SetFiltros(filters);
|
||||
UcFiltros.SetFiltros(filtros);
|
||||
}
|
||||
|
||||
private static void RegisterAsyncControl(
|
||||
ScriptManager scriptManager,
|
||||
GridViewRow row,
|
||||
string controlId)
|
||||
private static void RegistrarControlAsincrono(
|
||||
ScriptManager administradorScripts,
|
||||
GridViewRow fila,
|
||||
string identificadorControl)
|
||||
{
|
||||
Control control = row.FindControl(controlId);
|
||||
Control control = fila.FindControl(identificadorControl);
|
||||
|
||||
if (control != null)
|
||||
{
|
||||
scriptManager.RegisterAsyncPostBackControl(control);
|
||||
administradorScripts.RegisterAsyncPostBackControl(control);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowModal(string id)
|
||||
private void MostrarModal(string identificador)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.show('" + id + "');",
|
||||
"Show_" + id);
|
||||
"window.SIGTramiteCatalog.show('" + identificador + "');",
|
||||
"Mostrar_" + identificador);
|
||||
}
|
||||
|
||||
private void HideModal(string id)
|
||||
private void OcultarModal(string identificador)
|
||||
{
|
||||
RegistraScript(
|
||||
"window.SIGTramiteCatalog.hide('" + id + "');",
|
||||
"Hide_" + id);
|
||||
"window.SIGTramiteCatalog.hide('" + identificador + "');",
|
||||
"Ocultar_" + identificador);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,21 +2,21 @@ namespace SIG.Web.Pages.Catalogos
|
||||
{
|
||||
public partial class UnidadesMedida
|
||||
{
|
||||
protected global::System.Web.UI.UpdatePanel UpActions;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNew;
|
||||
protected global::System.Web.UI.UpdatePanel UpCatalog;
|
||||
protected global::System.Web.UI.UpdatePanel UpAcciones;
|
||||
protected global::System.Web.UI.WebControls.LinkButton BtnNuevo;
|
||||
protected global::System.Web.UI.UpdatePanel UpCatalogo;
|
||||
protected global::SIG.Web.AppCode.SigControls.Filtros UcFiltros;
|
||||
protected global::System.Web.UI.WebControls.GridView GvUnidadesMedida;
|
||||
protected global::System.Web.UI.UpdatePanel UpFilters;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtSearch;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkInactive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnApplyFilters;
|
||||
protected global::System.Web.UI.UpdatePanel UpEdit;
|
||||
protected global::System.Web.UI.WebControls.Literal LitModalTitle;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtMeasurementUnit;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtAbbreviation;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkActive;
|
||||
protected global::System.Web.UI.WebControls.Button BtnSave;
|
||||
protected global::System.Web.UI.UpdatePanel UpFiltros;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtBusqueda;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkInactivos;
|
||||
protected global::System.Web.UI.WebControls.Button BtnAplicarFiltros;
|
||||
protected global::System.Web.UI.UpdatePanel UpEdicion;
|
||||
protected global::System.Web.UI.WebControls.Literal LitTituloModal;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtUnidadMedida;
|
||||
protected global::System.Web.UI.WebControls.TextBox TxtAbreviatura;
|
||||
protected global::System.Web.UI.WebControls.CheckBox ChkActivo;
|
||||
protected global::System.Web.UI.WebControls.Button BtnGuardar;
|
||||
protected global::SIG.Web.AppCode.SigControls.BitacoraGrid
|
||||
UcBitacoraCatalogo;
|
||||
}
|
||||
|
||||
@@ -704,7 +704,7 @@
|
||||
runat="server"
|
||||
CssClass="btn btn-xs blue"
|
||||
Visible='<%# !ConvertToBoolean(Eval("VentaGenerada")) %>'
|
||||
NavigateUrl='<%# GetVentaTramiteUrl(Eval("CveSolicitud"), Eval("CveTramitePago")) %>'>
|
||||
NavigateUrl='<%# ObtenerUrlVentaTramite(Eval("CveSolicitud"), Eval("CveTramitePago")) %>'>
|
||||
<i class="fa fa-file-text-o"></i>
|
||||
Generar
|
||||
</asp:HyperLink>
|
||||
@@ -713,7 +713,7 @@
|
||||
runat="server"
|
||||
CssClass="btn btn-xs green"
|
||||
Visible='<%# ConvertToBoolean(Eval("VentaGenerada")) %>'
|
||||
NavigateUrl='<%# GetVentaTramiteUrl(Eval("CveSolicitud"), Eval("CveTramitePago")) %>'>
|
||||
NavigateUrl='<%# ObtenerUrlVentaTramite(Eval("CveSolicitud"), Eval("CveTramitePago")) %>'>
|
||||
<i class="fa fa-credit-card"></i>
|
||||
Pagar
|
||||
</asp:HyperLink>
|
||||
|
||||
@@ -2099,7 +2099,7 @@ namespace SIG.Web.Pages.Fraccionamientos
|
||||
BindProcedureStatusOptions();
|
||||
BindDocumentProcedureTypeOptions();
|
||||
BindProcedures();
|
||||
BindPagos();
|
||||
CargarPagos();
|
||||
BindDocuments();
|
||||
}
|
||||
|
||||
@@ -2184,7 +2184,7 @@ namespace SIG.Web.Pages.Fraccionamientos
|
||||
CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
private void BindPagos()
|
||||
private void CargarPagos()
|
||||
{
|
||||
DbResult<List<ModeloPagoPendienteFraccionamiento>> resultadoPendientes =
|
||||
AppServices.ServicioVentaTramite.ListarPagosPendientes(
|
||||
@@ -3290,18 +3290,18 @@ namespace SIG.Web.Pages.Fraccionamientos
|
||||
return Server.HtmlEncode(GetDisplayValue(value));
|
||||
}
|
||||
|
||||
protected string GetVentaTramiteUrl(
|
||||
object cveSolicitudValue,
|
||||
object cveTramitePagoValue)
|
||||
protected string ObtenerUrlVentaTramite(
|
||||
object valorCveSolicitud,
|
||||
object valorCveTramitePago)
|
||||
{
|
||||
int cveSolicitud;
|
||||
int cveTramitePago;
|
||||
|
||||
if (!int.TryParse(
|
||||
Convert.ToString(cveSolicitudValue),
|
||||
Convert.ToString(valorCveSolicitud),
|
||||
out cveSolicitud) ||
|
||||
!int.TryParse(
|
||||
Convert.ToString(cveTramitePagoValue),
|
||||
Convert.ToString(valorCveTramitePago),
|
||||
out cveTramitePago) ||
|
||||
cveSolicitud <= 0 ||
|
||||
cveTramitePago <= 0)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AutoEventWireup="true" CodeFile="Perfil.aspx.cs"
|
||||
Inherits="SIG.Web.Pages.Security.Perfil" %>
|
||||
|
||||
<asp:Content ID="ContentHead" ContentPlaceHolderID="H" runat="server">
|
||||
<asp:Content ID="ContenidoEncabezado" ContentPlaceHolderID="H" runat="server">
|
||||
<style>
|
||||
.perfil-contenedor {
|
||||
background: #fff;
|
||||
@@ -36,7 +36,7 @@
|
||||
</style>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentMain" ContentPlaceHolderID="C" runat="server">
|
||||
<asp:Content ID="ContenidoPrincipal" ContentPlaceHolderID="C" runat="server">
|
||||
<div class="perfil-contenedor">
|
||||
<ajax:TabContainer ID="TabsPerfil"
|
||||
runat="server"
|
||||
@@ -268,5 +268,5 @@
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="ContentScripts" ContentPlaceHolderID="J" runat="server">
|
||||
<asp:Content ID="ContenidoScripts" ContentPlaceHolderID="J" runat="server">
|
||||
</asp:Content>
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace SIG.Web.Pages.Security
|
||||
set { ViewState["CveClienteActual"] = value; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
protected void Page_Load(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
if (CurrentUser == null)
|
||||
{
|
||||
@@ -34,8 +34,8 @@ namespace SIG.Web.Pages.Security
|
||||
}
|
||||
|
||||
protected void BtnGuardarSesion_Click(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
if (!string.Equals(
|
||||
TxtContrasenaNueva.Text,
|
||||
@@ -48,8 +48,8 @@ namespace SIG.Web.Pages.Security
|
||||
return;
|
||||
}
|
||||
|
||||
DbResult<PerfilSesionModel> resultado =
|
||||
AppServices.PerfilUsuarioService.ActualizarSesion(
|
||||
DbResult<ModeloPerfilSesion> resultado =
|
||||
AppServices.ServicioPerfilUsuario.ActualizarSesion(
|
||||
CurrentUser,
|
||||
TxtNombreUsuario.Text,
|
||||
TxtContrasenaNueva.Text);
|
||||
@@ -86,8 +86,8 @@ namespace SIG.Web.Pages.Security
|
||||
}
|
||||
|
||||
protected void BtnGuardarCliente_Click(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
int cveRegimenFiscal;
|
||||
int cveUsoCfdi;
|
||||
@@ -109,7 +109,7 @@ namespace SIG.Web.Pages.Security
|
||||
return;
|
||||
}
|
||||
|
||||
var cliente = new PerfilClienteModel
|
||||
var cliente = new ModeloPerfilCliente
|
||||
{
|
||||
CveCliente = CveClienteActual,
|
||||
Nombre = TxtNombreFiscal.Text,
|
||||
@@ -130,7 +130,7 @@ namespace SIG.Web.Pages.Security
|
||||
};
|
||||
|
||||
DbResult<bool> resultado =
|
||||
AppServices.PerfilUsuarioService.ActualizarCliente(
|
||||
AppServices.ServicioPerfilUsuario.ActualizarCliente(
|
||||
CurrentUser,
|
||||
cliente);
|
||||
|
||||
@@ -151,8 +151,8 @@ namespace SIG.Web.Pages.Security
|
||||
|
||||
private void CargarPerfil()
|
||||
{
|
||||
DbResult<PerfilUsuarioConsultaModel> resultado =
|
||||
AppServices.PerfilUsuarioService.ObtenerPerfil(
|
||||
DbResult<ModeloConsultaPerfilUsuario> resultado =
|
||||
AppServices.ServicioPerfilUsuario.ObtenerPerfil(
|
||||
CurrentUser);
|
||||
|
||||
if (!resultado.Success ||
|
||||
@@ -167,7 +167,7 @@ namespace SIG.Web.Pages.Security
|
||||
return;
|
||||
}
|
||||
|
||||
PerfilUsuarioConsultaModel perfil = resultado.Data;
|
||||
ModeloConsultaPerfilUsuario perfil = resultado.Data;
|
||||
TxtNombreUsuario.Text = perfil.Sesion.NombreUsuario;
|
||||
TxtCorreoElectronico.Text =
|
||||
perfil.Sesion.CorreoElectronico;
|
||||
@@ -193,7 +193,7 @@ namespace SIG.Web.Pages.Security
|
||||
}
|
||||
|
||||
private void CargarCatalogos(
|
||||
PerfilUsuarioConsultaModel perfil)
|
||||
ModeloConsultaPerfilUsuario perfil)
|
||||
{
|
||||
bool faltanRegimenes =
|
||||
perfil.RegimenesFiscales.Count == 0;
|
||||
@@ -224,7 +224,7 @@ namespace SIG.Web.Pages.Security
|
||||
new ListItem("Seleccione", string.Empty));
|
||||
}
|
||||
|
||||
private void CargarCliente(PerfilClienteModel cliente)
|
||||
private void CargarCliente(ModeloPerfilCliente cliente)
|
||||
{
|
||||
TxtNombreFiscal.Text = cliente.Nombre;
|
||||
TxtNombreComercial.Text = cliente.NombreComercial;
|
||||
|
||||
@@ -115,17 +115,17 @@ namespace SIG.Web.Pages.Ventas
|
||||
set { ViewState["PuedeAgregarConceptosActual"] = value; }
|
||||
}
|
||||
|
||||
private List<ProductoServicioModel> ProductosServiciosActuales
|
||||
private List<ModeloProductoServicio> ProductosServiciosActuales
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["ProductosServiciosActuales"]
|
||||
as List<ProductoServicioModel>;
|
||||
as List<ModeloProductoServicio>;
|
||||
}
|
||||
set { ViewState["ProductosServiciosActuales"] = value; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
protected void Page_Load(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
if (IsPostBack)
|
||||
{
|
||||
@@ -155,7 +155,7 @@ namespace SIG.Web.Pages.Ventas
|
||||
CargarVenta();
|
||||
}
|
||||
|
||||
protected void BtnGenerar_Click(object sender, EventArgs e)
|
||||
protected void BtnGenerar_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
var venta = new ModeloCapturaVentaTramite
|
||||
{
|
||||
@@ -185,7 +185,7 @@ namespace SIG.Web.Pages.Ventas
|
||||
CargarVenta();
|
||||
}
|
||||
|
||||
protected void BtnPagar_Click(object sender, EventArgs e)
|
||||
protected void BtnPagar_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
if (!CargarOpcionesPago())
|
||||
{
|
||||
@@ -204,30 +204,30 @@ namespace SIG.Web.Pages.Ventas
|
||||
}
|
||||
|
||||
protected void BtnFormaEfectivo_Click(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
SeleccionarFormaPago("01");
|
||||
MostrarModalPago();
|
||||
}
|
||||
|
||||
protected void BtnFormaTransferencia_Click(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
SeleccionarFormaPago("03");
|
||||
MostrarModalPago();
|
||||
}
|
||||
|
||||
protected void DdlCuentaBancaria_SelectedIndexChanged(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
ActualizarCuentaSpeiSeleccionada();
|
||||
MostrarModalPago();
|
||||
}
|
||||
|
||||
protected void BtnRegistrarPago_Click(object sender, EventArgs e)
|
||||
protected void BtnRegistrarPago_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
decimal importe;
|
||||
DateTime fechaPago;
|
||||
@@ -326,8 +326,8 @@ namespace SIG.Web.Pages.Ventas
|
||||
}
|
||||
|
||||
protected void BtnGuardarCondicionesPago_Click(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
int cveMetodoPago;
|
||||
byte cveFormaPago;
|
||||
@@ -382,23 +382,23 @@ namespace SIG.Web.Pages.Ventas
|
||||
}
|
||||
|
||||
protected void DdlProductoServicio_SelectedIndexChanged(
|
||||
object sender,
|
||||
EventArgs e)
|
||||
object origenEvento,
|
||||
EventArgs argumentos)
|
||||
{
|
||||
ProductoServicioModel producto = ObtenerProductoSeleccionado();
|
||||
ModeloProductoServicio producto = ObtenerProductoSeleccionado();
|
||||
TxtPrecioUnitarioNuevo.Text = producto == null
|
||||
? "0.00"
|
||||
: producto.Precio.ToString("0.00", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
protected void BtnAgregarConcepto_Click(object sender, EventArgs e)
|
||||
protected void BtnAgregarConcepto_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
if (!ValidarPermiso(PermisoAgregarConceptos))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ProductoServicioModel producto = ObtenerProductoSeleccionado();
|
||||
ModeloProductoServicio producto = ObtenerProductoSeleccionado();
|
||||
decimal cantidad;
|
||||
decimal precioUnitario;
|
||||
|
||||
@@ -425,16 +425,16 @@ namespace SIG.Web.Pages.Ventas
|
||||
}
|
||||
|
||||
protected void GvConceptos_RowCommand(
|
||||
object sender,
|
||||
GridViewCommandEventArgs e)
|
||||
object origenEvento,
|
||||
GridViewCommandEventArgs argumentos)
|
||||
{
|
||||
if (e.CommandName != "GuardarConcepto" &&
|
||||
e.CommandName != "EliminarConcepto")
|
||||
if (argumentos.CommandName != "GuardarConcepto" &&
|
||||
argumentos.CommandName != "EliminarConcepto")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string permisoRequerido = e.CommandName == "EliminarConcepto"
|
||||
string permisoRequerido = argumentos.CommandName == "EliminarConcepto"
|
||||
? PermisoEliminarConceptos
|
||||
: PermisoModificarConceptos;
|
||||
|
||||
@@ -443,12 +443,12 @@ namespace SIG.Web.Pages.Ventas
|
||||
return;
|
||||
}
|
||||
|
||||
GridViewRow fila = ((Control)e.CommandSource).NamingContainer
|
||||
GridViewRow fila = ((Control)argumentos.CommandSource).NamingContainer
|
||||
as GridViewRow;
|
||||
int cveVentaDetalle;
|
||||
|
||||
if (fila == null ||
|
||||
!int.TryParse(e.CommandArgument.ToString(), out cveVentaDetalle))
|
||||
!int.TryParse(argumentos.CommandArgument.ToString(), out cveVentaDetalle))
|
||||
{
|
||||
Alert(
|
||||
"Seleccione un concepto válido.",
|
||||
@@ -456,7 +456,7 @@ namespace SIG.Web.Pages.Ventas
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.CommandName == "EliminarConcepto")
|
||||
if (argumentos.CommandName == "EliminarConcepto")
|
||||
{
|
||||
DbResult<bool> eliminarResultado =
|
||||
AppServices.ServicioVentaTramite.EliminarConcepto(
|
||||
@@ -515,7 +515,7 @@ namespace SIG.Web.Pages.Ventas
|
||||
"Concepto actualizado correctamente.");
|
||||
}
|
||||
|
||||
protected void BtnTimbrar_Click(object sender, EventArgs e)
|
||||
protected void BtnTimbrar_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
if (!ValidarPermiso(PermisoTimbrar))
|
||||
{
|
||||
@@ -545,7 +545,7 @@ namespace SIG.Web.Pages.Ventas
|
||||
CargarVenta();
|
||||
}
|
||||
|
||||
protected void BtnCancelarTimbre_Click(object sender, EventArgs e)
|
||||
protected void BtnCancelarTimbre_Click(object origenEvento, EventArgs argumentos)
|
||||
{
|
||||
if (!ValidarPermiso(PermisoCancelarTimbre))
|
||||
{
|
||||
@@ -799,7 +799,7 @@ namespace SIG.Web.Pages.Ventas
|
||||
cuenta = (CuentasPagoActuales ??
|
||||
new List<ModeloCuentaBancariaOpcion>())
|
||||
.FirstOrDefault(
|
||||
item => item.CveBancoCuenta == cveBancoCuenta);
|
||||
elemento => elemento.CveBancoCuenta == cveBancoCuenta);
|
||||
}
|
||||
|
||||
LitClabeSpei.Text = cuenta == null
|
||||
@@ -949,8 +949,8 @@ namespace SIG.Web.Pages.Ventas
|
||||
|
||||
private void CargarProductosServicios()
|
||||
{
|
||||
DbResult<List<ProductoServicioModel>> resultado =
|
||||
AppServices.ProductoServicioService.List(
|
||||
DbResult<List<ModeloProductoServicio>> resultado =
|
||||
AppServices.ServicioProductoServicio.Listar(
|
||||
null,
|
||||
false,
|
||||
CurrentUser.CveUsuario,
|
||||
@@ -962,8 +962,8 @@ namespace SIG.Web.Pages.Ventas
|
||||
return;
|
||||
}
|
||||
|
||||
List<ProductoServicioModel> productos = resultado.Data ??
|
||||
new List<ProductoServicioModel>();
|
||||
List<ModeloProductoServicio> productos = resultado.Data ??
|
||||
new List<ModeloProductoServicio>();
|
||||
ProductosServiciosActuales = productos;
|
||||
string seleccionActual = DdlProductoServicio.SelectedValue;
|
||||
|
||||
@@ -971,7 +971,7 @@ namespace SIG.Web.Pages.Ventas
|
||||
DdlProductoServicio.Items.Add(
|
||||
new ListItem("Seleccione", string.Empty));
|
||||
|
||||
foreach (ProductoServicioModel producto in productos)
|
||||
foreach (ModeloProductoServicio producto in productos)
|
||||
{
|
||||
string texto = string.IsNullOrWhiteSpace(producto.Codigo)
|
||||
? producto.PS
|
||||
@@ -987,12 +987,12 @@ namespace SIG.Web.Pages.Ventas
|
||||
}
|
||||
}
|
||||
|
||||
private ProductoServicioModel ObtenerProductoSeleccionado()
|
||||
private ModeloProductoServicio ObtenerProductoSeleccionado()
|
||||
{
|
||||
int cvePS;
|
||||
List<ProductoServicioModel> productos =
|
||||
List<ModeloProductoServicio> productos =
|
||||
ProductosServiciosActuales ??
|
||||
new List<ProductoServicioModel>();
|
||||
new List<ModeloProductoServicio>();
|
||||
|
||||
return int.TryParse(DdlProductoServicio.SelectedValue, out cvePS)
|
||||
? productos.FirstOrDefault(
|
||||
|
||||
@@ -17,13 +17,13 @@ namespace SIG.Web
|
||||
{
|
||||
public partial class Site : MasterPage, IGlobalErrorPresenter
|
||||
{
|
||||
private List<UsuarioCambioContextoModel> UsuariosCambioActuales
|
||||
private List<ModeloUsuarioCambioContexto> UsuariosCambioActuales
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["UsuariosCambioActuales"]
|
||||
as List<UsuarioCambioContextoModel>
|
||||
?? new List<UsuarioCambioContextoModel>();
|
||||
as List<ModeloUsuarioCambioContexto>
|
||||
?? new List<ModeloUsuarioCambioContexto>();
|
||||
}
|
||||
set { ViewState["UsuariosCambioActuales"] = value; }
|
||||
}
|
||||
@@ -78,8 +78,8 @@ namespace SIG.Web
|
||||
usuarioSesion.CveRol == 1 ||
|
||||
usuarioSesion.CveRol == 2;
|
||||
|
||||
DbResult<PerfilUsuarioConsultaModel> resultadoPerfil =
|
||||
AppServices.PerfilUsuarioService.ObtenerPerfil(
|
||||
DbResult<ModeloConsultaPerfilUsuario> resultadoPerfil =
|
||||
AppServices.ServicioPerfilUsuario.ObtenerPerfil(
|
||||
usuarioSesion);
|
||||
|
||||
if (resultadoPerfil.Success &&
|
||||
@@ -372,7 +372,7 @@ namespace SIG.Web
|
||||
}
|
||||
|
||||
DbResult<UserSessionModel> resultado =
|
||||
AppServices.PerfilUsuarioService.CambiarUsuario(
|
||||
AppServices.ServicioPerfilUsuario.CambiarUsuario(
|
||||
usuarioSesion,
|
||||
cveUsuarioSeleccionado);
|
||||
|
||||
@@ -404,21 +404,21 @@ namespace SIG.Web
|
||||
return;
|
||||
}
|
||||
|
||||
DbResult<List<UsuarioCambioContextoModel>> resultado =
|
||||
AppServices.PerfilUsuarioService.ListarUsuariosCambio(
|
||||
DbResult<List<ModeloUsuarioCambioContexto>> resultado =
|
||||
AppServices.ServicioPerfilUsuario.ListarUsuariosCambio(
|
||||
usuarioSesion,
|
||||
TxtBuscarUsuarioCambio.Text);
|
||||
|
||||
if (!resultado.Success)
|
||||
{
|
||||
UsuariosCambioActuales =
|
||||
new List<UsuarioCambioContextoModel>();
|
||||
new List<ModeloUsuarioCambioContexto>();
|
||||
MostrarErrorCambioUsuario(resultado.UserMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
UsuariosCambioActuales = resultado.Data ??
|
||||
new List<UsuarioCambioContextoModel>();
|
||||
new List<ModeloUsuarioCambioContexto>();
|
||||
LblCambioUsuario.Visible = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user