Example #1
0
        public List <GeckoDAL> GetGeckosRelatedToUser(int skip, int take, int UserID)

        {
            List <GeckoDAL> rv = new List <GeckoDAL>();

            try
            {
                EnsureConnected();
                using (SqlCommand command = new SqlCommand("GetGeckosRelatedToUser", Con))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@skip", skip);
                    command.Parameters.AddWithValue("@take", take);
                    command.Parameters.AddWithValue("@UserID", UserID);

                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        GeckoMapper mapper = new GeckoMapper(reader);
                        while (reader.Read())
                        {
                            GeckoDAL c = mapper.ToGecko(reader);
                            rv.Add(c);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log(ex);
                throw;
            }
            return(rv);
        }
Example #2
0
        public GeckoDAL FindGeckoByID(int GeckoID)
        {
            GeckoDAL rv = null;

            try
            {
                EnsureConnected();
                using (SqlCommand command = new SqlCommand("FindGeckoByID", Con))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@GeckoID", GeckoID);

                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        GeckoMapper mapper = new GeckoMapper(reader);
                        if (reader.Read())
                        {
                            rv = mapper.ToGecko(reader);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log(ex);
                throw;
            }
            return(rv);
        }