539 lines
23 KiB
VB.net
539 lines
23 KiB
VB.net
Imports Microsoft.VisualBasic
|
||
Imports CLIENTE.clsComplejo 'permite conectarme a la base de datos y establer parametros
|
||
Imports System.Data.SqlClient 'para manejar objetos de datos SQL
|
||
Imports CLIENTE.Registro 'clase que me permite encriptar el password
|
||
Imports System.Data 'Para manejar objetos de estructuras de datos
|
||
Imports CLIENTE.clBusqueda 'para realizar busqueda en un registro
|
||
Imports CLIENTE.clOcultarColumna 'Permite ocultar columnas
|
||
Imports CLIENTE.ValidaTexto 'Permite validad las cajas de texto o combox
|
||
Public Class RazonAct
|
||
Inherits System.Windows.Forms.Form
|
||
|
||
|
||
#Region " Windows Form Designer generated code "
|
||
|
||
Public Sub New()
|
||
MyBase.New()
|
||
|
||
'This call is required by the Windows Form Designer.
|
||
InitializeComponent()
|
||
|
||
'Add any initialization after the InitializeComponent() call
|
||
|
||
End Sub
|
||
|
||
'Form overrides dispose to clean up the component list.
|
||
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
|
||
|
||
'Required by the Windows Form Designer
|
||
Private components As System.ComponentModel.IContainer
|
||
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
|
||
Friend WithEvents PnPais As System.Windows.Forms.Panel
|
||
Friend WithEvents chkActivo As System.Windows.Forms.CheckBox
|
||
Friend WithEvents txtNombre As System.Windows.Forms.TextBox
|
||
Friend WithEvents txtClave As System.Windows.Forms.TextBox
|
||
Friend WithEvents Label2 As System.Windows.Forms.Label
|
||
Friend WithEvents Label1 As System.Windows.Forms.Label
|
||
Friend WithEvents GridMaster As C1.Win.C1TrueDBGrid.C1TrueDBGrid
|
||
Friend WithEvents Button1 As System.Windows.Forms.Button
|
||
Friend WithEvents BntSalie As System.Windows.Forms.Button
|
||
Friend WithEvents BtnAlta As System.Windows.Forms.Button
|
||
Friend WithEvents BtnLimpiar As System.Windows.Forms.Button
|
||
Friend WithEvents BtnBorrar As System.Windows.Forms.Button
|
||
|
||
'NOTE: The following procedure is required by the Windows Form Designer
|
||
'It can be modified using the Windows Form Designer.
|
||
'Do not modify it using the code editor.
|
||
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
|
||
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
|
||
Me.components = New System.ComponentModel.Container()
|
||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(RazonAct))
|
||
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
|
||
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
|
||
Me.PnPais = New System.Windows.Forms.Panel()
|
||
Me.chkActivo = New System.Windows.Forms.CheckBox()
|
||
Me.txtNombre = New System.Windows.Forms.TextBox()
|
||
Me.txtClave = New System.Windows.Forms.TextBox()
|
||
Me.Label2 = New System.Windows.Forms.Label()
|
||
Me.Label1 = New System.Windows.Forms.Label()
|
||
Me.GridMaster = New C1.Win.C1TrueDBGrid.C1TrueDBGrid()
|
||
Me.Button1 = New System.Windows.Forms.Button()
|
||
Me.BntSalie = New System.Windows.Forms.Button()
|
||
Me.BtnAlta = New System.Windows.Forms.Button()
|
||
Me.BtnLimpiar = New System.Windows.Forms.Button()
|
||
Me.BtnBorrar = New System.Windows.Forms.Button()
|
||
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||
Me.PnPais.SuspendLayout()
|
||
CType(Me.GridMaster, System.ComponentModel.ISupportInitialize).BeginInit()
|
||
Me.SuspendLayout()
|
||
'
|
||
'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, "")
|
||
'
|
||
'PictureBox1
|
||
'
|
||
Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
|
||
Me.PictureBox1.ErrorImage = CType(resources.GetObject("PictureBox1.ErrorImage"), System.Drawing.Image)
|
||
Me.PictureBox1.Image = Global.CLIENTE.My.Resources.Resources.Logo_Empresa
|
||
Me.PictureBox1.Location = New System.Drawing.Point(-2, 4)
|
||
Me.PictureBox1.Name = "PictureBox1"
|
||
Me.PictureBox1.Size = New System.Drawing.Size(142, 43)
|
||
Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
|
||
Me.PictureBox1.TabIndex = 94
|
||
Me.PictureBox1.TabStop = False
|
||
'
|
||
'PnPais
|
||
'
|
||
Me.PnPais.Controls.Add(Me.chkActivo)
|
||
Me.PnPais.Controls.Add(Me.txtNombre)
|
||
Me.PnPais.Controls.Add(Me.txtClave)
|
||
Me.PnPais.Controls.Add(Me.Label2)
|
||
Me.PnPais.Controls.Add(Me.Label1)
|
||
Me.PnPais.Location = New System.Drawing.Point(3, 196)
|
||
Me.PnPais.Name = "PnPais"
|
||
Me.PnPais.Size = New System.Drawing.Size(725, 101)
|
||
Me.PnPais.TabIndex = 89
|
||
'
|
||
'chkActivo
|
||
'
|
||
Me.chkActivo.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||
Me.chkActivo.ForeColor = System.Drawing.Color.Red
|
||
Me.chkActivo.Location = New System.Drawing.Point(17, 71)
|
||
Me.chkActivo.Name = "chkActivo"
|
||
Me.chkActivo.Size = New System.Drawing.Size(72, 21)
|
||
Me.chkActivo.TabIndex = 5
|
||
Me.chkActivo.Text = "Activo:"
|
||
'
|
||
'txtNombre
|
||
'
|
||
Me.txtNombre.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
|
||
Me.txtNombre.Location = New System.Drawing.Point(110, 46)
|
||
Me.txtNombre.MaxLength = 1000
|
||
Me.txtNombre.Name = "txtNombre"
|
||
Me.txtNombre.Size = New System.Drawing.Size(478, 20)
|
||
Me.txtNombre.TabIndex = 2
|
||
'
|
||
'txtClave
|
||
'
|
||
Me.txtClave.BackColor = System.Drawing.Color.White
|
||
Me.txtClave.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
|
||
Me.txtClave.Location = New System.Drawing.Point(110, 14)
|
||
Me.txtClave.Name = "txtClave"
|
||
Me.txtClave.ReadOnly = True
|
||
Me.txtClave.Size = New System.Drawing.Size(56, 20)
|
||
Me.txtClave.TabIndex = 1
|
||
'
|
||
'Label2
|
||
'
|
||
Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||
Me.Label2.Location = New System.Drawing.Point(16, 46)
|
||
Me.Label2.Name = "Label2"
|
||
Me.Label2.Size = New System.Drawing.Size(63, 16)
|
||
Me.Label2.TabIndex = 36
|
||
Me.Label2.Text = "Nombre:"
|
||
Me.Label2.ForeColor = System.Drawing.Color.MidnightBlue
|
||
'
|
||
'Label1
|
||
'
|
||
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||
Me.Label1.Location = New System.Drawing.Point(15, 15)
|
||
Me.Label1.Name = "Label1"
|
||
Me.Label1.Size = New System.Drawing.Size(64, 16)
|
||
Me.Label1.TabIndex = 35
|
||
Me.Label1.Text = "Clave Pa<50>s:"
|
||
Me.Label1.ForeColor = System.Drawing.Color.MidnightBlue
|
||
'
|
||
'GridMaster
|
||
'
|
||
Me.GridMaster.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer))
|
||
Me.GridMaster.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
|
||
Me.GridMaster.GroupByCaption = "AGRUPAR"
|
||
Me.GridMaster.Images.Add(CType(resources.GetObject("GridMaster.Images"), System.Drawing.Image))
|
||
Me.GridMaster.Location = New System.Drawing.Point(3, 52)
|
||
Me.GridMaster.Name = "GridMaster"
|
||
Me.GridMaster.PreviewInfo.Location = New System.Drawing.Point(0, 0)
|
||
Me.GridMaster.PreviewInfo.Size = New System.Drawing.Size(0, 0)
|
||
Me.GridMaster.PreviewInfo.ZoomFactor = 75.0R
|
||
Me.GridMaster.PrintInfo.PageSettings = CType(resources.GetObject("GridMaster.PrintInfo.PageSettings"), System.Drawing.Printing.PageSettings)
|
||
Me.GridMaster.Size = New System.Drawing.Size(727, 136)
|
||
Me.GridMaster.TabIndex = 88
|
||
Me.GridMaster.Text = "C1TrueDBGrid1"
|
||
Me.GridMaster.PropBag = resources.GetString("GridMaster.PropBag")
|
||
'
|
||
'Button1
|
||
'
|
||
Me.Button1.BackColor = System.Drawing.Color.White
|
||
Me.Button1.Cursor = System.Windows.Forms.Cursors.Hand
|
||
Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||
Me.Button1.ForeColor = System.Drawing.Color.MidnightBlue
|
||
Me.Button1.Image = Global.CLIENTE.My.Resources.Resources.botonPrint
|
||
Me.Button1.Location = New System.Drawing.Point(736, 189)
|
||
Me.Button1.Name = "Button1"
|
||
Me.Button1.Size = New System.Drawing.Size(106, 33)
|
||
Me.Button1.TabIndex = 113
|
||
Me.Button1.Text = "Exportar"
|
||
Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||
Me.Button1.UseVisualStyleBackColor = True
|
||
'
|
||
'BntSalie
|
||
'
|
||
Me.BntSalie.BackColor = System.Drawing.Color.White
|
||
Me.BntSalie.Cursor = System.Windows.Forms.Cursors.Hand
|
||
Me.BntSalie.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||
Me.BntSalie.ForeColor = System.Drawing.Color.MidnightBlue
|
||
Me.BntSalie.Image = CType(resources.GetObject("BntSalie.Image"), System.Drawing.Image)
|
||
Me.BntSalie.Location = New System.Drawing.Point(736, 264)
|
||
Me.BntSalie.Name = "BntSalie"
|
||
Me.BntSalie.Size = New System.Drawing.Size(106, 33)
|
||
Me.BntSalie.TabIndex = 112
|
||
Me.BntSalie.Text = "Cerrar"
|
||
Me.BntSalie.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||
Me.BntSalie.UseVisualStyleBackColor = True
|
||
'
|
||
'BtnAlta
|
||
'
|
||
Me.BtnAlta.BackColor = System.Drawing.Color.White
|
||
Me.BtnAlta.Cursor = System.Windows.Forms.Cursors.Hand
|
||
Me.BtnAlta.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||
Me.BtnAlta.ForeColor = System.Drawing.Color.MidnightBlue
|
||
Me.BtnAlta.Image = CType(resources.GetObject("BtnAlta.Image"), System.Drawing.Image)
|
||
Me.BtnAlta.Location = New System.Drawing.Point(736, 115)
|
||
Me.BtnAlta.Name = "BtnAlta"
|
||
Me.BtnAlta.Size = New System.Drawing.Size(106, 33)
|
||
Me.BtnAlta.TabIndex = 111
|
||
Me.BtnAlta.Text = "Grabar"
|
||
Me.BtnAlta.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||
Me.BtnAlta.UseVisualStyleBackColor = True
|
||
'
|
||
'BtnLimpiar
|
||
'
|
||
Me.BtnLimpiar.BackColor = System.Drawing.Color.White
|
||
Me.BtnLimpiar.Cursor = System.Windows.Forms.Cursors.Hand
|
||
Me.BtnLimpiar.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||
Me.BtnLimpiar.ForeColor = System.Drawing.Color.MidnightBlue
|
||
Me.BtnLimpiar.Image = CType(resources.GetObject("BtnLimpiar.Image"), System.Drawing.Image)
|
||
Me.BtnLimpiar.Location = New System.Drawing.Point(736, 225)
|
||
Me.BtnLimpiar.Name = "BtnLimpiar"
|
||
Me.BtnLimpiar.Size = New System.Drawing.Size(106, 33)
|
||
Me.BtnLimpiar.TabIndex = 110
|
||
Me.BtnLimpiar.Text = "Limpiar"
|
||
Me.BtnLimpiar.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||
Me.BtnLimpiar.UseVisualStyleBackColor = True
|
||
'
|
||
'BtnBorrar
|
||
'
|
||
Me.BtnBorrar.BackColor = System.Drawing.Color.White
|
||
Me.BtnBorrar.Cursor = System.Windows.Forms.Cursors.Hand
|
||
Me.BtnBorrar.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||
Me.BtnBorrar.ForeColor = System.Drawing.Color.MidnightBlue
|
||
Me.BtnBorrar.Image = Global.CLIENTE.My.Resources.Resources.botonErase
|
||
Me.BtnBorrar.Location = New System.Drawing.Point(736, 152)
|
||
Me.BtnBorrar.Name = "BtnBorrar"
|
||
Me.BtnBorrar.Size = New System.Drawing.Size(106, 33)
|
||
Me.BtnBorrar.TabIndex = 114
|
||
Me.BtnBorrar.Text = "Borrar"
|
||
Me.BtnBorrar.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||
Me.BtnBorrar.UseVisualStyleBackColor = True
|
||
'
|
||
'RazonAct
|
||
'
|
||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None
|
||
Me.BackColor = System.Drawing.Color.White
|
||
Me.ClientSize = New System.Drawing.Size(850, 316)
|
||
Me.Controls.Add(Me.BtnBorrar)
|
||
Me.Controls.Add(Me.Button1)
|
||
Me.Controls.Add(Me.BntSalie)
|
||
Me.Controls.Add(Me.BtnAlta)
|
||
Me.Controls.Add(Me.BtnLimpiar)
|
||
Me.Controls.Add(Me.PictureBox1)
|
||
Me.Controls.Add(Me.PnPais)
|
||
Me.Controls.Add(Me.GridMaster)
|
||
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
|
||
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
||
Me.MaximizeBox = False
|
||
Me.Name = "RazonAct"
|
||
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
|
||
Me.Text = "Razones"
|
||
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
|
||
Me.PnPais.ResumeLayout(False)
|
||
Me.PnPais.PerformLayout()
|
||
CType(Me.GridMaster, System.ComponentModel.ISupportInitialize).EndInit()
|
||
Me.ResumeLayout(False)
|
||
|
||
End Sub
|
||
|
||
#End Region
|
||
Dim clCmp As clsComplejo = New clsComplejo
|
||
Dim Bandera As Boolean 'True es una modificacion, False Inserta un elemento nuevo
|
||
Dim Accion As Integer = 0 '1 Inserta, 2 Actualiza, 3 Elimina
|
||
Dim Guardar As Boolean
|
||
Dim Nuevo As Boolean
|
||
|
||
Dim desh As New clsDeshabilita()
|
||
Dim dap As SqlDataAdapter = New SqlClient.SqlDataAdapter
|
||
Dim cmd As SqlCommand
|
||
Dim das As DataSet
|
||
Dim cnn As SqlConnection
|
||
Dim _Accion As String
|
||
Dim clcmj1 As New clsComplejo
|
||
Dim clsvariables As New clsVaribles
|
||
Dim blnuevo As Boolean = True
|
||
Dim blcarga As Boolean = True
|
||
Dim sql As String
|
||
Dim liClave As Integer
|
||
|
||
Private Sub llenagrid1()
|
||
Dim SQLGRID As String = ""
|
||
Try
|
||
|
||
clcmj1 = New clsComplejo
|
||
SQLGRID = "spConRazon "
|
||
|
||
clcmj1.fdtDataSetTabla(SQLGRID)
|
||
GridMaster.SetDataBinding(clcmj1.ds, "Tabla") 'Llena el grid
|
||
ConfiguraGrid()
|
||
Catch ex As Exception
|
||
MessageBox.Show("Error al cargar usuarios " & ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
'Finally
|
||
' cnn.Close()
|
||
End Try
|
||
|
||
End Sub
|
||
Private Sub RazonAct_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
||
Dim SQLGrid As String
|
||
Dim ds1 As DataSet
|
||
Dim OcultarCol As clOcultarColumna = New clOcultarColumna()
|
||
|
||
Try
|
||
|
||
llenagrid1()
|
||
|
||
|
||
Catch ex As Exception
|
||
MessageBox.Show("Error Busqueda; sbBuscas: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub ConfiguraGrid()
|
||
'Configura el grid
|
||
Try
|
||
Me.GridMaster.Splits(0).DisplayColumns("Razon").Width = 530
|
||
Me.GridMaster.Splits(0).DisplayColumns("Activo").Width = 70
|
||
Catch ex As Exception
|
||
MessageBox.Show("Error RazonAct; ConfiguraGrid: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
End Try
|
||
End Sub
|
||
|
||
|
||
|
||
Private Sub Limpiar()
|
||
Try
|
||
txtNombre.Text = ""
|
||
txtClave.Text = ""
|
||
chkActivo.Checked = False
|
||
liClave = 0
|
||
Catch ex As Exception
|
||
MessageBox.Show("Error RazonAct; Limpiar: ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
End Try
|
||
End Sub
|
||
|
||
|
||
|
||
|
||
Private Sub GridMaster_DoubleClick(sender As Object, e As System.EventArgs) Handles GridMaster.DoubleClick
|
||
Dim SQLBenef As String
|
||
Dim Fila As DataRow
|
||
Dim Classcom As New clsComplejo
|
||
|
||
|
||
Try
|
||
liClave = Val(Me.GridMaster.Columns("id").Value)
|
||
SQLBenef = "spConRazon 3," & liClave
|
||
Classcom.fdtDataSet(SQLBenef)
|
||
|
||
If Classcom.ds.Tables(0).Rows.Count <> 0 Then
|
||
'LLENA COMBOS
|
||
Fila = Classcom.ds.Tables(0).Rows(0)
|
||
txtNombre.Text = Fila("Razon")
|
||
txtClave.Text = Fila("id")
|
||
|
||
chkActivo.Checked = Fila("ACTIVO")
|
||
chkActivo.Tag = Fila("ACTIVO")
|
||
|
||
|
||
End If
|
||
Catch ex As System.ArgumentOutOfRangeException
|
||
MessageBox.Show("No existe Informacion", "MINDS Cliente", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
||
|
||
Catch ex As System.IndexOutOfRangeException
|
||
MessageBox.Show("No existe Informacion", "MINDS Cliente", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
||
|
||
|
||
Catch ex As Exception
|
||
MessageBox.Show("Error Busqueda; grdUsuario_DoubleClick: " & ex.Message, "MINDS Cliente", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub BtnAlta_Click(sender As System.Object, e As System.EventArgs) Handles BtnAlta.Click
|
||
|
||
Dim ClassAud As New ClassMyUtils
|
||
Dim lssql As String
|
||
Dim liactivo As Integer
|
||
Try
|
||
|
||
If Len(Me.txtNombre.Text.Trim) = 0 Then
|
||
MsgBox("Nombre no v<>lido", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Cliente")
|
||
Me.txtNombre.Focus()
|
||
Exit Sub
|
||
End If
|
||
|
||
If MsgBox("<EFBFBD>Desea guardar la Razon?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "MINDS Cliente") = MsgBoxResult.No Then Exit Sub
|
||
liactivo = chkActivo.CheckState
|
||
|
||
Dim liAud As Integer
|
||
clsVaribles.lsValAnt = ClassAud.FnObtenValAnterior("SpConValoresAnteriores 5," & Val(Me.txtClave.Text))
|
||
If Len(Trim(clsVaribles.lsValAnt)) = 0 Then
|
||
liAud = 2
|
||
Else
|
||
liAud = 4
|
||
End If
|
||
|
||
|
||
|
||
lssql = ""
|
||
lssql = lssql & "spGrabaRazon "
|
||
lssql = lssql & "A" & ", "
|
||
lssql = lssql & Val(Me.txtClave.Text) & ", "
|
||
lssql = lssql & "'" & Me.txtNombre.Text & "'," & liactivo
|
||
clCmp.sbGuardaModifica(lssql)
|
||
llenagrid1()
|
||
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 117, 41, clsVaribles.lsValAnt & " | Valores Nuevos: idRazon = " & Val(Me.txtClave.Text) & " Razon = " & Me.txtNombre.Text & ", Activo = " & liactivo)
|
||
Limpiar()
|
||
liClave = 0
|
||
Catch ex As Exception
|
||
MessageBox.Show("No se pudo dar de alta la Razon", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
liClave = 0
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub BtnBorrar_Click(sender As System.Object, e As System.EventArgs) Handles BtnBorrar.Click
|
||
'elimina el rgistro seleccionado
|
||
Dim lsopcion As String
|
||
Dim ClassAud As New ClassMyUtils
|
||
|
||
Try
|
||
Dim lsSQL, lsNombre As String
|
||
lsopcion = "E"
|
||
If liClave = 0 Then
|
||
MessageBox.Show("Debes seleccionar un Registro primero ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
Exit Sub
|
||
End If
|
||
|
||
|
||
If MessageBox.Show("Desea eliminar la Razon: " & lsNombre, "MINDS", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
|
||
'Formo el query
|
||
Dim liAud As Integer
|
||
clsVaribles.lsValAnt = ClassAud.FnObtenValAnterior("SpConValoresAnteriores 5," & Val(Me.txtClave.Text))
|
||
|
||
liAud = 3
|
||
|
||
lsSQL = ""
|
||
lsSQL = lsSQL & "spGrabaRazon "
|
||
lsSQL = lsSQL & lsopcion & ", "
|
||
lsSQL = lsSQL & liClave & ",'',0 "
|
||
clCmp.sbGuardaModifica(lsSQL)
|
||
|
||
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 117, 1, "Baja de Razon " & clsVaribles.lsValAnt)
|
||
|
||
BtnLimpiar.PerformClick()
|
||
llenagrid1()
|
||
ConfiguraGrid()
|
||
liClave = 0
|
||
'Me.btnGuardar.Enabled = False
|
||
End If
|
||
Catch ex As Exception
|
||
MessageBox.Show("No se pudo dar de baja la Razon ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
liClave = 0
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub BntSalie_Click_1(sender As System.Object, e As System.EventArgs) Handles BntSalie.Click
|
||
Me.Close()
|
||
End Sub
|
||
|
||
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
|
||
clcmj1 = New clsComplejo
|
||
Dim sqlgrid As String
|
||
Dim ds As DataSet
|
||
ds = New DataSet
|
||
sqlgrid = "spConRazon"
|
||
clcmj1.fdtDataSetTabla(sqlgrid)
|
||
|
||
Try
|
||
If clcmj1.ds.Tables.Count = 0 Then
|
||
MessageBox.Show("Realiza una consulta ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
Else
|
||
If clcmj1.ds.Tables(0).Rows.Count = 0 Then
|
||
MessageBox.Show("No hay datos para exportar ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
Else
|
||
|
||
'Dim clsExcel As aExcel = New aExcel
|
||
'clsExcel = New aExcel
|
||
''Obtenemos el nombre o el titulo del form
|
||
'clsExcel.Titulo = Me.Text
|
||
''Utilizo la funcion ExportDataset de la clase aExcel
|
||
'clsvariables.LsTituloExcel = "Catalogo Razones"
|
||
'clsExcel.ExportDataset(clcmj1.ds) 'Asigno el dataset a exportar
|
||
'clsvariables.LsTituloExcel = ""
|
||
|
||
'Creamos una copia del dataset
|
||
Dim copyDS As DataSet = clcmj1.ds.Copy()
|
||
Dim clsExcel As aExcel = New aExcel
|
||
'Obtenemos el nombre o el titulo del form
|
||
clsExcel.Titulo = Me.Text
|
||
'Utilizo la funcion ExportDataset de la clase aExcel
|
||
''clsVaribles.LsTituloExcel = "Catalogo Razones"
|
||
clsExcel.Titulo = "Catalogo Razones"
|
||
clsExcel.ExportDataset(copyDS) 'Asigno el dataset a exportar
|
||
clsVaribles.LsTituloExcel = ""
|
||
|
||
|
||
'End If
|
||
End If
|
||
End If
|
||
Catch ex As Exception
|
||
clsvariables.LsTituloExcel = ""
|
||
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
End Try
|
||
|
||
|
||
End Sub
|
||
|
||
Private Sub GridMaster_Click(sender As System.Object, e As System.EventArgs) Handles GridMaster.Click
|
||
|
||
End Sub
|
||
|
||
Private Sub BtnLimpiar_Click(sender As System.Object, e As System.EventArgs) Handles BtnLimpiar.Click
|
||
Limpiar()
|
||
End Sub
|
||
End Class
|