Ejemplo n.º 1
0
        private void Atualizar(object sender, RoutedEventArgs e)
        {
            Compras c = new Compras();

            try
            {
                c.IdCliente = int.Parse(txtI.Text);
            }
            catch (FormatException)
            {
                MessageBox.Show("Não é um numero");
            }
            c.NomeLivro = txtN.Text;
            try
            {
                c.Quantidade = int.Parse(txtQ.Text);
            }
            catch (FormatException)
            {
                MessageBox.Show("Não é um numero");
            }
            try
            {
                c.ValorTotal = double.Parse(txtT.Text);
            }
            catch (FormatException)
            {
                MessageBox.Show("Não é um numero");
            }
            NCompras n = new NCompras();

            n.Update(c);
            grid.ItemsSource = null;
            grid.ItemsSource = n.Select();
        }
Ejemplo n.º 2
0
        private void Excluir(object sender, RoutedEventArgs e)
        {
            Compras l = new Compras();

            l.IdCliente = int.Parse(txtI.Text);
            NCompras n = new NCompras();

            n.Delete(l);
            grid.ItemsSource = null;
            grid.ItemsSource = n.Select();
        }
Ejemplo n.º 3
0
        private void Inserir(object sender, RoutedEventArgs e)
        {
            Produtos w = new Produtos();

            if (w.ShowDialog().Value)
            {
                NCompras n = new NCompras();
                n.Insert(w.GetP());
                grid.ItemsSource = null;
                grid.ItemsSource = n.Select();
            }
        }