Public Class frmParamsPerfilCta Private opcion As Boolean Private id As Integer Private Sub frmObjCuenta_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Try Iniciar() ClassCatalogos.CambiaColorbloque2(btnAgregar, btnEditar, btnGuardar, btnCerrar) Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub Private Function Iniciar() As Boolean Iniciar = False Try Limpiar() llenarGrid() DesHeader.Text = Me.Text Catch ex As Exception MessageBox.Show(ex.Message) End Try Iniciar = True End Function Private Function Limpiar() As Boolean Try txtValor.DropDownStyle = ComboBoxStyle.Simple txtPerfilCta.Enabled = False txtPerfilCta.Text = "" 'chkActivo.Enabled = False 'chkActivo.Checked = False txtValor.Enabled = False txtValor.Text = "" btnGuardar.Enabled = False btnEditar.Enabled = False id = 0 opcion = False Catch ex As Exception MessageBox.Show(ex.Message) End Try End Function Private Function llenarGrid() As Boolean llenarGrid = False Try Dim ClassCatalogos As New ClassCatalogos GridMaster.AllowUpdate = False ClassCatalogos.LlenaGrid("SP_ConsultarConfiguracionGralParam NULL", Me.GridMaster) GridMaster.Splits(0).DisplayColumns(0).AutoSize() GridMaster.Splits(0).DisplayColumns(0).Visible = False GridMaster.Splits(0).DisplayColumns(1).AutoSize() GridMaster.Splits(0).DisplayColumns(2).AutoSize() Catch ex As Exception MessageBox.Show(ex.Message) End Try llenarGrid = True End Function Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles btnCerrar.Click Me.Close() End Sub Private Sub BtnAgregar_Click(sender As System.Object, e As System.EventArgs) Handles btnAgregar.Click Limpiar() habilitar() ClassCatalogos.CambiaColorbloque2(btnAgregar, btnEditar, btnGuardar, btnCerrar) opcion = True txtPerfilCta.Focus() End Sub Private Function habilitar() As Boolean habilitar = False Try 'txtPerfilCta.Enabled = True 'chkActivo.Enabled = True btnGuardar.Enabled = True 'txtRiesgo.Enabled = True txtValor.Enabled = True Catch ex As Exception MessageBox.Show(ex.Message) End Try habilitar = True End Function Private Sub GridMaster_DoubleClick(sender As System.Object, e As System.EventArgs) Handles GridMaster.DoubleClick Limpiar() llenarDatos() ClassCatalogos.CambiaColorbloque2(btnAgregar, btnEditar, btnGuardar, btnCerrar) End Sub Private Function llenarDatos() As Boolean llenarDatos = False Try If GridMaster.RowCount > 0 Then id = GridMaster.Columns(0).Value txtPerfilCta.Text = GridMaster.Columns(1).Value 'chkActivo.Checked = GridMaster.Columns(2).Value txtValor.Text = GridMaster.Columns(2).Value btnEditar.Enabled = True txtPerfilCta.Enabled = False 'chkActivo.Enabled = False btnGuardar.Enabled = False Else MsgBox("No hay datos para editar") End If Catch ex As Exception MessageBox.Show(ex.Message) End Try ClassCatalogos.CambiaColorbloque2(btnAgregar, btnEditar, btnGuardar, btnCerrar) llenarDatos = True End Function Private Sub BtnEditar_Click(sender As System.Object, e As System.EventArgs) Handles btnEditar.Click clsVaribles.lsValAnt = "Valores Anteriores: idConfiguracion: " & id & " Valor:" & txtValor.Text opcion = False habilitar() btnAgregar.Enabled = True btnEditar.Enabled = False If id = 3 Then txtValor.DropDownStyle = ComboBoxStyle.DropDownList Else txtValor.DropDownStyle = ComboBoxStyle.Simple End If ClassCatalogos.CambiaColorbloque2(btnAgregar, btnEditar, btnGuardar, btnCerrar) txtPerfilCta.Focus() End Sub Private Sub BtnOk_Click(sender As System.Object, e As System.EventArgs) Handles btnGuardar.Click Guardar() End Sub Private Function Guardar() As Boolean Guardar = False Dim cls As New clsComplejo Dim ssql As String Dim nombre As String Dim chk As Integer Dim riesgo As Single Dim ClassAud As New ClassMyUtils Try If ValidarDatos() Then nombre = txtValor.Text 'chk = chkActivo.CheckState If opcion = False Then ssql = "sp_UpdateConfiguracionGralParam " & id & ",'" & nombre & "'" cls.sbGuardaModifica(ssql) ' ClassAud.RT_Auditoria(clsVaribles.varUsuario, 138, 31, clsVaribles.lsValAnt & ", " & "Valores Nuevos: idConfiguracion: " & txtValor.Text) '& chkActivo.CheckState End If MessageBox.Show("Operación Realizada Correctamente ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information) Limpiar() llenarGrid() ClassCatalogos.CambiaColorbloque2(btnAgregar, btnEditar, btnGuardar, btnCerrar) End If Catch ex As Exception MessageBox.Show(ex.Message) End Try Guardar = True End Function Private Function ValidarDatos() As Boolean ValidarDatos = False Try If txtPerfilCta.Text.Trim = "" Then MessageBox.Show("Es necesario introducir el Perfil de la Cuenta ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) txtPerfilCta.Focus() Exit Function End If ValidarDatos = True Catch ex As Exception MessageBox.Show(ex.Message) End Try End Function End Class