client/conexion/Catalogos/CatSucursal.vb

566 lines
25 KiB
VB.net

Public Class CatSucursal
Inherits System.Windows.Forms.Form
Dim clCmpEst As New clsComplejo()
Dim clCmpReg As New clsComplejo
Dim clCmpPla As New clsComplejo
Dim clCmpGrd As clsComplejo = New clsComplejo
Dim clCmp As New clsComplejo
#Region " Código generado por el Diseñador de Windows Forms "
Public Sub New()
MyBase.New()
'El Diseñador de Windows Forms requiere esta llamada.
InitializeComponent()
'Agregar cualquier inicialización despué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ñador de Windows Forms
Private components As System.ComponentModel.IContainer
'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
Friend WithEvents cmbPlaza As System.Windows.Forms.ComboBox
Friend WithEvents chkActivo As System.Windows.Forms.CheckBox
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents cmbEstado As System.Windows.Forms.ComboBox
Friend WithEvents txtNombre As System.Windows.Forms.TextBox
Friend WithEvents txtClave As System.Windows.Forms.TextBox
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents cmbRegion As System.Windows.Forms.ComboBox
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 pnlBotones As System.Windows.Forms.Panel
Friend WithEvents btnAceptar As System.Windows.Forms.Button
Friend WithEvents btnCancelar As System.Windows.Forms.Button
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents C1TrueDBGrid1 As C1.Win.C1TrueDBGrid.C1TrueDBGrid
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(CatSucursal))
Me.cmbPlaza = New System.Windows.Forms.ComboBox
Me.chkActivo = New System.Windows.Forms.CheckBox
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.C1TrueDBGrid1 = New C1.Win.C1TrueDBGrid.C1TrueDBGrid
Me.Button1 = New System.Windows.Forms.Button
Me.cmbEstado = New System.Windows.Forms.ComboBox
Me.txtNombre = New System.Windows.Forms.TextBox
Me.txtClave = New System.Windows.Forms.TextBox
Me.Label5 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.Label2 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.cmbRegion = New System.Windows.Forms.ComboBox
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.pnlBotones = New System.Windows.Forms.Panel
Me.btnAceptar = New System.Windows.Forms.Button
Me.btnCancelar = New System.Windows.Forms.Button
Me.GroupBox1.SuspendLayout()
CType(Me.C1TrueDBGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.pnlBotones.SuspendLayout()
Me.SuspendLayout()
'
'cmbPlaza
'
Me.cmbPlaza.Location = New System.Drawing.Point(112, 184)
Me.cmbPlaza.Name = "cmbPlaza"
Me.cmbPlaza.Size = New System.Drawing.Size(208, 21)
Me.cmbPlaza.TabIndex = 3
'
'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(256, 56)
Me.chkActivo.Name = "chkActivo"
Me.chkActivo.Size = New System.Drawing.Size(64, 16)
Me.chkActivo.TabIndex = 4
Me.chkActivo.Text = "Activo"
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.C1TrueDBGrid1)
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(4, 212)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(464, 180)
Me.GroupBox1.TabIndex = 48
Me.GroupBox1.TabStop = False
'
'C1TrueDBGrid1
'
Me.C1TrueDBGrid1.AllowUpdate = False
Me.C1TrueDBGrid1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.C1TrueDBGrid1.Dock = System.Windows.Forms.DockStyle.Fill
Me.C1TrueDBGrid1.GroupByCaption = "Drag a column header here to group by that column"
Me.C1TrueDBGrid1.Images.Add(CType(resources.GetObject("resource"), System.Drawing.Image))
Me.C1TrueDBGrid1.Location = New System.Drawing.Point(3, 16)
Me.C1TrueDBGrid1.MarqueeStyle = C1.Win.C1TrueDBGrid.MarqueeEnum.HighlightRow
Me.C1TrueDBGrid1.Name = "C1TrueDBGrid1"
Me.C1TrueDBGrid1.PreviewInfo.Location = New System.Drawing.Point(0, 0)
Me.C1TrueDBGrid1.PreviewInfo.Size = New System.Drawing.Size(0, 0)
Me.C1TrueDBGrid1.PreviewInfo.ZoomFactor = 75
Me.C1TrueDBGrid1.Size = New System.Drawing.Size(458, 161)
Me.C1TrueDBGrid1.TabIndex = 0
Me.C1TrueDBGrid1.Text = "C1TrueDBGrid1"
Me.C1TrueDBGrid1.PropBag = "<?xml version=""1.0""?><Blob><Styles type=""C1.Win.C1TrueDBGrid.Design.ContextWrappe" & _
"r""><Data>Group{AlignVert:Center;Border:None,,0, 0, 0, 0;BackColor:ControlDark;}E" & _
"ditor{}Style2{}Style5{}Style4{}Style7{}Style6{}EvenRow{BackColor:Aqua;}Selected{" & _
"ForeColor:HighlightText;BackColor:Highlight;}Style3{}Inactive{ForeColor:Inactive" & _
"CaptionText;BackColor:InactiveCaption;}FilterBar{}Footer{}Caption{AlignHorz:Cent" & _
"er;}Style1{}Normal{Font:Microsoft Sans Serif, 8.25pt, style=Bold;}HighlightRow{F" & _
"oreColor:Aqua;BackColor:Highlight;}Style12{}OddRow{}RecordSelector{AlignImage:Ce" & _
"nter;}Style13{}Heading{Wrap:True;BackColor:Control;Border:Raised,,1, 1, 1, 1;For" & _
"eColor:ControlText;AlignVert:Center;}Style8{}Style10{AlignHorz:Near;}Style11{}St" & _
"yle14{}Style15{}Style9{}</Data></Styles><Splits><C1.Win.C1TrueDBGrid.MergeView N" & _
"ame="""" CaptionHeight=""17"" ColumnCaptionHeight=""17"" ColumnFooterHeight=""17"" Marqu" & _
"eeStyle=""HighlightRow"" RecordSelectorWidth=""16"" DefRecSelWidth=""16"" VerticalScro" & _
"llGroup=""1"" HorizontalScrollGroup=""1""><Height>157</Height><CaptionStyle parent=""" & _
"Style2"" me=""Style10"" /><EditorStyle parent=""Editor"" me=""Style5"" /><EvenRowStyle " & _
"parent=""EvenRow"" me=""Style8"" /><FilterBarStyle parent=""FilterBar"" me=""Style13"" /" & _
"><FooterStyle parent=""Footer"" me=""Style3"" /><GroupStyle parent=""Group"" me=""Style" & _
"12"" /><HeadingStyle parent=""Heading"" me=""Style2"" /><HighLightRowStyle parent=""Hi" & _
"ghlightRow"" me=""Style7"" /><InactiveStyle parent=""Inactive"" me=""Style4"" /><OddRow" & _
"Style parent=""OddRow"" me=""Style9"" /><RecordSelectorStyle parent=""RecordSelector""" & _
" me=""Style11"" /><SelectedStyle parent=""Selected"" me=""Style6"" /><Style parent=""No" & _
"rmal"" me=""Style1"" /><ClientRect>0, 0, 454, 157</ClientRect><BorderSide>0</Border" & _
"Side><BorderStyle>Sunken</BorderStyle></C1.Win.C1TrueDBGrid.MergeView></Splits><" & _
"NamedStyles><Style parent="""" me=""Normal"" /><Style parent=""Normal"" me=""Heading"" /" & _
"><Style parent=""Heading"" me=""Footer"" /><Style parent=""Heading"" me=""Caption"" /><S" & _
"tyle parent=""Heading"" me=""Inactive"" /><Style parent=""Normal"" me=""Selected"" /><St" & _
"yle parent=""Normal"" me=""Editor"" /><Style parent=""Normal"" me=""HighlightRow"" /><St" & _
"yle parent=""Normal"" me=""EvenRow"" /><Style parent=""Normal"" me=""OddRow"" /><Style p" & _
"arent=""Heading"" me=""RecordSelector"" /><Style parent=""Normal"" me=""FilterBar"" /><S" & _
"tyle parent=""Caption"" me=""Group"" /></NamedStyles><vertSplits>1</vertSplits><horz" & _
"Splits>1</horzSplits><Layout>None</Layout><DefaultRecSelWidth>16</DefaultRecSelW" & _
"idth><ClientArea>0, 0, 454, 157</ClientArea><PrintPageHeaderStyle parent="""" me=""" & _
"Style14"" /><PrintPageFooterStyle parent="""" me=""Style15"" /></Blob>"
'
'Button1
'
Me.Button1.BackColor = System.Drawing.SystemColors.Control
Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button1.Location = New System.Drawing.Point(350, 400)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(104, 22)
Me.Button1.TabIndex = 83
Me.Button1.Text = "Alias ..."
Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'cmbEstado
'
Me.cmbEstado.Location = New System.Drawing.Point(112, 152)
Me.cmbEstado.Name = "cmbEstado"
Me.cmbEstado.Size = New System.Drawing.Size(208, 21)
Me.cmbEstado.TabIndex = 2
'
'txtNombre
'
Me.txtNombre.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
Me.txtNombre.Location = New System.Drawing.Point(112, 88)
Me.txtNombre.Name = "txtNombre"
Me.txtNombre.Size = New System.Drawing.Size(208, 20)
Me.txtNombre.TabIndex = 0
Me.txtNombre.Text = ""
'
'txtClave
'
Me.txtClave.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
Me.txtClave.Location = New System.Drawing.Point(112, 56)
Me.txtClave.Name = "txtClave"
Me.txtClave.ReadOnly = True
Me.txtClave.Size = New System.Drawing.Size(56, 20)
Me.txtClave.TabIndex = 7
Me.txtClave.Text = ""
'
'Label5
'
Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.Location = New System.Drawing.Point(64, 192)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(40, 16)
Me.Label5.TabIndex = 43
Me.Label5.Text = "Plaza:"
'
'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(56, 160)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(48, 16)
Me.Label4.TabIndex = 42
Me.Label4.Text = "Estado:"
'
'Label3
'
Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.Location = New System.Drawing.Point(56, 128)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(48, 16)
Me.Label3.TabIndex = 41
Me.Label3.Text = "Región:"
'
'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
'
'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(56, 96)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(48, 16)
Me.Label2.TabIndex = 40
Me.Label2.Text = "Nombre:"
'
'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(16, 64)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(88, 16)
Me.Label1.TabIndex = 39
Me.Label1.Text = "Clave Sucursal:"
'
'cmbRegion
'
Me.cmbRegion.Location = New System.Drawing.Point(112, 120)
Me.cmbRegion.Name = "cmbRegion"
Me.cmbRegion.Size = New System.Drawing.Size(208, 21)
Me.cmbRegion.TabIndex = 1
'
'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(470, 47)
Me.tlbCorteCaja.TabIndex = 50
'
'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"
'
'btnSalir
'
Me.btnSalir.ImageIndex = 4
Me.btnSalir.Text = "Salir"
'
'pnlBotones
'
Me.pnlBotones.Controls.Add(Me.btnAceptar)
Me.pnlBotones.Controls.Add(Me.btnCancelar)
Me.pnlBotones.Location = New System.Drawing.Point(328, 56)
Me.pnlBotones.Name = "pnlBotones"
Me.pnlBotones.Size = New System.Drawing.Size(120, 80)
Me.pnlBotones.TabIndex = 82
'
'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
'
'CatSucursal
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.White
Me.ClientSize = New System.Drawing.Size(470, 427)
Me.ControlBox = False
Me.Controls.Add(Me.pnlBotones)
Me.Controls.Add(Me.tlbCorteCaja)
Me.Controls.Add(Me.cmbRegion)
Me.Controls.Add(Me.chkActivo)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.cmbEstado)
Me.Controls.Add(Me.txtNombre)
Me.Controls.Add(Me.txtClave)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.cmbPlaza)
Me.Controls.Add(Me.Button1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
Me.Name = "CatSucursal"
Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Catalogo: Sucursal"
Me.GroupBox1.ResumeLayout(False)
CType(Me.C1TrueDBGrid1, System.ComponentModel.ISupportInitialize).EndInit()
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"
actualizar(True)
LIMPIAR()
Case "Actualizar"
actualizar(True)
Case "Salir"
Me.Close()
End Select
End Sub
Private Sub actualizar(ByVal Bandera As Boolean)
Me.txtNombre.Enabled = Bandera
Me.chkActivo.Enabled = Bandera
End Sub
Private Sub LIMPIAR()
txtClave.Text = ""
txtNombre.Text = ""
chkActivo.Checked = False
End Sub
Private Sub sbAlias()
Dim miAlias As New ActAlias
miAlias.Entra(24, txtClave.Text.Trim)
miAlias.Text = "Alias Sucursal"
miAlias.piCatalogo = 24
miAlias.Show()
End Sub
Private Sub CatPais_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sbIniciaForma()
End Sub
Private Sub sbIniciaForma()
Try
clCmpEst.sbLlenaCombo("spListaEstado", Me.cmbEstado)
clCmpPla.sbLlenaCombo("spListaPlaza", Me.cmbPlaza)
clCmpReg.sbLlenaCombo("spListaRegion", Me.cmbRegion)
Dim CadSQL As String = "spGridSucursal " & Me.cmbEstado.SelectedValue
clCmp.fdtDataSetTabla(CadSQL)
Me.C1TrueDBGrid1.SetDataBinding(clCmp.ds, "Tabla")
'clCmp.sbLlenaMSFGrid(CadSQL, Me.grdSucursales)
'With grdSucursales
' .set_ColWidth(0, 0)
' .set_ColWidth(1, 0)
' .set_ColWidth(2, 0)
' .set_ColWidth(3, 2600)
' .set_ColWidth(4, 2400)
' .set_ColWidth(5, 800)
'End With
Catch ex As Exception
MessageBox.Show("Error en CatSucursal; sbIniciaForma: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub sbGuardar()
Dim lsMensaje As String
If MsgBox("¿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 liEstado As Integer
Dim liRegion As Integer
Dim liPlaza As Integer
Dim liActivo As Integer
Dim lsNombre As String
Dim lsSQL As String
Dim clCmp As New clsComplejo
On Error GoTo eh
fbValidaGrabar = False
If cmbEstado.SelectedIndex = -1 Then
MsgBox("Estado no válida", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente")
Exit Function
End If
If cmbRegion.SelectedIndex = -1 Then
MsgBox("Región no válida", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente")
Exit Function
End If
If cmbPlaza.SelectedIndex = -1 Then
MsgBox("Plaza no válida", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente")
Exit Function
End If
If Len(txtClave.Text) = 0 Then
liClave = -1
Else
liClave = Val(txtClave.Text)
End If
liEstado = cmbEstado.SelectedValue
liRegion = cmbRegion.SelectedValue
liPlaza = cmbPlaza.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 & "spGrabaCatSucursal "
lsSQL = lsSQL & liClave & ", "
lsSQL = lsSQL & liEstado & ", 24, "
lsSQL = lsSQL & liRegion & ", "
lsSQL = lsSQL & liPlaza & ", '"
lsSQL = lsSQL & lsNombre & "', "
lsSQL = lsSQL & liActivo
clCmp.sbGuardaModifica(lsSQL)
Return True
Exit Function
eh:
Return False
End Function
'Private Sub grdSucursales_DblClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdSucursales.DblClick
' With grdSucursales
' .Col = 0
' txtClave.Text = .Text
' .Col = 1
' clCmpEst.sbBuscaEnCombo(.Text, Me.cmbEstado)
' .Col = 2
' clCmpReg.sbBuscaEnCombo(.Text, Me.cmbRegion)
' .Col = 3
' clCmpPla.sbBuscaEnCombo(.Text, Me.cmbPlaza)
' .Col = 4
' txtNombre.Text = .Text
' .Col = 5
' If .Text = "Activo" Then
' chkActivo.Checked = True
' Else
' chkActivo.Checked = False
' End If
' End With
' actualizar(False)
'End Sub
Private Sub cmbEstado_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbEstado.SelectedIndexChanged
'On Error Resume Next
Try
Dim lsComando As String
Dim clCmpPais As New clsComplejo
'lsComando = "spGridSucursal " & cmbEstado.SelectedValue
'clCmpPais.sbLlenaMSFGrid(lsComando, Me.grdSucursales)
Dim CadSQL As String = "spGridSucursal " & Me.cmbEstado.SelectedValue
clCmp.fdtDataSetTabla(CadSQL)
Me.C1TrueDBGrid1.SetDataBinding(clCmp.ds, "Tabla")
Catch ex As Exception
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If txtClave.Text <> "" Then
sbAlias()
Else
MessageBox.Show("Debe Selecionar un elemento", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
Private Sub btnAceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAceptar.Click
sbGuardar()
actualizar(False)
End Sub
Private Sub C1TrueDBGrid1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1TrueDBGrid1.DoubleClick
With Me.C1TrueDBGrid1
.Col = 0
txtClave.Text = .Columns(0).Text
.Col = 1
clCmpEst.sbBuscaEnCombo(.Columns(1).Text, Me.cmbEstado)
.Col = 2
clCmpReg.sbBuscaEnCombo(.Columns(2).Text, Me.cmbRegion)
.Col = 3
clCmpPla.sbBuscaEnCombo(.Columns(3).Text, Me.cmbPlaza)
.Col = 4
txtNombre.Text = .Columns(4).Text
.Col = 5
If .Columns(5).Text = "Activo" Then
chkActivo.Checked = True
Else
chkActivo.Checked = False
End If
End With
actualizar(False)
End Sub
End Class