Esempio n. 1
0
        public ProjectMembersWindow(MainWindow2 caller, Project project)
        {
            InitializeComponent();

            callerWindow  = caller;
            activeProject = project;

            // Generate buttons for all users on the active project
            List <User> usersOnProject = DatabaseHandler.getInstance().getUsersOnProject(project.getProjectId());

            foreach (User user in usersOnProject)
            {
                Button userButton = new Button()
                {
                    Background = new SolidColorBrush(Colors.Transparent),
                    FontSize   = 16,
                    Height     = 58,
                    Content    = user.username
                };
                userButton.Click += UserButton_Click;
                userButton.Tag    = user;
                MainStackPanel.Children.Add(userButton);
            }
            ProjectNameLabel.Content = activeProject.getName();
        }
        private void CreateNewUserButton_Click(object sender, RoutedEventArgs e)
        {
            string username  = UsernameTextBox.Text;
            string password  = PasswordTextbox.Text;
            bool   isManager = IsManagerCheckBox.IsChecked == true;

            // Add new user to db then login as new user
            User        newUser        = DatabaseHandler.getInstance().addNewUser(username, password, isManager);
            MainWindow2 loggedInWindow = new MainWindow2(newUser);

            loggedInWindow.Show();
            this.Close();
        }
Esempio n. 3
0
        public NewTaskWindow(StackPanel parent, MainWindow2 mainWindow2, int listId, int projectId)
        {
            parentStackPanel = parent;
            callerWindow     = mainWindow2;
            this.listId      = listId;
            this.projectId   = projectId;
            InitializeComponent();
            List <User> allUsers = DatabaseHandler.getInstance().getAllUsers();

            foreach (User user in allUsers)
            {
                ComboBoxItem userComboBoxItem = new ComboBoxItem()
                {
                    Content = user.username,
                    Tag     = user,
                };
                AssignedToComboBox.Items.Add(userComboBoxItem);
            }
        }
Esempio n. 4
0
        private void ProcessLoginAttemptButton_Click(object sender, RoutedEventArgs e)
        {
            // User input values
            string username = UsernameTextBox.Text;
            string password = PasswordTextbox.Text;

            List <User> allUsers = DatabaseHandler.getInstance().getAllUsers();

            // Validate login attempt
            foreach (User user in allUsers)
            {
                if (user.username == username && user.password == password)
                {
                    MainWindow2 loggedInWindow = new MainWindow2(user);
                    loggedInWindow.Show();
                    this.Close();
                    return;
                }
            }
        }
 public NewProjectWindow(MainWindow2 caller)
 {
     callerWindow = caller;
     InitializeComponent();
 }
 public NewListWindow(MainWindow2 caller, int projectId)
 {
     callerWindow   = caller;
     this.projectId = projectId;
     InitializeComponent();
 }