Public Class CatPais Inherits System.Windows.Forms.Form Dim clCmpOrg As clsComplejo = New clsComplejo Dim clCmpOrg1 As clsComplejo = New clsComplejo Dim clCmpOrg2 As clsComplejo = New clsComplejo Dim clCmpClas As clsComplejo = New clsComplejo Dim Actualizar As Boolean #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 ImageList1 As System.Windows.Forms.ImageList Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents txtClave As System.Windows.Forms.TextBox Friend WithEvents txtNombre As System.Windows.Forms.TextBox Friend WithEvents txtNombreIngles As System.Windows.Forms.TextBox Friend WithEvents cmbOrganismo As System.Windows.Forms.ComboBox Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents chkActivo As System.Windows.Forms.CheckBox Friend WithEvents grdPaises As AxMSFlexGridLib.AxMSFlexGrid Friend WithEvents cmbClasificacion 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 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 Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox Friend WithEvents grsClasPais As AxMSFlexGridLib.AxMSFlexGrid Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(CatPais)) Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components) Me.Label1 = New System.Windows.Forms.Label Me.Label2 = New System.Windows.Forms.Label Me.Label3 = New System.Windows.Forms.Label Me.Label4 = New System.Windows.Forms.Label Me.Label5 = New System.Windows.Forms.Label Me.txtClave = New System.Windows.Forms.TextBox Me.txtNombre = New System.Windows.Forms.TextBox Me.txtNombreIngles = New System.Windows.Forms.TextBox Me.cmbOrganismo = New System.Windows.Forms.ComboBox Me.GroupBox1 = New System.Windows.Forms.GroupBox Me.chkActivo = New System.Windows.Forms.CheckBox Me.cmbClasificacion = 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.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.btnAliasPais = New System.Windows.Forms.Button Me.GroupBox2 = New System.Windows.Forms.GroupBox Me.pnlBotones.SuspendLayout() Me.SuspendLayout() ' '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 ' '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(32, 64) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(64, 16) Me.Label1.TabIndex = 25 Me.Label1.Text = "Clave País:" ' '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(48, 96) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(48, 16) Me.Label2.TabIndex = 26 Me.Label2.Text = "Nombre:" ' '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(9, 128) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(88, 16) Me.Label3.TabIndex = 27 Me.Label3.Text = "Nombre Inglés:" ' '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(26, 160) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(64, 16) Me.Label4.TabIndex = 28 Me.Label4.Text = "Organismo:" ' '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(18, 192) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(72, 16) Me.Label5.TabIndex = 29 Me.Label5.Text = "Clasificación:" ' 'txtClave ' Me.txtClave.BackColor = System.Drawing.Color.White 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 = 30 Me.txtClave.Text = "" ' '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(272, 20) Me.txtNombre.TabIndex = 0 Me.txtNombre.Text = "" ' 'txtNombreIngles ' Me.txtNombreIngles.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper Me.txtNombreIngles.Location = New System.Drawing.Point(112, 120) Me.txtNombreIngles.Name = "txtNombreIngles" Me.txtNombreIngles.Size = New System.Drawing.Size(272, 20) Me.txtNombreIngles.TabIndex = 1 Me.txtNombreIngles.Text = "" ' 'cmbOrganismo ' Me.cmbOrganismo.Location = New System.Drawing.Point(112, 152) Me.cmbOrganismo.Name = "cmbOrganismo" Me.cmbOrganismo.Size = New System.Drawing.Size(280, 21) Me.cmbOrganismo.TabIndex = 2 ' 'GroupBox1 ' 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(16, 304) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(536, 200) Me.GroupBox1.TabIndex = 35 Me.GroupBox1.TabStop = False ' '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(304, 56) Me.chkActivo.Name = "chkActivo" Me.chkActivo.Size = New System.Drawing.Size(72, 16) Me.chkActivo.TabIndex = 4 Me.chkActivo.Text = "Activo:" ' 'cmbClasificacion ' Me.cmbClasificacion.Location = New System.Drawing.Point(112, 184) Me.cmbClasificacion.Name = "cmbClasificacion" Me.cmbClasificacion.Size = New System.Drawing.Size(280, 21) Me.cmbClasificacion.TabIndex = 3 ' '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(558, 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" ' '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(432, 192) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(32, 24) 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(416, 80) 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 ' '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(448, 512) Me.btnAliasPais.Name = "btnAliasPais" Me.btnAliasPais.Size = New System.Drawing.Size(104, 24) Me.btnAliasPais.TabIndex = 83 Me.btnAliasPais.Text = "Alias ..." Me.btnAliasPais.TextAlign = System.Drawing.ContentAlignment.MiddleRight ' 'GroupBox2 ' Me.GroupBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.GroupBox2.Location = New System.Drawing.Point(112, 208) Me.GroupBox2.Name = "GroupBox2" Me.GroupBox2.Size = New System.Drawing.Size(280, 96) Me.GroupBox2.TabIndex = 84 Me.GroupBox2.TabStop = False ' 'CatPais ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(558, 547) Me.ControlBox = False Me.Controls.Add(Me.GroupBox2) Me.Controls.Add(Me.btnAliasPais) Me.Controls.Add(Me.pnlBotones) Me.Controls.Add(Me.Label7) Me.Controls.Add(Me.tlbCorteCaja) Me.Controls.Add(Me.cmbClasificacion) Me.Controls.Add(Me.chkActivo) Me.Controls.Add(Me.GroupBox1) Me.Controls.Add(Me.cmbOrganismo) Me.Controls.Add(Me.txtNombreIngles) 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.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D Me.Name = "CatPais" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "CatPais" 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" GroupBox2.Location = New Point(112, 208) Limpiar() Habilita(True) Case "Actualizar" GroupBox2.Location = New Point(112, 208) Habilita(True) Actualizar = True Case "Salir" Me.Close() End Select End Sub Private Sub Limpiar() txtClave.Text = "" txtNombre.Text = "" txtNombreIngles.Text = "" End Sub Private Sub Habilita(ByVal Bandera As Boolean) txtNombre.Enabled = Bandera txtNombreIngles.Enabled = Bandera End Sub Private Sub sbAlias() Habilita(False) Dim miAlias As New ActAlias() miAlias.Entra(15, txtClave.Text) miAlias.Text = "Alias País" miAlias.piCatalogo = 15 miAlias.Show() End Sub Private Sub CatPais_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load GroupBox2.Location = New Point(112, 184) sbIniciaForma() End Sub Private Sub sbIniciaForma() clCmpClas.sbLlenaCombo("spListaClasPais", Me.cmbClasificacion) clCmpOrg1.sbLlenaCombo("spListaOrganismos", Me.cmbOrganismo) clCmpOrg2.sbLlenaMSFGrid("spGridPais 0", grdPaises) clCmpOrg.sbLlenaMSFGrid("spGridPaisClasificacion 0", grsClasPais) Try With grdPaises .set_ColWidth(0, 0) .set_ColWidth(1, 1500) .set_ColWidth(2, 3200) .set_ColWidth(3, 3800) .set_ColWidth(4, 0) End With With grsClasPais .set_ColWidth(0, 0) .set_ColWidth(1, 0) .set_ColWidth(2, 3200) End With Catch a As Exception MessageBox.Show("Error en CatPais; sbIniciaForma: " & a.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Private Sub sbGuardar() Dim lsMensaje As String If MessageBox.Show("Desea guardar los cambios? ", "MINDS", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No Then Exit Sub '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 liClasificacion As Integer Dim liOrganismo As Integer Dim liActivo As Integer Dim lsNombre As String Dim lsNombreIngles As String Dim lsSQL As String Dim clCmp As New clsComplejo On Error GoTo eh fbValidaGrabar = False If cmbClasificacion.SelectedIndex = -1 Then MsgBox("Clasificación no válida", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente") Exit Function End If If cmbOrganismo.SelectedIndex = -1 Then MsgBox("Organismo no válido", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente") Exit Function End If '***********Asigancion de valores ************* If Len(txtClave.Text) = 0 Then liClave = -1 Else liClave = Val(txtClave.Text) End If liClasificacion = cmbClasificacion.SelectedValue liOrganismo = cmbOrganismo.SelectedValue liActivo = IIf(chkActivo.Checked, 1, 0) lsNombre = txtNombre.Text.Trim lsNombreIngles = txtNombreIngles.Text.Trim If Len(lsNombre.Trim) = 0 Then MsgBox("Nombre no válido", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente") Exit Function End If If Len(lsNombreIngles.Trim) = 0 Then MsgBox("Nombre inglés no válido", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "Cliente") Exit Function End If '********* Forma el query para grabar ******************** lsSQL = "" lsSQL = lsSQL & "spGrabaCatPais " lsSQL = lsSQL & liClave & ", " lsSQL = lsSQL & liOrganismo & ", 15, " lsSQL = lsSQL & liClasificacion & ", '" lsSQL = lsSQL & lsNombre & "', '" lsSQL = lsSQL & lsNombreIngles & "', " lsSQL = lsSQL & liActivo clCmp.sbGuardaModifica(lsSQL) Return True Exit Function eh: Return False End Function Private Sub grdPaises_DblClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdPaises.DblClick With Me.grdPaises .Col = 0 txtClave.Text = .Text .Col = 1 clCmpOrg.sbLlenaMSFGrid("spGridPaisClasificacion " & txtClave.Text.Trim, grsClasPais) With Me.grsClasPais .set_ColWidth(0, 0) .set_ColWidth(1, 0) .set_ColWidth(2, 4000) End With .Col = 2 txtNombre.Text = .Text .Col = 3 txtNombreIngles.Text = .Text .Col = 4 If .Text = "Activo" Then chkActivo.Checked = True Else chkActivo.Checked = False End If End With Habilita(True) GroupBox2.Location = New Point(112, 184) End Sub Private Sub grsClasPais_DblClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles grsClasPais.DblClick If Actualizar = True Then GroupBox2.Location = New Point(112, 208) Dim Id_Clasificacion As Integer With grsClasPais .Col = 1 Id_Clasificacion = .Text() cmbClasificacion.SelectedValue = Id_Clasificacion End With End If End Sub Private Sub cmbClasificacion_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbClasificacion.SelectedIndexChanged On Error Resume Next Dim lsComando As String Dim clCmpClas As New clsComplejo() lsComando = "spGridPais " & cmbClasificacion.SelectedValue clCmpClas.sbLlenaMSFGrid(lsComando, Me.grdPaises) 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 Private Sub btnAceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAceptar.Click Me.Actualizar = False sbGuardar() End Sub End Class