protected void btnSalvar_Click(object sender, EventArgs e) { LOCAR.Camadas.Model.Categoria categoria = new LOCAR.Camadas.Model.Categoria(); categoria.IdCategoria = Convert.ToInt32(lblId.Text); categoria.Descricao = txtDescricao.Text; categoria.Valor = Convert.ToInt32(txtValor.Text); categoria.qtdeVeiculos = Convert.ToInt32(txtQtde.Text); LOCAR.Camadas.BLL.Categoria bllCategoria = new LOCAR.Camadas.BLL.Categoria(); if (Cache["OP"].Equals('X')) { bllCategoria.Insert(categoria); } else if (Cache["OP"].Equals('U')) { bllCategoria.Update(categoria); } if (Cache["OP"].Equals('I')) { grvCategorias.SetPageIndex(grvCategorias.PageCount); } lblId.Text = "0"; txtQtde.Text = "0"; HabilitaCampos(false); Cache["OP"] = "S"; }
protected void btnRemover_Click(object sender, EventArgs e) { LOCAR.Camadas.Model.Categoria categoria = new LOCAR.Camadas.Model.Categoria(); categoria.IdCategoria = Convert.ToInt32(lblId.Text); categoria.Valor = Convert.ToInt32(txtValor.Text); categoria.qtdeVeiculos = Convert.ToInt32(txtQtde.Text); LOCAR.Camadas.BLL.Categoria bllCategoria = new LOCAR.Camadas.BLL.Categoria(); //lblId.Text = "0"; if (Convert.ToInt32(lblId.Text) > 0) { bllCategoria.Delete(categoria); } lblId.Text = "0"; txtDescricao.Text = ""; txtValor.Text = ""; txtQtde.Text = "0"; HabilitaCampos(false); Cache["OP"] = "S"; }