Example #1
0
        public static List <Animal> allAnimals()
        {
            string  sql = "SELECT* FROM \"ANIMAL\"";
            DataSet ds  = dsBySql(sql);

            List <Animal> toReturn = new List <Animal>();

            foreach (DataRow item in ds.Tables[0].Rows)
            {
                toReturn.Add(DataConversions.AnimalFromDataRow(item));
            }

            return(toReturn);
        }
Example #2
0
        public static List <User> ReturnAllUsers()
        {
            string  sql = "SELECT* FROM \"USER\"";
            DataSet ds  = dsBySql(sql);

            List <User> toReturn = new List <User>();

            foreach (DataRow item in ds.Tables[0].Rows)
            {
                toReturn.Add(DataConversions.userFromDataRow(item));
            }

            return(toReturn);
        }
Example #3
0
        /// <summary>
        /// Returns an animal based on AID.
        /// </summary>
        /// <param name="aid"></param>
        /// <returns></returns>
        public static Animal getAnimalByAid(int aid)
        {
            string sql = "SELECT * FROM \"ANIMAL\" WHERE \"AID\" = " + aid;

            DataSet ds = dsBySql(sql);

            try
            {
                return(DataConversions.AnimalFromDataRow(ds.Tables[0].Rows[0]));
            }
            catch
            {
                return(null);
            }
        }