예제 #1
0
        private void btnEinloggen_Click(object sender, EventArgs e)
        {
            DataAccessUser daUser = new DataAccessUser();

            string strUsername = txtUsername.Text.ToLower();
            string strPasswort = txtPasswort.Text;


            List <User> lstUser = daUser.ReadAll();

            for (int i = 0; i < lstUser.Count; i++)
            {
                if (strUsername == lstUser[i].Username.ToLower())
                {
                    if (strPasswort == lstUser[i].Passwort)
                    {
                        user.Username = lstUser[i].Username;
                        user.Passwort = lstUser[i].Passwort;
                        user.Vorname  = lstUser[i].Vorname;
                        user.Nachname = lstUser[i].Nachname;
                        user.Mail     = lstUser[i].Mail;
                        user.Rolle    = lstUser[i].Rolle;
                        MessageBox.Show("Erfolgreich eingeloggt");
                        Form fSpiel = new Hauptfenster(lstUser[i]);
                        this.Hide();
                        fSpiel.Show();
                    }
                    else
                    {
                        MessageBox.Show("Log in Fehlgeschlagen");
                    }
                }
            }
        }
예제 #2
0
        public void cboxFuellen()
        {
            DataAccessUser daUser = new DataAccessUser();

            lstUser = daUser.ReadAll();

            foreach (User user in lstUser)
            {
                cboxUser.Items.Add(user);
            }
        }