Exemple #1
0
        public List<Notification> GetCommentedOnPostNotification(Member member)
        {
            using (SqlConnection con = new SqlConnection(ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("uspGetCommentedOnPostNotification", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@MemberID", member.MemberId);

                List<Notification> NotificationsList = new List<Notification>();

                try
                {
                    con.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {

                        Notification aNotification = new Notification(int.Parse(reader["NotificationID"].ToString()), reader["MemberID"].ToString(), int.Parse(reader["PostID"].ToString()), reader["NotificationType"].ToString());
                        NotificationsList.Add(aNotification);
                    }//End while
                    reader.Close();
                }
                catch (Exception e)
                {
                    System.Windows.Forms.MessageBox.Show(e.Message.ToString());
                }
                return NotificationsList;
            }
        }
Exemple #2
0
        public List<Notification> GetEventNotificationsForGroupMembers()
        {
            using (SqlConnection con = new SqlConnection(ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("uspGetEventNotificationsForGroupMembers", con);
                cmd.CommandType = CommandType.StoredProcedure;

                List<Notification> EventList = new List<Notification>();

                try
                {
                    con.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {

                        Notification aNotification = new Notification(int.Parse(reader["NotificationID"].ToString()), reader["MemberID"].ToString(), int.Parse(reader["GroupID"].ToString()), int.Parse(reader["PostID"].ToString()), reader["NotificationType"].ToString(), 1);
                        EventList.Add(aNotification);
                    }//End while
                    reader.Close();
                }
                catch (Exception e)
                {
                    System.Windows.Forms.MessageBox.Show(e.Message.ToString());
                }
                return EventList;
            }
        }