private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { int menu = int.Parse((listView.SelectedItem as ListViewItem).Name.Replace("menu_", "")); List <Rotinas> list = new RotinasController().ListByMenu(menu); dataGrid.ItemsSource = list; } catch { Parametros p = ParametrosController.FindParametro("CSQL_PATH"); List <Rotinas> r = new List <Rotinas>(); DirectoryInfo di = new DirectoryInfo(p.Valor); foreach (FileInfo file in di.GetFiles()) { if (!file.Name.EndsWith(".csql")) { continue; } r.Add(new Rotinas() { Id = 600, Menu = 600, Descricao = file.Name.Replace(".csql", "") }); } dataGrid.ItemsSource = r; } }
private void ListaPermissoes() { List <Rotinas> list = new RotinasController().ListAll(); List <PermissoesAdapter> permissoes = new List <PermissoesAdapter>(); list.ForEach(e => permissoes.Add(new PermissoesAdapter(e))); dataGrid.ItemsSource = permissoes; }
private void txCod_rotina_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { int id_rotina = 0; if (int.TryParse(txCod_rotina.Text, out id_rotina)) { RotinasController rc = new RotinasController(); rc.ShowWindow(id_rotina); } txCod_rotina.Text = string.Empty; } }
private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { Rotinas r = (Rotinas)dataGrid.SelectedItem; if (r.Id == 600) { CarregaConsultaCustomizada(r.Descricao); return; } RotinasController rc = new RotinasController(); rc.ShowWindow(r.Id); } catch { } }