Exemplo n.º 1
0
        public static PosteTravail getOneById(int id, bool full)
        {
            PosteTravail     bean    = new PosteTravail();
            NpgsqlConnection connect = new Connexion().Connection();

            try
            {
                string           query = "select * from yvs_grh_poste_employes where id =" + id + ";";
                NpgsqlCommand    Lcmd  = new NpgsqlCommand(query, connect);
                NpgsqlDataReader lect  = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        bean = Return(lect, full);
                    }
                }
                return(bean);
            }
            catch (Exception ex)
            {
                Messages.Exception("PosteTravailDAO (getOneById) ", ex);
                return(bean);
            }
            finally
            {
                Connexion.Close(connect);
            }
        }
Exemplo n.º 2
0
        private static PosteTravail Return(NpgsqlDataReader lect, bool full)
        {
            PosteTravail bean = new PosteTravail();

            bean.Id    = Convert.ToInt32(lect["id"].ToString());
            bean.Poste = PosteDAO.getOneById(Convert.ToInt32(lect["poste"].ToString()));
            bean.Poste = new Poste(Convert.ToInt32(lect["poste"].ToString()));
            if (full)
            {
                bean.Poste = PosteDAO.getOneById(Convert.ToInt32(lect["poste"].ToString()));
            }
            return(bean);
        }