640 lines
26 KiB
VB.net
640 lines
26 KiB
VB.net
Public Class FRMyEstado
|
||
|
||
Private Sub FRMyEstado_Load(ByVal sender As System.Object, ByVal 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
|
||
|
||
PnPais.Visible = False
|
||
|
||
|
||
CMBRiesgo.Enabled = False
|
||
Me.Text = "Estados"
|
||
Me.PnPais.Visible = True
|
||
DesHeader.Text = Me.Text
|
||
If clsVaribles.lbDemo = True Then Exit Sub
|
||
|
||
'LLENA GRID
|
||
'SQL = "SELECT idestado CLAVE,Estado NOMBRE,idpais PAIS,ACTIVO FROM cat_estado ORDER BY Estado"
|
||
SQL = "sp_ConsultarEstado "
|
||
|
||
ClassCatalogos.LlenaGrid(SQL, Me.GridMaster)
|
||
|
||
|
||
Classcom.sbLlenaCombo("sp_ConsultarPais ", Me.cmbOrganismo)
|
||
cmbOrganismo.SelectedIndex = -1
|
||
|
||
txtNombre.Enabled = False
|
||
cmbOrganismo.Enabled = False
|
||
txtCalRiesgo.Enabled = False
|
||
chkFronterizo.Enabled = False
|
||
chkActivo.Enabled = False
|
||
ClassCatalogos.CambiaColorbloque2(BtnAgregar, BtnEditar, BtnOk, Button1)
|
||
SQL = "sp_ConsultaCatalogoRiesgo"
|
||
Classcom.sbLlenaCombo(SQL, Me.CMBRiesgo)
|
||
CMBRiesgo.SelectedIndex = -1
|
||
End Sub
|
||
|
||
Private Sub tlbCorteCaja_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs)
|
||
Dim classcom As New clsComplejo
|
||
Dim strSQLComodin As String
|
||
|
||
Select Case e.Button.Text
|
||
Case "Agregar"
|
||
|
||
'pnlBotones.Visible = True
|
||
|
||
txtClave.Enabled = True
|
||
txtAlias.Enabled = True
|
||
txtClave.ReadOnly = False
|
||
txtClave.Text = ""
|
||
txtAlias.Text = ""
|
||
txtNombre.Text = ""
|
||
'txtNombreIngles.Text = ""
|
||
'cmbOrganismo.Text = ""
|
||
clsVaribles.varProceso = "Agregar"
|
||
txtClave.Focus()
|
||
BtnOk.Enabled = True
|
||
|
||
'txtClave.Enabled = True
|
||
txtClave.Visible = False
|
||
txtAlias.Enabled = True
|
||
txtNombre.Enabled = True
|
||
'Me.txtNombreIngles.Enabled = True
|
||
Me.cmbOrganismo.Enabled = True
|
||
Me.chkActivo.Enabled = True
|
||
|
||
Case "Actualizar"
|
||
|
||
'VALIDACION DE CAMPOS
|
||
|
||
'If txtClave.Text = "" Then
|
||
' MessageBox.Show("Es Necesario Introducir el Numero del Pais ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
' Exit Sub
|
||
'End If
|
||
|
||
'If txtNombre.Text = "" Then
|
||
' MessageBox.Show("Es Necesario Introducir el Nombre del Pais ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
' Exit Sub
|
||
'End If
|
||
|
||
'If cmbOrganismo.Text = "" Then
|
||
' MessageBox.Show("Es Necesario Introducir el Organismo ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
' Exit Sub
|
||
'End If
|
||
|
||
''pnlBotones.Visible = False
|
||
|
||
'strSQLComodin = "UPDATE PAIS SET Id_Pais = " & TXTNumero.Text & " ,Id_Organismo = " & Me.cmbOrganismo.SelectedIndex & ""
|
||
'strSQLComodin = strSQLComodin & ",Nombre = '" & txtNombre.Text & "',NombreUs = '" & txtNombreIngles.Text & "',Activo = " & Me.chkActivo.CheckState
|
||
'strSQLComodin = strSQLComodin & " where ID_PAIS = " & TXTNumero.Text
|
||
|
||
'classcom.sbInserta(strSQLComodin)
|
||
|
||
''AUDITORIA
|
||
'Dim ClassAud As New ClassMyUtils
|
||
'Dim varUser As Long
|
||
'Dim ClassComodin As New clsComplejo
|
||
''varUser = ClassComodin.BuscaValores("IdUsuario", "usuario", "usuario = '" & My.User.Name & "'")
|
||
'ClassAud.RT_Auditoria(clsVaribles.varUsuario, 39, My.Computer.Name, "Minds Cliente", "Cambio de Pais CLAVE = " & TXTNumero.Text & " NOMBRE = " & txtNombre.Text)
|
||
''FIN AUDITORIA
|
||
|
||
'MessageBox.Show("Operacion Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
|
||
'C1TrueDBGrid1.DataSource = Nothing
|
||
|
||
'clCmp.fdtDataSetTabla("spGridPais 0")
|
||
'Me.C1TrueDBGrid1.SetDataBinding(clCmp.ds, "Tabla") 'Llena el grid
|
||
|
||
'sbIniciaForma()
|
||
|
||
clsVaribles.varProceso = "Actualizar"
|
||
|
||
txtClave.Enabled = False
|
||
'txtClave.Visible = False
|
||
txtAlias.Enabled = True
|
||
txtNombre.Enabled = True
|
||
'Me.txtNombreIngles.Enabled = True
|
||
Me.cmbOrganismo.Enabled = True
|
||
|
||
Me.chkActivo.Enabled = True
|
||
BtnOk.Enabled = True
|
||
|
||
Case "Desactivar"
|
||
|
||
'If TXTNumero.Text = "" Then
|
||
' MessageBox.Show("Es Necesario Introducir el Numero del Pais ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
' Exit Sub
|
||
'End If
|
||
|
||
'pnlBotones.Visible = False
|
||
|
||
'strSQLComodin = "UPDATE pais SET ACTIVO = 0 where id_pais = " & TXTNumero.Text
|
||
'classcom.sbInserta(strSQLComodin)
|
||
|
||
''AUDITORIA
|
||
'Dim ClassAud As New ClassMyUtils
|
||
'Dim varUser As Long
|
||
'Dim ClassComodin As New clsComplejo
|
||
''varUser = ClassComodin.BuscaValores("IdUsuario", "usuario", "usuario = '" & My.User.Name & "'")
|
||
'ClassAud.RT_Auditoria(clsVaribles.varUsuario, 38, My.Computer.Name, "Minds Cliente", "Baja de Pais CLAVE = " & TXTNumero.Text & " NOMBRE = " & txtNombre.Text)
|
||
''FIN AUDITORIA
|
||
|
||
'MessageBox.Show("Operacion Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
|
||
clsVaribles.varProceso = "Eliminar"
|
||
|
||
txtClave.Enabled = False
|
||
txtAlias.Enabled = False
|
||
txtNombre.Enabled = False
|
||
'Me.txtNombreIngles.Enabled = False
|
||
Me.cmbOrganismo.Enabled = False
|
||
'Me.chkActivo.Enabled = False
|
||
|
||
BtnOk.Enabled = True
|
||
|
||
Case "Salir"
|
||
Me.Close()
|
||
End Select
|
||
|
||
End Sub
|
||
|
||
|
||
Private Sub GridMaster_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridMaster.DoubleClick
|
||
'Recupero Datos del gird
|
||
Me.txtClave.Text = Me.GridMaster.Columns("CLAVE").Value
|
||
Me.txtAlias.Text = Me.GridMaster.Columns("ALIAS").Value
|
||
Me.txtNombre.Text = Me.GridMaster.Columns("Nombre").Value
|
||
'Me.txtNombreIngles.Text = Me.GridMaster.Columns("NOMBREUS").Value
|
||
'Me.cmbOrganismo.ValueMember = Me.C1TrueDBGrid1.Columns("Id_Organismo").Text
|
||
Me.cmbOrganismo.SelectedValue = Me.GridMaster.Columns("IDpais").Value
|
||
Me.chkActivo.Checked = Me.GridMaster.Columns("ACTIVO").Value
|
||
'Hago una consulta ala base de datos para recuperar la clasificacion del pais
|
||
|
||
CMBRiesgo.SelectedValue = Convert.ToInt32(GridMaster.Columns("CALRIESGO").Value)
|
||
chkFronterizo.Checked = GridMaster.Columns("FRONTERIZO").Value
|
||
If cmbOrganismo.SelectedValue <> GridMaster.Columns("idpais").Value Then
|
||
cmbOrganismo.SelectedIndex = -1
|
||
End If
|
||
|
||
|
||
txtClave.Visible = True
|
||
txtClave.Enabled = False
|
||
txtAlias.Enabled = False
|
||
txtNombre.Enabled = False
|
||
'Me.txtNombreIngles.Enabled = False
|
||
Me.cmbOrganismo.Enabled = False
|
||
|
||
Dim SQL As String = ""
|
||
|
||
'SQL = fsDefineSQL("spGridPaisClasificacion ")
|
||
'clCmp1.fdtDataSetTabla(SQL)
|
||
|
||
txtClave.Enabled = False
|
||
BtnEditar.Enabled = True
|
||
chkActivo.Enabled = False
|
||
chkFronterizo.Enabled = False
|
||
txtCalRiesgo.Enabled = False
|
||
|
||
cmbOrganismo.Enabled = False
|
||
|
||
ClassCatalogos.CambiaColorbloque2(BtnAgregar, BtnEditar, BtnOk, Button1)
|
||
|
||
End Sub
|
||
|
||
Private Sub btnAceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
|
||
Dim classcom As New clsComplejo
|
||
Dim strSQLComodin As String
|
||
|
||
Dim ClassAud As New ClassMyUtils
|
||
Dim varUser As Long
|
||
Dim ClassComodin As New clsComplejo
|
||
|
||
Select Case UCase(clsVaribles.varProceso)
|
||
|
||
Case Is = "AGREGAR"
|
||
|
||
txtClave.Enabled = True
|
||
|
||
'VALIDACION DE CAMPOS
|
||
|
||
'If txtClave.Text = "" Then
|
||
' MessageBox.Show("Es Necesario Introducir el Numero del Pais ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
' Exit Sub
|
||
'End If
|
||
|
||
If txtNombre.Text = "" Then
|
||
MessageBox.Show("Es Necesario Introducir el Nombre ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End If
|
||
|
||
If cmbOrganismo.Text = "" Then
|
||
MessageBox.Show("Es Necesario Introducir el Pais ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End If
|
||
|
||
strSQLComodin = "SELECT id_estado FROM estado WHERE nombreestado = '" & txtNombre.Text & "' And id_pais = " & cmbOrganismo.SelectedValue
|
||
|
||
If classcom.BuscaDatos(strSQLComodin) Then
|
||
MessageBox.Show("Este Nombre de Estado ya Existe en el Catalogo para el Mismo Pais ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End If
|
||
|
||
strSQLComodin = "INSERT INTO estado (NombreEstado,id_pais,Id_Catalogo,Activo) VALUES ("
|
||
strSQLComodin = strSQLComodin & "'" & txtNombre.Text & "'," & cmbOrganismo.SelectedValue & " ,8," & Me.chkActivo.CheckState & ")"
|
||
|
||
classcom.sbInserta(strSQLComodin)
|
||
|
||
'AUDITORIA
|
||
|
||
'varUser = ClassComodin.BuscaValores("IdUsuario", "usuario", "usuario = '" & My.User.Name & "'")
|
||
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 83, 1, txtNombre.Text)
|
||
|
||
' ClassAud.RT_Auditoria(clsVaribles.varUsuario, 83, My.Computer.Name, "Minds Cliente", "ALTA DE ESTADO CLAVE = " & txtClave.Text & " NOMBRE = " & txtNombre.Text)
|
||
'FIN AUDITORIA
|
||
|
||
MessageBox.Show("Operaci<EFBFBD>n Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
|
||
|
||
Case Is = "ACTUALIZAR"
|
||
|
||
'VALIDACION DE CAMPOS
|
||
|
||
'If cmbOrganismo.Text = "" Then
|
||
' MessageBox.Show("Es Necesario Introducir el Numero del Tipo de Operacion ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
' Exit Sub
|
||
'End If
|
||
|
||
If txtNombre.Text = "" Then
|
||
MessageBox.Show("Es Necesario Introducir el Nombre del Estado ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End If
|
||
|
||
If cmbOrganismo.Text = "" Then
|
||
MessageBox.Show("Es Necesario Introducir el Pais ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End If
|
||
|
||
'pnlBotones.Visible = False
|
||
|
||
strSQLComodin = "UPDATE estado SET "
|
||
strSQLComodin = strSQLComodin & " nombreestado = '" & txtNombre.Text & "',Activo = " & Me.chkActivo.CheckState & " , id_pais = " & cmbOrganismo.SelectedValue
|
||
strSQLComodin = strSQLComodin & " where id_estado = " & txtClave.Text
|
||
|
||
classcom.sbInserta(strSQLComodin)
|
||
|
||
'AUDITORIA
|
||
'Dim ClassAud As New ClassMyUtils
|
||
'Dim varUser As Long
|
||
'Dim ClassComodin As New clsComplejo
|
||
'varUser = ClassComodin.BuscaValores("IdUsuario", "usuario", "usuario = '" & My.User.Name & "'")
|
||
|
||
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 84, 1, txtNombre.Text)
|
||
|
||
' ClassAud.RT_Auditoria(clsVaribles.varUsuario, 84, My.Computer.Name, "Minds Cliente", "CAMBIO DE ESTADO CLAVE = " & txtClave.Text & " NOMBRE = " & txtNombre.Text)
|
||
'FIN AUDITORIA
|
||
|
||
MessageBox.Show("Operaci<EFBFBD>n Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
|
||
|
||
|
||
classcom = New clsComplejo
|
||
'classcom.fdtDataSetTabla("spGridPais 0")
|
||
'Me.GridMaster.SetDataBinding(classcom.ds, "Tabla") 'Llena el grid
|
||
|
||
'MessageBox.Show("Operacion Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
|
||
Case Is = "ELIMINAR"
|
||
|
||
If txtClave.Text = "" Then
|
||
MessageBox.Show("Es Necesario Introducir el Numero del Estado ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End If
|
||
|
||
'pnlBotones.Visible = False
|
||
|
||
strSQLComodin = "UPDATE Estado SET ACTIVO = 0 where id_estado = '" & txtClave.Text & "' AND id_pais = " & cmbOrganismo.SelectedValue
|
||
classcom.sbInserta(strSQLComodin)
|
||
|
||
''AUDITORIA
|
||
'Dim ClassAud As New ClassMyUtils
|
||
'Dim varUser As Long
|
||
'Dim ClassComodin As New clsComplejo
|
||
''varUser = ClassComodin.BuscaValores("IdUsuario", "usuario", "usuario = '" & My.User.Name & "'")
|
||
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 84, 1, txtNombre.Text)
|
||
|
||
' ClassAud.RT_Auditoria(clsVaribles.varUsuario, 85, My.Computer.Name, "Minds Cliente", "BAJA DE ESTADO CLAVE = " & txtClave.Text & " NOMBRE = " & txtNombre.Text)
|
||
''FIN AUDITORIA
|
||
|
||
MessageBox.Show("Operaci<EFBFBD>n Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
|
||
End Select
|
||
|
||
BtnOk.Enabled = False
|
||
|
||
|
||
Dim SQL As String
|
||
Dim CLASSCATALOGOS As New ClassCatalogos
|
||
|
||
GridMaster.DataSource = Nothing
|
||
SQL = "SELECT id_estado CLAVE,NombreEstado NOMBRE,id_pais PAIS,ACTIVO FROM estado ORDER BY NombreEstado"
|
||
CLASSCATALOGOS.LlenaGrid(SQL, Me.GridMaster)
|
||
|
||
CLASSCATALOGOS.sbLimpiaControlesEsp(PnPais)
|
||
|
||
End Sub
|
||
|
||
Private Sub BtnConsulta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
|
||
|
||
End Sub
|
||
|
||
Private Sub BtnAgregar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAgregar.Click
|
||
|
||
If clsVaribles.lbDemo = True Then Exit Sub
|
||
|
||
'pnlBotones.Visible = True
|
||
|
||
txtClave.Enabled = True
|
||
txtClave.ReadOnly = True
|
||
txtClave.Text = ""
|
||
txtAlias.Enabled = True
|
||
txtAlias.Text = ""
|
||
txtNombre.Text = ""
|
||
'txtNombreIngles.Text = ""
|
||
'cmbOrganismo.Text = ""
|
||
clsVaribles.varProceso = "Agregar"
|
||
BtnOk.Enabled = True
|
||
|
||
'txtClave.Enabled = True
|
||
'txtClave.Visible = True
|
||
|
||
txtNombre.Enabled = True
|
||
'Me.txtNombreIngles.Enabled = True
|
||
Me.cmbOrganismo.Enabled = True
|
||
Me.chkActivo.Enabled = True
|
||
|
||
cmbOrganismo.SelectedIndex = -1
|
||
txtCalRiesgo.Text = 0
|
||
chkFronterizo.Checked = False
|
||
chkActivo.Checked = False
|
||
chkFronterizo.Enabled = True
|
||
chkFronterizo.Checked = False
|
||
txtCalRiesgo.Enabled = True
|
||
BtnEditar.Enabled = False
|
||
ClassCatalogos.CambiaColorbloque2(BtnAgregar, BtnEditar, BtnOk, Button1)
|
||
txtNombre.Focus()
|
||
|
||
End Sub
|
||
|
||
Private Sub BtnEditar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEditar.Click
|
||
|
||
If clsVaribles.lbDemo = True Then Exit Sub
|
||
|
||
clsVaribles.varProceso = "Actualizar"
|
||
CMBRiesgo.Enabled = True
|
||
txtClave.Enabled = False
|
||
txtClave.ReadOnly = True
|
||
'txtClave.Visible = False
|
||
txtAlias.Enabled = True
|
||
txtNombre.Enabled = True
|
||
'Me.txtNombreIngles.Enabled = True
|
||
Me.cmbOrganismo.Enabled = True
|
||
|
||
Me.chkActivo.Enabled = True
|
||
BtnOk.Enabled = True
|
||
BtnEditar.Enabled = False
|
||
CMBRiesgo.Enabled = True
|
||
chkActivo.Enabled = True
|
||
txtCalRiesgo.Enabled = True
|
||
txtNombre.Enabled = True
|
||
ClassCatalogos.CambiaColorbloque2(BtnAgregar, BtnEditar, BtnOk, Button1)
|
||
txtNombre.Focus()
|
||
chkFronterizo.Enabled = True
|
||
End Sub
|
||
Private Function ObtieneRiesgoValor(ByVal idParametro As Integer) As Integer
|
||
Dim Classcom As New clsComplejo
|
||
Dim ssql As String
|
||
Dim Fila As DataRow
|
||
ObtieneRiesgoValor = 0
|
||
ssql = "sp_ConsultaParametroRiesgo " & idParametro & " "
|
||
Classcom = New clsComplejo
|
||
Classcom.fdtDataSet(ssql)
|
||
If Classcom.ds.Tables(0).Rows.Count <> 0 Then
|
||
Fila = Classcom.ds.Tables(0).Rows(0)
|
||
ObtieneRiesgoValor = Fila("valor").ToString
|
||
End If
|
||
End Function
|
||
Private Sub BtnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOk.Click
|
||
|
||
If clsVaribles.lbDemo = True Then Exit Sub
|
||
Dim riesgoValor As Integer
|
||
Dim nRiesgo As Integer
|
||
Dim classcom As New clsComplejo
|
||
Dim strSQLComodin As String
|
||
|
||
Dim ClassAud As New ClassMyUtils
|
||
Dim varUser As Long
|
||
Dim ClassComodin As New clsComplejo
|
||
|
||
If CMBRiesgo.SelectedValue = 1 Then
|
||
nRiesgo = 16
|
||
ElseIf CMBRiesgo.SelectedValue = 2 Then
|
||
nRiesgo = 17
|
||
ElseIf CMBRiesgo.SelectedValue = 3 Then
|
||
nRiesgo = 18
|
||
ElseIf nRiesgo = 0 Then
|
||
End If
|
||
If nRiesgo = 0 Then
|
||
MessageBox.Show("Es necesario elegir un riesgo ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End If
|
||
riesgoValor = ObtieneRiesgoValor(nRiesgo)
|
||
|
||
|
||
Select Case UCase(clsVaribles.varProceso)
|
||
|
||
Case Is = "AGREGAR"
|
||
|
||
txtClave.Enabled = True
|
||
txtAlias.Enabled = True
|
||
|
||
'VALIDACION DE CAMPOS
|
||
|
||
'If txtClave.Text = "" Then
|
||
' MessageBox.Show("Es Necesario Introducir el Numero del Pais ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
' Exit Sub
|
||
'End If
|
||
|
||
If txtNombre.Text = "" Then
|
||
MessageBox.Show("Es Necesario Introducir el Nombre del estado.", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
txtNombre.Focus()
|
||
Exit Sub
|
||
End If
|
||
|
||
If cmbOrganismo.Text = "" Then
|
||
MessageBox.Show("Es Necesario Selecionar el Pa<50>s.", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
cmbOrganismo.Focus()
|
||
Exit Sub
|
||
End If
|
||
|
||
strSQLComodin = "SELECT idestado FROM cat_estado WHERE estado = '" & txtNombre.Text & "' And idpais = " & cmbOrganismo.SelectedValue
|
||
|
||
If classcom.BuscaDatos(strSQLComodin) Then
|
||
MessageBox.Show("Este Nombre de Estado ya Existe en el Catalogo para el Mismo Pa<50>s ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End If
|
||
|
||
'strSQLComodin = "INSERT INTO cat_estado (Estado,idpais,Activo) VALUES ("
|
||
'strSQLComodin = strSQLComodin & "'" & txtNombre.Text & "'," & cmbOrganismo.SelectedValue & " ," & Me.chkActivo.CheckState & ")"
|
||
|
||
strSQLComodin = "sp_CargarEstado NULL," & cmbOrganismo.SelectedValue & ",'" & txtNombre.Text.Trim & "'," & CMBRiesgo.SelectedValue & "," &
|
||
chkFronterizo.CheckState & "," & chkActivo.CheckState & ",'" & txtAlias.Text & "', " & riesgoValor & ""
|
||
|
||
classcom.sbInserta(strSQLComodin)
|
||
|
||
'AUDITORIA
|
||
|
||
'varUser = ClassComodin.BuscaValores("IdUsuario", "usuario", "usuario = '" & My.User.Name & "'")
|
||
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 83, 1, "Valores Nuevos: Estado: " & txtNombre.Text & ", Pais = " & cmbOrganismo.Text & ",Activo = " & Me.chkActivo.CheckState)
|
||
|
||
' ClassAud.RT_Auditoria(clsVaribles.varUsuario, 83, My.Computer.Name, "Minds Cliente", "ALTA DE ESTADO CLAVE = " & txtClave.Text & " NOMBRE = " & txtNombre.Text)
|
||
'FIN AUDITORIA
|
||
|
||
MessageBox.Show("Operaci<EFBFBD>n Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
|
||
|
||
Case Is = "ACTUALIZAR"
|
||
|
||
'VALIDACION DE CAMPOS
|
||
|
||
'If cmbOrganismo.Text = "" Then
|
||
' MessageBox.Show("Es Necesario Introducir el Numero del Tipo de Operacion ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
' Exit Sub
|
||
'End If
|
||
|
||
If txtNombre.Text = "" Then
|
||
MessageBox.Show("Es Necesario Introducir el Nombre del Estado ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End If
|
||
|
||
If cmbOrganismo.Text = "" Then
|
||
MessageBox.Show("Es Necesario Seleccionar el Pa<50>s ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End If
|
||
|
||
'pnlBotones.Visible = False
|
||
'clsVaribles.lsValAnt = ClassAud.FnObtenValAnterior("SpConValoresAnteriores 12," & txtClave.Text)
|
||
|
||
|
||
'strSQLComodin = "UPDATE cat_estado SET "
|
||
'strSQLComodin = strSQLComodin & " estado = '" & txtNombre.Text & "',Activo = " & Me.chkActivo.CheckState & " , idpais = " & cmbOrganismo.SelectedValue
|
||
'strSQLComodin = strSQLComodin & " where idestado = " & txtClave.Text
|
||
|
||
strSQLComodin = "sp_CargarEstado " & txtClave.Text & "," & cmbOrganismo.SelectedValue & ",'" & txtNombre.Text.Trim & "'," & CMBRiesgo.SelectedValue & "," &
|
||
chkFronterizo.CheckState & "," & chkActivo.CheckState & ",'" & txtAlias.Text & "', " & riesgoValor & " "
|
||
|
||
classcom.sbInserta(strSQLComodin)
|
||
|
||
'AUDITORIA
|
||
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 84, 1, clsVaribles.lsValAnt & " | Valores Nuevos: Estado: " & txtNombre.Text & ", Pais = " & cmbOrganismo.Text & ",Activo = " & Me.chkActivo.CheckState)
|
||
|
||
|
||
' ClassAud.RT_Auditoria(clsVaribles.varUsuario, 84, My.Computer.Name, "Minds Cliente", "CAMBIO DE ESTADO CLAVE = " & txtClave.Text & " NOMBRE = " & txtNombre.Text)
|
||
'FIN AUDITORIA
|
||
|
||
MessageBox.Show("Operaci<EFBFBD>n Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
|
||
|
||
|
||
classcom = New clsComplejo
|
||
'classcom.fdtDataSetTabla("spGridPais 0")
|
||
'Me.GridMaster.SetDataBinding(classcom.ds, "Tabla") 'Llena el grid
|
||
|
||
'MessageBox.Show("Operacion Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
|
||
Case Is = "ELIMINAR"
|
||
|
||
If txtClave.Text = "" Then
|
||
MessageBox.Show("Es Necesario Introducir el Numero del Estado ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End If
|
||
|
||
'pnlBotones.Visible = False
|
||
|
||
strSQLComodin = "UPDATE Estado SET ACTIVO = 0 where id_estado = '" & txtClave.Text & "' AND id_pais = " & cmbOrganismo.SelectedValue
|
||
classcom.sbInserta(strSQLComodin)
|
||
|
||
''AUDITORIA
|
||
'Dim ClassAud As New ClassMyUtils
|
||
'Dim varUser As Long
|
||
'Dim ClassComodin As New clsComplejo
|
||
''varUser = ClassComodin.BuscaValores("IdUsuario", "usuario", "usuario = '" & My.User.Name & "'")
|
||
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 84, 1, txtNombre.Text)
|
||
|
||
' ClassAud.RT_Auditoria(clsVaribles.varUsuario, 85, My.Computer.Name, "Minds Cliente", "BAJA DE ESTADO CLAVE = " & txtClave.Text & " NOMBRE = " & txtNombre.Text)
|
||
''FIN AUDITORIA
|
||
|
||
MessageBox.Show("Operaci<EFBFBD>n Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
|
||
End Select
|
||
|
||
BtnOk.Enabled = False
|
||
|
||
|
||
Dim SQL As String
|
||
Dim CLASSCATALOGOS As New ClassCatalogos
|
||
|
||
GridMaster.DataSource = Nothing
|
||
'SQL = "SELECT idestado CLAVE,Estado NOMBRE,idpais PAIS,ACTIVO FROM cat_estado ORDER BY Estado"
|
||
SQL = "sp_ConsultarEstado "
|
||
CLASSCATALOGOS.LlenaGrid(SQL, GridMaster)
|
||
|
||
'CLASSCATALOGOS.sbLimpiaControlesEsp(PnPais)
|
||
|
||
txtClave.Text = ""
|
||
txtAlias.Text = ""
|
||
txtNombre.Text = ""
|
||
cmbOrganismo.SelectedIndex = -1
|
||
cmbOrganismo.SelectedIndex = -1
|
||
txtCalRiesgo.Text = 0
|
||
chkFronterizo.Checked = False
|
||
chkActivo.Checked = False
|
||
|
||
chkActivo.Enabled = False
|
||
chkFronterizo.Enabled = False
|
||
txtCalRiesgo.Enabled = False
|
||
txtAlias.Enabled = False
|
||
txtNombre.Enabled = False
|
||
CMBRiesgo.Enabled = False
|
||
ClassCatalogos.CambiaColorbloque2(BtnAgregar, BtnEditar, BtnOk, Button1)
|
||
|
||
End Sub
|
||
|
||
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
|
||
Me.Close()
|
||
End Sub
|
||
|
||
Private Sub txtCalRiesgo_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtCalRiesgo.KeyPress
|
||
Dim classCom As New clsComplejo
|
||
e.KeyChar = classCom.ValidaCampos("numeros", e.KeyChar)
|
||
|
||
End Sub
|
||
|
||
Private Sub txtCalRiesgo_LostFocus(sender As Object, e As System.EventArgs) Handles txtCalRiesgo.LostFocus
|
||
txtCalRiesgo.Text = IIf(txtCalRiesgo.Text = "", 0, txtCalRiesgo.Text)
|
||
End Sub
|
||
|
||
Private Sub txtCalRiesgo_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtCalRiesgo.TextChanged
|
||
|
||
End Sub
|
||
|
||
Private Sub chkFronterizo_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkFronterizo.CheckedChanged
|
||
|
||
End Sub
|
||
|
||
Private Sub txtClave_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtClave.TextChanged
|
||
|
||
End Sub
|
||
End Class |