public void Update_DataGrid() { try { TablaUsuarios.ItemsSource = SqlQueries.UpdateDataGrid("SELECT [FlemidraDB].[dbo].[Users].[id], [FlemidraDB].[dbo].[Users].[username], [FlemidraDB].[dbo].[Users].[password], [FlemidraDB].[dbo].[Users].[rec_key], [FlemidraDB].[dbo].[Users].[type] FROM [FlemidraDB].[dbo].[Users]").DefaultView; TablaUsuarios.AutoGenerateColumns = false; TablaUsuarios.CanUserAddRows = false; } catch (Exception en) { MessageBox.Show("Error al realizar operacion. " + en); } }
private void Search_Name(object sender, KeyEventArgs e) { if (string.IsNullOrEmpty(TxtSearch.Text)) { Update_DataGrid(); } else { DataView dataView = new DataView(SqlQueries.UpdateDataGrid("SELECT [FlemidraDB].[dbo].[Users].[id], [FlemidraDB].[dbo].[Users].[username], [FlemidraDB].[dbo].[Users].[password], [FlemidraDB].[dbo].[Users].[rec_key], [FlemidraDB].[dbo].[Users].[type] FROM [FlemidraDB].[dbo].[Users]")); dataView.RowFilter = string.Format("username LIKE '%{0}%'", TxtSearch.Text); TablaUsuarios.ItemsSource = dataView; } }
public void Update_DataGrid() { try { TablaProductos.ItemsSource = SqlQueries.UpdateDataGrid("SELECT [FlemidraDB].[dbo].[Products].[id] As 'ID', [FlemidraDB].[dbo].[Products].[name] As 'Nombre', [FlemidraDB].[dbo].[Products].[quantity] As 'Existencia', CONCAT('$. ', [FlemidraDB].[dbo].[Products].[price]) As 'Precio', CONCAT('$. ', [FlemidraDB].[dbo].[Products].[price] *1.12) As 'PrecioIva', [FlemidraDB].[dbo].[Categories].[name] As 'Categoria', [FlemidraDB].[dbo].[Categories].[id] As 'IDcat' FROM [FlemidraDB].[dbo].[Products] LEFT JOIN [FlemidraDB].[dbo].[Categories] on [FlemidraDB].[dbo].[Products].[id_cat] = [FlemidraDB].[dbo].[Categories].[id]").DefaultView; TablaProductos.AutoGenerateColumns = false; TablaProductos.CanUserAddRows = false; } catch (Exception) { // ignored } }
public void Update_DataGrid() { try { TablaCategorias.ItemsSource = SqlQueries.UpdateDataGrid("SELECT [FlemidraDB].[dbo].[Categories].[id] As 'ID', [FlemidraDB].[dbo].[Categories].[name] As 'Nombre' FROM [FlemidraDB].[dbo].[Categories]").DefaultView; TablaCategorias.AutoGenerateColumns = false; TablaCategorias.CanUserAddRows = false; } catch (Exception en) { MessageBox.Show("Error al realizar operacion de actualizacion de Datagrid. " + en); } }
public void Update_DataGrid() { try { //TablaProductos.ItemsSource = SqlQueries.UpdateDataGrid("SELECT [FlemidraDB].[dbo].[Records].[type] As 'Evento', [FlemidraDB].[dbo].[Products].[name] As 'Producto', [FlemidraDB].[dbo].[Categories].[name] As 'Categoria', [FlemidraDB].[dbo].[Records].[quantity] As 'Cantidad', CONVERT(date, [FlemidraDB].[dbo].[Records].[time]) As 'Fecha', [FlemidraDB].[dbo].[Users].[username] As 'Usuario' FROM [FlemidraDB].[dbo].[Records] INNER JOIN [FlemidraDB].[dbo].[Products] on [FlemidraDB].[dbo].[Records].[id_Product] = [FlemidraDB].[dbo].[Products].[id] INNER JOIN [FlemidraDB].[dbo].[Users] ON [FlemidraDB].[dbo].[Records].[id_Users] = [FlemidraDB].[dbo].[Users].[id] INNER JOIN [FlemidraDB].[dbo].[Categories] on [FlemidraDB].[dbo].[Products].[id_cat] = [FlemidraDB].[dbo].[Categories].[id]").DefaultView; TablaProductos.ItemsSource = SqlQueries.UpdateDataGrid("SELECT [FlemidraDB].[dbo].[Records].[type] As 'Evento', [FlemidraDB].[dbo].[Products].[name] As 'Producto', [FlemidraDB].[dbo].[Categories].[name] As 'Categoria', [FlemidraDB].[dbo].[Records].[quantity] As 'Cantidad', CONVERT(date, [FlemidraDB].[dbo].[Records].[time]) As 'Fecha', [FlemidraDB].[dbo].[Users].[username] As 'Usuario' FROM [FlemidraDB].[dbo].[Records] INNER JOIN [FlemidraDB].[dbo].[Products] on [FlemidraDB].[dbo].[Records].[id_Product] = [FlemidraDB].[dbo].[Products].[id] INNER JOIN [FlemidraDB].[dbo].[Users] ON [FlemidraDB].[dbo].[Records].[id_Users] = [FlemidraDB].[dbo].[Users].[id] INNER JOIN [FlemidraDB].[dbo].[Categories] on [FlemidraDB].[dbo].[Products].[id_cat] = [FlemidraDB].[dbo].[Categories].[id]").DefaultView; TablaProductos.AutoGenerateColumns = false; TablaProductos.CanUserAddRows = false; } catch (Exception en) { MessageBox.Show("Error al realizar operacion de actualizacion de DataGrid. " + en); } }
private void Search_Name(object sender, KeyEventArgs e) { if (string.IsNullOrEmpty(TxtSearch.Text)) { Update_DataGrid(); } else { DataView dataView1 = new DataView(SqlQueries.UpdateDataGrid("SELECT [FlemidraDB].[dbo].[Products].[id] As 'ID', [FlemidraDB].[dbo].[Products].[name] As 'Nombre', [FlemidraDB].[dbo].[Products].[quantity] As 'Existencia', CONCAT('Bs ', [FlemidraDB].[dbo].[Products].[price]) As 'Precio', CONCAT('Bs ', [FlemidraDB].[dbo].[Products].[price] *1.12) As 'PrecioIva', [FlemidraDB].[dbo].[Categories].[name] As 'Categoria', [FlemidraDB].[dbo].[Categories].[id] As 'IDcat' FROM [FlemidraDB].[dbo].[Products] LEFT JOIN [FlemidraDB].[dbo].[Categories] on [FlemidraDB].[dbo].[Products].[id_cat] = [FlemidraDB].[dbo].[Categories].[id]")) { RowFilter = $"Nombre LIKE '%{TxtSearch.Text}%'" }; TablaProductos.ItemsSource = dataView1; } }
private void Search_Name(object sender, KeyEventArgs e) { if (String.IsNullOrEmpty(TxtSearch.Text)) { Update_DataGrid(); } else { DataView dataView1 = new DataView(SqlQueries.UpdateDataGrid("SELECT [FlemidraDB].[dbo].[Categories].[id] As 'ID', [FlemidraDB].[dbo].[Categories].[name] As 'Nombre' FROM [FlemidraDB].[dbo].[Categories]")) { RowFilter = $"Nombre LIKE '%{TxtSearch.Text}%'" }; TablaCategorias.ItemsSource = dataView1; } }