Example #1
0
        private void RegisterBtn_Click(object sender, EventArgs e)
        {
            IAccount tmp = new Account
            {
                Password = PasswordInp.Text,
                Username = UsernameInp.Text,
                Student  = new Student()
                {
                    MobilePhone    = PhoneInp.Text,
                    Name           = NameInp.Text,
                    Surname        = SurnameInp.Text,
                    Age            = Convert.ToInt32(AgeInp.Text),
                    Email          = EmailInp.Text,
                    UniversityName = UniInp.Text,
                    Gender         = (GenderType)Convert.ToInt32(_allGenderRadionButtons.FirstOrDefault(o => o.Checked).TabIndex),
                    Degree         = (DegreeType)Convert.ToInt32(_allDegreeRadionButtons.FirstOrDefault(o => o.Checked).TabIndex),
                },
            };

            var registered = Services.Get <IStudentsPortalRepositoryLayer>().RegisterUser(tmp);

            if (registered)
            {
                MessageBox.Show($"User {UsernameInp.Text} {SurnameInp.Text} successfully registered!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClearInputs();
                Authorisation authorisation = new Authorisation();
                authorisation.ShowDialog();
                this.Hide();
            }
            else
            {
                MessageBox.Show($"User {UsernameInp.Text} {SurnameInp.Text} coudn't be registered.!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            LoginHelperService.LogOutUser();
            var result = MessageBox.Show("Do you want to log out?", "Logging out", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                Authorisation auth = new Authorisation();
                this.Hide();
                auth.Show();
            }
        }