client/Actualizadores/MyAsignaGrupo.vb

285 lines
9.9 KiB
VB.net
Raw Normal View History

Public Class MyAsignaGrupo
Private LlenaGrid As New LlenaGrid
Private LlenaCombo As New LlenaCombo
Dim dtGrupos As New DataTable 'Tabla de combo de Grupos de Cuentas
Dim Cuenta As clsComplejo = New clsComplejo
Dim Cliente As clsComplejo = New clsComplejo
Dim BanCliente, BanCuenta, BanPatron, BanStatus, BanProducto As Boolean
Dim blnuevo As Boolean = True
Dim blcarga As Boolean = True
Private Sub MyAsignaGrupo_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
If clsVaribles.lbDemo = True Then Exit Sub
'LLENA GRID
Classcom = New clsComplejo
SQL = "spConTipoCon "
Classcom.sbLlenaCombo(SQL, Me.cboBuscar)
Classcom = New clsComplejo
'SQL = "spConParametrorango 1"
'SQL = "sp_GrupoRiesgoPorId 0"
SQL = " sp_ConsultaGruposRiesgo 0"
Classcom.sbLlenaCombo(SQL, Me.cboGruCue)
blcarga = False
End Sub
Private Sub cboCuenta_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboCuenta.DropDown
If clsVaribles.lbDemo = True Then Exit Sub
Try
If Me.cboCliente.Text = "" Then
Me.cboCliente.Focus()
MessageBox.Show("Debes de seleccionar un cliente ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
If BanCuenta = False Then
Dim cad As String
cad = "spLlenaComboCuenta "
cad = cad & CInt(cboCliente.SelectedValue)
Cuenta.sbLlenaCombo1(cad, Me.cboCuenta)
BanCuenta = True
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub cboCliente_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboCliente.DropDown
Try
If clsVaribles.lbDemo = True Then Exit Sub
If BanCliente = False Then
Cliente.sbLlenaCombo("spLlenaComboCliente", Me.cboCliente)
End If
BanCliente = True
Catch ex As Exception
End Try
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
Dim index = cboGruCue.Items.IndexOf(GridMaster.Columns("IDGRUPORIESGO").Value)
'Dim index As Integer = 0
cboGruCue.SelectedItem = index
cboCliente.Tag = GridMaster.Columns("IDCLIENTE").Value
cboCliente.Text = GridMaster.Columns("NOMBREORAZONS").Value & " " & GridMaster.Columns("APATERNO").Value & " " & GridMaster.Columns("AMATERNO").Value
cboCuenta.Text = GridMaster.Columns("NOCUENTA").Value
cboCuenta.Tag = GridMaster.Columns("IDCUENTA").Value
cboGruCue.SelectedValue = GridMaster.Columns("IDGRUPORIESGO").Value
'Dim index = GridMaster.Columns("IDGRUPORIESGO").Value
'SQL = "spConAsignaGrupo 4, '" & Me.GridMaster.Columns("poliza").Value & "','" & Me.GridMaster.Columns("cliente").Value + "'"
'SQL = "spConAsignaGrupo 4, " & Me.GridMaster.Columns(3).Value & "," & Me.GridMaster.Columns(1).Value
'Classcom = New clsComplejo
'Classcom.fdtDataSet(SQL)
'If Classcom.ds.Tables(0).Rows.Count <> 0 Then
' Fila = Classcom.ds.Tables(0).Rows(0)
' Me.cboCliente.Text = Fila("Nombre Cliente").ToString
' cboCuenta.Text = Fila("No. Cuenta")
' cboGruCue.SelectedValue = Fila("grupo_id")
' blnuevo = True
' PnPais.Enabled = True
' PnPais.Visible = True
' cboGruCue.Enabled = True
'End If
Catch ex As Exception
MessageBox.Show("Error al cargar Registro seleccionado" & 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 llenagrid1()
Dim Classcom As New clsComplejo
Dim ClassCatalogos As New ClassCatalogos
Dim SQL As String
Dim FILA As DataRow
Dim lscriterio As String
Try
'PnPais.Visible = False
If txtCriterio.Text = "" Then
MessageBox.Show("Es necesario introducir un criterio de busqueda ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
txtCriterio.Focus()
Exit Sub
End If
If cboBuscar.SelectedIndex = -1 Then
MessageBox.Show("Es necesario Seleccionar un criterio de Busqueda ", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
cboBuscar.Focus()
Exit Sub
End If
Select Case cboBuscar.Text
Case "Nombre"
SQL = "sp_BusquedaCtaXCriterio " & "'" & txtCriterio.Text.Trim & "'" & ",NULL" & ",NULL"
Case "NIC Cliente"
SQL = "sp_BusquedaCtaXCriterio " & " NULL,'" & txtCriterio.Text.Trim & "'" & ", NULL"
Case "Numero de Cuenta"
SQL = "sp_BusquedaCtaXCriterio " & " NULL,NULL,'" & txtCriterio.Text.Trim & "'"
Case Else
Exit Sub
End Select
'Select Case cboBuscar.SelectedValue
' Case 1, 2, 3
' lscriterio = "'" & txtCriterio.Text & "'"
' 'Case 2, 3
' ' lscriterio = txtCriterio.Text
'End Select
'If Not IsNumeric(txtCriterio.Text) And cboBuscar.SelectedValue = 2 Then
' MessageBox.Show("El criterio para el filtro por idcliente debe ser numerico", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
' Exit Sub
'End If
'SQL = " spConAsignaGrupo " & cboBuscar.SelectedValue & "," & lscriterio
'Classcom.fdtDataTable(SQL)
'GridMaster.Splits(0). = Classcom.dt.Columns(0)
ClassCatalogos.LlenaGrid(SQL, Me.GridMaster)
GridMaster.Visible = True
'txtCriterio.Text = ""
Catch ex As Exception
MessageBox.Show("Error al cargar los Datos" & ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End Sub
Private Sub BtnBuscar_Click(sender As System.Object, e As System.EventArgs) Handles BtnBuscar.Click
llenagrid1()
End Sub
Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
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 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 cboCuenta.Text = "" Or cboCliente.Text = "" Then
MsgBox("Debe seleccionar un registro para realizar esta operaci<63>n.")
Exit Sub
End If
'Dim liAud As Integer
'clsVaribles.lsValAnt = ClassAud.FnObtenValAnterior("SpConValoresAnteriores 4,'" & Me.GridMaster.Columns("No. Cuenta").Value & "','" & Me.GridMaster.Columns("cliente").Value & "'")
'If Len(Trim(clsVaribles.lsValAnt)) = 0 Then
' liAud = 2
'Else
' liAud = 4
'End If
'strSQLComodin = "spGrabaAsignaGrupo " & Me.cboGruCue.SelectedValue & " ,'" & Me.GridMaster.Columns("No. Cuenta").Value & "','" & Me.GridMaster.Columns("cliente").Value & "'"
strSQLComodin = "sp_ActualizarRiesgoEnCta " & cboGruCue.SelectedValue & "," & cboCliente.Tag & "," & cboCuenta.Tag
classcom = New clsComplejo
classcom.sbInserta(strSQLComodin)
'blnuevo = False
'ClassAud.RT_Auditoria(clsVaribles.varUsuario, 68, 1, clsVaribles.lsValAnt & " | Valores Nuevos: Cuenta = " & Me.GridMaster.Columns("No. Cuenta").Value & ", Cliente = " & Me.GridMaster.Columns("cliente").Value & ", Grupo Cta = " & Me.cboGruCue.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
llenagrid1()
MessageBox.Show("Operaci<EFBFBD>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 limpiar()
txtCriterio.Text = ""
cboBuscar.SelectedIndex = -1
cboCliente.Text = ""
cboCuenta.Text = ""
cboGruCue.SelectedIndex = -1
chkActivo.Checked = False
blnuevo = False
'GridMaster.Visible = False
GridMaster.DataSource = Nothing
GridMaster.DataBindings.Clear()
'Me.Refresh()
PnPais.Visible = True
End Sub
Private Sub BtnLimpiar_Click(sender As System.Object, e As System.EventArgs) Handles BtnLimpiar.Click
limpiar()
End Sub
Private Sub GridMaster_Click(sender As System.Object, e As System.EventArgs) Handles GridMaster.Click
End Sub
End Class