client/Reportes/CierreGrupal.vb

603 lines
27 KiB
VB.net
Raw Normal View History

'Imports Microsoft.VisualBasic.Compatibility
Imports System.Data.SqlClient
Imports CLIENTE.SenteciasSQL
Public Class CierreGrupal
Inherits System.Windows.Forms.Form
#Region " C<>digo generado por el Dise<73>ador de Windows Forms "
Public Sub New()
MyBase.New()
'El Dise<73>ador de Windows Forms requiere esta llamada.
InitializeComponent()
'Agregar cualquier inicializaci<63>n despu<70>s de la llamada a InitializeComponent()
End Sub
'Form reemplaza a Dispose para limpiar la lista de componentes.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requerido por el Dise<73>ador de Windows Forms
Private components As System.ComponentModel.IContainer
'NOTA: el Dise<73>ador de Windows Forms requiere el siguiente procedimiento
'Puede modificarse utilizando el Dise<73>ador de Windows Forms.
'No lo modifique con el editor de c<>digo.
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents cmbEstatus As System.Windows.Forms.ComboBox
Friend WithEvents lblRazon As System.Windows.Forms.Label
Friend WithEvents txtDescripcion As System.Windows.Forms.TextBox
Friend WithEvents BtnGuardar As System.Windows.Forms.Button
Friend WithEvents btnCerrar As System.Windows.Forms.Button
Friend WithEvents opfDialog As System.Windows.Forms.OpenFileDialog
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtLista As System.Windows.Forms.TextBox
Friend WithEvents BtnA24Hr As System.Windows.Forms.Button
Friend WithEvents btnAgregarEvidencia As System.Windows.Forms.Button
Private WithEvents panel2 As Panel
Private WithEvents Img_logoCabecera As PictureBox
Friend WithEvents desHeader As Label
Private WithEvents panel3 As Panel
Friend WithEvents Label5 As Label
Friend WithEvents lblFooter As Label
Friend WithEvents txtRazon As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(CierreGrupal))
Me.Label3 = New System.Windows.Forms.Label()
Me.txtDescripcion = New System.Windows.Forms.TextBox()
Me.cmbEstatus = New System.Windows.Forms.ComboBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.lblRazon = New System.Windows.Forms.Label()
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.txtRazon = New System.Windows.Forms.TextBox()
Me.BtnGuardar = New System.Windows.Forms.Button()
Me.btnCerrar = New System.Windows.Forms.Button()
Me.opfDialog = New System.Windows.Forms.OpenFileDialog()
Me.Label1 = New System.Windows.Forms.Label()
Me.txtLista = New System.Windows.Forms.TextBox()
Me.BtnA24Hr = New System.Windows.Forms.Button()
Me.btnAgregarEvidencia = New System.Windows.Forms.Button()
Me.panel2 = New System.Windows.Forms.Panel()
Me.Img_logoCabecera = New System.Windows.Forms.PictureBox()
Me.desHeader = New System.Windows.Forms.Label()
Me.panel3 = New System.Windows.Forms.Panel()
Me.Label5 = New System.Windows.Forms.Label()
Me.lblFooter = New System.Windows.Forms.Label()
Me.panel2.SuspendLayout()
CType(Me.Img_logoCabecera, System.ComponentModel.ISupportInitialize).BeginInit()
Me.panel3.SuspendLayout()
Me.SuspendLayout()
'
'Label3
'
Me.Label3.ForeColor = System.Drawing.Color.Black
Me.Label3.Location = New System.Drawing.Point(33, 124)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(58, 17)
Me.Label3.TabIndex = 2
Me.Label3.Text = "Estatus:"
'
'txtDescripcion
'
Me.txtDescripcion.Location = New System.Drawing.Point(183, 159)
Me.txtDescripcion.Multiline = True
Me.txtDescripcion.Name = "txtDescripcion"
Me.txtDescripcion.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.txtDescripcion.Size = New System.Drawing.Size(494, 63)
Me.txtDescripcion.TabIndex = 5
'
'cmbEstatus
'
Me.cmbEstatus.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cmbEstatus.Location = New System.Drawing.Point(183, 121)
Me.cmbEstatus.Name = "cmbEstatus"
Me.cmbEstatus.Size = New System.Drawing.Size(174, 21)
Me.cmbEstatus.TabIndex = 3
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.Transparent
Me.Label2.ForeColor = System.Drawing.Color.Black
Me.Label2.Location = New System.Drawing.Point(33, 162)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(82, 16)
Me.Label2.TabIndex = 4
Me.Label2.Text = "Descripci<EFBFBD>n:"
'
'lblRazon
'
Me.lblRazon.BackColor = System.Drawing.Color.Transparent
Me.lblRazon.ForeColor = System.Drawing.Color.Black
Me.lblRazon.Location = New System.Drawing.Point(35, 235)
Me.lblRazon.Name = "lblRazon"
Me.lblRazon.Size = New System.Drawing.Size(56, 16)
Me.lblRazon.TabIndex = 6
Me.lblRazon.Text = "Raz<EFBFBD>n:"
'
'ImageList1
'
Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Turquoise
Me.ImageList1.Images.SetKeyName(0, "")
Me.ImageList1.Images.SetKeyName(1, "")
Me.ImageList1.Images.SetKeyName(2, "")
Me.ImageList1.Images.SetKeyName(3, "")
Me.ImageList1.Images.SetKeyName(4, "")
Me.ImageList1.Images.SetKeyName(5, "")
Me.ImageList1.Images.SetKeyName(6, "")
Me.ImageList1.Images.SetKeyName(7, "")
Me.ImageList1.Images.SetKeyName(8, "")
Me.ImageList1.Images.SetKeyName(9, "")
'
'txtRazon
'
Me.txtRazon.Location = New System.Drawing.Point(183, 235)
Me.txtRazon.Multiline = True
Me.txtRazon.Name = "txtRazon"
Me.txtRazon.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.txtRazon.Size = New System.Drawing.Size(494, 68)
Me.txtRazon.TabIndex = 7
'
'BtnGuardar
'
Me.BtnGuardar.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.BtnGuardar.BackColor = System.Drawing.Color.Black
Me.BtnGuardar.Cursor = System.Windows.Forms.Cursors.Hand
Me.BtnGuardar.ForeColor = System.Drawing.Color.White
Me.BtnGuardar.Location = New System.Drawing.Point(698, 83)
Me.BtnGuardar.Name = "BtnGuardar"
Me.BtnGuardar.Size = New System.Drawing.Size(108, 33)
Me.BtnGuardar.TabIndex = 8
Me.BtnGuardar.Text = "&Guardar"
Me.BtnGuardar.UseVisualStyleBackColor = False
'
'btnCerrar
'
Me.btnCerrar.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnCerrar.BackColor = System.Drawing.Color.Black
Me.btnCerrar.Cursor = System.Windows.Forms.Cursors.Hand
Me.btnCerrar.ForeColor = System.Drawing.Color.White
Me.btnCerrar.Location = New System.Drawing.Point(698, 270)
Me.btnCerrar.Name = "btnCerrar"
Me.btnCerrar.Size = New System.Drawing.Size(108, 33)
Me.btnCerrar.TabIndex = 9
Me.btnCerrar.Text = "&Cerrar"
Me.btnCerrar.UseVisualStyleBackColor = False
'
'opfDialog
'
Me.opfDialog.FileName = "OpenFileDialog1"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.ForeColor = System.Drawing.Color.Black
Me.Label1.Location = New System.Drawing.Point(33, 69)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(153, 13)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Gesti<EFBFBD>n Grupal Transacciones:"
'
'txtLista
'
Me.txtLista.ForeColor = System.Drawing.Color.White
Me.txtLista.Location = New System.Drawing.Point(183, 44)
Me.txtLista.Multiline = True
Me.txtLista.Name = "txtLista"
Me.txtLista.ReadOnly = True
Me.txtLista.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.txtLista.Size = New System.Drawing.Size(494, 63)
Me.txtLista.TabIndex = 1
'
'BtnA24Hr
'
Me.BtnA24Hr.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.BtnA24Hr.BackColor = System.Drawing.Color.Black
Me.BtnA24Hr.Cursor = System.Windows.Forms.Cursors.Hand
Me.BtnA24Hr.ForeColor = System.Drawing.Color.White
Me.BtnA24Hr.Location = New System.Drawing.Point(698, 124)
Me.BtnA24Hr.Name = "BtnA24Hr"
Me.BtnA24Hr.Size = New System.Drawing.Size(108, 33)
Me.BtnA24Hr.TabIndex = 156
Me.BtnA24Hr.Text = "&Alarma 24 Horas"
Me.BtnA24Hr.UseVisualStyleBackColor = False
Me.BtnA24Hr.Visible = False
'
'btnAgregarEvidencia
'
Me.btnAgregarEvidencia.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnAgregarEvidencia.BackColor = System.Drawing.Color.Black
Me.btnAgregarEvidencia.Cursor = System.Windows.Forms.Cursors.Hand
Me.btnAgregarEvidencia.ForeColor = System.Drawing.Color.White
Me.btnAgregarEvidencia.Location = New System.Drawing.Point(698, 44)
Me.btnAgregarEvidencia.Name = "btnAgregarEvidencia"
Me.btnAgregarEvidencia.Size = New System.Drawing.Size(108, 33)
Me.btnAgregarEvidencia.TabIndex = 159
Me.btnAgregarEvidencia.Text = "Agregar &Evidencia"
Me.btnAgregarEvidencia.UseVisualStyleBackColor = False
'
'panel2
'
Me.panel2.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.panel2.BackColor = System.Drawing.Color.Black
Me.panel2.Controls.Add(Me.Img_logoCabecera)
Me.panel2.Controls.Add(Me.desHeader)
Me.panel2.ForeColor = System.Drawing.Color.Navy
Me.panel2.Location = New System.Drawing.Point(-6, -9)
Me.panel2.Name = "panel2"
Me.panel2.Size = New System.Drawing.Size(827, 47)
Me.panel2.TabIndex = 163
'
'Img_logoCabecera
'
Me.Img_logoCabecera.Image = Global.CLIENTE.My.Resources.Resources.blackrock_logo
Me.Img_logoCabecera.Location = New System.Drawing.Point(704, 0)
Me.Img_logoCabecera.Name = "Img_logoCabecera"
Me.Img_logoCabecera.Size = New System.Drawing.Size(117, 50)
Me.Img_logoCabecera.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.Img_logoCabecera.TabIndex = 360
Me.Img_logoCabecera.TabStop = False
'
'desHeader
'
Me.desHeader.AutoSize = True
Me.desHeader.BackColor = System.Drawing.Color.Transparent
Me.desHeader.Font = New System.Drawing.Font("Century Gothic", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.desHeader.ForeColor = System.Drawing.SystemColors.Window
Me.desHeader.Location = New System.Drawing.Point(21, 18)
Me.desHeader.Name = "desHeader"
Me.desHeader.Size = New System.Drawing.Size(70, 22)
Me.desHeader.TabIndex = 2
Me.desHeader.Text = "Perfiles"
'
'panel3
'
Me.panel3.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.panel3.BackColor = System.Drawing.Color.Black
Me.panel3.Controls.Add(Me.Label5)
Me.panel3.Controls.Add(Me.lblFooter)
Me.panel3.ForeColor = System.Drawing.Color.Navy
Me.panel3.Location = New System.Drawing.Point(-6, 360)
Me.panel3.Name = "panel3"
Me.panel3.Size = New System.Drawing.Size(842, 33)
Me.panel3.TabIndex = 365
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.BackColor = System.Drawing.Color.Transparent
Me.Label5.Font = New System.Drawing.Font("Century Gothic", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.ForeColor = System.Drawing.SystemColors.Window
Me.Label5.Location = New System.Drawing.Point(766, 5)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(42, 17)
Me.Label5.TabIndex = 3
Me.Label5.Text = "Minds"
'
'lblFooter
'
Me.lblFooter.AutoSize = True
Me.lblFooter.BackColor = System.Drawing.Color.Transparent
Me.lblFooter.Font = New System.Drawing.Font("Century Gothic", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblFooter.ForeColor = System.Drawing.SystemColors.Window
Me.lblFooter.Location = New System.Drawing.Point(1019, 7)
Me.lblFooter.Name = "lblFooter"
Me.lblFooter.Size = New System.Drawing.Size(42, 17)
Me.lblFooter.TabIndex = 2
Me.lblFooter.Text = "Minds"
'
'CierreGrupal
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.White
Me.ClientSize = New System.Drawing.Size(818, 389)
Me.Controls.Add(Me.panel3)
Me.Controls.Add(Me.panel2)
Me.Controls.Add(Me.btnAgregarEvidencia)
Me.Controls.Add(Me.BtnA24Hr)
Me.Controls.Add(Me.txtLista)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.btnCerrar)
Me.Controls.Add(Me.BtnGuardar)
Me.Controls.Add(Me.txtRazon)
Me.Controls.Add(Me.lblRazon)
Me.Controls.Add(Me.cmbEstatus)
Me.Controls.Add(Me.txtDescripcion)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.Name = "CierreGrupal"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Detalle Agrupaci<63>n Alarmas"
Me.panel2.ResumeLayout(False)
Me.panel2.PerformLayout()
CType(Me.Img_logoCabecera, System.ComponentModel.ISupportInitialize).EndInit()
Me.panel3.ResumeLayout(False)
Me.panel3.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
Dim frmReporteDivisas As InusualesDivisas = New InusualesDivisas
Dim clCmp As clsComplejo = New clsComplejo
Dim clCmp1 As clsComplejo = New clsComplejo
Dim clCmpCombo As clsComplejo = New clsComplejo
Dim clCmpGrid As clsComplejo = New clsComplejo
Dim clsVAr As clsVaribles = New clsVaribles
Dim i As Integer
Dim statusT, CadSQL As String
Public ListaTransacciones As String
Public arreglo(0 To 10000, 0 To 2) As String
Private Sub DetalleDivisas_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
'si el estatus de transacion es = a 3 (cerrado) se muestran los controles deshabilitados
'LLENO COMBO de estatus de transaccion
clCmpCombo.sbLlenaCombo("SELECT IDESTATUSALARMA AS clave, ESTATUSALARMA AS nombre FROM CAT_ESTATUSALARMA", Me.cmbEstatus)
Me.cmbEstatus.SelectedIndex = 0 'Sea asigna el valor q trae antes
txtLista.Text = ListaTransacciones
desHeader.Text = Me.Text
Catch er As Exception
MessageBox.Show("Detalle de cierre grupal:" & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub ' Fin carga form+
Private Sub CargaDatos()
Try
'Carga el valor del campo NOTA
Dim SQLcad As String
SQLcad = "SELECT isnull(Nota,'') nota , isnull(Razon,'') razon FROM " & _
" TransaccionReporte TR WHERE TR.IdTransaccion = " & _
clsVaribles.Id_Transaccion & " AND TR.IdProducto = " & _
clsVaribles.Id_Producto & " AND TR.IdPatron = " & _
clsVaribles.Id_Patron
clCmp.fdtDataSet(SQLcad)
Dim fila As DataRow
fila = clCmp.ds.Tables(0).Rows(0)
Me.txtDescripcion.Text = fila("Nota")
Me.txtRazon.Text = fila("Razon")
Dim strTabla As String = ""
Dim fila1 As DataRow
Select Case clsVaribles.Id_Producto
Case 1
strTabla = "BANCATRADICIONAL"
Case 2
strTabla = "MERCADODEDINERO"
Case 5
strTabla = "TESORERIA"
Case 6
strTabla = "DERIVADOS"
End Select
Catch er As Exception
MessageBox.Show(er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Sub ejecutoQuery()
Try
For i As Integer = 0 To arreglo.GetUpperBound(0)
If arreglo(i, 0) <> Nothing Then
'Se verifican las opciones para grabar
'If Me.cmbEstatus.Text = "Cerrado" And Razon = True Then '-- se quito la validacion de razon, c.clain 22/Nov/2011
If Me.cmbEstatus.Text = "Cerrado" Then
'******************** UPDATE **************************
Dim CadUpdate As String
CadUpdate = ""
CadUpdate = "UPDATE TransaccionReporte SET Nota = " & _
"'" & Me.txtDescripcion.Text & "', Razon = '" & Me.txtRazon.Text & "', IDESTATUSALARMA = " & Me.cmbEstatus.SelectedValue & _
" ,FECHADETECCION = getdate() " & "' WHERE IdTransaccion = " & _
arreglo(i, 0) & " AND IdProducto = " & _
arreglo(i, 1) & " AND IdPatron = " & arreglo(i, 2)
'MsgBox(CadUpdate)
clCmp.sbGuardaModifica(CadUpdate) 'Ejecuta query
'If VariablesGlobales.gblA24Hrs = 0 Then
' MessageBox.Show("Actualizacion Realizada", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
'End If
Else
If Me.cmbEstatus.Text <> "Cerrado" Then
'******************** UPDATE **************************
Dim CadUpdate As String
CadUpdate = ""
CadUpdate = "UPDATE TransaccionReporte SET FECHADETECCION = getdate(), Nota = " & _
"'" & Me.txtDescripcion.Text & "', Razon = '" & Me.txtRazon.Text & "', IDESTATUSALARMA = " & Me.cmbEstatus.SelectedValue & _
" WHERE IdTransaccion = " & _
arreglo(i, 0) & " AND IdProducto = " & _
arreglo(i, 1) & " AND IdPatron = " & arreglo(i, 2)
' MsgBox(CadUpdate)
clCmp.sbGuardaModifica(CadUpdate) 'Ejecuta query
'If VariablesGlobales.gblA24Hrs = 0 Then
' MessageBox.Show("Actualizacion Realizada", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
'End If
End If
End If
Else
Exit For
End If
Next
MessageBox.Show("Actualizaci<EFBFBD>n grupal realizada", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As Exception
MessageBox.Show("Actualizaci<EFBFBD>n de estatus grupal:" & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub BtnGuardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGuardar.Click
If txtRazon.Text.Trim() <> "" And txtDescripcion.Text.Trim() <> "" Then
ejecutoQuery() 'Mando a traer el sub para guardar los cambios
Me.Close()
Else
MessageBox.Show("Debe de indicar una descripci<63>n y raz<61>n, favor de revisar!", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
Private Sub BtnSal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Close()
End Sub
Private Sub cmbEstatus_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbEstatus.SelectedIndexChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCerrar.Click
Me.Close()
End Sub
Private Sub BtnA24Hr_Click(sender As System.Object, e As System.EventArgs) Handles BtnA24Hr.Click
'VariablesGlobales.gblA24Hrs = 1
''txtReportadoPor.Enabled = False
''txtNombre.Enabled = False
''txtNo_Referencia.Enabled = False
'cmbEstatus.SelectedValue = 2
'txtDescripcion.Text = "Alarma de 24 Horas"
'txtRazon.Text = "Alarma de 24 Horas"
''Me.chkListRazon.Visible = False
''Me.chkListRazon.Enabled = False
'cmbEstatus.Enabled = False
'BtnGuardar.Enabled = False
'Dim frmDetalles As Detalles = New Detalles
'frmDetalles.Text = "Detalle Cr<43>dito"
'frmDetalles.Refresh()
'ejecutoQuery() 'Mando a traer el sub para guardar los cambios
'Dim ClassSITI As New ClassSITI
'VariablesGlobales.gblFecha = C1TrueDBGrid1.Columns("fecha").Text
'ClassSITI.ArchivoInusuales(VariablesGlobales.gblFecha, VariablesGlobales.gblFecha)
'cmbEstatus.SelectedValue = 4
'BtnA24Hr.Enabled = False
'txtDescripcion.Enabled = False
'txtRazon.Enabled = False
'frmDetalles.Refresh()
'ejecutoQuery() 'Mando a traer el sub para guardar los cambios
End Sub
Private Sub btnAgregarEvidencia_Click(sender As System.Object, e As System.EventArgs) Handles btnAgregarEvidencia.Click
Dim myDesktopDir As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Dim opfDialog As New System.Windows.Forms.OpenFileDialog
Dim Folder_Path_Destino As String
Dim strSQL As String
Dim classCom As New clsComplejo
'Folder_Path_Destino = Application.StartupPath & "\EvidenciaAlarmas\IdProducto_" & clsVAr.Id_Producto & _
' "-IdTransaccion_" & clsVAr.Id_Transaccion & _
' "-IdPatron_" & clsVAr.Id_Patron
opfDialog.InitialDirectory = myDesktopDir
opfDialog.Filter = "All files (*.*)|*.*"
If opfDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Try
If (opfDialog.FileName IsNot Nothing) Then
' Insert code to read the stream here.
'My.Computer.FileSystem.CopyFile( _
' opfDialog.FileName, _
' Folder_Path_Destino & "\" & opfDialog.SafeFileName, overwrite:=True)
'agregar a la base de datos el archivo seleccionado
Dim bytes = My.Computer.FileSystem.ReadAllBytes(opfDialog.FileName)
Dim clsSQL As New ClassSQL
Dim resultado As Boolean
'Dim nombre As String = clsVAr.Nombre
'Dim referencia As String = clsVAr.No_Referencia
'Dim transaccion As String = clsVAr.Id_Transaccion
Dim producto As String = clsVAr.Id_Producto
'Dim subProducto As String = clsVAr.Id_SubProducto
Dim patron As String = clsVAr.Id_Patron
'Dim estatusTransaccion As String = clsVAr.Id_EstatusTransaccion
Dim idTransaccion As String()
idTransaccion = Split(txtLista.Text, ";")
For y As Integer = 0 To idTransaccion.Length - 1
If idTransaccion(y).Trim = String.Empty Then
Else
If clsSQL.BuscaDatos("select * from tbl_Evidencias where nombrearchivo = '" & opfDialog.SafeFileName & "' AND IdTransaccion = " & (idTransaccion(y))) Then
MessageBox.Show("La alarma " & idTransaccion(y) & " ya cuenta con un archivo del mismo nombre, favor de verificar!", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Exit Sub
End If
End If
Next
'INICIO Ingresa alarmas de forma grupal
producto = producto.Substring(0, producto.Length - 2)
patron = patron.Substring(0, patron.Length - 2)
Dim _Producto As String()
Dim _Patron As String()
Dim x As String()
_Producto = Split(producto, ",")
_Patron = Split(patron, ",")
x = Split(txtLista.Text, ";")
For i As Integer = 0 To x.Length - 1
If x(i).Trim <> String.Empty Then
'Add File
resultado = clsSQL.IngresaArchivoAlarma(_Producto(i), _Patron(i), x(i), opfDialog.SafeFileName, bytes)
End If
Next
'FIN Ingresa alarmas de forma grupal
If resultado = True Then
'-----
strSQL = "spGrabaAuditoria 115" & "," & clsVaribles.varUsuario & _
", 24" & ",'Se agreg<65> archivo de evidencia en Id. Producto = " & clsVAr.Id_Producto & _
";Id. Transaccion = " & clsVAr.Id_Transaccion & ";Id. Patron = " & clsVAr.Id_Patron & _
"','" & My.Application.Info.ProductName & "/" & _
VariablesGlobales.gblUsuario & "','" & VariablesGlobales.gblMaquina & "','" & classCom.ObtenFecha(Date.Now.Date, "YYYYMMDD") & "'"
classCom.sbInserta(strSQL)
MessageBox.Show("Los archivos se agregaron correctamente !", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End If
Catch Ex As Exception
MessageBox.Show("No se puede obtener el archivo seleccionado. Original error: " & Ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
End Sub
End Class