Beispiel #1
0
 private void btnEliminarCliente_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("", "Aviso Eliminar Persona", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             CLS.Personas oPersonas = new CLS.Personas();
             oPersonas.IDPersonas = dtgClientes.CurrentRow.Cells["idpersonas"].Value.ToString();
             oPersonas.Eliminar();
         }
     }
     catch
     {
         throw;
     }
 }
Beispiel #2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (validarCampos())
            {
                try
                {
                    CLS.Personas oPersona = new CLS.Personas();
                    oPersona.IDPersonas = txbIDCliente.Text;
                    oPersona.Nombres    = txbNombres.Text;
                    oPersona.Apellidos  = txbApellidos.Text;
                    if (cbbTipoPersona.SelectedIndex == 1)
                    {
                        oPersona.TipoPersona = cbbTipoPersona.Text;
                    }
                    else if (cbbTipoPersona.SelectedIndex == 2)
                    {
                        oPersona.TipoPersona = cbbTipoPersona.Text;
                    }
                    if (txbDUI.Text.Length > 0)
                    {
                        oPersona.DUI = txbDUI.Text;
                    }
                    else
                    {
                        oPersona.DUI = "N/A";
                    }
                    if (txbNIT.Text.Length > 0)
                    {
                        oPersona.NIT = txbNIT.Text;
                    }
                    else
                    {
                        oPersona.NIT = "N/A";
                    }
                    if (txbNRC.Text.Length > 0)
                    {
                        oPersona.NRC = txbNRC.Text;
                    }
                    else
                    {
                        oPersona.NRC = "N/A";
                    }
                    if (txbGiro.Text.Length > 0)
                    {
                        oPersona.Giro = txbGiro.Text;
                    }
                    else
                    {
                        oPersona.Giro = "";
                    }
                    if (txbDireccion.Text.Length > 0)
                    {
                        oPersona.Direccion = txbDireccion.Text;
                    }
                    else
                    {
                        oPersona.Direccion = "";
                    }
                    if (txbCategoria.Text.Length > 0)
                    {
                        oPersona.Categoria = txbCategoria.Text;
                    }
                    else
                    {
                        oPersona.Categoria = "";
                    }

                    if (txbIDCliente.Text.Length > 0)
                    {
                        if (oPersona.Actualizar())
                        {
                            Close();
                        }
                    }
                    else
                    {
                        if (oPersona.Guardar())
                        {
                            Close();
                        }
                    }
                }
                catch
                {
                }
            }
        }