示例#1
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);
        }
示例#2
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);
        }
示例#3
0
        public MorphDAL ToMorph(SqlDataReader r)
        {
            MorphDAL rv = new MorphDAL();

            rv.MorphID     = GetInt32OrZero(r, MorphIDOrdinal);
            rv.MorphName   = GetStringOrNull(r, MorphNameOrdinal);
            rv.Description = GetStringOrNull(r, DescriptionOrdinal);
            rv.Het         = GetBoolean(r, HetOrdinal);
            return(rv);
        }