Beispiel #1
0
 private void Aceptar_Click(object sender, RoutedEventArgs e)
 {
     if (dgvBuscar.SelectedCells.Count == 1)
     {
         int id = Convert.ToInt32(dgvBuscar.SelectedCells[0].Item);
         ClienteSelecccionado = ClienteDAL.ObtenerCliente(id);
         this.Close();
     }
     else
     {
         MessageBox.Show("debe de seleccionar una fila");
     }
 }
Beispiel #2
0
        /*/void gridFill()
         * {
         *  string conectionString = @"server=127.0.0.1; database=Programacion; Uid=root; pwd=pollo2419;";
         *  using (MySqlConnection conectar = new MySqlConnection(connectionString))
         *  {
         *      MySqlCommand sqlDa = new MySqlCommand("select * from book", conectar);
         *      conectar.Open();
         *      DataTable dt = new DataTable();
         *      dt.Load(sqlDa.ExecuteReader());
         *      conectar.Close();
         *      pngrid.DataContext = dt;
         *      if (dt.Rows.Count > 0)
         *  }
         * }
         * /*/
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Cliente pCliente = new Cliente();

            pCliente.Nombre   = txtNombre.Text.Trim();
            pCliente.Apellido = txtApellido.Text.Trim();

            pCliente.Genero    = cbGenero.Text.Trim();
            pCliente.Direccion = txtDireccion.Text.Trim();
            int resultado = ClienteDAL.Agregar(pCliente);

            if (resultado > 0)
            {
                MessageBox.Show("Cliente Guardado Con Exito!!", "Guardado", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("No se pudo guardar el cliente", "Fallo!!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
Beispiel #3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     dgvBuscar.ItemsSource = ClienteDAL.Buscar(txtNombr.Text);
 }