Ejemplo n.º 1
0
        public void friendBtnClick(object sender, EventArgs e)
        {
            if ((sender as Button).Text == "Añadir amigo")
            {
                bool check = _proxy.CreateFriendRequest(Convert.ToInt32((sender as Button).Name), _userID);

                if (check)
                {
                    _form.Hide();
                    Form next = new OtherProfile(Convert.ToInt32((sender as Button).Name));
                    next.ShowDialog();
                    _form.Close();
                }
                else
                {
                    MessageBox.Show("Error al mandar solicitud.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if ((sender as Button).Text == "Eliminar amigo")
            {
                User otherUser = _proxy.GetUserById(Convert.ToInt32((sender as Button).Name));
                if (MessageBox.Show($"¿Seguro que quieres eliminar a {otherUser.firstName}?", "Eliminar amigo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    bool check = _proxy.DeleteFriendship(_userID, otherUser.ID);

                    if (check)
                    {
                        _form.Hide();
                        Form next = new OtherProfile(otherUser.ID);
                        next.ShowDialog();
                        _form.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error al eliminar amigo.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                User otherUser = _proxy.GetUserById(Convert.ToInt32((sender as Button).Name));
                if (MessageBox.Show($"¿Seguro que quieres cancelar la solicitud de amistad a {otherUser.firstName}?", "Cancelar solicitud", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    bool check = _proxy.DeleteFriendshipRequest(otherUser.ID, _userID);

                    if (check)
                    {
                        _form.Hide();
                        Form next = new FriendSearch(_pattern);
                        next.ShowDialog();
                        _form.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error al eliminar solicitud.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void profileBtnClick(object sender, EventArgs e)
        {
            _form.Hide();
            Form next = new OtherProfile(Convert.ToInt32((sender as Button).Name));

            next.ShowDialog();
            _form.Close();
        }
        public void acceptBtnClick(object sender, EventArgs e)
        {
            bool check = _proxy.CreateFriendship(_userID, Convert.ToInt32((sender as Button).Name));

            if (check)
            {
                _form.Hide();
                Form next = new OtherProfile(Convert.ToInt32((sender as Button).Name));
                next.ShowDialog();
                _form.Close();
            }
            else
            {
                MessageBox.Show("Error al agregar amigo.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
 public void nameLblClick(object sender, EventArgs e)
 {
     if (Convert.ToInt32((sender as Label).Name) != feed.userID)
     {
         feed.form.Hide();
         Form next = new OtherProfile(Convert.ToInt32((sender as Label).Name));
         next.ShowDialog();
         feed.form.Close();
     }
     else
     {
         feed.form.Hide();
         Form next = new Profile();
         next.ShowDialog();
         feed.form.Close();
     }
 }