コード例 #1
0
ファイル: BuscarCliente.cs プロジェクト: jenesepas/csharp
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if (dgvBuscar.SelectedRows.Count == 1)
            {
                int id = Convert.ToInt32(dgvBuscar.CurrentRow.Cells[0].Value);
                ClienteSelecionado = ClietesDAL.ObtenerCliente(id);

                this.Close();
            }
            else
            {
                MessageBox.Show("debe de seleccionar una fila");
            }
        }
コード例 #2
0
ファイル: FormClientes.cs プロジェクト: larriojas/GitWeb
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Cliente pCliente = new Cliente();

            pCliente.Nombre    = txtNombre.Text.Trim();
            pCliente.Apellido  = txtApellido.Text.Trim();
            pCliente.Fecha_Nac = dtpFechaNacimiento.Value.Year + "/" + dtpFechaNacimiento.Value.Month + "/" + dtpFechaNacimiento.Value.Day;
            pCliente.Direccion = txtDireccion.Text.Trim();

            int resultado = ClietesDAL.Agregar(pCliente);

            if (resultado > 0)
            {
                MessageBox.Show("Cliente Guardado Con Exito!!", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("No se pudo guardar el cliente", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
コード例 #3
0
ファイル: BuscarCliente.cs プロジェクト: jenesepas/csharp
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     dgvBuscar.DataSource = ClietesDAL.Buscar(txtNombre.Text, txtApellido.Text);
 }