Esempio n. 1
0
        public DateTime GetDate()
        {
            ConectarDB Cnn = new ConectarDB();
            DateTime   Regreso;

            Cnn.ConecDb_Abrir();
            NpgsqlDataReader Rst = null;

            Cnn.GetDataReader(ref Rst, "SELECT current_timestamp");
            Rst.Read();
            Regreso = Rst.GetDateTime(0);
            Rst.Close();
            Cnn.ConecDb_Close();
            return(Regreso);
        }
Esempio n. 2
0
        public static _PERSONAL[] GetAll(string where = "", string order = "cedper")
        {
            List <_PERSONAL> items     = new List <_PERSONAL>();
            ConectarDB       dbSQLConn = new ConectarDB();

            dbSQLConn.ConecDb_Abrir();
            NpgsqlDataReader Dr     = null;
            string           strSQL = $"SELECT {Funciones.Fun_PERSONAL.Elementos} FROM personal {(where != "" ? $"WHERE {where}" : "")}{(where != "" ? $"WHERE {where}" : "")} {(order != "" ? $"ORDER BY {order}" : "")}";
            NpgsqlCommand    cmd    = new NpgsqlCommand(strSQL, dbSQLConn.Cnn);

            Dr = cmd.ExecuteReader();
            if (Dr.HasRows)
            {
                while (Dr.Read())
                {
                    items.Add(Funciones.Fun_PERSONAL.LLenar(Dr));
                }
                Dr.Close();
            }
            dbSQLConn.ConecDb_Close();
            return(items.ToArray());
        }