protected void valorTotal_Click(object sender, EventArgs e)
        {
            msg.Text = null;

            try {
                GVDados.DataSource = PizzaDB.ValorTotal();
                GVDados.DataBind();

                SaveLog("Valor Total Consultado");
            }
            catch (Exception) {
                msg.Text = "Erro ao consultar Valor Total";
                SaveLog(msg.Text);
            }

            ApagarCampos();
        }
        protected void remover_Click(object sender, EventArgs e)
        {
            ApagarTabela();
            try {
                PizzaDB.Delete(id.Text);

                msg.Text = "Pizza removida com sucesso!";
            }
            catch (Exception) {
                msg.Text = "Erro ao remover a pizza";
            }
            finally {
                SaveLog(msg.Text);
            }

            ApagarCampos();
        }
        protected void consultar_Click(object sender, EventArgs e)
        {
            msg.Text = null;

            try {
                GVDados.DataSource = PizzaDB.Read();
                GVDados.DataBind();

                SaveLog("Dados consultados");
            }
            catch (Exception) {
                msg.Text = "Erro ao consultar os dados";
                SaveLog(msg.Text);
            }

            ApagarCampos();
        }
        protected void inserir_Click(object sender, EventArgs e)
        {
            ApagarTabela();

            try {
                var pizza = new Pizza(descricao.Text, decimal.Parse(valor.Text));
                PizzaDB.Insert(pizza);

                msg.Text = "Pizza inserida com sucesso!";
            }
            catch (Exception) {
                msg.Text = "Erro ao inserir a pizza";
            }
            finally {
                SaveLog(msg.Text);
            }

            ApagarCampos();
        }
Esempio n. 5
0
        protected void btnAtualziar_Click(object sender, EventArgs e)
        {
            Pizza  valor;
            string desc = txtDescricao.Text;
            string id   = txtId.Text;

            if (id == "")
            {
                valor = new PizzaDB().Consultar(desc);
                SaveLog("Consulta por ID");
            }
            else
            {
                valor = new PizzaDB().Consultar(id);
                SaveLog("Consulta por Descrição");
            }
            LoadLog();
            txtId.Text        = Convert.ToString(valor.Id);
            txtDescricao.Text = valor.Descricao;
            txtValor.Text     = Convert.ToString(valor.Valor);
        }
Esempio n. 6
0
        // GET: Pizza
        public IEnumerable <Pizza> Get()
        {
            var pizza = new PizzaDB().Select();

            return(pizza);
        }
Esempio n. 7
0
 public void Post([FromBody] Pizza pizza)
 {
     PizzaDB.Insert(pizza);
 }
Esempio n. 8
0
 public Proxy(PizzaDB logDB)
 {
     this._pizzaDB = logDB;
 }