public void AtualizarObjeto(GerenciadorFinanceiro.Dominio.Estado objeto) { string sSqlUpdate = "update TB_Estado set NomeEstado = @NomeEstado, Sigla = @Sigla where IdEstado = @IdEstado"; try { Conection.AbrirConexao(); Conection.Execute(sSqlUpdate, objeto.NomeEstado, objeto.SiglaEstado, objeto.IdEstado); } catch (Exception ex) { throw new Exception("Não foi possível atualizar o estado.", ex); } finally { Conection.FecharConexao(); } }
public void DeletarObjeto(GerenciadorFinanceiro.Dominio.Estado objeto) { string sSqlDelete = "update TB_Estado set Ativo = 0 where IdEstado = @IdEstado"; try { Conection.AbrirConexao(); Conection.Execute(sSqlDelete, objeto.IdEstado); } catch (Exception ex) { throw new Exception("Não foi possível deletar o estado.", ex); } finally { Conection.FecharConexao(); } }
public void SalvarObjeto(GerenciadorFinanceiro.Dominio.Estado objeto) { string sSqlInsert = "insert into TB_Estado (NomeEstado, Sigla) values (@NomeEstado, @Sigla)"; try { Conection.AbrirConexao(); Conection.Execute(sSqlInsert, objeto.NomeEstado, objeto.SiglaEstado); } catch (Exception ex) { throw new Exception("Não foi possível inserir o estado.", ex); } finally { Conection.FecharConexao(); } }