コード例 #1
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            var user = MapTxtBoxesToStudent();

            var repository = new UserRepository();

            repository.Insert(user);

            GeneralTools.WarningBox("User inserted");
            Close();
        }
コード例 #2
0
        private void btn_SaveStudent_Click(object sender, EventArgs e)
        {
            var student = MapTxtBoxesToStudent();

            var repository = new StudentRepository();

            repository.Insert(student);

            GeneralTools.WarningBox("Student inserted");
            Close();
        }
コード例 #3
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            var userRepository = new UserRepository();

            var response = userRepository.Login(txtBox_login.Text, txtbox_password.Text);

            if (response == LoginEnum.Successful)
            {
                LoggedInDetails.SetUserLogged(txtBox_login.Text);
                LoggedInDetails.SetLoggedInState(true);
                Close();
                return;
            }

            if (response == LoginEnum.IncorrectLogin)
            {
                GeneralTools.WarningBox("Incorrect login.");
            }

            if (response == LoginEnum.IncorrectPassword)
            {
                GeneralTools.WarningBox("Incorrect password.");
            }
        }