212 lines
8.5 KiB
VB.net
212 lines
8.5 KiB
VB.net
Public Class FrmAgentes
|
|
Private lsComando As String
|
|
Dim blnuevo As Boolean = True
|
|
Friend WithEvents txtcompra As System.Windows.Forms.TextBox
|
|
Dim blcarga As Boolean = True
|
|
Dim clase As New ValidaTexto
|
|
Dim clsfecha As New clsComplejo
|
|
|
|
Private Sub LIMPIAR()
|
|
Me.txtNombre.Text = ""
|
|
Me.txtid.Text = ""
|
|
Me.txtLinea.Text = ""
|
|
cmbAplicativo.SelectedIndex = -1
|
|
cmbAplicativo.SelectedIndex = -1
|
|
cmbAgencia.SelectedIndex = -1
|
|
cmbAgencia.SelectedIndex = -1
|
|
cmbOficina.SelectedIndex = -1
|
|
|
|
cmbOficina.SelectedIndex = -1
|
|
End Sub
|
|
|
|
Private Sub Habilita(ByVal Bandera As Boolean)
|
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|
Me.txtcompra.Enabled = Bandera
|
|
Me.txtid.Enabled = Bandera
|
|
Me.txtLinea.Enabled = Bandera
|
|
End Sub
|
|
Private Sub llenagrid()
|
|
Dim Classcom As New clsComplejo
|
|
Dim ClassCatalogos As New ClassCatalogos
|
|
Dim SQL As String
|
|
Dim FILA As DataRow
|
|
Try
|
|
|
|
'LLENA GRID
|
|
SQL = " spConAgente 0"
|
|
ClassCatalogos.LlenaGrid(SQL, Me.GridMaster)
|
|
|
|
Catch ex As Exception
|
|
MessageBox.Show("Error al cargar llenar Grid" & 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 Btnbaja_Click(sender As System.Object, e As System.EventArgs) Handles Btnbaja.Click
|
|
Dim strSQLComodin As String
|
|
|
|
Dim ClassAud As New ClassMyUtils
|
|
Dim varUser As Long
|
|
Dim ClassComodin As New clsComplejo
|
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|
clsfecha = New clsComplejo
|
|
'VALIDACION DE CAMPOS
|
|
Try
|
|
|
|
If txtid.Text = "" Then
|
|
MessageBox.Show("Es Necesario seleccionar el tipo de Moneda ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Exit Sub
|
|
End If
|
|
If MsgBox("¿Desea Eliminar el registro?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "MINDS Cliente") = MsgBoxResult.No Then Exit Sub
|
|
|
|
clsVaribles.lsValAnt = ClassAud.FnObtenValAnterior("SpConValoresAnteriores 16," & txtid.Text)
|
|
|
|
|
|
strSQLComodin = "spGrabaAgentes 'E'," & txtid.Text
|
|
ClassComodin = New clsComplejo
|
|
ClassComodin.sbInserta(strSQLComodin)
|
|
blnuevo = False
|
|
LIMPIAR()
|
|
'auditoria
|
|
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 3, 1, clsVaribles.lsValAnt)
|
|
'FIN AUDITORIA
|
|
llenagrid()
|
|
ClassCatalogos.CambiaColorbloque2(BtnAlta, Btnbaja, BtnLimpiar, BntSalie)
|
|
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 BtnAlta_Click(sender As System.Object, e As System.EventArgs) Handles BtnAlta.Click
|
|
Dim strSQLComodin As String
|
|
Dim liId As Integer
|
|
Dim ClassAud As New ClassMyUtils
|
|
Dim varUser As Long
|
|
Dim ClassComodin As New clsComplejo
|
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|
|
|
'VALIDACION DE CAMPOS
|
|
Try
|
|
|
|
'If cmbAplicativo.SelectedIndex = -1 Then
|
|
' MsgBox("Aplicativo no válido", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Cliente")
|
|
' Exit Sub
|
|
'End If
|
|
|
|
|
|
If Len(txtNombre.Text) = 0 Then
|
|
MsgBox("El Nombre no puede ser un campo sin valor", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Cliente")
|
|
Exit Sub
|
|
End If
|
|
|
|
If Len(txtid.Text) = 0 Then
|
|
liId = 9999999
|
|
Else
|
|
liId = txtid.Text
|
|
End If
|
|
|
|
If MsgBox("¿Desea guardar los cambios?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "MINDS Cliente") = MsgBoxResult.No Then Exit Sub
|
|
|
|
Dim liAud As Integer
|
|
clsVaribles.lsValAnt = ClassAud.FnObtenValAnterior("SpConValoresAnteriores 16," & liId)
|
|
If Len(Trim(clsVaribles.lsValAnt)) = 0 Then
|
|
liAud = 2
|
|
Else
|
|
liAud = 4
|
|
End If
|
|
|
|
|
|
|
|
strSQLComodin = "spGrabaAgentes 'A'," & liId & " ,'" & IIf(cmbAgencia.SelectedIndex = -1, "", cmbAgencia.SelectedValue) & "'"
|
|
strSQLComodin = strSQLComodin & ",'" & IIf(cmbOficina.SelectedIndex = -1, "", cmbOficina.SelectedValue) & "'"
|
|
strSQLComodin = strSQLComodin & ",'" & txtLinea.Text & "'," & IIf(cmbAplicativo.SelectedIndex = -1, "''", cmbAplicativo.SelectedValue) & ",'" & txtNombre.Text & "'"
|
|
|
|
ClassComodin = New clsComplejo
|
|
ClassComodin.sbInserta(strSQLComodin)
|
|
ClassAud.RT_Auditoria(clsVaribles.varUsuario, liAud, 1, clsVaribles.lsValAnt & " | Valores Nuevos: IdAgente = " & txtid.Text & " Descripcion = " & txtNombre.Text _
|
|
& ", Direccion Agencia: " & cmbAgencia.Text & ", Oficina: " & cmbOficina.Text & ", Aplicativo GNP: " & cmbAplicativo.Text & ", Linea de Negocio: " & txtLinea.Text)
|
|
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()
|
|
ClassCatalogos.CambiaColorbloque2(BtnAlta, Btnbaja, BtnLimpiar, BntSalie)
|
|
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 GridMaster_DoubleClick(sender As System.Object, 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 = "spConAgente 3,'" & 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.txtLinea.Text = Fila("lineadenegocio").ToString
|
|
Me.txtid.Text = Fila("IdFuncionario").ToString
|
|
Me.txtNombre.Text = Fila("descripcion").ToString
|
|
|
|
'cmbAplicativo.SelectedValue = Fila("IdAplicativoGNP")
|
|
'cmbAgencia.SelectedValue = Fila("IdDirAgencia")
|
|
'cmbOficina.SelectedValue = Fila("IdOficina")
|
|
|
|
End If
|
|
ClassCatalogos.CambiaColorbloque2(BtnAlta, Btnbaja, BtnLimpiar, BntSalie)
|
|
Catch ex As Exception
|
|
MessageBox.Show("Error al cargar Registro" & ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|
End Try
|
|
End Sub
|
|
Private Sub GridMaster_Click(sender As System.Object, e As System.EventArgs) Handles GridMaster.Click
|
|
|
|
End Sub
|
|
Private Sub BtnLimpiar_Click(sender As System.Object, e As System.EventArgs) Handles BtnLimpiar.Click
|
|
LIMPIAR()
|
|
Dim ClassCatalogos As New ClassCatalogos
|
|
ClassCatalogos.CambiaColorbloque2(BtnAlta, Btnbaja, BtnLimpiar, BntSalie)
|
|
End Sub
|
|
|
|
Private Sub FrmAgentes_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
|
|
Try
|
|
|
|
llenagrid()
|
|
DesHeader.Text = Me.Text
|
|
'SQL = "spConAplicativo "
|
|
'Classcom.sbLlenaCombo(SQL, cmbAplicativo)
|
|
|
|
'Classcom = New clsComplejo
|
|
'SQL = "spConDireccionAgenciaC "
|
|
'Classcom.sbLlenaCombo(SQL, cmbAgencia)
|
|
|
|
'Classcom = New clsComplejo
|
|
'SQL = "spConOficinasC "
|
|
'Classcom.sbLlenaCombo(SQL, cmbOficina)
|
|
ClassCatalogos.CambiaColorbloque2(BtnAlta, Btnbaja, BtnLimpiar, BntSalie)
|
|
Catch ex As Exception
|
|
MessageBox.Show("Error al cargar llenar Grid" & ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|
End Try
|
|
|
|
End Sub
|
|
End Class |