コード例 #1
0
        public List <Member_Friend> GetInvitationStatus(Member member, Member friend)
        {
            using (SqlConnection con = new SqlConnection(ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("uspGetInvitationStatus", con);
                cmd.CommandType = CommandType.StoredProcedure;

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

                List <Member_Friend> statusList = new List <Member_Friend>();

                try
                {
                    con.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        Member_Friend status = new Member_Friend(Convert.ToString(reader["InvitationStatus"]));
                        statusList.Add(status);
                    }//End while
                    reader.Close();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message.ToString());
                }
                return(statusList);
            }
        }
コード例 #2
0
ファイル: FriendshipDAL.cs プロジェクト: Ndiya999/Bulabula
        public List<Member_Friend> GetMemberBlockedFriendStatus(Member member, Member friend)
        {
            using (SqlConnection con = new SqlConnection(ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("uspGetMemberBlockedFriendStatus", con);
                cmd.CommandType = CommandType.StoredProcedure;

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

                List<Member_Friend> statusList = new List<Member_Friend>();

                try
                {
                    con.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        Member_Friend status = new Member_Friend(bool.Parse(reader["MemberBlockedFriend"].ToString()));
                        statusList.Add(status);
                    }//End while
                    reader.Close();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message.ToString());
                }
                return statusList;
            }
        }