Example #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);
            }
        }
Example #2
0
        public void InitializeazFormulare()
        {
            AdminFormularService courses = new AdminFormularService();
            var formulars = courses.GetFormulars();

            foreach (var formular in formulars)
            {
                var       student = courses.GetStudent(formular.studentID);
                InfoFrame card    = new InfoFrame(formular, student); //do not forget
                FormulareExploreCount++;
                if (FormulareExploreCount % 3 == 0)
                {
                    FormulareGrid.Height = 500 * (FormulareExploreCount / 3) + 200;
                }
                else
                {
                    FormulareGrid.Height = 300 * (FormulareExploreCount / 3 + 1) + 100;
                }
                card.formular = formular;
                FormulareGrid.Children.Add(card);

                card.MouseDoubleClick += new MouseButtonEventHandler(DoubleClickExploreCourseHandler);

                card.MenuItemEdit.Click += new RoutedEventHandler((sender, e) => EditCourseHandler(sender, e, card));
            }
        }
Example #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);
            }
        }