client/FrmCalStatus.vb

168 lines
6.3 KiB
VB.net
Raw Blame History

Public Class FrmCalStatus
Inherits System.Windows.Forms.Form
Dim clCmpOrg As clsComplejo = New clsComplejo
Public pb As String
Public pb1 As String
Public pb2 As String
Public pb3 As String
Public pb4 As String
Public pb5 As String
Public pbNomFigura As String
Public pb7 As String
Public pb8 As String
Public pb9 As String
Public pb10 As String
''Public pb10 As String
Public fecha As String
Public Comentario As String
''Public pb11 As String
Public pbIdFigura As String
Dim das As DataSet
Public Function Buscaindice(ByVal nomvariabl As String, ByVal ocombo As ComboBox) As Integer
'JLL 27-08-13 encuentra la descripcion seleccionada
Dim i As Integer
Buscaindice = 0
For i = 0 To ocombo.Items.Count - 1
ocombo.SelectedIndex = i
If ocombo.Text() = nomvariabl Then
Buscaindice = i
Exit For
End If
Next
End Function
'JLL 21-08-13 llena combo status
Private Sub CatStatus_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sbIniciaForma()
clCmpOrg.sbLlenaCombo("select descStatus as nombre,Id_status as clave from status", Me.cmbstatus)
Me.txtpersonaboletinada.Text = pb
Me.txtporcentaje.Text = pb1
Me.txtorganismo.Text = pb2
Me.txtpais.Text = pb3
Me.txtclientenombre.Text = pb7
Me.txtnic.Text = pb4
Me.txtestatus.Text = pb8
'Me.txtobservaciones.Text = pb7
Me.txtfecha.Text = fecha
Me.txtidlistarestringida.Text = pb9
Me.txtcomentarios.Text = Comentario
'Me.TxtId_Figura.Text = pb11
'If pb11 = "" Then
' pb11 = 0
'End If
Me.cmbstatus.SelectedIndex = Buscaindice(pb8, Me.cmbstatus)
Me.txtNomFigura.Text = pbNomFigura
Me.TxtId_Figura.Text = pbIdFigura
End Sub
Private Sub LlenoCmb()
'enlazo el combo
Me.cmbstatus.DataBindings.Clear()
Me.cmbstatus.DataBindings.Add("selectedtext", das, "pb11")
Me.cmbstatus.DataSource = das.Tables("Status")
Me.cmbstatus.DisplayMember = "nombre"
Me.cmbstatus.ValueMember = "clave"
End Sub
Private Sub sbIniciaForma()
End Sub
Private Sub btnInsertar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsertar.Click
'JLL 28-08-13 se establece la auditor<6F>a
Try
Dim s1Auditoria As String
Dim ClassAud As New ClassMyUtils
Dim classcom As New clsComplejo
Dim strSQLComodin As String
Dim ClassComodin As New clsComplejo
Dim ds As New DataSet
If txtcomentarios.Text = "" Then
MessageBox.Show("Es Necesario Introducir el Comentario ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
If cmbstatus.Text = "" Then
MessageBox.Show("Es Necesario Introducir el Status ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
'JLL 24-08-2013 armar cadena de guardado
Dim consapos As String
Dim iEsta As Integer
iEsta = Me.cmbstatus.SelectedValue
consapos = "'"
strSQLComodin = "UPDATE listacliente "
strSQLComodin += "SET Comentario = '" & txtcomentarios.Text & "', "
strSQLComodin += "id_Status = " & iEsta & ", "
strSQLComodin += "fechaCambio= Convert(VARCHAR, GETDATE(), 112) " ''--Now.ToString("yyyyMMdd") & "' "
strSQLComodin += "Where ID_ListaRestringida = " & txtidlistarestringida.Text & " "
strSQLComodin += "and id_figura=" & Me.TxtId_Figura.Text
classcom.sbGuardaModifica(strSQLComodin)
s1Auditoria = "Modificacion Lista Restringida "
If txtcomentarios.Text.Trim <> "" Then s1Auditoria = s1Auditoria & " ID=" & txtidlistarestringida.Text.Trim
If txtcomentarios.Text.Trim <> "" Then s1Auditoria = s1Auditoria & " comentario=" & txtcomentarios.Text.Trim
If cmbstatus.Text.Trim <> "" Then s1Auditoria = s1Auditoria & " cambio de status=" & cmbstatus.Text.Trim
s1Auditoria = s1Auditoria + " IdFigura= " & TxtId_Figura.Text.Trim
s1Auditoria = s1Auditoria + " NomFigura= " & txtNomFigura.Text.Trim
s1Auditoria = Mid(s1Auditoria.Trim, 1, 8000)
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 115, My.Computer.Name, "MIND CLIENTE", s1Auditoria)
MessageBox.Show("Datos Guardados correctamente", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
Me.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub btncancelar_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncancelar.Click
Me.Close()
End Sub
Private Sub txtcomentarios_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtcomentarios.KeyPress
'If Char.IsLetter(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
' JMVD 2014-08-19 CAMBIO IF
If Asc(e.KeyChar) = 13 Then
e.KeyChar = ""
End If
End Sub
Public Sub CreateMyMultilineTextBox()
' Create an instance of a TextBox control.
Dim txtcomentarios As New TextBox()
' Set the Multiline property to true.
txtcomentarios.Multiline = True
' Add vertical scroll bars to the TextBox control.
txtcomentarios.ScrollBars = ScrollBars.Vertical
' Allow the TAB key to be entered in the TextBox control.
txtcomentarios.AcceptsReturn = False
' Allow the TAB key to be entered in the TextBox control.
txtcomentarios.AcceptsTab = False
' Set WordWrap to true to allow text to wrap to the next line.
txtcomentarios.WordWrap = True
' Set the default text of the control.
'txtcomentarios.Text = "Welcome!"
End Sub
End Class