예제 #1
0
        public static GiftMessage[] FetchByMessageId(int msgId)
        {
            var giftsOfMessages = new List<GiftMessage>();

            using (SqlConnection conn = Config.DB.Open())
            {
                SqlDataReader reader = (SqlDataReader) SqlHelper.GetDB().ExecuteReader( "FetchGiftsOfMessage", msgId);

                while (reader.Read())
                {
                    var giftMessage = new GiftMessage
                                      {
                                          id = (int)reader["Id"],
                                          GiftId = (int)reader["GiftId"],
                                          MessageId = (int) reader["MessageId"]
                                      };
                    giftsOfMessages.Add(giftMessage);
                }
            }
            return giftsOfMessages.ToArray();
        }
예제 #2
0
        public static GiftMessage[] FetchByMessageId(int msgId)
        {
            var giftsOfMessages = new List<GiftMessage>();

            //using (var conn = Config.DB.Open())
            {
                using (var reader = SqlHelper.GetDB().ExecuteReader("FetchGiftsOfMessage", msgId))
                {

                    while (reader.Read())
                    {
                        var giftMessage = new GiftMessage
                            {
                                id = (int) reader["Id"],
                                GiftId = (int) reader["GiftId"],
                                MessageId = (int) reader["MessageId"]
                            };
                        giftsOfMessages.Add(giftMessage);
                    }
                    reader.Close();
                }
            }
            return giftsOfMessages.ToArray();
        }