252 lines
9.6 KiB
VB.net
252 lines
9.6 KiB
VB.net
|
Public Class frmCatalogos
|
|||
|
Dim blnuevo As Boolean = True
|
|||
|
Dim blcarga As Boolean = True
|
|||
|
|
|||
|
|
|||
|
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
|
|||
|
Dim Classcom As New clsComplejo
|
|||
|
Dim ClassCatalogos As New ClassCatalogos
|
|||
|
Dim SQL As String
|
|||
|
Dim FILA As DataRow
|
|||
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|||
|
PnPais.Visible = False
|
|||
|
|
|||
|
Me.PnPais.Visible = True
|
|||
|
Classcom = New clsComplejo
|
|||
|
|
|||
|
'LLENA GRID
|
|||
|
SQL = "spCargaCatalogo"
|
|||
|
Classcom.sbLlenaCombo(SQL, Me.CMBGrupo)
|
|||
|
Me.CMBGrupo.SelectedIndex = -1
|
|||
|
blcarga = False
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub llenagrid()
|
|||
|
Dim Classcom As New clsComplejo
|
|||
|
Dim ClassCatalogos As New ClassCatalogos
|
|||
|
Dim SQL As String
|
|||
|
Dim FILA As DataRow
|
|||
|
Try
|
|||
|
PnPais.Visible = False
|
|||
|
If blcarga = True Then Exit Sub
|
|||
|
|
|||
|
|
|||
|
Me.PnPais.Visible = True
|
|||
|
|
|||
|
|
|||
|
If Me.CMBGrupo.Text <> "" Then
|
|||
|
'LLENA GRID
|
|||
|
SQL = " spConcatalogo " & Me.CMBGrupo.SelectedValue
|
|||
|
ClassCatalogos.LlenaGrid(SQL, Me.GridMaster)
|
|||
|
If Me.CMBGrupo.SelectedValue = 14 Then
|
|||
|
txtClave.Enabled = True
|
|||
|
txtClave.ReadOnly = False
|
|||
|
Else
|
|||
|
txtClave.Enabled = False
|
|||
|
txtClave.ReadOnly = True
|
|||
|
End If
|
|||
|
End If
|
|||
|
|
|||
|
Catch ex As Exception
|
|||
|
MessageBox.Show("Error al cargar los Datos" & ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|||
|
End Try
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub CMBGrupo_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CMBGrupo.SelectedValueChanged
|
|||
|
LlenaGrid()
|
|||
|
blnuevo = True
|
|||
|
Me.Text = "Mantenimiento Catalogo de " & CMBGrupo.Text
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub limpiar()
|
|||
|
txtClave.Text = ""
|
|||
|
cboParamRango.SelectedIndex = -1
|
|||
|
txtValor.Text = ""
|
|||
|
blnuevo = False
|
|||
|
llenagrid()
|
|||
|
End Sub
|
|||
|
Private Sub GridMaster_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridMaster.DoubleClick
|
|||
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|||
|
Dim Classcom As New clsComplejo
|
|||
|
'0 Dim sql As String
|
|||
|
'Recupero Datos del gird
|
|||
|
Dim SQL As String = ""
|
|||
|
|
|||
|
|
|||
|
Dim Fila As DataRow
|
|||
|
' Dim Clsvar As clsVaribles
|
|||
|
|
|||
|
Try
|
|||
|
|
|||
|
SQL = "spConcatalogoOpcion " & CMBGrupo.SelectedValue & "," & Me.GridMaster.Columns("id").Value
|
|||
|
Classcom = New clsComplejo
|
|||
|
|
|||
|
Classcom.fdtDataSet(SQL)
|
|||
|
|
|||
|
If Classcom.ds.Tables(0).Rows.Count <> 0 Then
|
|||
|
|
|||
|
Fila = Classcom.ds.Tables(0).Rows(0)
|
|||
|
Me.txtValor.Text = Fila("descripcion").ToString
|
|||
|
txtClave.Text = Fila("id")
|
|||
|
|
|||
|
If CMBGrupo.SelectedValue = 1 Or CMBGrupo.SelectedValue = 2 Then
|
|||
|
chkActivo.Visible = False
|
|||
|
Else
|
|||
|
chkActivo.Visible = True
|
|||
|
chkActivo.Enabled = True
|
|||
|
chkActivo.Checked = Fila("Estatus")
|
|||
|
End If
|
|||
|
|
|||
|
blnuevo = True
|
|||
|
End If
|
|||
|
|
|||
|
txtValor.Enabled = True
|
|||
|
cboParamRango.Enabled = True
|
|||
|
|
|||
|
|
|||
|
If Me.CMBGrupo.SelectedValue = 14 Then
|
|||
|
txtClave.Enabled = True
|
|||
|
txtClave.ReadOnly = False
|
|||
|
Else
|
|||
|
txtClave.Enabled = False
|
|||
|
txtClave.ReadOnly = True
|
|||
|
End If
|
|||
|
|
|||
|
'--txtClave.Enabled = False
|
|||
|
|
|||
|
|
|||
|
Me.txtValor.Focus()
|
|||
|
Catch ex As Exception
|
|||
|
MessageBox.Show("Error al cargar Registro" & ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|||
|
End Try
|
|||
|
End Sub
|
|||
|
|
|||
|
|
|||
|
Private Sub BntSalie_Click(sender As System.Object, e As System.EventArgs) Handles BntSalie.Click
|
|||
|
Me.Close()
|
|||
|
End Sub
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Private Sub BtnAlta_Click(sender As System.Object, e As System.EventArgs) Handles BtnAlta.Click
|
|||
|
Dim classcom As New clsComplejo
|
|||
|
Dim strSQLComodin As String
|
|||
|
Dim liclave As Integer
|
|||
|
Dim ClassAud As New ClassMyUtils
|
|||
|
Dim varUser As Long
|
|||
|
Dim ClassComodin As New clsComplejo
|
|||
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|||
|
txtClave.Enabled = True
|
|||
|
|
|||
|
'VALIDACION DE CAMPOS
|
|||
|
Try
|
|||
|
|
|||
|
'If cboParamRango.Text = "" Or cboParamRango.SelectedIndex = -1 Then
|
|||
|
' MessageBox.Show("Es Necesario Introducir el Nombre o Descripcion", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|||
|
' Exit Sub
|
|||
|
'End If
|
|||
|
|
|||
|
If txtValor.Text = "" Then
|
|||
|
MessageBox.Show("Es Necesario Introducir el Valor y/o Descripcion para el catalogo ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|||
|
txtValor.Focus()
|
|||
|
Exit Sub
|
|||
|
End If
|
|||
|
If Me.CMBGrupo.SelectedValue = 14 Then
|
|||
|
If txtClave.Text = "" Then
|
|||
|
MessageBox.Show("Es Necesario Introducir el Valor de la clave para el catalogo ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|||
|
txtClave.Focus()
|
|||
|
Exit Sub
|
|||
|
Else
|
|||
|
liclave = Val(txtClave.Text)
|
|||
|
End If
|
|||
|
Else
|
|||
|
If txtClave.Text = "" Then
|
|||
|
liclave = 999999
|
|||
|
Else
|
|||
|
liclave = Val(txtClave.Text)
|
|||
|
End If
|
|||
|
End If
|
|||
|
|
|||
|
strSQLComodin = "spGrabaCatalogos 'A' , " & Me.CMBGrupo.SelectedValue & "," & liclave & ",'" & Me.txtValor.Text & "'," & Math.Abs(CInt(Me.chkActivo.Checked)) & "," & clsVaribles.varUsuario & ",'" & My.Application.Info.ProductName & "/" & My.User.Name & "','" & My.Computer.Name & "','" & classcom.ObtenFecha(Date.Now.Date, "YYYYMMDD") & "'"
|
|||
|
'Else
|
|||
|
' strSQLComodin = "spParametroGrupo " & Me.CMBGrupo.SelectedValue & " ," & cboParamRango.SelectedValue & ",'" & Me.txtValor.Text & "',3"
|
|||
|
|
|||
|
|
|||
|
'End If
|
|||
|
classcom = New clsComplejo
|
|||
|
classcom.sbInserta(strSQLComodin)
|
|||
|
blnuevo = True
|
|||
|
limpiar()
|
|||
|
'auditoria
|
|||
|
''''''ClassAud.RT_Auditoria(clsVaribles.varUsuario, 98, My.Computer.Name, "Minds Cliente", "ALTA DE PARAMETROGRUPO CLAVE = " & txtClave.Text & " NOMBRE = " & cboParamRango.Text)
|
|||
|
'FIN AUDITORIA
|
|||
|
llenagrid()
|
|||
|
MessageBox.Show("Operación Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|||
|
Catch ex As Exception
|
|||
|
MessageBox.Show("Error al grabar Datos" & ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|||
|
End Try
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub BtnLimpiar_Click(sender As System.Object, e As System.EventArgs) Handles BtnLimpiar.Click
|
|||
|
limpiar()
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub BtnBorrar_Click(sender As System.Object, e As System.EventArgs) Handles BtnBorrar.Click
|
|||
|
Dim classcom As New clsComplejo
|
|||
|
Dim strSQLComodin As String
|
|||
|
Dim liclave As Integer
|
|||
|
|
|||
|
Dim ClassAud As New ClassMyUtils
|
|||
|
Dim varUser As Long
|
|||
|
Dim ClassComodin As New clsComplejo
|
|||
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|||
|
txtClave.Enabled = True
|
|||
|
|
|||
|
'VALIDACION DE CAMPOS
|
|||
|
Try
|
|||
|
If blnuevo = False Then
|
|||
|
MessageBox.Show("Es necesario seleccionar un registro", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|||
|
Exit Sub
|
|||
|
|
|||
|
End If
|
|||
|
If txtClave.Text = "" Then
|
|||
|
liclave = 99999
|
|||
|
Else
|
|||
|
liclave = Val(txtClave.Text)
|
|||
|
End If
|
|||
|
' strSQLComodin = "spGrabaCatalogos 'E' , " & Me.CMBGrupo.SelectedValue & "," & liclave & ",'" & Me.txtValor.Text & "'," & chkActivo.Checked & ",'" & My.Application.Info.ProductName & "/" & My.User.Name & "','" & My.Computer.Name & "','" & classcom.ObtenFecha(Date.Now.Date, "YYYYMMDD") & "'"
|
|||
|
|
|||
|
strSQLComodin = "spGrabaCatalogos 'E' , " & Me.CMBGrupo.SelectedValue & "," & liclave & ",'" & Me.txtValor.Text & "'," & chkActivo.Checked & "," & clsVaribles.varUsuario & ",'" & My.Application.Info.ProductName & "/" & My.User.Name & "','" & My.Computer.Name & "','" & classcom.ObtenFecha(Date.Now.Date, "YYYYMMDD") & "'"
|
|||
|
|
|||
|
' strSQLComodin = "spGrabaCatalogos " & Me.CMBGrupo.SelectedValue & " ,'E'," & cboParamRango.SelectedValue & ",'" & Me.txtValor.Text & "',2"
|
|||
|
classcom = New clsComplejo
|
|||
|
classcom.sbInserta(strSQLComodin)
|
|||
|
blnuevo = False
|
|||
|
limpiar()
|
|||
|
'auditoria
|
|||
|
''''''ClassAud.RT_Auditoria(clsVaribles.varUsuario, 98, My.Computer.Name, "Minds Cliente", "ALTA DE PARAMETROGRUPO CLAVE = " & txtClave.Text & " NOMBRE = " & cboParamRango.Text)
|
|||
|
'FIN AUDITORIA
|
|||
|
llenagrid()
|
|||
|
MessageBox.Show("Operación Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|||
|
Catch ex As Exception
|
|||
|
MessageBox.Show("Error al cargar los Datos" & ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|||
|
End Try
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub BtnImprimir_Click(sender As System.Object, e As System.EventArgs) Handles BtnImprimir.Click
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub CMBGrupo_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles CMBGrupo.SelectedIndexChanged
|
|||
|
limpiar()
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub GridMaster_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GridMaster.Click
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub txtClave_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtClave.TextChanged
|
|||
|
|
|||
|
End Sub
|
|||
|
End Class
|