private void bDeconnexion_Click(object sender, EventArgs e)
        {
            string email = f1.tEmail.Text;

            connexion c = Form1.dc.connexion.ToList().Skip(Form1.dc.connexion.ToList().Count - 1).SingleOrDefault(co => co.email == email);

            if (c != null)
            {
                c.etat = "Deconnecté";
                DateTime df = DateTime.Now;
                c.FinSession = df;

                TimeSpan duree    = df.Subtract(Form1.db);
                double   secondes = duree.TotalSeconds;
                if (secondes < 59)
                {
                    c.Dureé = duree.Seconds.ToString() + " Secondes";
                }
                else if (secondes > 59)
                {
                    c.Dureé = duree.Minutes.ToString() + " Minutes " + duree.Seconds.ToString() + " s";
                }
                else
                {
                    c.Dureé = duree.Hours.ToString() + " Heures " + duree.Minutes.ToString() + " m " + duree.Seconds.ToString() + " s";
                }
                Form1.dc.SubmitChanges();
                this.Close();
            }

            f1.Visible = true;
        }
Example #2
0
        private void bLogin_Click(object sender, EventArgs e)
        {
            log_in l = dc.log_in.ToList().SingleOrDefault(lo => lo.email == tEmail.Text);

            if (l != null)
            {
                if (l.mdpss == tPass.Text)
                {
                    db = DateTime.Now;

                    connexion c = new connexion();
                    c.etat         = "Connecté";
                    c.email        = tEmail.Text;
                    c.DebutSession = db;
                    dc.connexion.InsertOnSubmit(c);
                    dc.SubmitChanges();

                    l.derniereCon = db;

                    // hide
                    this.Visible = false;

                    FBoite b = new FBoite(this);
                    b.Show();
                }
                else
                {
                    tPass.LineIdleColor = Color.FromArgb(228, 103, 103);
                    lPass.Visible       = true;
                }
            }
            else
            {
                tEmail.LineIdleColor = Color.FromArgb(228, 103, 103);
                tPass.LineIdleColor  = Color.FromArgb(228, 103, 103);
                lEmail.Visible       = true;
                lPass.Visible        = true;
            }
        }
 private void detach_connexion(connexion entity)
 {
     this.SendPropertyChanging();
     entity.log_in = null;
 }
 private void attach_connexion(connexion entity)
 {
     this.SendPropertyChanging();
     entity.log_in = this;
 }
 partial void Deleteconnexion(connexion instance);
 partial void Updateconnexion(connexion instance);
 partial void Insertconnexion(connexion instance);