private async void btnEliminar_Click(object sender, RoutedEventArgs e) { try { if (ID <= 0) { MessageBox.Show("Selecciona un Item"); } else { if (MessageBox.Show("Seguro que desea eliminar?", "Eliminar", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { //DateTime ThisDay = new DateTime(); //ThisDay = Convert.ToDateTime(txtFecha.Text); _Reservation.ReservationID = ID; _Reservation.Origin = Origen; _Reservation.Destination = Destino; _Reservation.Action = Accion; _Reservation.Date = Date; _Reservation.CarID = CarId; _Reservation.EmployeeID = EmpleadoId; _Reservation.State = false; _ReservationBL.UpdateItem(_Reservation); //dgvReservacion.ItemsSource = _ReservationBL.GetAll(); //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 dgvReservacion.ItemsSource = list.ToList(); //Establecemos el numero de paginas del DataGrid tbPaginacion.Text = string.Format("Pagina {0}/{1}", pageNumber, list.PageCount); //txtAccion.Text = ""; txtDestino.Text = ""; txtOrigen.Text = ""; cmdIdAuto.Text = ""; cmdIdEmpleado.Text = ""; } } } catch (Exception ex) { MessageBox.Show("Algo anda mal : " + ex.Message, "Error CRVA-UG", MessageBoxButton.OK, MessageBoxImage.Error); } }
private async void btnRestaurar_Click(object sender, RoutedEventArgs e) { try { if (ID <= 0) { MessageBox.Show("Selecciona un Item"); } else { if (MessageBox.Show("Seguro que desea restaurar?", "Restaurar", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { _dataObj.Destination = Destino; _dataObj.Origin = Origen; _dataObj.Date = Fecha; _dataObj.Action = Action; _dataObj.CarID = CarID; _dataObj.EmployeeID = EmployeeID; _dataObj.ReservationID = ID; _dataObj.State = true; _dataObjBL.UpdateItem(_dataObj); //dgvRestaurar.Items.Refresh(); //dgvRestaurar.ItemsSource = _dataObjBL.GetAllDeleted(); //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 dgvRestaurar.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-UG", MessageBoxButton.OK, MessageBoxImage.Error); } }