protected void Visualizar_Click(object sender, EventArgs e)
 {
     try
     {
         Class_ItensVenda vend = new Class_ItensVenda();
         GDItemVenda.DataSource = vend.visualizar();
         GDItemVenda.DataBind();
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
        protected void GDItemVenda_RowEditing(object sender, GridViewEditEventArgs e)
        {
            try
            {
                Class_ItensVenda classe = new Class_ItensVenda();
                GDItemVenda.EditIndex = e.NewEditIndex;

                GDItemVenda.DataSource = classe.visualizar();
                GDItemVenda.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
        protected void Deletar_Click(object sender, EventArgs e)
        {
            try
            {
                Class_ItensVenda vend = new Class_ItensVenda();
                vend.codlaboratorio = int.Parse(txtcodlab.Text);

                vend.deletar();
                GDItemVenda.DataSource = vend.visualizar();
                GDItemVenda.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
        protected void GDItemVenda_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                Class_ItensVenda classe = new Class_ItensVenda();
                classe.codlaboratorio = Convert.ToInt32(e.Values[0]);

                classe.deletar();

                GDItemVenda.EditIndex = -1;


                GDItemVenda.DataSource = classe.visualizar();
                GDItemVenda.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
        protected void Alterar_Click(object sender, EventArgs e)
        {
            try
            {
                Class_ItensVenda vend = new Class_ItensVenda();
                vend.cb        = txtcb.Text;
                vend.codvenda  = int.Parse(txtcodvenda.Text);
                vend.iditens   = int.Parse(txtIDitem.Text);
                vend.qtdeitem  = int.Parse(txtqtdeitem.Text);
                vend.valoritem = int.Parse(txtValorItem.Text);

                vend.alterar_dados();

                GDItemVenda.DataSource = vend.visualizar();
                GDItemVenda.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }