client/VariablesGlobales.vb

236 lines
8.3 KiB
VB.net
Raw Normal View History

Imports System.Collections.Generic
Imports System.Linq
Public Class VariablesGlobales
'--
Public Shared gblUsuario As String = ""
Public Shared gblMaquina As String = ""
Public Shared gblIdUsuario As Integer
Public Shared gblIdPerfilUsuario As Integer
'Public Shared gbConexion As String = ""
Public Shadows TipoAlarma As Integer
Public Shared breview As Boolean
Public Shared bcompli As Boolean
Public Shared gblA24Hrs As Integer = 0
Public Shared gblFecha As String = ""
Public Shared Function ValidaParametros() As Boolean
Dim bOK As Boolean
bOK = False
Dim cMSG As String
If Environment.GetCommandLineArgs.Length > 1 Then
gblUsuario = Environment.GetCommandLineArgs(1)
gblMaquina = Environment.GetCommandLineArgs(2)
'gbConexion = Environment.GetCommandLineArgs(4)
'- despliega los valores enviados del programa de arranque, en la barra de estatus de la mdiform
'-- en caso de que no la use comentar estas dos lineas
mdiForm.ToolStripStatusLabel1.Text = "Usr:" & gblUsuario & " / " & "Maquina:" & gblMaquina
mdiForm.ToolStripStatusLabel1.TextAlign = ContentAlignment.MiddleRight
bOK = True
Else
bOK = False
cMSG = "No se han indicado los parámetros correspondientes " & vbCrLf & _
"para le ejecucion del MINDS CLIENTE"
MsgBox(cMSG, MsgBoxStyle.Exclamation, "MINDS ")
End If
'-- regresa valor obtenido
Return bOK
End Function
Private Shared Function validacionCampos(listaControlesParaValidacion As List(Of Control), listaControlesTotal As List(Of Control), dt As DataTable) As List(Of elementoLista)
Dim result As New List(Of elementoLista)
Dim nombreCampo As String
Dim orden As Integer = 0
Dim mControl As Control
If dt.Rows.Count > 0 Then
For Each ctrl As Control In listaControlesParaValidacion
If ctrl.Tag <> Nothing Then
For Each row As DataRow In dt.Rows
Select Case ctrl.GetType().Name
Case "TextBox"
If (ctrl.Tag.ToString = row(0).ToString() And row(3).Equals(True) And ctrl.Text = "") Then
nombreCampo = ctrl.Name.ToLower.Replace("txt", "lbl")
mControl = listaControlesTotal.Single(Function(x) x.Name.ToLower = nombreCampo)
nombreCampo = listaControlesTotal.FindAll(Function(x) x.GetType.Name = "Label").Find(Function(x) x.Name.ToLower = nombreCampo).Text
orden = listaControlesTotal.FindAll(Function(x) x.GetType.Name = "Label").Find(Function(x) x.Name.ToLower() = ("lbl" & ctrl.Name.ToLower().Replace("txt", ""))).TabIndex
Dim nuevo As New elementoLista()
nuevo.Orden = orden
nuevo.Mensaje = "El campo " & nombreCampo & " es obligatorio."
nuevo.ctrl = mControl
result.Add(nuevo)
End If
Case "ComboBox"
Dim cbo As ComboBox = CType(ctrl, ComboBox)
If cbo.Tag.ToString() = row(0).ToString() And row(3).Equals(True) And cbo.SelectedIndex < 0 Then
nombreCampo = cbo.Name.ToLower.Replace("cbo", "lbl")
mControl = listaControlesTotal.Single(Function(x) x.Name.ToLower = nombreCampo)
nombreCampo = listaControlesTotal.FindAll(Function(x) x.GetType.Name = "Label").Find(Function(x) x.Name.ToLower = nombreCampo).Text
orden = listaControlesTotal.FindAll(Function(x) x.GetType.Name = "Label").Find(Function(x) x.Name.ToLower() = ("lbl" & ctrl.Name.ToLower().Replace("cbo", ""))).TabIndex
'nombreCampo = listaControlesTotal.Find(Function(x) x.Name.ToLower().Replace("cbo", "")).Text
'orden = listaControlesTotal.Find(Function(x) x.Name.ToLower() = ("lbl" & ctrl.Name.ToLower().Replace("cbo", ""))).TabIndex
Dim nuevo As New elementoLista()
nuevo.Orden = orden
nuevo.Mensaje = "El campo " & nombreCampo & " es obligatorio."
nuevo.ctrl = mControl
result.Add(nuevo)
End If
Case "DateTimePicker"
Dim dtp As DateTimePicker = CType(ctrl, DateTimePicker)
If dtp.Tag.ToString() = row(0).ToString() And row(3).Equals(True) And Not dtp.Checked Then
nombreCampo = dtp.Name.ToLower.Replace("dtp", "lbl")
mControl = listaControlesTotal.Single(Function(x) x.Name.ToLower = nombreCampo)
nombreCampo = listaControlesTotal.FindAll(Function(x) x.GetType.Name = "Label").Find(Function(x) x.Name.ToLower = nombreCampo).Text
orden = listaControlesTotal.FindAll(Function(x) x.GetType.Name = "Label").Find(Function(x) x.Name.ToLower() = ("lbl" & ctrl.Name.ToLower().Replace("dtp", ""))).TabIndex
'nombreCampo = listaControlesTotal.Find(Function(x) x.Name.ToLower().Replace("cbo", "")).Text
'orden = listaControlesTotal.Find(Function(x) x.Name.ToLower() = ("lbl" & ctrl.Name.ToLower().Replace("cbo", ""))).TabIndex
Dim nuevo As New elementoLista()
nuevo.Orden = orden
nuevo.Mensaje = "El campo " & nombreCampo & " es obligatorio."
nuevo.ctrl = mControl
result.Add(nuevo)
End If
End Select
Next
End If
Next
End If
Return result
End Function
Public Shared Function validarFuncionario(listaControlesParaValidar As List(Of Control), listaControlesTotal As List(Of Control)) As List(Of elementoLista)
Dim datos As New clsComplejo
datos.fdtDataTable("sp_Val_CamposFuncionario")
Return validacionCampos(listaControlesParaValidar, listaControlesTotal, datos.dt)
End Function
End Class
Public Class elementoLista
Public Orden As Integer
Public Mensaje As String
Public ctrl As Control
End Class
Public Class transferenciaInternacional
Private _idTransferncia? As Integer
Public Property idTransfencia() As Integer
Get
Return _idTransferncia
End Get
Set(ByVal value As Integer)
_idTransferncia = value
End Set
End Property
Private _fechaTransferencia? As Date
Public Property fechaTransferencia() As Date
Get
Return _fechaTransferencia
End Get
Set(ByVal value As Date)
_fechaTransferencia = value
End Set
End Property
Private _campo1 As String
Public Property campo1() As String
Get
Return _campo1
End Get
Set(ByVal value As String)
_campo1 = value
End Set
End Property
Private _campo2 As String
Public Property campo2() As String
Get
Return _campo2
End Get
Set(ByVal value As String)
_campo2 = value
End Set
End Property
Private _campo3 As String
Public Property campo3() As String
Get
Return _campo3
End Get
Set(ByVal value As String)
_campo3 = value
End Set
End Property
Public Sub New(id As Integer, fechaTransfe? As Date, c1 As String, c2 As String, c3 As String)
_idTransferncia = id
_fechaTransferencia = fechaTransfe
_campo1 = c1
_campo2 = c2
_campo3 = c3
End Sub
End Class