Beispiel #1
0
        private void buttonModify_Click(object sender, EventArgs e)
        {
            // Better make sure it isn't the empty string or all blanks
            string newProjectName = textBoxProjectName.Text.Trim();

            if (newProjectName == "")
            {
                MessageBox.Show("Project name cannot be empty or blank", "Attention");
                return;
            }
            FakeProjectRepository projectRepository = new FakeProjectRepository();

            if (projectRepository.IsDupliclateName(newProjectName))
            {
                MessageBox.Show("Project name already exists.", "Attention");
                return;
            }
            Project project = new Project {
                Id = _SelectedProjectId, Name = newProjectName
            };
            string result = projectRepository.Modify(_SelectedProjectId, project);

            if (result != FakeProjectRepository.NO_ERROR)
            {
                MessageBox.Show("Error modifying project. Error: " + result);
            }
            else
            {
                MessageBox.Show("Project modification successful.", "Information");
                this.Close();
            }
        }
Beispiel #2
0
 public Remove_Project(FakeProjectRepository currentRepository, Project current, Project toRemove)
 {
     InitializeComponent();
     currentProject    = current;
     projectToRemove   = toRemove;
     ProjectRepository = currentRepository;
     allProjects       = ProjectRepository.GetAll();
 }
Beispiel #3
0
 public Modify_Project(FakeProjectRepository currentRepository, Project current, Project toModify)
 {
     InitializeComponent();
     currentProject    = current;
     projectToModify   = toModify;
     ProjectRepository = currentRepository;
     allProjects       = ProjectRepository.GetAll();
 }
Beispiel #4
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            FakeProjectRepository projectRepository = new FakeProjectRepository();
            Project project = new Project();

            project.Name = textBoxProjectName.Text.Trim();
            int    assignedProjectId;
            string result = projectRepository.Add(project, out assignedProjectId);

            if (result == FakeProjectRepository.NO_ERROR)
            {
                MessageBox.Show("Project added successfully.");
            }
            else
            {
                MessageBox.Show("Project not created. " + result, "Attention.");
            }
            this.Close();
        }
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            DialogResult isSure = MessageBox.Show("Are you sure you want to permenantly remove this project?", "Attention", MessageBoxButtons.YesNo);

            if (isSure == DialogResult.Yes)
            {
                FakeProjectRepository repository = new FakeProjectRepository();
                string result = repository.Remove(_SelectedProjectId);
                if (result == FakeProjectRepository.NO_ERROR)
                {
                    MessageBox.Show("Project removed.", "Information");
                }
                else
                {
                    MessageBox.Show(result, "Attention");
                }
                Close();
            }
        }
 public Create_Project(FakeProjectRepository currentRepository)
 {
     InitializeComponent();
     ProjectRepository = currentRepository;
 }