public void facebook() { Application.EnableVisualStyles(); facebook_mail = new GetTheMail(); string mail = facebook_mail.getMail(); try { id = dataBaseOperations.getIdByMail(mail); if (db.ConnStatus() == false) { db.OpenConn(); } SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; cmd.Connection = db.getConnection(); cmd.CommandText = "SELECT username, pass FROM USERS WHERE id = @id"; cmd.Parameters.AddWithValue("id", Convert.ToInt16(id)); DataSet ds = db.generalCommand(cmd); username = ds.Tables[0].Rows[0].ItemArray[0].ToString(); password = ds.Tables[0].Rows[0].ItemArray[1].ToString(); db.CloseConn(db.ConnStatus()); login(); } catch (Exception) { MessageBox.Show("the user not exist"); } finally { facebook_mail.logout(); } }
public void facebook() { Application.EnableVisualStyles(); g = new GetTheMail(); string mail = g.getMail(); if (dataBaseOperations.facebookUserExist(mail, "Admin")) { //In perception i thing that its importent to pass //user object for the next managing form //plese do it in all other form //here i create new inst obj admin ad = new admin(dataBaseOperations.getIdByMail(mail)); //and then i pass it to the next form //i'll catch it in the next form constractor adminMenu instrfMen = new adminMenu(ad); this.Hide(); instrfMen.ShowDialog(); } else { MessageBox.Show("the user not exist"); } g.logout(); }