Вы находитесь на странице: 1из 5

Private Sub FrmActaMatrimonio_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try Me.btnLook_.Enabled = True Me.listarTipMatrimonio() Me.

IniciaGridPersonas() ' Me.desactivarFormulario() Catch ex As Exception MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Private Sub listarTipMatrimonio() Dim loTipMat As New S30TipMatri_Presentacion Me.cmbTipMat.DataSource = loTipMat.S30BuscarTipoMatrimonio() Me.cmbTipMat.DisplayMember = "N_TipMat" Me.cmbTipMat.ValueMember = "C_TipMAt" End Sub

Private Sub btnDelete__Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete_.Click Try If Me.txtC_actMat.Text.Trim.Length = 0 Then MessageBox.Show("Ud. primero debe de realizar la busqueda del acta de matrimonio que desea eliminar") Else If MsgBox("Esta Seguro de Eliminar El Registro Seleccionado ?", MsgBoxStyle.YesNo, "Alerta") = MsgBoxResult.Yes Then Me.loActaMatrimonio.S30EliminarActaMatrimonio(Me.txtC_actMat.Text.Trim) 'S30EliminarActaMatrimonio(Me.txtC_actMat.Text.Trim) Me.limpiarFormulario() Me.EstadoFormulario(False) End If

End If Catch ex As Exception MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK) End Try End Sub Private Sub btnSave__Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave_.Click Dim band As Boolean = False Dim dtActMatPersona As DataTable Try If Me.grdActMat.Rows.Count > 0 AndAlso Me.grdActMat.CurrentRow IsNot Nothing Then If Me.txtC_Fun.Text.Trim.Length = 0 Then MessageBox.Show("Debe seleccionar a la Autoridad Celebrante") Else If Me.txtLugCel.Text.Trim.Length = 0 Or Me.txtExp.Text.Trim.Length = 0 Then MessageBox.Show("Faltan datos por ingresar") band = True 'desabilito botones Else If Me.grdActMat.Rows.Count = 4 Then If Me.opcion = "2" Then 'modificar acta matrimonio If Me.txtMotiModi.Text.Trim.Length = 0 Then MessageBox.Show("Ud. tiene que ingresar el motivo por la cual va a modificar") band = True Else dtActMatPersona = Me.grdActMat.DataSource dtActMatPersona.TableName = "dtActMatPersona" Me.loActaMatrimonio.ModificarActaCelebracion(Me.txtC_actMat.Text.Trim, Me.txtLugCel.Text, Me.dtpFecha.Value, Me.txtC_Fun.Text, Me.cmbTipMat.SelectedValue, Me.txtExp.Text, Me.txtObser.Text, Me.txtMotiModi.Text, dtActMatPersona) Me.lblModifica.Enabled = False Me.txtMotiModi.Enabled = False End If End If If Me.opcion = "1" Then dtActaMatrimonio = Me.grdActMat.DataSource dtActaMatrimonio.TableName = "dtActMatPersona"

Me.loActaMatrimonio.S30AgregarActaCelebracion(Me.txtLugCel.Text, Me.dtpFecha.Text, Me.txtC_Fun.Text, Me.cmbTipMat.SelectedValue, Me.txtExp.Text, Me.txtObser.Text, gcLogin, dtActaMatrimonio) MessageBox.Show("Se registro con exito...!!") 'Me.EstadoFormulario(False) band = True End If Else MessageBox.Show("Debes contar con 4 intervinientes para el registro") Me.Cambio_Estado = False Me.EstadoFormulario(True) End If ' End If Me.Cambio_Estado = False Me.EstadoFormulario(band) End If Else MessageBox.Show("Ud. debe tener ingresar la informacion de los intervienientes") End If Catch ex As Exception MessageBox.Show(ex.Message) Me.IniciaGridPersonas() End Try End Sub Private Sub IniciaGridPersonas() Dim loActaPersona As New S30ActMatPersonas_Presentacion Try Me.grdActMat.AutoGenerateColumns = False Me.grdActMat.DataSource = loActaPersona.S30BuscarActMatPersona(Nothing, "") Catch ex As Exception MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Private Sub txtExp_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)

If Char.IsDigit(e.KeyChar) Then e.Handled = False ElseIf Char.IsControl(e.KeyChar) Then e.Handled = False Else e.Handled = True End If End Sub Private Sub btnQuitar_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuitar.Click Dim loActMatPersonas As New S30ActMatPersonas_Presentacion Dim dtPersonas As New DataTable Try If Me.grdActMat.Rows.Count > 0 AndAlso Me.grdActMat.CurrentRow IsNot Nothing Then dtPersonas = DirectCast(Me.grdActMat.DataSource, DataTable) dtPersonas.Rows(Me.grdActMat.CurrentCell.RowIndex).Delete() Me.IniciaGridPersonas() Me.grdActMat.AutoGenerateColumns = False Me.grdActMat.DataSource = dtPersonas End If Catch ex As Exception MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub End Class

Buscar persona
Private Sub btnBuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuscar.Click Dim dtPersonas As New DataTable Try If Me.cmbOpcion.SelectedItem.ToString.Trim.Length = 0 Then If Me.cmbOpcion.SelectedItem = "Por Nombre" Then

' dtPersonas = Me.lopersona.S30BuscarPersona("", Me.txtBuscar.Text.Trim, "02") dtPersonas.TableName = "dtPersonas" Me.grdPersonas.AutoGenerateColumns = False Me.grdPersonas.DataSource = dtPersonas End If Else MessageBox.Show("Ud. debe seleccionar una opcion") End If Catch ex As Exception MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK) End Try End Sub Private Sub FrmBuscarPersona_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load listarCombo() End Sub Private Sub listarCombo() Me.cmbOpcion.Items.Add("Por Documento") Me.cmbOpcion.Items.Add("Por Nombre") End Sub End Class

Вам также может понравиться