public void chargerMsgEnvoye()
        {
            foreach (msg m in Form1.dc.msg.ToList())
            {
                if (m.emailOrigin == lEmail.Text)                 // improtant
                {
                    if (m.emailExp == lEmail.Text && m.supp != 1) // important
                    {
                        ucm = new UCMessages(this);

                        // username
                        log_in l = Form1.dc.log_in.ToList().SingleOrDefault(lo => lo.email == m.emailExp);
                        ucm.lUser.Text = l.username;

                        ucm.lMessage.Text = m.corps;
                        ucm.lDate.Text    = m.datee.Value.ToShortTimeString();
                        ucm.lid.Text      = m.id.ToString();
                        if (m.imp == 1)
                        {
                            ucm.pictureBox1.Image = BoiteMessages.Properties.Resources.star_4;
                        }
                        ucm.rSellectionner.Checked = false;

                        // pMessages design
                        ucm.Left = ucm.Left + 10;
                        ucm.Top  = (ucm.Height + 5) * pMessages.Controls.Count;

                        pMessages.Controls.Add(ucm);
                    }
                }
            }
        }
 public void changerColorNonl(UCMessages u)
 {
     u.BackColor = Color.White;
     foreach (Control c in ucm.Controls)
     {
         c.BackColor = Color.FromArgb(255, 255, 255);
         if (c.GetType() == typeof(TextBox))
         {
             ((TextBox)c).Font = new Font("Century Gothic", 10, FontStyle.Bold);
         }
         if (c.GetType() == typeof(ns1.BunifuCheckbox))
         {
             ((ns1.BunifuCheckbox)c).ChechedOffColor = Color.FromArgb(239, 239, 240);
         }
     }
 }
        public void chargerMsgSupprime()
        {
            foreach (msg m in Form1.dc.msg.ToList())
            {
                if (m.emailOrigin == lEmail.Text) // improtant
                {
                    if (m.emailDes == lEmail.Text || m.emailExp == lEmail.Text)
                    {
                        if (m.supp == 1)
                        {
                            ucm = new UCMessages(this);

                            // username
                            log_in l = Form1.dc.log_in.ToList().SingleOrDefault(lo => lo.email == m.emailExp);
                            ucm.lUser.Text = l.username;

                            ucm.lid.Text      = m.id.ToString();
                            ucm.lMessage.Text = m.corps;
                            ucm.lDate.Text    = m.datee.Value.ToShortTimeString();
                            if (m.imp == 1)
                            {
                                ucm.pictureBox1.Image = BoiteMessages.Properties.Resources.star_4;
                            }
                            if (m.lu == 0)
                            {
                                changerColorNonl(ucm);
                            }
                            ucm.rSellectionner.Checked = false;

                            // pMessages design
                            ucm.Left = ucm.Left + 10;
                            ucm.Top  = (ucm.Height + 5) * pMessages.Controls.Count;

                            // masquer favori icon
                            ucm.pictureBox1.Visible = false;
                            ucm.lUser.Left          = ucm.lUser.Left - 30;
                            ucm.lMessage.Left       = ucm.lMessage.Left - 30;

                            ucm.lMessage.Width = ucm.lMessage.Width + 30;
                            pMessages.Controls.Add(ucm);
                        }
                    }
                }
            }
        }
        public void afficherMessageUC(object sender, EventArgs e)
        {
            UCMessages ucmessage = sender as UCMessages;

            uca = new UCAfficherMessage(this);
            msg m = Form1.dc.msg.ToList().SingleOrDefault(ms => ms.id == int.Parse(ucmessage.lid.Text));


            uca.lTitre.Text       = m.titre;
            uca.richTextBox1.Text = m.corps;
            uca.lExp.Text         = m.emailExp;
            uca.lDate.Text        = m.datee.ToString();

            // message lu
            m.lu = 1;
            Form1.dc.SubmitChanges();

            pMessages.Controls.Clear();
            pMessages.Controls.Add(uca);
            uca.richTextBox1.ReadOnly = true;
        }
 public FBoite(UCMessages ucm)
 {
     InitializeComponent();
     this.ucm = ucm;
 }