Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            label3.Text = "";

            UsersTableManager manager = new UsersTableManager();
            User user = manager.GetUser(this.textBox_username.Text, this.textBox_password.Text);

            if (user != null)
            {
                if (user.Szerepkor == "Tanulo")
                {
                    User.CurrentUser = user;
                    FormTanuloSzerepkor formTanuloSzerepkor = new FormTanuloSzerepkor();
                    this.Hide();
                    formTanuloSzerepkor.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Hozzáférés megtagadva!");
                }
            }
            else
            {
                label3.Text           = "Sikertelen bejelentkezés!";
                textBox_password.Text = "";
                textBox_username.Text = "";
            }
        }
Exemplo n.º 2
0
        public void UserExists()
        {
            UsersTableManager manager = new UsersTableManager();

            User expected = new User("teszttanulo", "teszttanulo");

            User actual = manager.GetUser("teszttanulo", "teszttanulo");

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void UserNotExists()
        {
            UsersTableManager manager = new UsersTableManager();

            User expected = null;

            User actual = manager.GetUser("nemletezo", "nemletezo");

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        private void button3_Click(object sender, EventArgs e)
        {
            UsersTableManager manager = new UsersTableManager();
            List <User>       list    = manager.SelectAll();

            for (int i = 0; i < list.Count; i++)
            {
                MessageBox.Show(list[i].Username + " " + list[i].Password + " " + list[i].Szerepkor);
            }
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            User user = new User(textBox_username.Text, textBox_password.Text, comboBox_szerepkor.Text);
            UsersTableManager manager = new UsersTableManager();

            if (manager.GetUser(user.Username) == null)
            {
                manager.Insert(user);
                MessageBox.Show("Sikeres regisztráció!");
            }
            else
            {
                MessageBox.Show("Létező felhasználónév!");
            }
        }