コード例 #1
0
        private void Add_Producto(object sender, RoutedEventArgs e)
        {
            GrocerieStore.CrudWPF_FrameDataSet crudWPF_FrameDataSet = ((GrocerieStore.CrudWPF_FrameDataSet)(this.FindResource("crudWPF_FrameDataSet")));

            // Cargar datos en la tabla grocerie_store. Puede modificar este código según sea necesario.
            GrocerieStore.CrudWPF_FrameDataSetTableAdapters.grocerie_storeTableAdapter crudWPF_FrameDataSetgrocerie_storeTableAdapter = new GrocerieStore.CrudWPF_FrameDataSetTableAdapters.grocerie_storeTableAdapter();

            // Insert Data
            var     _price    = AddPriceTextBox.Text.Replace(".", ",");
            decimal add_price = Convert.ToDecimal(_price);

            crudWPF_FrameDataSetgrocerie_storeTableAdapter.InsertProduct(AddNameTextBox.Text, AddDescriptTextBox.Text, add_price, Convert.ToInt32(AddQuantityTextBox.Text));

            // Fill DataGrid
            crudWPF_FrameDataSetgrocerie_storeTableAdapter.Fill(crudWPF_FrameDataSet.grocerie_store);
            System.Windows.Data.CollectionViewSource grocerie_storeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("grocerie_storeViewSource")));
            grocerie_storeViewSource.View.MoveCurrentToFirst();

            // Clear TexBox
            clearAddTextBox();

            // Notification
            var duration = 5;

            SnackbarAdd.MessageQueue.Enqueue(
                "Product Added!",
                "OK",
                param => Trace.WriteLine("Actioned: " + param),
                null,
                false,
                true,
                TimeSpan.FromSeconds(duration));
        }
コード例 #2
0
        private void Update_Product(object sender, RoutedEventArgs e)
        {
            GrocerieStore.CrudWPF_FrameDataSet crudWPF_FrameDataSet = ((GrocerieStore.CrudWPF_FrameDataSet)(this.FindResource("crudWPF_FrameDataSet")));

            // Cargar datos en la tabla grocerie_store. Puede modificar este código según sea necesario.
            GrocerieStore.CrudWPF_FrameDataSetTableAdapters.grocerie_storeTableAdapter crudWPF_FrameDataSetgrocerie_storeTableAdapter = new GrocerieStore.CrudWPF_FrameDataSetTableAdapters.grocerie_storeTableAdapter();

            // Row selected id
            DataRowView row = (DataRowView)grocerie_storeDataGrid.SelectedItems[0];
            var         id  = Convert.ToInt32(row["id"]);

            // Update
            var     _price     = EditPriceTextBox.Text.Replace(".", ",");
            decimal edit_price = Convert.ToDecimal(_price);

            crudWPF_FrameDataSetgrocerie_storeTableAdapter.UpdateProduct(EditNameTextBox.Text, EditDescriptTextBox.Text, edit_price, Convert.ToInt32(EditQuantityTextBox.Text), id, id);

            // Fill DataGrid
            crudWPF_FrameDataSetgrocerie_storeTableAdapter.Fill(crudWPF_FrameDataSet.grocerie_store);
            System.Windows.Data.CollectionViewSource grocerie_storeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("grocerie_storeViewSource")));
            grocerie_storeViewSource.View.MoveCurrentToFirst();

            // Notification
            var duration = 5;

            SnackbarUpdate.MessageQueue.Enqueue(
                "Product Updated!",
                "OK",
                param => Trace.WriteLine("Actioned: " + param),
                null,
                false,
                true,
                TimeSpan.FromSeconds(duration));
        }
コード例 #3
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     GrocerieStore.CrudWPF_FrameDataSet crudWPF_FrameDataSet = ((GrocerieStore.CrudWPF_FrameDataSet)(this.FindResource("crudWPF_FrameDataSet")));
     // Cargar datos en la tabla grocerie_store. Puede modificar este código según sea necesario.
     GrocerieStore.CrudWPF_FrameDataSetTableAdapters.grocerie_storeTableAdapter crudWPF_FrameDataSetgrocerie_storeTableAdapter = new GrocerieStore.CrudWPF_FrameDataSetTableAdapters.grocerie_storeTableAdapter();
     crudWPF_FrameDataSetgrocerie_storeTableAdapter.Fill(crudWPF_FrameDataSet.grocerie_store);
     System.Windows.Data.CollectionViewSource grocerie_storeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("grocerie_storeViewSource")));
     grocerie_storeViewSource.View.MoveCurrentToFirst();
 }
コード例 #4
0
        private void Delete_Product(object sender, RoutedEventArgs e)
        {
            GrocerieStore.CrudWPF_FrameDataSet crudWPF_FrameDataSet = ((GrocerieStore.CrudWPF_FrameDataSet)(this.FindResource("crudWPF_FrameDataSet")));

            // Cargar datos en la tabla grocerie_store. Puede modificar este código según sea necesario.
            GrocerieStore.CrudWPF_FrameDataSetTableAdapters.grocerie_storeTableAdapter crudWPF_FrameDataSetgrocerie_storeTableAdapter = new GrocerieStore.CrudWPF_FrameDataSetTableAdapters.grocerie_storeTableAdapter();

            // Row selected id
            DataRowView row = (DataRowView)grocerie_storeDataGrid.SelectedItems[0];
            var         id  = Convert.ToInt32(row["id"]);

            // Deletequery
            crudWPF_FrameDataSetgrocerie_storeTableAdapter.DeleteProduct(id);

            // Fill DataGrid
            crudWPF_FrameDataSetgrocerie_storeTableAdapter.Fill(crudWPF_FrameDataSet.grocerie_store);
            System.Windows.Data.CollectionViewSource grocerie_storeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("grocerie_storeViewSource")));
            grocerie_storeViewSource.View.MoveCurrentToFirst();
        }