private async void btnEliminar_Click(object sender, RoutedEventArgs e) { try { if (txtNombre.Text.ToUpper().Trim() != "" || txtApellido.Text != "" || txtFecha.Text != "" || txtSalario.Text != "") { //if (MessageBox.Show("Seguro que desea eliminar?", "Eliminar", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) //{ DateTime ThisDay = new DateTime(); ThisDay = Convert.ToDateTime(txtFecha.Text); _Employee.Code = Code; _Employee.Name = txtNombre.Text.ToUpper(); _Employee.LastName = txtApellido.Text.ToUpper(); _Employee.DateBirth = Convert.ToDateTime(ThisDay.ToString("d")); _Employee.Date = Date; _Employee.Salary = Convert.ToDecimal(txtSalario.Text); _Employee.OfficeID = Convert.ToInt64(cmbOficina.SelectedValue); _Employee.EmployeeID = ID; DialogoEliminacion dialogo = new DialogoEliminacion(_Employee); dialogo.ShowDialog(); Limpiar(); EstadoBotones(0); //lista a paginar list = await GetPagedListAsync(); //Determinamos el estado de los botones btnPrevius.IsEnabled = list.HasPreviousPage; btnSiguiente.IsEnabled = list.HasNextPage; //Cargamos la lista al DataGrid dgvEmpleado.ItemsSource = list.ToList(); //Establecemos el numero de paginas del DataGrid tbPaginacion.Text = string.Format("Pagina {0}/{1}", pageNumber, list.PageCount); //} } else if (txtNombre.Text.ToUpper().Trim() == "" || txtApellido.Text == "" || txtFecha.Text == "" || txtSalario.Text == "" || ID <= 0) { MessageBox.Show("Selecciona un Item"); } } catch (Exception ex) { MessageBox.Show("Algo anda mal: " + ex.Message, "Error CRVA-EE", MessageBoxButton.OK, MessageBoxImage.Error); } }
private async void btnEliminar_Click(object sender, RoutedEventArgs e) { try { if (ID <= 0) { MessageBox.Show("Selecciona un Item", "Alerta CRVA-VE", MessageBoxButton.OK, MessageBoxImage.Information); } else { DateTime ThisDay = new DateTime(); ThisDay = Convert.ToDateTime(txtFecha.Text); _Car.MarkID = Convert.ToInt64(cmbMarca.SelectedValue); _Car.Date = Convert.ToDateTime(ThisDay.ToString("d")); _Car.Details = txtDetalle.Text.ToUpper(); _Car.Image = img; _Car.Code = txtMatricula.Text.ToUpper(); _Car.CarID = ID; //Modificación para eliminar mediante el cuadro de eliminación. DialogoEliminacion dialogoEliminacion = new DialogoEliminacion(_Car); dialogoEliminacion.ShowDialog(); dgvVehiculo.UnselectAllCells(); EstadoBotones(0); LimpiarWindow(); //lista a paginar list = await GetPagedListAsync(); //Determinamos el estado de los botones btnPrevius.IsEnabled = list.HasPreviousPage; btnSiguiente.IsEnabled = list.HasNextPage; //Cargamos la lista al DataGrid dgvVehiculo.ItemsSource = list.ToList(); //Establecemos el numero de paginas del DataGrid tbPaginacion.Text = string.Format("Pagina {0}/{1}", pageNumber, list.PageCount); } } catch (Exception ex) { MessageBox.Show("Algo anda mal : " + ex.Message, "Error CRVA-VE", MessageBoxButton.OK, MessageBoxImage.Error); } }