1008 lines
35 KiB
VB.net
1008 lines
35 KiB
VB.net
Public Class frmMyParametroGrupo
|
|
Dim blnuevo As Boolean = True
|
|
Dim blcarga As Boolean = True
|
|
|
|
Dim id_Riesgo As Integer = 0
|
|
|
|
Private Sub frmMyParametroGrupo_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
|
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|
PnPais.Visible = False
|
|
|
|
Me.Text = "Parámetros de Grupo"
|
|
Me.PnPais.Visible = True
|
|
Label5.Text = Me.Text
|
|
'LLENA GRID
|
|
SQL = "sp_ConsultaGruposRiesgo 0"
|
|
Classcom.sbLlenaCombo(SQL, Me.CMBGrupo)
|
|
CMBGrupo.SelectedIndex = -1
|
|
Classcom = New clsComplejo
|
|
|
|
SQL = "sp_ConsultaParametros "
|
|
Classcom.sbLlenaCombo(SQL, Me.cboParamRango)
|
|
cboParamRango.SelectedIndex = -1
|
|
blcarga = False
|
|
|
|
Classcom = New clsComplejo
|
|
SQL = "sp_ConsultaPatrones"
|
|
Classcom.sbLlenaCombo(SQL, Me.cboPatron)
|
|
cboPatron.SelectedIndex = -1
|
|
|
|
'Classcom = New clsComplejo
|
|
'SQL = "sp_ConsultaCatalogoDescripcionRiesgo"
|
|
'Classcom.sbLlenaCombo(SQL, Me.cmbDescripcion)
|
|
'cmbDescripcion.SelectedIndex = -1
|
|
'Classcom = New clsComplejo
|
|
'SQL = "sp_ConsultaCatalogoRiesgo"
|
|
'Classcom.sbLlenaCombo(SQL, Me.cmbRiesgo)
|
|
'cmbRiesgo.SelectedIndex = -1
|
|
limpiarParametros()
|
|
|
|
ConsultaParametrosGenerales()
|
|
|
|
cargaRiesgos()
|
|
|
|
ctdbgRiesgos.Splits(0).DisplayColumns.Item(0).Visible = False
|
|
|
|
End Sub
|
|
Private Sub Exportar()
|
|
If GridMaster.DataSource Is Nothing Then
|
|
MessageBox.Show("Presione primero el botón de consultar y despues el boton de exportar.", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
Return
|
|
End If
|
|
|
|
''Preparo la tabla a exportar
|
|
''hago una copia por valor de la tabla
|
|
Dim copyDS As DataSet = GridMaster.DataSource.Copy() ''clCmp.ds.Copy()
|
|
If copyDS.Tables(0) Is Nothing Then
|
|
MessageBox.Show("Presione primero el botón de consultar y despues el boton de exportar.", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
Return
|
|
End If
|
|
If copyDS.Tables(0).Rows.Count = 0 Then
|
|
MessageBox.Show("No existen datos para exportar", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
Return
|
|
End If
|
|
Dim Resul As DialogResult
|
|
Resul = MessageBox.Show("Este proceso puede tardar varios minutos, ¿Deseas continuar? ", "MINDS", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
|
If Resul = DialogResult.No Then
|
|
Return
|
|
End If
|
|
|
|
''Quito las columnas ocultas del grid.
|
|
Dim i As Integer
|
|
For i = 0 To GridMaster.Columns.Count - 1
|
|
If Me.GridMaster.Splits(0).DisplayColumns(i).Visible = False Then
|
|
Dim j As Integer
|
|
For j = 0 To copyDS.Tables(0).Columns.Count - 1
|
|
If Me.GridMaster.Splits(0).DisplayColumns(i).Name = copyDS.Tables(0).Columns.Item(j).ColumnName Then
|
|
copyDS.Tables(0).Columns.Remove(copyDS.Tables(0).Columns.Item(j).ColumnName)
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
Next
|
|
|
|
Try
|
|
Dim sError As String = ""
|
|
''Inicia Exportacion
|
|
'Creo una instancia de la clase aExcel
|
|
Dim clsExcel As aExcel = New aExcel
|
|
'Obtenemos el nombre o el titulo del form
|
|
clsExcel.Titulo = "Parámetros de Grupo"
|
|
'Utilizo la funcion ExportDataset de la clase aExcel
|
|
clsExcel.ExportDataset(copyDS) 'Asigno el dataset a exportar
|
|
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
End Try
|
|
Cursor = System.Windows.Forms.Cursors.Default
|
|
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
|
|
|
|
|
|
Me.Text = "Parametros de Grupo"
|
|
Me.PnPais.Visible = True
|
|
|
|
|
|
If CMBGrupo.SelectedIndex > -1 Then
|
|
'LLENA GRID
|
|
'SQL = " spConParametrorango 3"
|
|
SQL = "sp_ConsultarGrupoPatron " & CMBGrupo.SelectedValue & IIf(cboPatron.SelectedIndex = -1, "", "," & cboPatron.SelectedValue)
|
|
'If blcarga = True Then
|
|
' SQL = SQL & " , 0"
|
|
'Else
|
|
' SQL = SQL & "," & Me.CMBGrupo.SelectedValue
|
|
'End If
|
|
|
|
ClassCatalogos.LlenaGrid(SQL, Me.GridMaster)
|
|
GridMaster.Splits(0).DisplayColumns(0).AutoSize()
|
|
GridMaster.Splits(0).DisplayColumns(1).AutoSize()
|
|
GridMaster.Splits(0).DisplayColumns(2).AutoSize()
|
|
GridMaster.Splits(0).DisplayColumns(3).AutoSize()
|
|
GridMaster.Splits(0).DisplayColumns(4).AutoSize()
|
|
GridMaster.Splits(0).DisplayColumns(0).Visible = False
|
|
GridMaster.Splits(0).DisplayColumns(2).Visible = False
|
|
Else
|
|
GridMaster.ClearFields()
|
|
GridMaster.Refresh()
|
|
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)
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub limpiar()
|
|
txtClave.Text = ""
|
|
cboParamRango.SelectedIndex = -1
|
|
CMBGrupo.SelectedIndex = -1
|
|
cboPatron.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
|
|
|
|
'If GridMaster.RowCount = 0 Then
|
|
' Exit Sub
|
|
'End If
|
|
|
|
Dim descripcionParametro As String
|
|
Dim index As Integer
|
|
|
|
|
|
descripcionParametro = GridMaster.Columns("Parametro").Value
|
|
index = cboParamRango.FindString(descripcionParametro)
|
|
|
|
|
|
If index = -1 Then
|
|
|
|
Exit Sub
|
|
Else
|
|
|
|
cboParamRango.SelectedIndex = index
|
|
End If
|
|
|
|
If GridMaster.RowCount = 0 Then
|
|
Exit Sub
|
|
End If
|
|
|
|
'SQL = "spConParametrorango 4, " & Me.GridMaster.Columns("idgrupocuenta").Value & "," & Me.GridMaster.Columns("idparametrorango").Value
|
|
|
|
SQL = "sp_ConsultarValorDeGpoPatron " & GridMaster.Columns("IdGrupoRiesgo").Value & "," & GridMaster.Columns("idParametro").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("valor").ToString
|
|
cboParamRango.SelectedValue = Fila("IdParametro")
|
|
blnuevo = True
|
|
End If
|
|
|
|
txtValor.Enabled = True
|
|
cboParamRango.Enabled = True
|
|
|
|
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)
|
|
Me.Close()
|
|
End Sub
|
|
|
|
Private Sub BtnAlta_Click(sender As System.Object, 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
|
|
Dim idPatron As Integer
|
|
|
|
Dim Sql As String
|
|
|
|
|
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|
txtClave.Enabled = True
|
|
|
|
'VALIDACION DE CAMPOS
|
|
Try
|
|
|
|
If CMBGrupo.SelectedIndex = -1 Then
|
|
MessageBox.Show("Es Necesario Seleccionar un grupo ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
CMBGrupo.Focus()
|
|
Exit Sub
|
|
End If
|
|
|
|
If cboParamRango.Text = "" Or cboParamRango.SelectedIndex = -1 Then
|
|
MessageBox.Show("Es Necesario Seleccionar un Parametro ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
cboParamRango.Focus()
|
|
|
|
Exit Sub
|
|
End If
|
|
|
|
If txtValor.Text = "" Then
|
|
MessageBox.Show("Es Necesario Introducir el Valor para el parametro ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
txtValor.Focus()
|
|
Exit Sub
|
|
End If
|
|
|
|
'If blnuevo = True Then
|
|
'Dim liAud As Integer
|
|
'clsVaribles.lsValAnt = ClassAud.FnObtenValAnterior("SpConValoresAnteriores 2," & Me.CMBGrupo.SelectedValue & "," & cboParamRango.SelectedValue)
|
|
'If Len(Trim(clsVaribles.lsValAnt)) = 0 Then
|
|
' liAud = 2
|
|
'Else
|
|
' liAud = 4
|
|
'End If
|
|
|
|
'strSQLComodin = "spParametroGrupo " & Me.CMBGrupo.SelectedValue & " ," & cboParamRango.SelectedValue & ",'" & Me.txtValor.Text & "',1"
|
|
'Else
|
|
' strSQLComodin = "spParametroGrupo " & Me.CMBGrupo.SelectedValue & " ," & cboParamRango.SelectedValue & ",'" & Me.txtValor.Text & "',3"
|
|
|
|
|
|
'End If
|
|
|
|
'idPatron
|
|
'sp_ConsultaParametros
|
|
|
|
Sql = "sp_ConsultaParametros " & cboParamRango.SelectedValue
|
|
|
|
|
|
classcom = New clsComplejo
|
|
|
|
classcom.fdtDataSetTabla(Sql)
|
|
|
|
idPatron = classcom.ds.Tables(0).Rows(0)(2)
|
|
|
|
|
|
Sql = "sp_CargarGrupoRiego " & CMBGrupo.SelectedValue & "," & cboParamRango.SelectedValue & "," & txtValor.Text
|
|
|
|
classcom = New clsComplejo
|
|
classcom.sbInserta(Sql)
|
|
|
|
blnuevo = True
|
|
'ClassAud.RT_Auditoria(clsVaribles.varUsuario, 41, 1, clsVaribles.lsValAnt & " | Valores Nuevos: Grupo Poliza = " & Me.CMBGrupo.Text & " Parametro = " & cboParamRango.Text & " Valor = " & Me.txtValor.Text)
|
|
|
|
|
|
|
|
'limpiar()
|
|
cboParamRango.SelectedIndex = -1
|
|
txtValor.Text = ""
|
|
|
|
'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)
|
|
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 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 cboParamRango.Text = "" Or cboParamRango.SelectedIndex = -1 Then
|
|
MessageBox.Show("Es Necesario Seleccionar el Parametro ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Exit Sub
|
|
End If
|
|
Dim idPatron As Integer
|
|
|
|
|
|
Dim liAud As Integer
|
|
'clsVaribles.lsValAnt = ClassAud.FnObtenValAnterior("SpConValoresAnteriores 2," & Me.CMBGrupo.SelectedValue & "," & cboParamRango.SelectedValue)
|
|
'liAud = 3
|
|
|
|
|
|
|
|
strSQLComodin = "sp_ConsultaParametros " & cboParamRango.SelectedValue
|
|
|
|
classcom = New clsComplejo
|
|
|
|
classcom.fdtDataSetTabla(strSQLComodin)
|
|
|
|
idPatron = classcom.dt.Columns("IDPatron").ToString()
|
|
|
|
strSQLComodin = "sp_EliminarGrupoPatron " & CMBGrupo.SelectedValue & "," & idPatron & "," & cboParamRango.SelectedValue
|
|
|
|
'strSQLComodin = "spParametroGrupo " & Me.CMBGrupo.SelectedValue & " ," & cboParamRango.SelectedValue & ",'" & Me.txtValor.Text & "',2"
|
|
|
|
classcom = New clsComplejo
|
|
classcom.sbInserta(strSQLComodin)
|
|
|
|
blnuevo = False
|
|
limpiar()
|
|
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 41, 1, "ELIMINACION DE GRUPO PATRON " & clsVaribles.lsValAnt)
|
|
'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 Function ConsultaParametrosGenerales()
|
|
Dim classcom As New clsComplejo
|
|
Dim ClassCatalogos As New ClassCatalogos
|
|
Dim Fila As DataRow
|
|
Dim sql As String
|
|
'sql = "sp_ConsultaParametrosGenerales 3 "
|
|
'classcom.fdtDataSetTabla(sql)
|
|
'If classcom.ds.Tables(0).Rows.Count <> 0 Then
|
|
' Fila = classcom.ds.Tables(0).Rows(0)
|
|
' txtRiesgoBajoMin.Text = Fila("MINIMO").ToString
|
|
' txtRiesgoBajoMax.Text = Fila("MAXIMO").ToString
|
|
'End If
|
|
'sql = "sp_ConsultaParametrosGenerales 2 "
|
|
'classcom.fdtDataSetTabla(sql)
|
|
'If classcom.ds.Tables(0).Rows.Count <> 0 Then
|
|
' Fila = classcom.ds.Tables(0).Rows(0)
|
|
' txtRiesgoMedioMin.Text = Fila("MINIMO").ToString
|
|
' txtRiesgoMedioMax.Text = Fila("MAXIMO").ToString
|
|
'End If
|
|
'sql = "sp_ConsultaParametrosGenerales 1 "
|
|
'classcom.fdtDataSetTabla(sql)
|
|
'If classcom.ds.Tables(0).Rows.Count <> 0 Then
|
|
' Fila = classcom.ds.Tables(0).Rows(0)
|
|
' txtRiesgoAltoMin.Text = Fila("MINIMO").ToString
|
|
' txtRiesgoAltoMax.Text = Fila("MAXIMO").ToString
|
|
'End If
|
|
|
|
txtOrigenBajo.Text = ObtenerParametro(4)
|
|
txtOrigenMedio.Text = ObtenerParametro(5)
|
|
txtOrigenAlto.Text = ObtenerParametro(6)
|
|
|
|
txtDestinoBajo.Text = ObtenerParametro(7)
|
|
txtDestinoMedio.Text = ObtenerParametro(8)
|
|
txtDestinoAlto.Text = ObtenerParametro(9)
|
|
|
|
txtBajoAct.Text = ObtenerParametro(10)
|
|
txtMedioAct.Text = ObtenerParametro(11)
|
|
txtAltoAct.Text = ObtenerParametro(12)
|
|
|
|
End Function
|
|
|
|
Private Function ObtenerParametro(ByVal idParametros As Integer) As String
|
|
Dim classcom As New clsComplejo
|
|
Dim ClassCatalogos As New ClassCatalogos
|
|
Dim Fila As DataRow
|
|
Dim sql As String
|
|
ObtenerParametro = ""
|
|
sql = "sp_ObtenerControlParametros " & idParametros & " "
|
|
classcom.fdtDataSetTabla(sql)
|
|
If classcom.ds.Tables(0).Rows.Count <> 0 Then
|
|
Fila = classcom.ds.Tables(0).Rows(0)
|
|
ObtenerParametro = Fila("valor").ToString
|
|
End If
|
|
End Function
|
|
|
|
Private Sub CMBGrupo_DropDownClosed(sender As Object, e As System.EventArgs)
|
|
|
|
If CMBGrupo.SelectedValue <> Nothing Then
|
|
txtClave.Text = ""
|
|
cboParamRango.SelectedIndex = -1
|
|
llenagrid()
|
|
blnuevo = True
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub txtValor_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs)
|
|
|
|
If Asc(e.KeyChar) = 46 And InStr(txtValor.Text, ".") > 0 Then
|
|
e.Handled = True
|
|
Exit Sub
|
|
End If
|
|
|
|
|
|
If Asc(e.KeyChar) <> 8 Then
|
|
If (Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57) And Asc(e.KeyChar) <> 46 Then
|
|
e.Handled = True
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub cboPatron_SelectedIndexChanged(sender As System.Object, e As System.EventArgs)
|
|
If CMBGrupo.SelectedIndex <> -1 And cboPatron.SelectedIndex <> -1 Then
|
|
txtClave.Text = ""
|
|
cboParamRango.SelectedIndex = -1
|
|
llenagrid()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub BtnImprimir_Click(sender As Object, e As EventArgs) Handles BtnImprimir.Click
|
|
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
Exportar()
|
|
End Sub
|
|
|
|
Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Private Sub txtCalificacion_KeyPress(sender As Object, e As KeyPressEventArgs)
|
|
|
|
If Asc(e.KeyChar) = 46 And InStr(txtValor.Text, ".") > 0 Then
|
|
e.Handled = True
|
|
Exit Sub
|
|
End If
|
|
|
|
|
|
If Asc(e.KeyChar) <> 8 Then
|
|
If (Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57) And Asc(e.KeyChar) <> 46 Then
|
|
e.Handled = True
|
|
End If
|
|
End If
|
|
|
|
|
|
'If Char.IsDigit(e.KeyChar) Then
|
|
' e.Handled = False
|
|
'ElseIf Char.IsControl(e.KeyChar) Then
|
|
' e.Handled = False
|
|
'ElseIf Char.IsSeparator(e.KeyChar) Then
|
|
' e.Handled = False
|
|
'Else
|
|
' e.Handled = True
|
|
'End If
|
|
|
|
End Sub
|
|
|
|
Private Sub BtnAlta_Click_1(sender As Object, e As 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
|
|
Dim idPatron As Integer
|
|
|
|
Dim Sql As String
|
|
|
|
|
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|
txtClave.Enabled = True
|
|
|
|
'VALIDACION DE CAMPOS
|
|
Try
|
|
|
|
If CMBGrupo.SelectedIndex = -1 Then
|
|
MessageBox.Show("Es Necesario Seleccionar un grupo ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
CMBGrupo.Focus()
|
|
Exit Sub
|
|
End If
|
|
|
|
If cboParamRango.Text = "" Or cboParamRango.SelectedIndex = -1 Then
|
|
MessageBox.Show("Es Necesario Seleccionar un Parametro ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
cboParamRango.Focus()
|
|
|
|
Exit Sub
|
|
End If
|
|
|
|
If txtValor.Text = "" Then
|
|
MessageBox.Show("Es Necesario Introducir el Valor para el parametro ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
txtValor.Focus()
|
|
Exit Sub
|
|
End If
|
|
|
|
'If blnuevo = True Then
|
|
'Dim liAud As Integer
|
|
'clsVaribles.lsValAnt = ClassAud.FnObtenValAnterior("SpConValoresAnteriores 2," & Me.CMBGrupo.SelectedValue & "," & cboParamRango.SelectedValue)
|
|
'If Len(Trim(clsVaribles.lsValAnt)) = 0 Then
|
|
' liAud = 2
|
|
'Else
|
|
' liAud = 4
|
|
'End If
|
|
|
|
'strSQLComodin = "spParametroGrupo " & Me.CMBGrupo.SelectedValue & " ," & cboParamRango.SelectedValue & ",'" & Me.txtValor.Text & "',1"
|
|
'Else
|
|
' strSQLComodin = "spParametroGrupo " & Me.CMBGrupo.SelectedValue & " ," & cboParamRango.SelectedValue & ",'" & Me.txtValor.Text & "',3"
|
|
|
|
|
|
'End If
|
|
|
|
'idPatron
|
|
'sp_ConsultaParametros
|
|
|
|
Sql = "sp_ConsultaParametros " & cboParamRango.SelectedValue
|
|
|
|
|
|
classcom = New clsComplejo
|
|
|
|
classcom.fdtDataSetTabla(Sql)
|
|
|
|
idPatron = classcom.ds.Tables(0).Rows(0)(2)
|
|
|
|
|
|
Sql = "sp_CargarGrupoRiego " & CMBGrupo.SelectedValue & "," & cboParamRango.SelectedValue & "," & txtValor.Text
|
|
|
|
classcom = New clsComplejo
|
|
classcom.sbInserta(Sql)
|
|
|
|
blnuevo = True
|
|
'ClassAud.RT_Auditoria(clsVaribles.varUsuario, 41, 1, clsVaribles.lsValAnt & " | Valores Nuevos: Grupo Poliza = " & Me.CMBGrupo.Text & " Parametro = " & cboParamRango.Text & " Valor = " & Me.txtValor.Text)
|
|
|
|
|
|
|
|
'limpiar()
|
|
cboParamRango.SelectedIndex = -1
|
|
txtValor.Text = ""
|
|
|
|
'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 Function limpiarParametros()
|
|
'cmbRiesgo.SelectedIndex = -1
|
|
'cmbDescripcion.SelectedIndex = -1
|
|
'txtCalificacion.Text = ""
|
|
'chkEstatus.Checked = True
|
|
End Function
|
|
Private Sub Button3_Click(sender As Object, e As EventArgs)
|
|
limpiarParametros()
|
|
End Sub
|
|
Private Function Valida() As Boolean
|
|
Valida = True
|
|
|
|
'If Len(txtRiesgoBajoMax.Text) = 0 Then
|
|
' Valida = False
|
|
' Exit Function
|
|
'End If
|
|
'If Len(txtRiesgoMedioMax.Text) = 0 Then
|
|
' Valida = False
|
|
' Exit Function
|
|
'End If
|
|
|
|
'If Not IsNumeric(txtRiesgoBajoMin.Text) Then
|
|
' MessageBox.Show("En riesgo bajo, el valor Minimo debe ser Númerico.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|
' Valida = False
|
|
' Exit Function
|
|
'End If
|
|
|
|
'If Not IsNumeric(txtRiesgoBajoMax.Text) Then
|
|
' MessageBox.Show("En riesgo bajo, el valor Máximo debe ser Númerico.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|
' Valida = False
|
|
' Exit Function
|
|
'End If
|
|
|
|
'If Not IsNumeric(txtRiesgoMedioMin.Text) Then
|
|
' MessageBox.Show("En riesgo medio, el valor Minimo debe ser Númerico.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|
' Valida = False
|
|
' Exit Function
|
|
'End If
|
|
|
|
'If Not IsNumeric(txtRiesgoMedioMax.Text) Then
|
|
' MessageBox.Show("En riesgo medio, el valor Máximo debe ser Númerico.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|
' Valida = False
|
|
' Exit Function
|
|
'End If
|
|
|
|
'If Not IsNumeric(txtRiesgoAltoMin.Text) Then
|
|
' MessageBox.Show("En riesgo Alto, el valor Minimo debe ser Númerico.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|
' Valida = False
|
|
' Exit Function
|
|
'End If
|
|
|
|
'If Not IsNumeric(txtRiesgoAltoMax.Text) Then
|
|
' MessageBox.Show("En riesgo Alto, el valor Máximo debe ser Númerico.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|
' Valida = False
|
|
' Exit Function
|
|
'End If
|
|
|
|
|
|
|
|
'If Valida Then
|
|
' If Convert.ToSingle(txtRiesgoBajoMax.Text) <= 0 Then
|
|
' MessageBox.Show("Riesgo bajo Max no puede ser 0 o menor a 0", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|
' Valida = False
|
|
' Exit Function
|
|
' End If
|
|
' If Convert.ToSingle(txtRiesgoMedioMax.Text) <= Convert.ToSingle(txtRiesgoMedioMin.Text) Then
|
|
' MessageBox.Show("Riesgo Medio Max no puede ser menor o igual al Riesgo Medio Min", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
|
' Valida = False
|
|
' Exit Function
|
|
' End If
|
|
'End If
|
|
|
|
|
|
|
|
End Function
|
|
Private Sub btnGuardarParametro_Click(sender As Object, e As EventArgs)
|
|
|
|
|
|
'If Valida() Then
|
|
' Try
|
|
' sql = "sp_GuardarParametrosGenerales " & cmbDescripcion.SelectedValue & "," & cmbRiesgo.SelectedValue & "," & txtCalificacion.Text & ", " & chkEstatus.Checked & " "
|
|
' classcom = New clsComplejo
|
|
' classcom.sbInserta(sql)
|
|
' MessageBox.Show("El parámetro se guardó correctamente", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
' Catch ex As Exception
|
|
' MessageBox.Show("Ocurrió un error al guardar el parámetro ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
' End Try
|
|
' ConsultaParametrosGenerales()
|
|
' limpiarParametros()
|
|
' lblID.Text = 0
|
|
'End If
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub Button4_Click(sender As Object, e As EventArgs)
|
|
End
|
|
End Sub
|
|
|
|
Private Sub BntSalie_Click_1(sender As Object, e As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Private Sub GridParametros_DoubleClick(sender As Object, e As EventArgs)
|
|
'lblID.Text = 0
|
|
'Try
|
|
' lblID.Text = GridParametros.Columns(0).Value
|
|
' cmbDescripcion.SelectedValue = GridParametros.Columns(5).Value
|
|
' cmbRiesgo.SelectedValue = GridParametros.Columns(6).Value
|
|
' chkEstatus.Checked = GridParametros.Columns(4).Value
|
|
' txtCalificacion.Text = GridParametros.Columns(3).Value
|
|
'Catch ex As Exception
|
|
' MessageBox.Show(ex.Message)
|
|
'End Try
|
|
End Sub
|
|
|
|
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Private Sub TextBox10_TextChanged(sender As Object, e As EventArgs) Handles txtFideicomiso.TextChanged
|
|
|
|
End Sub
|
|
|
|
Private Sub TextBox8_TextChanged(sender As Object, e As EventArgs) Handles txtMedioAct.TextChanged
|
|
|
|
End Sub
|
|
|
|
Private Sub TextBox7_TextChanged(sender As Object, e As EventArgs) Handles txtAltoAct.TextChanged
|
|
|
|
End Sub
|
|
|
|
Private Sub txtRiesgoBajoMax_TextChanged(sender As Object, e As EventArgs)
|
|
'If Len(txtRiesgoBajoMax.Text) > 0 Then
|
|
' txtRiesgoMedioMin.Text = Convert.ToSingle(txtRiesgoBajoMax.Text) + 1
|
|
'End If
|
|
End Sub
|
|
|
|
Private Sub txtRiesgoMedioMax_TextChanged(sender As Object, e As EventArgs)
|
|
'If Len(txtRiesgoMedioMax.Text) > 0 Then
|
|
' txtRiesgoAltoMin.Text = Convert.ToSingle(txtRiesgoMedioMax.Text) + 1
|
|
'End If
|
|
End Sub
|
|
|
|
Private Sub btnGuardaParametros_Click(sender As Object, e As EventArgs) Handles btnGuardaParametros.Click
|
|
Dim classcom = New clsComplejo
|
|
Dim Sql As String
|
|
|
|
If validarRiesgo() Then
|
|
|
|
Sql = "sp_GuardarParametrosGenerales " & id_Riesgo & "," & Single.Parse(txtMinimo.Text) & "," & Single.Parse(txtMaximo.Text)
|
|
classcom.sbInserta(Sql)
|
|
|
|
MsgBox("Operación realizada correctamente.")
|
|
|
|
limpiarRiesgo()
|
|
|
|
cargaRiesgos()
|
|
|
|
ctdbgRiesgos.Splits(0).DisplayColumns.Item(0).Visible = False
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'Dim classcom As New clsComplejo
|
|
'Dim sql As String = ""
|
|
'If Valida() Then
|
|
' Try
|
|
' sql = "sp_GuardarParametrosGenerales 3, " & txtRiesgoBajoMin.Text & "," & txtRiesgoBajoMax.Text & " "
|
|
' classcom = New clsComplejo
|
|
' classcom.sbInserta(sql)
|
|
' sql = "sp_GuardarParametrosGenerales 2, " & txtRiesgoMedioMin.Text & "," & txtRiesgoMedioMax.Text & " "
|
|
' classcom = New clsComplejo
|
|
' classcom.sbInserta(sql)
|
|
' sql = "sp_GuardarParametrosGenerales 1, " & txtRiesgoAltoMin.Text & "," & txtRiesgoAltoMax.Text & " "
|
|
' classcom = New clsComplejo
|
|
' classcom.sbInserta(sql)
|
|
' '----------------------------------------
|
|
' 'sql = "sp_GuardarParametrosGenerales 3, " & txtRiesgoAltoMin.Text & "," & txtRiesgoAltoMax.Text & " "
|
|
' 'classcom = New clsComplejo
|
|
' 'classcom.sbInserta(sql)
|
|
|
|
|
|
|
|
' MessageBox.Show("El parámetro se guardó correctamente", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
' Catch ex As Exception
|
|
' MessageBox.Show("Ocurrió un error al guardar el parámetro ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
' End Try
|
|
' ConsultaParametrosGenerales()
|
|
' limpiarParametros()
|
|
|
|
'End If
|
|
|
|
End Sub
|
|
|
|
Private Sub txtRiesgoBajoMax_KeyPress(sender As Object, e As KeyPressEventArgs)
|
|
If Asc(e.KeyChar) = 13 Or Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Or Char.IsDigit(e.KeyChar) Then
|
|
e.Handled = False
|
|
Else
|
|
e.Handled = True
|
|
End If
|
|
|
|
'If InStr(txtRiesgoBajoMax.Text, ".") <> 0 And Asc(e.KeyChar) = 46 Then
|
|
' e.Handled = True
|
|
'End If
|
|
End Sub
|
|
|
|
Private Sub txtRiesgoMedioMin_KeyPress(sender As Object, e As KeyPressEventArgs)
|
|
If Asc(e.KeyChar) = 13 Or Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Or Char.IsDigit(e.KeyChar) Then
|
|
e.Handled = False
|
|
Else
|
|
e.Handled = True
|
|
End If
|
|
|
|
'If InStr(txtRiesgoMedioMin.Text, ".") <> 0 And Asc(e.KeyChar) = 46 Then
|
|
' e.Handled = True
|
|
'End If
|
|
End Sub
|
|
|
|
Private Sub BntSalie_Click_2(sender As Object, e As EventArgs) Handles BntSalie.Click
|
|
Me.Close()
|
|
End Sub
|
|
|
|
Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs) Handles txtUbicacionRiesgoAlto.TextChanged
|
|
|
|
End Sub
|
|
|
|
Private Sub TextBox10_TextChanged_1(sender As Object, e As EventArgs) Handles txtOptimizacion.TextChanged
|
|
|
|
End Sub
|
|
|
|
Private Sub TextBox11_TextChanged(sender As Object, e As EventArgs) Handles txtOperaciones.TextChanged
|
|
|
|
End Sub
|
|
|
|
Private Sub cboPatron_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles cboPatron.SelectionChangeCommitted
|
|
|
|
End Sub
|
|
|
|
Private Sub cboPatron_SelectedIndexChanged_1(sender As Object, e As EventArgs) Handles cboPatron.SelectedIndexChanged
|
|
If CMBGrupo.SelectedIndex <> -1 And cboPatron.SelectedIndex <> -1 Then
|
|
txtClave.Text = ""
|
|
cboParamRango.SelectedIndex = -1
|
|
llenagrid()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CMBGrupo_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles CMBGrupo.SelectionChangeCommitted
|
|
txtClave.Text = ""
|
|
cboParamRango.SelectedIndex = -1
|
|
llenagrid()
|
|
End Sub
|
|
|
|
Private Sub BtnLimpiar_Click_1(sender As Object, e As EventArgs) Handles BtnLimpiar.Click
|
|
limpiar()
|
|
End Sub
|
|
|
|
Private Sub txtRiesgoBajoMin_KeyPress(sender As Object, e As KeyPressEventArgs)
|
|
|
|
If Asc(e.KeyChar) = 13 Or Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Or Char.IsDigit(e.KeyChar) Then
|
|
e.Handled = False
|
|
Else
|
|
e.Handled = True
|
|
End If
|
|
|
|
'If InStr(txtRiesgoBajoMin.Text, ".") <> 0 And Asc(e.KeyChar) = 46 Then
|
|
' e.Handled = True
|
|
'End If
|
|
|
|
End Sub
|
|
|
|
Private Sub txtRiesgoMedioMax_KeyPress(sender As Object, e As KeyPressEventArgs)
|
|
If Asc(e.KeyChar) = 13 Or Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Or Char.IsDigit(e.KeyChar) Then
|
|
e.Handled = False
|
|
Else
|
|
e.Handled = True
|
|
End If
|
|
|
|
'If InStr(txtRiesgoMedioMax.Text, ".") <> 0 And Asc(e.KeyChar) = 46 Then
|
|
' e.Handled = True
|
|
'End If
|
|
End Sub
|
|
|
|
Private Sub txtRiesgoAltoMin_KeyPress(sender As Object, e As KeyPressEventArgs)
|
|
If Asc(e.KeyChar) = 13 Or Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Or Char.IsDigit(e.KeyChar) Then
|
|
e.Handled = False
|
|
Else
|
|
e.Handled = True
|
|
End If
|
|
|
|
'If InStr(txtRiesgoAltoMin.Text, ".") <> 0 And Asc(e.KeyChar) = 46 Then
|
|
' e.Handled = True
|
|
'End If
|
|
End Sub
|
|
|
|
Private Sub txtRiesgoAltoMax_KeyPress(sender As Object, e As KeyPressEventArgs)
|
|
If Asc(e.KeyChar) = 13 Or Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Or Char.IsDigit(e.KeyChar) Then
|
|
e.Handled = False
|
|
Else
|
|
e.Handled = True
|
|
End If
|
|
|
|
'If InStr(txtRiesgoAltoMin.Text, ".") <> 0 And Asc(e.KeyChar) = 46 Then
|
|
' e.Handled = True
|
|
'End If
|
|
|
|
End Sub
|
|
|
|
Private Sub key(sender As Object, e As KeyPressEventArgs)
|
|
If Asc(e.KeyChar) = 13 Or Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Or Char.IsDigit(e.KeyChar) Then
|
|
e.Handled = False
|
|
Else
|
|
e.Handled = True
|
|
End If
|
|
|
|
'If InStr(txtRiesgoAltoMin.Text, ".") <> 0 And Asc(e.KeyChar) = 46 Then
|
|
' e.Handled = True
|
|
'End If
|
|
'sender.ToString().IndexOf
|
|
|
|
Dim t As TextBox = DirectCast(sender, TextBox)
|
|
|
|
|
|
If InStr(t.Text, ".") <> 0 And Asc(e.KeyChar) = 46 Then
|
|
e.Handled = True
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub cargaRiesgos()
|
|
Dim Classcom As New clsComplejo
|
|
Dim Sql As String
|
|
|
|
Sql = "sp_ConsultaParametrosGenerales 0 "
|
|
classcom.fdtDataSetTabla(Sql)
|
|
If Classcom.ds.Tables(0).Rows.Count > 0 Then
|
|
ctdbgRiesgos.DataSource = Classcom.ds.Tables(0)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub ctdbgRiesgos_DoubleClick(sender As Object, e As EventArgs) Handles ctdbgRiesgos.DoubleClick
|
|
Dim r As Integer
|
|
|
|
If ctdbgRiesgos.RowCount > 0 Then
|
|
r = ctdbgRiesgos.Row
|
|
id_Riesgo = ctdbgRiesgos.Item(r, 0)
|
|
txtCriterio.Text = ctdbgRiesgos.Item(r, 1)
|
|
txtRiesgo.Text = ctdbgRiesgos.Item(r, 2)
|
|
txtMinimo.Text = ctdbgRiesgos.Item(r, 3)
|
|
txtMaximo.Text = ctdbgRiesgos.Item(r, 4)
|
|
End If
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub limpiarRiesgo()
|
|
|
|
id_Riesgo = 0
|
|
txtCriterio.Text = ""
|
|
txtRiesgo.Text = ""
|
|
txtMinimo.Text = ""
|
|
txtMaximo.Text = ""
|
|
|
|
End Sub
|
|
|
|
Private Sub txtMinimo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMinimo.KeyPress
|
|
key(sender, e)
|
|
End Sub
|
|
|
|
Private Sub txtMaximo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMaximo.KeyPress
|
|
key(sender, e)
|
|
End Sub
|
|
|
|
Private Function validarRiesgo()
|
|
validarRiesgo = True
|
|
|
|
If id_Riesgo = 0 Then
|
|
MsgBox("Selecione un registro de Registro")
|
|
validarRiesgo = False
|
|
Exit Function
|
|
End If
|
|
|
|
|
|
If Not IsNumeric(txtMinimo.Text) Then
|
|
MsgBox(" El valor minimo, debe ser numérico")
|
|
validarRiesgo = False
|
|
txtMinimo.Focus()
|
|
Exit Function
|
|
End If
|
|
|
|
If Not IsNumeric(txtMaximo.Text) Then
|
|
MsgBox("El valor numérico, debe ser numérico")
|
|
validarRiesgo = False
|
|
txtMaximo.Focus()
|
|
Exit Function
|
|
End If
|
|
|
|
End Function
|
|
|
|
|
|
End Class |