예제 #1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            Options options = new Options();

            options.ID_Post = ID_Post;
            options.visible = Visible;
            DialogResult dr = options.ShowDialog();

            if (dr == DialogResult.Yes)
            {
                Post post = new Post();
                post.Editar   = true;
                post.PostEdit = postServices.Get("SELECT * FROM POST WHERE ID_POST = " + ID_Post);
                post.ShowDialog();
            }
            else if (dr == DialogResult.No)
            {
                if (postServices.EditVisiblity(ID_Post, 0))
                {
                    MessageBox.Show("El post fue ocultado");
                }
                else
                {
                    MessageBox.Show("La accion no pudo realizarse correctamente");
                }
            }
            else if (dr == DialogResult.OK)
            {
                if (postServices.Delete(ID_Post))
                {
                    MessageBox.Show("Publicacion eliminada correctamente");
                }
                else
                {
                    MessageBox.Show("La accion no pudo realizarse correctamente");
                }
            }
            else if (dr == DialogResult.Retry)
            {
                if (postServices.EditVisiblity(ID_Post, 1))
                {
                    MessageBox.Show("El post ya puede ser visualizado");
                }
                else
                {
                    MessageBox.Show("La accion no pudo realizarse correctamente");
                }
            }
            options.Close();
            options.Dispose();
            OnRefresh(e);
        }