Example #1
0
        public void ExcluirVenda()
        {
            VendaController vc = new VendaController();

            try
            {
                selecionado = vc.PesquisarPorID(selecionado.VendaID);
            }
            catch (Exception)
            {
                MessageBox.Show("Selecione um item para excluir!!");
            }

            if (selecionado == null)
            {
                return;
            }
            else
            {
                vc.ExcluirVenda(selecionado.VendaID);

                txtID.Text                  = "";
                txtExcluir.Text             = "";
                dtgMinhasVendas.ItemsSource = ctx.tblVendas.ToList();
                lblQuantidadeVendas.Content = ctx.tblVendas.Count();
            }
        }
Example #2
0
        public void BuscaVenda()
        {
            List <Venda> selecao = new List <Venda>();

            try
            {
                VendaController vc = new VendaController();
                selecionado = vc.PesquisarPorID(selecionado.VendaID);

                if (selecionado == null)
                {
                    return;
                }
                else
                {
                    txtID.Text = selecionado.VendaID.ToString();
                    selecao.Add(selecionado);
                }
            }
            catch
            {
                MessageBox.Show("Venda não encontrada!!");
            }

            dtgMinhasVendas.ItemsSource = selecao.ToList();
            txtExcluir.Text             = "";
            txtID.Text = "";
        }