client/Actualizadores/FrmOficinas.vb

189 lines
7.1 KiB
VB.net

Public Class FrmOficinas
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
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 = " spConOficinas 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 FrmOficinas_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
'LLENA GRID
SQL = " spConOficinas 0"
ClassCatalogos.LlenaGrid(SQL, Me.GridMaster)
SQL = "spConAplicativo "
Classcom.sbLlenaCombo(SQL, cmbAplicativo)
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 BtnLimpiar_Click(sender As System.Object, e As System.EventArgs) Handles BtnLimpiar.Click
LIMPIAR()
End Sub
Private Sub BtnAlta_Click(sender As System.Object, e As System.EventArgs) Handles BtnAlta.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
'VALIDACION DE CAMPOS
Try
If cmbAplicativo.SelectedIndex = -1 Then
MsgBox("Moneda no válida", 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 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 17," & Val(txtid.Text))
If Len(Trim(clsVaribles.lsValAnt)) = 0 Then
liAud = 2
Else
liAud = 4
End If
strSQLComodin = "spGrabaoficinas 'A'," & Me.cmbAplicativo.SelectedValue & " ,'" & txtNombre.Text & "','" & txtLinea.Text & "'," & cmbAplicativo.SelectedValue & ""
ClassComodin = New clsComplejo
ClassComodin.sbInserta(strSQLComodin)
LIMPIAR()
'auditoria
ClassAud.RT_Auditoria(clsVaribles.varUsuario, liAud, 1, clsVaribles.lsValAnt & " | Valores Nuevos: IdOficina = " & txtid.Text & " Nombre = " & txtNombre.Text _
& ", Aplicativo GNP: " & Me.cmbAplicativo.Text & ", Linea de Negocio: " & txtLinea.Text)
'FIN AUDITORIA Valores Anteriores : IdOficina : 2, Nombre : AGENTE 1, Aplicativo GNP = AZUL, Linea de Negocio = 1
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 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 17," & Val(txtid.Text))
strSQLComodin = "spGrabaoficinas 'E'," & txtid.Text
ClassComodin = New clsComplejo
ClassComodin.sbInserta(strSQLComodin)
blnuevo = False
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 3, 1, clsVaribles.lsValAnt & " | Valores Nuevos: IdOficina = " & txtid.Text & " Nombre = " & txtNombre.Text _
& ", Aplicativo GNP: " & Me.cmbAplicativo.Text & ", Linea de Negocio: " & txtLinea.Text)
LIMPIAR()
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 Sub GridMaster_Click(sender As System.Object, e As System.EventArgs) Handles GridMaster.Click
End Sub
Private Sub GridMaster_DoubleClick(sender As 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 = "spConOficinas 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("Idoficina").ToString
Me.txtNombre.Text = Fila("nombre").ToString
cmbAplicativo.SelectedValue = Fila("IdAplicativoGNP")
End If
Catch ex As Exception
MessageBox.Show("Error al cargar Registro" & ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End Sub
End Class