734 lines
31 KiB
VB.net
734 lines
31 KiB
VB.net
|
Public Class FrmMasterCatalogo
|
|||
|
|
|||
|
Private Sub FrmMasterCatalogo_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
|
|||
|
|
|||
|
SQL = "sp_ConsultaCatalogoRiesgo"
|
|||
|
Classcom.sbLlenaCombo(SQL, Me.CMBRiesgo)
|
|||
|
CMBRiesgo.SelectedIndex = -1
|
|||
|
|
|||
|
Me.Text = "Pa<EFBFBD>ses"
|
|||
|
Me.PnPais.Visible = True
|
|||
|
DesHeader.Text = Me.Text
|
|||
|
CMBRiesgo.Enabled = False
|
|||
|
'If clsVaribles.lbDemo = True Then Exit Sub
|
|||
|
|
|||
|
'LLENA GRID
|
|||
|
'SQL = "SELECT IdPais CLAVE,IdOrganismoInternacional ORGANISMO,PAIS NOMBRE,PAISUS NOMBREUS,ACTIVO FROM CAT_PAIS ORDER BY PAIS"
|
|||
|
SQL = "sp_ConsultarPais "
|
|||
|
|
|||
|
ClassCatalogos.LlenaGrid(SQL, Me.GridMaster)
|
|||
|
GridMaster.Splits(0).DisplayColumns(13).Visible = False
|
|||
|
' Classcom.sbLlenaCombo("sp_ConsultarOrgInternacionales", Me.cmbOrganismo)
|
|||
|
'txtClave.Focus()
|
|||
|
|
|||
|
Call enabledCamposPanel(False)
|
|||
|
|
|||
|
ClassCatalogos.CambiaColorbloque2(BtnAgregar, BtnEditar, BtnOk, Button1)
|
|||
|
'Classcom.fdtDataSet(SQL)
|
|||
|
|
|||
|
|
|||
|
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
|
|||
|
txtClave.ReadOnly = False
|
|||
|
txtClave.Text = ""
|
|||
|
txtNombre.Text = ""
|
|||
|
txtNombreIngles.Text = ""
|
|||
|
cmbOrganismo.Text = ""
|
|||
|
clsVaribles.varProceso = "Agregar"
|
|||
|
txtClave.Focus()
|
|||
|
BtnOk.Enabled = True
|
|||
|
|
|||
|
txtClave.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 = 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
|
|||
|
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 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 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
|
|||
|
|
|||
|
strSQLComodin = "SELECT ID_PAIS FROM PAIS WHERE ID_PAIS = " & txtClave.Text
|
|||
|
|
|||
|
If classcom.BuscaDatos(strSQLComodin) Then
|
|||
|
MessageBox.Show("Esta Clave de Pais ya Existe en el Catalogo ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|||
|
Exit Sub
|
|||
|
End If
|
|||
|
|
|||
|
strSQLComodin = "INSERT INTO Pais (Id_Pais,Id_Organismo,Id_Catalogo,Nombre,NombreUs,Activo,nocooperante,restringido,paraisofiscal,pasonarcoticos,fabricantenarcoticos) VALUES ("
|
|||
|
strSQLComodin = strSQLComodin & txtClave.Text & "," & Me.cmbOrganismo.SelectedIndex & ",15,'" & txtNombre.Text & "','" & txtNombreIngles.Text & "'," & Me.chkActivo.CheckState & "," & Math.Abs(CInt(CHK1.Checked)) & "," & Math.Abs(CInt(CHK2.Checked)) & "," & Math.Abs(CInt(CHK3.Checked)) & "," & Math.Abs(CInt(CHK4.Checked)) & "," & Math.Abs(CInt(CHK5.Checked)) & ")"
|
|||
|
|
|||
|
classcom.sbInserta(strSQLComodin)
|
|||
|
|
|||
|
'AUDITORIA
|
|||
|
|
|||
|
'varUser = ClassComodin.BuscaValores("IdUsuario", "usuario", "usuario = '" & My.User.Name & "'")
|
|||
|
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 31, 1, "ALTA DE PAIS " & txtNombre.Text)
|
|||
|
|
|||
|
' ClassAud.RT_Auditoria(clsVaribles.varUsuario, 37, My.Computer.Name, "Minds Cliente", "ALTA DE PAIS 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 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 = " & txtClave.Text & " ,Id_Organismo = " & Me.cmbOrganismo.SelectedIndex & ""
|
|||
|
strSQLComodin = strSQLComodin & ",Nombre = '" & txtNombre.Text & "',NombreUs = '" & txtNombreIngles.Text & "',Activo = " & Me.chkActivo.CheckState
|
|||
|
strSQLComodin = strSQLComodin & ",nocooperante = " & Math.Abs(CInt(CHK1.Checked))
|
|||
|
strSQLComodin = strSQLComodin & ",restringido = " & Math.Abs(CInt(CHK2.Checked))
|
|||
|
strSQLComodin = strSQLComodin & ",paraisofiscal = " & Math.Abs(CInt(CHK3.Checked))
|
|||
|
strSQLComodin = strSQLComodin & ",pasonarcoticos = " & Math.Abs(CInt(CHK4.Checked))
|
|||
|
strSQLComodin = strSQLComodin & ",fabricantenarcoticos = " & Math.Abs(CInt(CHK5.Checked))
|
|||
|
|
|||
|
strSQLComodin = strSQLComodin & " where ID_PAIS = " & 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, 39, 1, txtNombre.Text)
|
|||
|
|
|||
|
' ClassAud.RT_Auditoria(clsVaribles.varUsuario, 39, My.Computer.Name, "Minds Cliente", "Cambio de Pais 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 Pais ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|||
|
Exit Sub
|
|||
|
End If
|
|||
|
|
|||
|
'pnlBotones.Visible = False
|
|||
|
|
|||
|
strSQLComodin = "UPDATE pais SET ACTIVO = 0 where id_pais = " & 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, 39, 1, "CAMBIO DE ESTATUS DEL PAIS " & txtClave.Text)
|
|||
|
|
|||
|
' ClassAud.RT_Auditoria(clsVaribles.varUsuario, 38, My.Computer.Name, "Minds Cliente", "Baja de Pais 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_PAIS CLAVE,ID_ORGANISMO ORGANISMO,NOMBRE,NOMBREUS,ACTIVO FROM PAIS ORDER BY NOMBRE"
|
|||
|
CLASSCATALOGOS.LlenaGrid(SQL, Me.GridMaster)
|
|||
|
GridMaster.Splits(0).DisplayColumns(13).Visible = False
|
|||
|
|
|||
|
CLASSCATALOGOS.sbLimpiaControlesEsp(PnPais)
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub GridMaster_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GridMaster.Click
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub GridMaster_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridMaster.DoubleClick
|
|||
|
|
|||
|
Dim Classcom As New clsComplejo
|
|||
|
Dim varComodin As Object
|
|||
|
|
|||
|
'SQL = "SELECT IdPais CLAVE,IdOrganismoInternacional ORGANISMO,PAIS NOMBRE,PAISUS NOMBREUS,ACTIVO FROM CAT_PAIS ORDER BY PAIS"
|
|||
|
Call enabledCamposPanel(False)
|
|||
|
'Recupero Datos del gird
|
|||
|
'PUNTAJERIESGO
|
|||
|
Me.txtClave.Text = Me.GridMaster.Columns("CLAVE").Value
|
|||
|
Me.txtNombre.Text = Me.GridMaster.Columns("Nombre").Value
|
|||
|
Me.txtNombreIngles.Text = Me.GridMaster.Columns("PAISUS").Value
|
|||
|
txtIso.Text = GridMaster.Columns("ISO").Value
|
|||
|
'Me.cmbOrganismo.ValueMember = Me.C1TrueDBGrid1.Columns("Id_Organismo").Text
|
|||
|
'Me.cmbOrganismo.SelectedValue = Me.GridMaster.Columns("Organismo").Value
|
|||
|
Me.chkActivo.Checked = Me.GridMaster.Columns("ACTIVO").Value
|
|||
|
|
|||
|
txtRiesgoNac.Text = GridMaster.Columns("PUNTAJERIESGO").Value
|
|||
|
txtRiesgoUbicacion.Text = GridMaster.Columns("PUNTAJEUBICACION").Value
|
|||
|
|
|||
|
|
|||
|
chkCoorporativo.Checked = GridMaster.Columns("COORPORATIVO").Value
|
|||
|
chkLegislacionPLD.Checked = GridMaster.Columns("LEGISLACIONPLD").Value
|
|||
|
|
|||
|
varComodin = Classcom.BuscaValores("nocooperante", "cat_pais", " idpais = " & Me.GridMaster.Columns("CLAVE").Value)
|
|||
|
|
|||
|
If IsDBNull(varComodin) Then
|
|||
|
CHK1.Checked = False
|
|||
|
Else
|
|||
|
CHK1.Checked = varComodin
|
|||
|
End If
|
|||
|
|
|||
|
varComodin = Classcom.BuscaValores("restringido", "cat_pais", " idpais = " & Me.GridMaster.Columns("CLAVE").Value)
|
|||
|
|
|||
|
If IsDBNull(varComodin) Then
|
|||
|
CHK2.Checked = False
|
|||
|
Else
|
|||
|
CHK2.Checked = varComodin
|
|||
|
End If
|
|||
|
|
|||
|
varComodin = Classcom.BuscaValores("paraisofiscal", "cat_pais", " idpais = " & Me.GridMaster.Columns("CLAVE").Value)
|
|||
|
|
|||
|
If IsDBNull(varComodin) Then
|
|||
|
CHK3.Checked = False
|
|||
|
Else
|
|||
|
CHK3.Checked = varComodin
|
|||
|
End If
|
|||
|
|
|||
|
varComodin = Classcom.BuscaValores("pasonarcoticos", "cat_pais", " idpais = " & Me.GridMaster.Columns("CLAVE").Value)
|
|||
|
|
|||
|
If IsDBNull(varComodin) Then
|
|||
|
CHK4.Checked = False
|
|||
|
Else
|
|||
|
CHK4.Checked = varComodin
|
|||
|
End If
|
|||
|
|
|||
|
varComodin = Classcom.BuscaValores("fabricantenarcoticos", "cat_pais", " idpais = " & Me.GridMaster.Columns("CLAVE").Value)
|
|||
|
|
|||
|
If IsDBNull(varComodin) Then
|
|||
|
CHK5.Checked = False
|
|||
|
Else
|
|||
|
CHK5.Checked = varComodin
|
|||
|
End If
|
|||
|
|
|||
|
'Hago una consulta ala base de datos para recuperar la clasificacion del pais
|
|||
|
|
|||
|
txtClave.Enabled = False
|
|||
|
txtNombre.Enabled = False
|
|||
|
Me.txtNombreIngles.Enabled = False
|
|||
|
Me.cmbOrganismo.Enabled = False
|
|||
|
Me.chkActivo.Enabled = False
|
|||
|
Dim SQL As String = ""
|
|||
|
|
|||
|
'SQL = fsDefineSQL("spGridPaisClasificacion ")
|
|||
|
'clCmp1.fdtDataSetTabla(SQL)
|
|||
|
'CMBRiesgo.Enabled = True
|
|||
|
txtClave.Enabled = False
|
|||
|
BtnEditar.Enabled = True
|
|||
|
ClassCatalogos.CambiaColorbloque2(BtnAgregar, BtnEditar, BtnOk, Button1)
|
|||
|
'pnlBotones.Visible = False
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub txtClave_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtClave.KeyPress
|
|||
|
Dim classCom As New ClassCatalogos
|
|||
|
|
|||
|
e.KeyChar = classCom.ValidaCampos("numeros", e.KeyChar)
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub txtClave_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtClave.TextChanged
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub BtnConsulta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAgregar.Click
|
|||
|
|
|||
|
'If clsVaribles.lbDemo = True Then Exit Sub
|
|||
|
|
|||
|
Call enabledCamposPanel(True)
|
|||
|
|
|||
|
txtClave.Enabled = True
|
|||
|
txtClave.ReadOnly = True
|
|||
|
txtClave.Text = ""
|
|||
|
txtNombre.Text = ""
|
|||
|
txtNombreIngles.Text = ""
|
|||
|
cmbOrganismo.Text = ""
|
|||
|
clsVaribles.varProceso = "Agregar"
|
|||
|
|
|||
|
BtnOk.Enabled = True
|
|||
|
|
|||
|
txtClave.Enabled = True
|
|||
|
txtNombre.Enabled = True
|
|||
|
Me.txtNombreIngles.Enabled = True
|
|||
|
Me.cmbOrganismo.Enabled = True
|
|||
|
Me.chkActivo.Enabled = True
|
|||
|
|
|||
|
txtIso.Text = ""
|
|||
|
txtRiesgoNac.Text = 0
|
|||
|
|
|||
|
CHK1.Checked = False
|
|||
|
CHK2.Checked = False
|
|||
|
CHK3.Checked = False
|
|||
|
CHK4.Checked = False
|
|||
|
CHK5.Checked = False
|
|||
|
|
|||
|
chkActivo.Checked = False
|
|||
|
BtnOk.Enabled = True
|
|||
|
chkLegislacionPLD.Checked = False
|
|||
|
chkCoorporativo.Checked = False
|
|||
|
txtNombre.Focus()
|
|||
|
BtnEditar.Enabled = False
|
|||
|
ClassCatalogos.CambiaColorbloque2(BtnAgregar, BtnEditar, BtnOk, Button1)
|
|||
|
|
|||
|
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
|
|||
|
Call enabledCamposPanel(True)
|
|||
|
clsVaribles.varProceso = "Actualizar"
|
|||
|
|
|||
|
txtClave.Enabled = True
|
|||
|
txtNombre.Enabled = True
|
|||
|
Me.txtNombreIngles.Enabled = True
|
|||
|
Me.cmbOrganismo.Enabled = True
|
|||
|
Me.chkActivo.Enabled = True
|
|||
|
CMBRiesgo.Enabled = True
|
|||
|
BtnOk.Enabled = True
|
|||
|
BtnEditar.Enabled = False
|
|||
|
txtNombre.Focus()
|
|||
|
ClassCatalogos.CambiaColorbloque2(BtnAgregar, BtnEditar, BtnOk, Button1)
|
|||
|
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 classcom As New clsComplejo
|
|||
|
Dim strSQLComodin As String
|
|||
|
|
|||
|
Dim ClassAud As New ClassMyUtils
|
|||
|
Dim varUser As Long
|
|||
|
Dim ClassComodin As New clsComplejo
|
|||
|
Dim riesgoValor As Integer
|
|||
|
Dim riesgoValorGeo As Integer
|
|||
|
Dim nRiesgo As Integer
|
|||
|
Dim riesgoGeo As Integer
|
|||
|
|
|||
|
'If CMBRiesgo.SelectedValue = 1 Then
|
|||
|
' nRiesgo = 13
|
|||
|
'ElseIf CMBRiesgo.SelectedValue = 2 Then
|
|||
|
' nRiesgo = 14
|
|||
|
'ElseIf CMBRiesgo.SelectedValue = 3 Then
|
|||
|
' nRiesgo = 15
|
|||
|
'ElseIf nRiesgo = 0 Then
|
|||
|
'End If
|
|||
|
|
|||
|
'If nRiesgo = 0 Then
|
|||
|
' MessageBox.Show("Es necesario seleccionar un riesgo para el pa<70>s", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|||
|
' Exit Sub
|
|||
|
'End If
|
|||
|
'riesgoValor = ObtieneRiesgoValor(nRiesgo)
|
|||
|
|
|||
|
'If CMBRiesgo.SelectedValue = 1 Then
|
|||
|
' riesgoGeo = 19
|
|||
|
'ElseIf CMBRiesgo.SelectedValue = 2 Then
|
|||
|
' riesgoGeo = 20
|
|||
|
'ElseIf CMBRiesgo.SelectedValue = 3 Then
|
|||
|
' riesgoGeo = 21
|
|||
|
'ElseIf nRiesgo = 0 Then
|
|||
|
'End If
|
|||
|
|
|||
|
'riesgoValorGeo = ObtieneRiesgoValor(riesgoGeo)
|
|||
|
|
|||
|
If txtRiesgoNac.Text.Trim = "" Then
|
|||
|
MessageBox.Show("Es necesario capturar riesgo nacionalidad", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|||
|
Exit Sub
|
|||
|
End If
|
|||
|
If txtRiesgoUbicacion.Text.Trim = "" Then
|
|||
|
MessageBox.Show("Es necesario capturar riesgo ubicaci<63>n geogr<67>fica", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|||
|
Exit Sub
|
|||
|
End If
|
|||
|
' txtRiesgoUbicacion
|
|||
|
|
|||
|
|
|||
|
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 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
|
|||
|
|
|||
|
strSQLComodin = "SELECT IDPAIS FROM cat_PAIS WHERE PAIS = '" & txtNombre.Text & "'"
|
|||
|
|
|||
|
If classcom.BuscaDatos(strSQLComodin) Then
|
|||
|
MessageBox.Show("Esta Clave de Pais ya Existe en el Catalogo ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|||
|
Exit Sub
|
|||
|
End If
|
|||
|
|
|||
|
'strSQLComodin = "INSERT INTO cat_Pais (idpais,IdOrganismoInternacional,pais,paisus,Activo,nocooperante,restringido,paraisofiscal,pasonarcoticos,fabricantenarcoticos) VALUES ("
|
|||
|
'strSQLComodin = strSQLComodin & txtClave.Text & "," & Me.cmbOrganismo.SelectedIndex & ",'" & txtNombre.Text & "','" & txtNombreIngles.Text & "'," & Me.chkActivo.CheckState & "," & Math.Abs(CInt(CHK1.Checked)) & "," & Math.Abs(CInt(CHK2.Checked)) & "," & Math.Abs(CInt(CHK3.Checked)) & "," & Math.Abs(CInt(CHK4.Checked)) & "," & Math.Abs(CInt(CHK5.Checked)) & ")"
|
|||
|
|
|||
|
strSQLComodin = "sp_CargarPais " & "NULL,'" & txtIso.Text & "','" & txtNombre.Text & "','" & txtNombreIngles.Text & "'," &
|
|||
|
chkActivo.CheckState & "," & CHK1.CheckState & "," & CHK2.CheckState & "," & CHK3.CheckState & "," &
|
|||
|
CHK4.CheckState & "," & CHK5.CheckState & "," & chkLegislacionPLD.CheckState & "," &
|
|||
|
chkCoorporativo.CheckState & ",NULL , " & Convert.ToInt32(txtRiesgoNac.Text) & " , " & Convert.ToInt32(txtRiesgoUbicacion.Text) & ""
|
|||
|
classcom.sbInserta(strSQLComodin)
|
|||
|
|
|||
|
'AUDITORIA
|
|||
|
|
|||
|
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 37, 1, "Valores Nuevos: idpais: " & txtClave.Text & ", pais = " & txtNombre.Text & ",organismointernacional = " & Me.cmbOrganismo.Text _
|
|||
|
& ",Activo: " & Me.chkActivo.CheckState & ",paisUs = " & txtNombreIngles.Text & ", nocooperante: " & Math.Abs(CInt(CHK1.Checked)) _
|
|||
|
& ",restringido = " & Math.Abs(CInt(CHK2.Checked)) & ",paraisofiscal = " & Math.Abs(CInt(CHK3.Checked)) & ",pasonarcoticos = " & Math.Abs(CInt(CHK4.Checked)) & ",fabricantenarcoticos = " & Math.Abs(CInt(CHK5.Checked)))
|
|||
|
'FIN AUDITORIA
|
|||
|
|
|||
|
MessageBox.Show("Operaci<EFBFBD>n Satisfactoria ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|||
|
|
|||
|
|
|||
|
Case Is = "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
|
|||
|
'clsVaribles.lsValAnt = ClassAud.FnObtenValAnterior("SpConValoresAnteriores 11," & txtClave.Text)
|
|||
|
|
|||
|
'strSQLComodin = "UPDATE cat_PAIS SET idpais = " & txtClave.Text & " ,idorganismointernacional = " & Me.cmbOrganismo.SelectedIndex & ""
|
|||
|
'strSQLComodin = strSQLComodin & ",pais = '" & txtNombre.Text & "',paisUs = '" & txtNombreIngles.Text & "',Activo = " & Me.chkActivo.CheckState
|
|||
|
'strSQLComodin = strSQLComodin & ",nocooperante = " & Math.Abs(CInt(CHK1.Checked))
|
|||
|
'strSQLComodin = strSQLComodin & ",restringido = " & Math.Abs(CInt(CHK2.Checked))
|
|||
|
'strSQLComodin = strSQLComodin & ",paraisofiscal = " & Math.Abs(CInt(CHK3.Checked))
|
|||
|
'strSQLComodin = strSQLComodin & ",pasonarcoticos = " & Math.Abs(CInt(CHK4.Checked))
|
|||
|
'strSQLComodin = strSQLComodin & ",fabricantenarcoticos = " & Math.Abs(CInt(CHK5.Checked))
|
|||
|
|
|||
|
'strSQLComodin = strSQLComodin & " where idpais = " & txtClave.Text
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
strSQLComodin = "sp_CargarPais " & txtClave.Text & ",'" & txtIso.Text & "','" & txtNombre.Text & "','" & txtNombreIngles.Text & "'," &
|
|||
|
chkActivo.CheckState & "," & CHK1.CheckState & "," & CHK2.CheckState & "," & CHK3.CheckState & "," &
|
|||
|
CHK4.CheckState & "," & CHK5.CheckState & "," & chkLegislacionPLD.CheckState & "," &
|
|||
|
chkCoorporativo.CheckState & ",'999999'," & Convert.ToInt32(txtRiesgoNac.Text) & ", " & Convert.ToInt32(txtRiesgoUbicacion.Text) & ""
|
|||
|
|
|||
|
classcom.sbInserta(strSQLComodin)
|
|||
|
|
|||
|
'AUDITORIA
|
|||
|
|
|||
|
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 39, 1, clsVaribles.lsValAnt & " | Valores Nuevos: idpais: " & txtClave.Text & ", pais = " & txtNombre.Text & ",organismointernacional = " & Me.cmbOrganismo.Text _
|
|||
|
& ",Activo: " & Me.chkActivo.CheckState & ",paisUs = " & txtNombreIngles.Text & ", Riesgo Nacionalidad: " & txtRiesgoNac.Text & " , Riesgo Ubicacion Geogr<67>fica: " & txtRiesgoUbicacion.Text & ", nocooperante: " & Math.Abs(CInt(CHK1.Checked)) _
|
|||
|
& ",restringido = " & Math.Abs(CInt(CHK2.Checked)) & ",paraisofiscal = " & Math.Abs(CInt(CHK3.Checked)) & ",pasonarcoticos = " & Math.Abs(CInt(CHK4.Checked)) & ",fabricantenarcoticos = " & Math.Abs(CInt(CHK5.Checked)))
|
|||
|
'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 Pais ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|||
|
Exit Sub
|
|||
|
End If
|
|||
|
|
|||
|
'pnlBotones.Visible = False
|
|||
|
|
|||
|
strSQLComodin = "UPDATE cat_pais SET ACTIVO = 0 where id_pais = " & 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, 38, My.Computer.Name, "Minds Cliente", "Baja de Pais 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 IdPais CLAVE,IdOrganismoInternacional ORGANISMO,PAIS NOMBRE,PAISUS NOMBREUS,ACTIVO FROM CAT_PAIS ORDER BY PAIS"
|
|||
|
'CLASSCATALOGOS.LlenaGrid(SQL, Me.GridMaster)
|
|||
|
|
|||
|
'CLASSCATALOGOS.sbLimpiaControlesEsp(PnPais)
|
|||
|
|
|||
|
SQL = "sp_ConsultarPais "
|
|||
|
CLASSCATALOGOS.LlenaGrid(SQL, Me.GridMaster)
|
|||
|
GridMaster.Splits(0).DisplayColumns(13).Visible = False
|
|||
|
Call enabledCamposPanel(False)
|
|||
|
|
|||
|
txtClave.Text = ""
|
|||
|
txtNombre.Text = ""
|
|||
|
txtNombreIngles.Text = ""
|
|||
|
txtIso.Text = ""
|
|||
|
CMBRiesgo.SelectedValue = -1
|
|||
|
CMBRiesgo.Enabled = False
|
|||
|
'Me.cmbOrganismo.ValueMember = Me.C1TrueDBGrid1.Columns("Id_Organismo").Text
|
|||
|
'Me.cmbOrganismo.SelectedValue = Me.GridMaster.Columns("Organismo").Value
|
|||
|
Me.chkActivo.Checked = False
|
|||
|
txtRiesgoNac.Text = ""
|
|||
|
chkCoorporativo.Checked = False
|
|||
|
chkLegislacionPLD.Checked = False
|
|||
|
CHK1.Checked = False
|
|||
|
CHK2.Checked = False
|
|||
|
CHK3.Checked = False
|
|||
|
CHK4.Checked = False
|
|||
|
CHK5.Checked = False
|
|||
|
txtRiesgoNac.Text = "0"
|
|||
|
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 chkActivo_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkActivo.CheckedChanged
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub txtRiesgo_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtRiesgoNac.KeyPress
|
|||
|
|
|||
|
If Not Char.IsDigit(e.KeyChar) And (Asc(e.KeyChar) <> 8) Then
|
|||
|
e.Handled = True
|
|||
|
Else
|
|||
|
e.Handled = False
|
|||
|
End If
|
|||
|
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub txtRiesgo_Leave(sender As Object, e As System.EventArgs) Handles txtRiesgoNac.Leave
|
|||
|
txtRiesgoNac.Text = IIf(txtRiesgoNac.Text = "", 0, txtRiesgoNac.Text)
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub txtRiesgo_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtRiesgoNac.TextChanged
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub enabledCamposPanel(bool As Boolean)
|
|||
|
|
|||
|
For Each ctrl As Control In PnPais.Controls
|
|||
|
ctrl.Enabled = bool
|
|||
|
Next
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
|
|||
|
End Class
|