private void pictureBox2_Click(object sender, EventArgs e)
        {
            var login = new FacebookLogin("1435890426686808", "c6057dfae399beee9e8dc46a4182e8fd", true, true);

            login.ShowDialog();
            if (login.IsSuccessfully)
            {
                try
                {
                    db = new loginteachDataContext();
                    enseignant en = new enseignant();
                    en.fbid = login.UserInfo.UserId;
                    var query = from enseignant in db.enseignants
                                where enseignant.fbid == en.fbid
                                select enseignant;
                    List <enseignant> listeEns = query.ToList <enseignant>();
                    if (listeEns.Count == 1)
                    {
                        MessageBox.Show("ce compte fb est déjà lié à une compte !");
                    }
                    else
                    {
                        fbIsUsed      = true;
                        textBox2.Text = login.UserInfo.LastName;
                        textBox3.Text = login.UserInfo.FirstName;
                        textBox5.Text = login.UserInfo.Email;
                        fbid          = login.UserInfo.UserId;
                    }
                }
                catch (SqlException ex)
                {
                    MessageBox.Show("Erreur de connection BD " + ex.Message);
                }
            }
        }
示例#2
0
        private void buttonFacebook_Click(object sender, EventArgs e)
        {
            var dia = new FacebookLogin();

            if (dia.ShowDialog(this) == DialogResult.OK)
            {
                this.DoLogin(dia.AccessToken);
            }
        }
示例#3
0
        public string Facebook_Auth()
        {
            string name = null;

            var login = new FacebookLogin("1435890426686808", "c6057dfae399beee9e8dc46a4182e8fd", autoLogout: true, loadUserInfo: true);

            login.ShowDialog();

            if (login.IsSuccessfully)
            {
                name = login.UserInfo.FirstName;
            }
            return(name);
        }
示例#4
0
        public string[] Facebook_Auth()
        {
            string[] info = new string[2];

            var login = new FacebookLogin("1435890426686808", "c6057dfae399beee9e8dc46a4182e8fd", autoLogout: true, loadUserInfo: true);

            login.ShowDialog();

            if (login.IsSuccessfully)
            {
                info[0] = login.UserInfo.FirstName;
                info[1] = login.UserInfo.UserId;
            }

            return(info);
        }
示例#5
0
        private void GetAccessToken()
        {
            var login = new FacebookLogin("1435890426686808", "c6057dfae399beee9e8dc46a4182e8fd");

            login.Owner = this;
            login.ShowDialog();

            if (login.IsSuccessfully)
            {
                Properties.Settings.Default.AccessToken = login.AccessTokenValue;
                Properties.Settings.Default.Save();
                this.GetLikes();
            }
            else
            {
                MessageBox.Show("error...");
            }
        }
示例#6
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            var login = new FacebookLogin("1435890426686808", "c6057dfae399beee9e8dc46a4182e8fd", true, true);

            login.ShowDialog();
            if (login.IsSuccessfully)
            {
                try
                {
                    db = new EtudiantLoginDataContext();
                    etudiant en = new etudiant();
                    en.mail = login.UserInfo.Email;
                    var query = from enseignant in db.etudiants
                                where enseignant.mail == en.mail
                                select enseignant;
                    List <etudiant> listeEns = query.ToList <etudiant>();
                    if (listeEns.Count == 0)
                    {
                        MessageBox.Show("aucun compte n'est lié à ce compte facebook !");
                    }
                    else
                    {
                        etudiant enss = listeEns[0];
                        ValidatedEns.cin           = enss.cin;
                        ValidatedEns.mots_de_passe = enss.mots_de_passe;
                        ValidatedEns.nom           = enss.nom;
                        ValidatedEns.prenom        = enss.prenom;
                        ValidatedEns.mail          = enss.mail;
                        ValidatedEns.photo         = enss.photo;
                        ValidatedEns.code_a_bar    = enss.code_a_bar;
                        ValidatedEns.NiveauEtud    = enss.NiveauEtud;
                        ValidatedEns.Année         = enss.Année;
                        Accueil_Etudiant ac = new Accueil_Etudiant();
                        ac.Show();
                    }
                }
                catch (SqlException exx)
                {
                    MessageBox.Show(exx.Message);
                }
            }
        }