Пример #1
0
        public List <MorphDAL> GetMorphsRelatedToGecko(int skip, int take, int GeckoID)
        {
            List <MorphDAL> rv = new List <MorphDAL>();

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

                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        MorphMapper mapper = new MorphMapper(reader);
                        while (reader.Read())
                        {
                            MorphDAL c = mapper.ToMorph(reader);
                            rv.Add(c);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log(ex);
                throw;
            }
            return(rv);
        }
Пример #2
0
        public MorphDAL FindMorphByID(int MorphID)
        {
            MorphDAL rv = null;

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

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