client/conexion/Catalogos/CatPlaza.vb

413 lines
17 KiB
VB.net
Raw Normal View History

Public Class CatPlaza
Inherits System.Windows.Forms.Form
Dim clCmp As New clsComplejo()
#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 txtNombre As System.Windows.Forms.TextBox
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents chkActivo As System.Windows.Forms.CheckBox
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents grdPlazas As AxMSFlexGridLib.AxMSFlexGrid
Friend WithEvents cmbEstado As System.Windows.Forms.ComboBox
Friend WithEvents txtClave As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents tlbCorteCaja As System.Windows.Forms.ToolBar
Friend WithEvents btnAgrergar As System.Windows.Forms.ToolBarButton
Friend WithEvents btnActualizar As System.Windows.Forms.ToolBarButton
Friend WithEvents btnEliminar As System.Windows.Forms.ToolBarButton
Friend WithEvents btnSalir As System.Windows.Forms.ToolBarButton
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents pnlBotones As System.Windows.Forms.Panel
Friend WithEvents btnAceptar As System.Windows.Forms.Button
Friend WithEvents btnCancelar As System.Windows.Forms.Button
Friend WithEvents btnAliasPais As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(CatPlaza))
Me.txtNombre = New System.Windows.Forms.TextBox
Me.Label4 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.chkActivo = New System.Windows.Forms.CheckBox
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.btnAliasPais = New System.Windows.Forms.Button
Me.cmbEstado = New System.Windows.Forms.ComboBox
Me.txtClave = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.tlbCorteCaja = New System.Windows.Forms.ToolBar
Me.btnAgrergar = New System.Windows.Forms.ToolBarButton
Me.btnActualizar = New System.Windows.Forms.ToolBarButton
Me.btnEliminar = New System.Windows.Forms.ToolBarButton
Me.btnSalir = New System.Windows.Forms.ToolBarButton
Me.Label7 = New System.Windows.Forms.Label
Me.pnlBotones = New System.Windows.Forms.Panel
Me.btnAceptar = New System.Windows.Forms.Button
Me.btnCancelar = New System.Windows.Forms.Button
Me.GroupBox1.SuspendLayout()
Me.pnlBotones.SuspendLayout()
Me.SuspendLayout()
'
'txtNombre
'
Me.txtNombre.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
Me.txtNombre.Location = New System.Drawing.Point(136, 88)
Me.txtNombre.Name = "txtNombre"
Me.txtNombre.Size = New System.Drawing.Size(208, 20)
Me.txtNombre.TabIndex = 0
Me.txtNombre.Text = ""
'
'Label4
'
Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.Location = New System.Drawing.Point(72, 128)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(48, 16)
Me.Label4.TabIndex = 53
Me.Label4.Text = "Estado:"
'
'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(48, 64)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 16)
Me.Label1.TabIndex = 51
Me.Label1.Text = "Clave Plaza:"
'
'ImageList1
'
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Turquoise
'
'chkActivo
'
Me.chkActivo.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, 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(288, 56)
Me.chkActivo.Name = "chkActivo"
Me.chkActivo.Size = New System.Drawing.Size(56, 16)
Me.chkActivo.TabIndex = 2
Me.chkActivo.Text = "Activo:"
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.btnAliasPais)
Me.GroupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.GroupBox1.Location = New System.Drawing.Point(0, 168)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(544, 304)
Me.GroupBox1.TabIndex = 57
Me.GroupBox1.TabStop = False
'
'btnAliasPais
'
Me.btnAliasPais.BackColor = System.Drawing.SystemColors.Control
Me.btnAliasPais.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnAliasPais.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnAliasPais.Location = New System.Drawing.Point(392, 216)
Me.btnAliasPais.Name = "btnAliasPais"
Me.btnAliasPais.Size = New System.Drawing.Size(104, 24)
Me.btnAliasPais.TabIndex = 84
Me.btnAliasPais.Text = "Alias ..."
Me.btnAliasPais.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'cmbEstado
'
Me.cmbEstado.Location = New System.Drawing.Point(136, 120)
Me.cmbEstado.Name = "cmbEstado"
Me.cmbEstado.Size = New System.Drawing.Size(208, 21)
Me.cmbEstado.TabIndex = 1
'
'txtClave
'
Me.txtClave.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
Me.txtClave.Location = New System.Drawing.Point(136, 56)
Me.txtClave.Name = "txtClave"
Me.txtClave.ReadOnly = True
Me.txtClave.Size = New System.Drawing.Size(56, 20)
Me.txtClave.TabIndex = 5
Me.txtClave.Text = ""
'
'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(72, 96)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(48, 16)
Me.Label2.TabIndex = 52
Me.Label2.Text = "Nombre:"
'
'tlbCorteCaja
'
Me.tlbCorteCaja.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.tlbCorteCaja.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.btnAgrergar, Me.btnActualizar, Me.btnEliminar, Me.btnSalir})
Me.tlbCorteCaja.ButtonSize = New System.Drawing.Size(75, 40)
Me.tlbCorteCaja.DropDownArrows = True
Me.tlbCorteCaja.ImageList = Me.ImageList1
Me.tlbCorteCaja.Location = New System.Drawing.Point(0, 0)
Me.tlbCorteCaja.Name = "tlbCorteCaja"
Me.tlbCorteCaja.ShowToolTips = True
Me.tlbCorteCaja.Size = New System.Drawing.Size(510, 47)
Me.tlbCorteCaja.TabIndex = 58
'
'btnAgrergar
'
Me.btnAgrergar.ImageIndex = 0
Me.btnAgrergar.Text = "Agregar"
'
'btnActualizar
'
Me.btnActualizar.ImageIndex = 5
Me.btnActualizar.Text = "Actualizar"
'
'btnEliminar
'
Me.btnEliminar.ImageIndex = 1
Me.btnEliminar.Text = "Eliminar"
Me.btnEliminar.Visible = False
'
'btnSalir
'
Me.btnSalir.ImageIndex = 4
Me.btnSalir.Text = "Salir"
'
'Label7
'
Me.Label7.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label7.Location = New System.Drawing.Point(344, 126)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(24, 18)
Me.Label7.TabIndex = 79
Me.Label7.Text = "..."
'
'pnlBotones
'
Me.pnlBotones.Controls.Add(Me.btnAceptar)
Me.pnlBotones.Controls.Add(Me.btnCancelar)
Me.pnlBotones.Location = New System.Drawing.Point(384, 64)
Me.pnlBotones.Name = "pnlBotones"
Me.pnlBotones.Size = New System.Drawing.Size(120, 80)
Me.pnlBotones.TabIndex = 83
'
'btnAceptar
'
Me.btnAceptar.BackColor = System.Drawing.SystemColors.Control
Me.btnAceptar.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnAceptar.ForeColor = System.Drawing.Color.Black
Me.btnAceptar.Image = CType(resources.GetObject("btnAceptar.Image"), System.Drawing.Image)
Me.btnAceptar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnAceptar.Location = New System.Drawing.Point(16, 8)
Me.btnAceptar.Name = "btnAceptar"
Me.btnAceptar.Size = New System.Drawing.Size(96, 23)
Me.btnAceptar.TabIndex = 2
Me.btnAceptar.Text = "Aceptar"
Me.btnAceptar.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'btnCancelar
'
Me.btnCancelar.BackColor = System.Drawing.SystemColors.Control
Me.btnCancelar.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnCancelar.ForeColor = System.Drawing.Color.Black
Me.btnCancelar.Image = CType(resources.GetObject("btnCancelar.Image"), System.Drawing.Image)
Me.btnCancelar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnCancelar.Location = New System.Drawing.Point(16, 40)
Me.btnCancelar.Name = "btnCancelar"
Me.btnCancelar.Size = New System.Drawing.Size(96, 23)
Me.btnCancelar.TabIndex = 3
Me.btnCancelar.Text = "Cancelar"
Me.btnCancelar.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'CatPlaza
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(510, 419)
Me.ControlBox = False
Me.Controls.Add(Me.pnlBotones)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.tlbCorteCaja)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.chkActivo)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.cmbEstado)
Me.Controls.Add(Me.txtClave)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.txtNombre)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
Me.Name = "CatPlaza"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "CatPlaza"
Me.GroupBox1.ResumeLayout(False)
Me.pnlBotones.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub tlbCorteCaja_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tlbCorteCaja.ButtonClick
Select Case e.Button.Text
Case "Agregar"
Me.txtNombre.Enabled = True
Me.chkActivo.Enabled = True
LIMPIAR()
Case "Actualizar"
Me.txtNombre.Enabled = True
Me.chkActivo.Enabled = True
Case "Salir"
Me.Close()
End Select
End Sub
Private Sub LIMPIAR()
txtClave.Text = ""
txtNombre.Text = ""
chkActivo.Checked = False
End Sub
Private Sub sbAlias()
Dim miAlias As New ActAlias()
miAlias.Entra(17, txtClave.Text.Trim)
miAlias.Text = "Alias Plaza"
miAlias.piCatalogo = 17
miAlias.Show()
End Sub
Private Sub CatPlaza_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sbIniciaForma()
End Sub
Private Sub sbIniciaForma()
clCmp.sbLlenaCombo("spListaEstado", Me.cmbEstado)
clCmp.sbLlenaMSFGrid("spGridPlazas " & cmbEstado.SelectedValue, grdPlazas)
Me.txtNombre.Enabled = False
With grdPlazas
.set_ColWidth(0, 1000)
.set_ColWidth(1, 2700)
.set_ColWidth(2, 3100)
.set_ColWidth(3, 1000)
End With
End Sub
Private Sub sbGuardar()
Dim lsMensaje As String
If MsgBox("<EFBFBD>Desea guardar los cambios?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "MINDS Cliente") = MsgBoxResult.No Then Exit Sub
If fbValidaGrabar() Then
lsMensaje = "Datos guardados correctamente"
sbIniciaForma()
Else
lsMensaje = "Los datos no fueron guardados"
End If
MsgBox(lsMensaje, MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente")
End Sub
Private Function fbValidaGrabar() As Boolean
Dim liClave As Integer
Dim liClaveEstado As Integer
Dim liActivo As Integer
Dim lsNombre As String
Dim lsSQL As String
On Error GoTo eh
fbValidaGrabar = False
If cmbEstado.SelectedIndex = -1 Then
MsgBox("Estado no v<>lido", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente")
Exit Function
End If
If Len(txtClave.Text) = 0 Then
liClave = -1
Else
liClave = Val(txtClave.Text)
End If
liClaveEstado = cmbEstado.SelectedValue
liActivo = IIf(chkActivo.Checked, 1, 0)
lsNombre = txtNombre.Text.Trim
If Len(lsNombre.Trim) = 0 Then
MsgBox("Nombre no v<>lido", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente")
Exit Function
End If
lsSQL = ""
lsSQL = lsSQL & "spGrabaCatPlaza "
lsSQL = lsSQL & liClave & ", "
lsSQL = lsSQL & liClaveEstado & ", 17, '"
lsSQL = lsSQL & lsNombre & "', "
lsSQL = lsSQL & liActivo
clCmp.sbGuardaModifica(lsSQL)
Return True
Exit Function
eh:
Return False
End Function
Private Sub grdPlazas_DblClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdPlazas.DblClick
With grdPlazas
.Col = 0
txtClave.Text = .Text
.Col = 1
clCmp.sbBuscaEnCombo(.Text, Me.cmbEstado)
.Col = 2
txtNombre.Text = .Text
.Col = 3
If .Text = "Activo" Then
chkActivo.Checked = True
Else
chkActivo.Checked = False
End If
End With
End Sub
Private Sub cmbEstado_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbEstado.SelectedIndexChanged
On Error Resume Next
Dim lsComando As String
Dim clCmpEdo As New clsComplejo()
lsComando = "spGridPlazas " & cmbEstado.SelectedValue
clCmpEdo.sbLlenaMSFGrid(lsComando, Me.grdPlazas)
End Sub
Private Sub btnAceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAceptar.Click
sbGuardar()
Me.txtNombre.Enabled = False
Me.chkActivo.Enabled = False
End Sub
Private Sub btnAliasPais_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAliasPais.Click
If txtClave.Text <> "" Then
sbAlias()
Else
MessageBox.Show("Debe Selecionar un elemento", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
End Class