Пример #1
0
        private void cbBxSubject_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (visibiliteSujets())
            {
                PanelSujetVisible();
                Subject subject = (Subject)cbBxSubject.SelectedItem;
                txtDescSujet.Text = subject.Desc + Environment.NewLine + "de, " + subject.Auteur + Environment.NewLine + "le, " + subject.Date;

                if (visibilitePost())
                {
                    PanelPostVisible();
                    List <Post> posts = Outil.GetAllReponseBySujet((int)cbBxSubject.SelectedValue);
                    if (posts != null)
                    {
                        displaydgVPost(posts);
                    }
                }
                else
                {
                    PanelPostInvisible();
                }
            }
            else
            {
                PanelSujetInvisible();
            }
        }
Пример #2
0
        private void btSupPost_Click(object sender, EventArgs e)
        {
            DialogResult dr = new DialogResult();

            dr = MessageBox.Show(Properties.Resources.MsgBoxDeletePostText, Properties.Resources.MsgBoxDeletePostTitre, MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
            if (dr == DialogResult.OK)
            {
                if (Outil.DeleteReponse((int)dGVPost.CurrentRow.Cells["ID"].Value) != 1)
                {
                    MessageBox.Show(Properties.Resources.MsgBoxErreurDeletePostText, Properties.Resources.MsgBoxErreurDeletePostTitre);
                }
                List <Post> posts = Outil.GetAllReponseBySujet((int)cbBxSubject.SelectedValue);


                if (posts != null)
                {
                    displaydgVPost(posts);
                }

                if (visibilitePost())
                {
                    PanelPostVisible();
                }
                else
                {
                    PanelPostInvisible();
                }
            }
        }
Пример #3
0
 private void btCreerPost_Click(object sender, EventArgs e)
 {
     using (CreerPost frmCreerPost = new CreerPost())
     {
         frmCreerPost.subject = (Subject)cbBxSubject.SelectedItem;
         frmCreerPost.Text    = string.Format("Ajout du post au sujet {0}", frmCreerPost.subject.Titre);
         frmCreerPost.ShowDialog();
         displaydgVPost(Outil.GetAllReponseBySujet((int)cbBxSubject.SelectedValue));
     }
 }
Пример #4
0
 private bool visibilitePost()
 {
     if (cbBxSubject.SelectedIndex != -1)
     {
         if (Outil.GetAllReponseBySujet((int)cbBxSubject.SelectedValue) != null)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id_subject"></param>
        /// <returns></returns>
        public List <Post> GetAllReponseBySujet(string id_subject)
        {
            int r; //Variable locale de retour (résultat)

            if (int.TryParse(id_subject, out r))
            {
                return(Outil.GetAllReponseBySujet(r));
            }
            else
            {
                return(null);
            }
        }