private async void button1_Click(object sender, EventArgs e) { pictureBox2.Visible = true; await Task.Delay(2000); bool res = GlobalItems.Login(textBox1.Text, textBox2.Text); if (res) { this.Hide(); textBox1.Text = ""; textBox2.Text = ""; if (GlobalItems.CheckUserLevel() == 1) { ManagerWin wnd = new ManagerWin(); wnd.Show(); } else if (GlobalItems.CheckUserLevel() == 2) { MazkiraWin wnd = new MazkiraWin(); wnd.Show(); } else if (GlobalItems.CheckUserLevel() == 3) { TeacherWin wnd = new TeacherWin(); wnd.Show(); } else if (GlobalItems.CheckUserLevel() == 4) { TeacherWin wnd = new TeacherWin(); wnd.Show(); } else if (GlobalItems.CheckUserLevel() == 5) { StudentWin wnd = new StudentWin(); wnd.Show(); } else { MessageBox.Show("Your account is not approved by secretary"); } } else { MessageBox.Show("This user is not exist", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } pictureBox2.Visible = false; }
public void TestLoginTrue() { Assert.AreEqual(GlobalItems.Login("3333", "12345"), true); }
public void LoginWrong() { bool res = GlobalItems.Login("33657433", "15352345"); Assert.IsFalse(res); }
public void Login() { bool res = GlobalItems.Login("3333", "12345"); Assert.IsTrue(res); }
private void GraphApiExample() { // note: avoid using synchronous methods if possible as it will block the thread until the result is received try { var fb = new FacebookClient(_accessToken); // instead of casting to IDictionary<string,object> or IList<object> // you can also make use of the dynamic keyword. dynamic result = fb.Get("me?fields=first_name,last_name,id,name"); // You can either access it this way, using the . dynamic id = result.id; dynamic name = result.name; dynamic first_name = result.first_name; dynamic last_name = result.last_name; // if dynamic you don't need to cast explicitly. lblUserId.Text = "User Id: " + id; lnkName.Text = "Hi " + name; lblFirstName.Text = "First Name " + first_name; lblLastName.Text = "Last Name " + last_name; string iden = GlobalItems.getIdNumber("users", "fname", first_name); if (iden != id) { Unproved obj = new Unproved(); obj.addUser(first_name, last_name, "", "", id, 6); } else { this.Close(); GlobalItems.Login(id, ""); switch (GlobalItems.CheckUserLevel()) { case 3: case 4: TeacherWin wnd = new TeacherWin(_accessToken); wnd.Show(startFrom.Instance); wnd.Select(); wnd.Focus(); break; case 5: case 6: StudentWin wnd2 = new StudentWin(_accessToken); wnd2.Show(startFrom.Instance); wnd2.Select(); wnd2.Focus(); break; } } } catch (FacebookApiException ex) { MessageBox.Show(ex.Message); } }