Esempio n. 1
0
        public BasicCatholicPrayer Find(int id)
        {
            var basicCatholicPrayer = new BasicCatholicPrayer();

            using (var sp = new StoredProcedure("spFindBasicCatholicPrayer"))
            {
                sp.SqlCommand.Parameters.AddWithValue("@BasicCatholicPrayerID", id);

                var reader = sp.SqlCommand.ExecuteReader();

                while (reader.Read())
                {
                    basicCatholicPrayer = _basicCatholicPrayerTransformer.Transform(reader);
                }
            }

            return(basicCatholicPrayer);
        }
Esempio n. 2
0
        public Models.BasicCatholicPrayer Find(int id)
        {
            var basicCatholicPrayer = new Models.BasicCatholicPrayer();

            using (var dbconn = new SqlConnection(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString))
            {
                if (dbconn.State == ConnectionState.Open)
                {
                    dbconn.Close();
                }
                dbconn.Open();

                using (var cmd = new SqlCommand("spFindBasicCatholicPrayer", dbconn))
                {
                    try
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@BasicCatholicPrayerID", id);


                        var reader = cmd.ExecuteReader();

                        while (reader.Read())
                        {
                            basicCatholicPrayer = _basicCatholicPrayerTransformer.Transform(reader);
                        }
                    }
                    catch (Exception)
                    {
                        // ignored
                    }
                }
            }

            return(basicCatholicPrayer);
        }
Esempio n. 3
0
        public List <BasicCatholicPrayer> GetFavoriteBasicCatholicPrayer(int userId)
        {
            var basicCatholicPrayer            = new List <BasicCatholicPrayer>();
            var basicCatholicPrayerTransformer = new BasicCatholicPrayerTransformer();

            using (var sp = new StoredProcedure("spGetFavoriteBasicCatholicPrayer"))
            {
                sp.SqlCommand.Parameters.AddWithValue("@userID", userId);

                var reader = sp.SqlCommand.ExecuteReader();

                while (reader.Read())
                {
                    basicCatholicPrayer.Add(basicCatholicPrayerTransformer.Transform(reader));
                }
            }

            return(basicCatholicPrayer);
        }