private async void btnDelete_Click(object sender, RoutedEventArgs e) { UsuarioModel dataRowView = (UsuarioModel)((Button)e.Source).DataContext; int usuario_id = dataRowView.usuario_id; UsuarioDAO dao = new UsuarioDAO(); //LoginDAO loginDao = new LoginDAO(); try { ////borrar login por uasuario_id //var login = await loginDao.Delete(usuario_id); //borrar usuario var response = await dao.Delete(usuario_id); if (response.IsSuccessStatusCode) { MessageBox.Show("Usuario Exitosamente Borrado!"); DataContext = new PaginacionUsuario(); } } catch (Exception) { MessageBox.Show("Usuario no Borrado!"); } }
public RecursosUsuarioUC() { InitializeComponent(); DataContext = new PaginacionUsuario(); dg.Columns[0].Visibility = Visibility.Hidden; }
private void DataGrid_Sorting(object sender, DataGridSortingEventArgs e) { e.Handled = true; PaginacionUsuario paginacionMenu = (PaginacionUsuario)DataContext; string sortField = String.Empty; // Use a switch statement to check the SortMemberPath // and set the sort column to the actual column name. In this case, // the SortMemberPath and column names match. switch (e.Column.SortMemberPath) { case ("usuario_id"): sortField = "Tipo1"; break; case ("nombre"): sortField = "Tipo2"; break; case ("ap_paterno"): sortField = "Tipo3"; break; case ("ap_materno"): sortField = "Tipo4"; break; case ("e_mail"): sortField = "Tipo5"; break; case ("fono"): sortField = "Tipo6"; break; case ("rol_desc"): sortField = "Tipo7"; break; } ListSortDirection direction = (e.Column.SortDirection != ListSortDirection.Ascending) ? ListSortDirection.Ascending : ListSortDirection.Descending; bool sortAscending = direction == ListSortDirection.Ascending; paginacionMenu.Sort(sortField, sortAscending); currentSortColumn.SortDirection = null; e.Column.SortDirection = direction; currentSortColumn = e.Column; currentSortDirection = direction; }
private void btnRefresh_Click(object sender, RoutedEventArgs e) { DataContext = new PaginacionUsuario(); }