Ejemplo n.º 1
0
        private void LoginBtn_Click(object sender, RoutedEventArgs e)
        {
            Rooms.LoginRegister.Login login = new LoginRegister.Login();
            string email    = textBoxEmail.Text;
            string password = passwordBox1.Password.ToString();


            try
            {
                utilizator           loggedUser           = login.Verificare_User(email, password);
                AdminFormularService adminFormularService = new AdminFormularService();

                student = adminFormularService.GetStudent(loggedUser.id);

                if (loggedUser.Role.ToString().Equals("Membru"))
                {
                    StudentModule mainWindow = new StudentModule(loggedUser, student);
                    mainWindow.Show();
                    this.Close();
                }
                else if (loggedUser.Role.ToString().Equals("Administrator"))
                {
                    AdminModule mainWindowAdmin = new AdminModule(loggedUser);
                    mainWindowAdmin.Show();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                textBoxEmail.Clear();
                passwordBox1.Clear();
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        public void ShowMainWindow(utilizator user)
        {
            StudentModule mainWindow = new StudentModule(user, student);

            mainWindow.SetUser(user);
            mainWindow.Show();
            this.Close();
        }
Ejemplo n.º 3
0
        private void RegisterBtn_Click_1(object sender, RoutedEventArgs e)
        {
            Rooms.LoginRegister.Register register = new LoginRegister.Register();
            string username        = EnterUsername.Text;
            string password        = EnterPassword.Password.ToString();
            string confirmpassword = ConfirmPassword.Password.ToString();
            string firstname       = EnterName.Text;
            string lastname        = EnterSurname.Text;

            bool checkInstructor;

            if (InstructorRadioBtn.IsChecked == true)
            {
                checkInstructor = true;
            }
            else
            {
                checkInstructor = false;
            }


            string email = EnterEmail.Text;

            utilizator.username  = username;
            utilizator.password  = password;
            utilizator.firstname = firstname;
            utilizator.lastname  = lastname;
            utilizator.email     = email;
            utilizator.Role      = InstructorRadioBtn.IsEnabled ? Rol_Utilizator.Membru : Rol_Utilizator.Administrator;

            try
            {
                utilizator newUser = register.Valideaza_Inregistrare(username, password, firstname, lastname, confirmpassword, checkInstructor, email);
                MessageBox.Show("Welcome to Rooms 404. Enjoy!");

                AdminFormularService adminFormularService = new AdminFormularService();

                student = adminFormularService.GetStudent(utilizator.id);

                if (newUser.Role.ToString().Equals("Membru"))
                {
                    StudentModule mainWindow = new StudentModule(utilizator, student);
                    mainWindow.Show();
                    this.Close();
                }
                else if (newUser.Role.ToString().Equals("Administrator"))
                {
                    AdminModule adminModule = new AdminModule(utilizator);
                    adminModule.Show();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                EnterUsername.Clear();
                EnterPassword.Clear();
                EnterName.Clear();
                EnterSurname.Clear();
                EnterEmail.Clear();

                MessageBox.Show(ex.Message);
            }
        }