viernes, 14 de febrero de 2020
TODO EL SISTEMA EDITAR PERFILES FORMULARIO GUARDAR Y ELIMINAR MODULOS Y APLICACIONES
Public Class FormABMEditarPermiso
Private mDt As DataTable
Private IdAplicacionSel As Integer
Private IdPerfilSel As Integer
Private IdModuloSel As Integer
Private rDt As DataTable
Private IDPERFILes As Integer
Private idmo As Integer
Private Aidmodulo As Integer
Dim gvidmodulo2 As Integer
Dim gvidperfil As Integer
Dim gvaplicacion1 As Integer
Private vaux As Integer
Private confGB As Boolean
#Region "Procesos"
Private Sub ListarAplicaciones()
Try
mDt = New DataTable
Aidmodulo = GLUE_Modulos.EditValue
mDt = ConexionSQL.EjecutarSP("SP_PLUS_ABMTABLA_LISTADO_APLICACIONES", Aidmodulo)
If Not IsNothing(mDt) Then
GLUE_Aplicaciones.Properties.DataSource = mDt
Else
GLUE_Aplicaciones.Properties.DataSource = Nothing
End If
Catch ex As Exception
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Errores, "#ERROR: " + ex.ToString).ShowDialog()
Exit Sub
End Try
End Sub
Private Sub ListarPerfiles()
mDt = New DataTable
mDt = ConexionSQL.EjecutarSP("SP_PLUS_ABMTABLA_LISTAR_PERFILES")
If Not IsNothing(mDt) Then
GLUE_Perfiles.Properties.DataSource = mDt
Else
GLUE_Perfiles.Properties.DataSource = Nothing
End If
End Sub
Private Sub ListarModulos()
mDt = New DataTable
mDt = ConexionSQL.EjecutarSP("SP_PLUS_ABMTABLA_MODULOS_LISTAR")
If Not IsNothing(mDt) Then
GLUE_Modulos.Properties.DataSource = mDt
Else
GLUE_Modulos.Properties.DataSource = Nothing
End If
End Sub
Private Sub CargarGlueCombinada()
Try
IDPERFILes = GLUE_Perfiles.EditValue
Aidmodulo = GLUE_Modulos.EditValue
GcPermisos.DataSource = Nothing
mDt = New DataTable
If Aidmodulo <> 0 Then
mDt = ConexionSQL.EjecutarSP("SP_PLUS_ABMTABLA_CARGAR_PERFILES", IDPERFILes, Aidmodulo)
Else
mDt = ConexionSQL.EjecutarSP("SP_PLUS_ABMTABLA_CARGAR_PERFILES", IDPERFILes, Aidmodulo)
End If
If Not IsNothing(mDt) Then
GcPermisos.DataSource = mDt
Else
GcPermisos.DataSource = Nothing
End If
Catch ex As Exception
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Errores, "#ERROR: " + ex.ToString).ShowDialog()
Exit Sub
End Try
Dactivarbto()
End Sub
Private Sub CargarDatos()
LimpiarCampos()
ListarPerfiles()
ListarModulos()
Dactivarbto()
End Sub
Sub LimpiarCampos()
GLUE_Aplicaciones.EditValue = 0
GcPermisos.DataSource = Nothing
GLUE_Perfiles.EditValue = 0
GLUE_Modulos.EditValue = 0
End Sub
Sub Dactivarbto()
BtnEliminar.Enabled = False
BtnEliminarModulo.Enabled = False
End Sub
#End Region
Private Sub FormABMEditarPermiso_Load(sender As Object, e As EventArgs) Handles MyBase.Load
CargarDatos()
End Sub
#Region "Funciones"
Private Function ValidarCampos(ByVal _activo As Boolean) As Boolean
Try
_activo = True
If GLUE_Aplicaciones.EditValue = 0 Or GLUE_Modulos.EditValue = 0 Or GLUE_Perfiles.EditValue = 0 Then
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Errores, "#ERROR: Algunos campos estan vacios.").ShowDialog()
Return _activo = False
Else
End If
Catch ex As Exception
MessageBox.Show("" + ex.ToString)
End Try
Return _activo = True
End Function
#End Region 'fin funciones
#Region "botones y combos"
Private Sub BtnGrabar_Click(sender As Object, e As EventArgs) Handles BtnGrabar.Click
If ValidarCampos(True) = False Then
Exit Sub
End If
Try
IdAplicacionSel = GLUE_Aplicaciones.EditValue
GLUE_Aplicaciones.EditValue = 0
IdPerfilSel = GLUE_Perfiles.EditValue
IdModuloSel = GLUE_Modulos.EditValue
If ConexionSQL.EjecutarSP("SP_PLUS_ABMTABLA_BUSCAR_APLICACION_MODULO_POR_PERFIL", IdAplicacionSel, IdPerfilSel, IdModuloSel) Is Nothing Then
' ConexionSQL.EjecutarSP("SP_PLUS_ABMTABLA_GRABAR_APLICACION_MODULO_POR_PERFIL", IdAplicacionSel, IdPerfilSel, IdModuloSel, My.Application.IDUSUARIO)
GrabarModuloAplicaciones(IdAplicacionSel, IdPerfilSel, IdModuloSel)
Else
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Adveretencia, "Registro ya existe, intente de nuevo").ShowDialog()
Exit Sub
End If
Catch ex As Exception
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Errores, "@ERROR BTG1:No se pudo registrar la información" + ex.ToString).ShowDialog()
End Try
GLUE_Aplicaciones.EditValue = 0
CargarGlueCombinada()
End Sub
Private Sub GLUE_Perfiles_EditValueChanged(sender As Object, e As EventArgs) Handles GLUE_Perfiles.EditValueChanged
CargarGlueCombinada()
End Sub
Public Function GrabarModuloAplicaciones(ByVal idaplicacionSel As Integer, ByVal idperfilSel As Integer, ByVal idModuloSel As Integer) As Boolean
confGB = False
Try
ConexionSQL.EjecutarSP("SP_PLUS_ABMTABLA_GRABAR_APLICACION_MODULO_POR_PERFIL", idaplicacionSel, idperfilSel, idModuloSel, My.Application.IDUSUARIO)
confGB = True
Catch ex As Exception
confGB = False
End Try
Return confGB
End Function
Private Sub GLUE_Modulos_EditValueChanged(sender As Object, e As EventArgs) Handles GLUE_Modulos.EditValueChanged
CargarGlueCombinada()
' GLUE_Modulos.EditValue = 0
ListarAplicaciones()
End Sub
#End Region
Private Sub GvPermisos_Click(sender As Object, e As EventArgs) Handles GvPermisos.Click
Dim gvIDMODULO As Integer
Dim gvIDPERFIL As Integer
Dim gvIDAPLICACION As Integer
Try
gvIDMODULO = Convert.ToInt32(GvPermisos.GetFocusedRowCellValue("IDMODULO"))
gvIDAPLICACION = Convert.ToInt32(GvPermisos.GetFocusedRowCellValue("IDAPLICACION"))
gvIDPERFIL = Convert.ToInt32(GvPermisos.GetFocusedRowCellValue("IDPERFIL"))
' MsgBox("modulo: " + Str(gvIDMODULO) + " perfil: " + Str(gvIDPERFIL) + " aplicacion: " + Str(gvIDAPLICACION))
If gvIDMODULO <> 0 Or gvIDAPLICACION <> 0 Or gvIDPERFIL <> 0 Then
BtnEliminar.Enabled = True
BtnEliminarModulo.Enabled = True
End If
Catch ex As Exception
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Errores, "#ERROR GV1: " + ex.ToString).ShowDialog()
End Try
End Sub
Private Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click
Dim gvIDMODULO As Integer
Dim gvIDPERFIL As Integer
Dim gvIDAPLICACION As Integer
Dim result As DialogResult
Try
gvIDMODULO = Convert.ToInt32(GvPermisos.GetFocusedRowCellValue("IDMODULO"))
gvIDAPLICACION = Convert.ToInt32(GvPermisos.GetFocusedRowCellValue("IDAPLICACION"))
gvIDPERFIL = Convert.ToInt32(GvPermisos.GetFocusedRowCellValue("IDPERFIL"))
If gvIDAPLICACION <> 0 And gvIDPERFIL <> 0 Then
result = MessageBox.Show("¿Esta seguro que desea eliminar la aplicación seleccionada? ", "Eliminar", MessageBoxButtons.YesNo)
If result = System.Windows.Forms.DialogResult.Yes Then
ConexionSQL.EjecutarSP("SP_PLUS_ABMTABLA_PERFILES_ELIMINAR_APLICACION", gvIDPERFIL, gvIDAPLICACION)
Else
Exit Sub
End If
Else
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Adveretencia, "#ERROR A14: No se ha seleccionado ninguna aplicación. ").ShowDialog()
Exit Sub
End If
Catch ex As Exception
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Adveretencia, "#ERROR A14: No se pudo eliminar la aplicaión. " + ex.ToString).ShowDialog()
Exit Sub
End Try
CargarGlueCombinada()
End Sub
Private Sub BtnEliminarModulo_Click(sender As Object, e As EventArgs) Handles BtnEliminarModulo.Click
Dim gvIDMODULO As Integer
Dim gvIDPERFIL As Integer
Dim gvIDAPLICACION As Integer
Dim result As DialogResult
Try
gvIDMODULO = Convert.ToInt32(GvPermisos.GetFocusedRowCellValue("IDMODULO"))
gvIDAPLICACION = Convert.ToInt32(GvPermisos.GetFocusedRowCellValue("IDAPLICACION"))
gvIDPERFIL = Convert.ToInt32(GvPermisos.GetFocusedRowCellValue("IDPERFIL"))
If gvIDMODULO <> 0 And gvIDPERFIL <> 0 Then
result = MessageBox.Show("¿Esta seguro que desea eliminar el modulo seleccionado con sus aplicaciones? ", "Eliminar", MessageBoxButtons.YesNo)
If result = System.Windows.Forms.DialogResult.Yes Then
ConexionSQL.EjecutarSP("SP_PLUS_ABMTABLA_PERFILES_ELIMINAR_MODULO", gvIDPERFIL, gvIDMODULO, gvIDAPLICACION)
Else
Exit Sub
End If
Else
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Adveretencia, "#ERROR BT15: No se ha seleccionado ningun módulo. ").ShowDialog()
Exit Sub
End If
Catch ex As Exception
GestorMensajes.MensajeDelSistema(MensajeSistema.TipoDeMensaje.Adveretencia, "#ERROR BT15: No se pudo eliminar el módulo. " + ex.ToString).ShowDialog()
Exit Sub
End Try
CargarGlueCombinada()
End Sub
End Class
Suscribirse a:
Enviar comentarios (Atom)
Los mail de oulook no se pueden reenviar.
cuando en el asunto poseen un caracter especial por ejemplo @#$ los correos no salen y no te muestra ningun correo de rebote, especialmente...
-
https://msdn.microsoft.com/en-us/library/office/ff192694.aspx filtros DoCmd.SetFilter Method (Access) Office 2013 and later Ot...
-
Tabla de operadores Access para Office 365 Access 2019 Access 2016 Access 2013 Access 2010 Access 2007 Un operador es...
No hay comentarios:
Publicar un comentario