コード例 #1
0
        private void FormSelectProject_Load(object sender, EventArgs e)
        {
            CenterToScreen();

            FakeProjectRepository fp   = new FakeProjectRepository();
            List <Project>        list = fp.GetAll();

            foreach (var Project in list)
            {
                string projectsListed = (Project.Id + " - " + Project.Name);
                listBox1.Items.Add(projectsListed);
            }
        }
コード例 #2
0
        private void RemoveProject_Load(object sender, EventArgs e)
        {
            CenterToScreen();
            FakeProjectRepository projectRepository = new FakeProjectRepository();
            List <Project>        list = projectRepository.GetAll();

            foreach (var Project in list)
            {
                if (projectToBeRemoved == Project.Id)
                {
                    ProjectToBeRemovedLabel.Text = Project.Name;
                }
            }
        }
コード例 #3
0
        private void CreateProjectAddButton_Click(object sender, EventArgs e)
        {
            FakeProjectRepository projectRepository = new FakeProjectRepository();
            string newName = CreateProjectTextBox.Text;
            string Result  = projectRepository.Add(new Project {
                Name = newName
            }, out int newId);

            if (Result != FakePreferenceRepository.NO_ERROR)
            {
                MessageBox.Show("Error adding project. " + Result);
            }
            else
            {
                MessageBox.Show("Successfully added project.");
            }
            CreateProjectTextBox.Clear();
        }
コード例 #4
0
        private void RemoveProjectRemoveButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to permenantly remove this project?", "Attention", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                FakeProjectRepository projectRepository = new FakeProjectRepository();
                string result = projectRepository.Remove(projectToBeRemoved);
                if (result != FakePreferenceRepository.NO_ERROR)
                {
                    MessageBox.Show("No project found. " + result);
                }
                else
                {
                    MessageBox.Show("Successfully removed project");
                }
                this.Close();
            }
            else if (dialogResult == DialogResult.No)
            {
                this.Close();
            }
        }
コード例 #5
0
        private void ModifyProjectModifyButton_Click(object sender, EventArgs e)
        {
            string newName  = ModifyProjectTextBox.Text;
            string oldName  = Properties.Settings.Default.Preference;
            string UserName = Properties.Settings.Default.Username;
            FakePreferenceRepository preferenceRepository = new FakePreferenceRepository();
            string pref = preferenceRepository.GetPreference(UserName, oldName);

            FakeProjectRepository projectRepository = new FakeProjectRepository();
            //string newName = ModifyProjectTextBox.Text;
            string result = projectRepository.Modify(idToBeModified, new Project {
                Name = newName
            });

            if (result != FakePreferenceRepository.NO_ERROR)
            {
                MessageBox.Show("Error modifying project. " + result);
            }
            else
            {
                MessageBox.Show("Successfully modified project");
            }
            this.Close();
        }