예제 #1
0
        private void addFriend(object sender, EventArgs e)
        {
            var friList = showListFriend(userID);

            if (FriendID.Text.Equals(userID))
            {
                MessageBox.Show("คุณไม่สามารถเพิ่มเพื่อนตัวเองได้!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!MainService.SearchFromList(FriendID.Text, friList))
            {
                MessageBox.Show("เป็นเพื่อนกันอยู่แล้ว", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!MainService.checkIfFriendExist(FriendID.Text))
            {
                MessageBox.Show("ไม่พบไอดีนี้!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            MainService.insertFriend(userID, FriendID.Text);
            loadFriendList();
        }
예제 #2
0
 private List <FriendData> showListFriend(string userID)
 {
     return(MainService.getAllFriend(userID));
 }