Пример #1
0
        public Cargo Select(int id)
        {
            Cargo cargo = null;

            System.Data.IDbConnection objConexao;
            System.Data.IDbCommand objCommand;
            System.Data.IDataReader objDataReader;

            objConexao = Mapped.Connection();
            objCommand = Mapped.Command("SELECT * FROM TBL_CARGO WHERE CAR_ID = ?codigo", objConexao);
            objCommand.Parameters.Add(Mapped.Parameter("?codigo", id));

            objDataReader = objCommand.ExecuteReader();
            while (objDataReader.Read())
            {
                cargo = new Cargo();
                cargo.ID = Convert.ToInt32(objDataReader["CAR_ID"]);
                cargo.Nome = Convert.ToString(objDataReader["CAR_NOME"]);
                cargo.Ativado = Convert.ToBoolean(objDataReader["CAR_ATIVADO"]);
            }

            objDataReader.Close();
            objConexao.Close();

            objCommand.Dispose();
            objConexao.Dispose();
            objDataReader.Dispose();

            return cargo;
        }
Пример #2
0
 public Funcionario()
 {
     //ininia o atributo cargo
     Ativado = true;
     Cargo = new Cargo();
 }