Beispiel #1
0
        public BreedDAL BreedFindbyID(int BreedID)
        {
            BreedDAL proposedReturnValue = null;

            try
            {
                EnsureConnected();
                using (SqlCommand command = new SqlCommand("BreedFindByID", sec))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@BreedID", BreedID);
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        BreedMapper bm = new BreedMapper(reader);
                        while (reader.Read())
                        {
                            proposedReturnValue = bm.ToBreed(reader);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Logger.Log(ex);
            }
            return(proposedReturnValue);
        }
Beispiel #2
0
        public List <BreedDAL> BreedGetAll(int Skip, int Take)
        {
            List <BreedDAL> proposedReturnValue = new List <BreedDAL>();

            try
            {
                EnsureConnected();
                using (SqlCommand command = new SqlCommand("BreedGetAll", sec))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@skip", Skip);
                    command.Parameters.AddWithValue("@take", Take);
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        BreedMapper bm = new BreedMapper(reader);
                        while (reader.Read())
                        {
                            BreedDAL items = bm.ToBreed(reader);
                            proposedReturnValue.Add(items);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Logger.Log(ex);
            }
            return(proposedReturnValue);
        }
Beispiel #3
0
        public BreedDAL ToBreed(SqlDataReader reader)
        {
            BreedDAL proposedReturnValue = new BreedDAL
            {
                BreedID   = reader.GetInt32(OffsetToBreedID),
                BreedName = reader.GetString(OffsetToBreedName)
            };

            return(proposedReturnValue);
        }