public ModifyProject(FakeProjectRepository currRepository, Project current, Project tomodify) { InitializeComponent(); currentProject = current; projectModify = tomodify; ProjectRepository = currRepository; allprojects = ProjectRepository.GetAll(); }
public SelectProject(FakeProjectRepository projectDatabase) { InitializeComponent(); projects = projectDatabase.GetAll(); foreach (var project in projects) { listBox2.Items.Add(project.name); } }
public void button1_Click(object sender, EventArgs e) { DialogResult res = MessageBox.Show("Are you sure you want to permanently remove this project", "Attention", MessageBoxButtons.YesNo); if (res == DialogResult.Yes) { string result = FakeProjectRepository.Removeproj(useid + 1); this.Close(); } if (res == DialogResult.No) { this.Close(); } }
public void FormLogin_Load() { CenterToScreen(); FakeProjectRepository newproject = new FakeProjectRepository(); listBox1.ClearSelected(); string arr = "0"; int num = 0; foreach (KeyValuePair <string, Project> pro in FakeProjectRepository.Projects) { arr = pro.Key; num = pro.Value.ID; listBox1.Items.Add(num + " - " + arr); } listBox1.EndUpdate(); }
private void removeProjectToolStripMenuItem_Click(object sender, EventArgs e) { // REMOVE Project ProjectToRemove = null; bool validresult = false; FakeProjectRepository projects = new FakeProjectRepository(); using (FormSelectProject SelectProjectForm = new FormSelectProject()) { do { SelectProjectForm.ShowDialog(); if (SelectProjectForm.DialogResult == DialogResult.OK) { if (SelectProjectForm.SelectedProject == currentProject) { MessageBox.Show("Cannot remove your current session project.", "Attention"); } else { ProjectToRemove = SelectProjectForm.SelectedProject; validresult = true; } } else if (SelectProjectForm.DialogResult == DialogResult.Cancel) { validresult = true; } } while (!validresult); } if (ProjectToRemove != null) { using (FormRemoveProject RemoveProjectForm = new FormRemoveProject()) { RemoveProjectForm.ProjectToRemove = ProjectToRemove.Name; RemoveProjectForm.ShowDialog(this); if (RemoveProjectForm.DialogResult == DialogResult.OK) { projects.Remove(ProjectToRemove.Id); } } } }
private void createProjectToolStripMenuItem_Click(object sender, EventArgs e) { // CREATE string newProjectOut; DialogResult newProjectResult; FakeProjectRepository projects = new FakeProjectRepository(); Project newProject = new Project(); bool validresult = false; using (FormCreateProject CreateProjectForm = new FormCreateProject()) { do { CreateProjectForm.ShowDialog(); newProjectResult = CreateProjectForm.DialogResult; if (newProjectResult == DialogResult.OK) { if (CreateProjectForm.NewProjectsName != "") { newProject.Name = CreateProjectForm.NewProjectsName; newProjectOut = projects.Add(newProject, out int Id); if (newProjectOut != "") { MessageBox.Show(newProjectOut); // shows error string from FakeProjectRepo. } else { validresult = true; } } } else if (newProjectResult == DialogResult.Cancel) { validresult = true; } } while (!validresult); } }
private void addButton_Click(object sender, EventArgs e) { Project createProject = new Project(); bool duplicate = FakeProjectRepository.isDuplicateName(newProjectName); createProject.Name = newProjectName; if (projectNameText.Text.Trim() == string.Empty) { MessageBox.Show(FakeProjectRepository.EMPTY_PROJECTNAME_ERROR); return; } if (duplicate == false) { string newProject = FakeProjectRepository.Add(createProject, FakeProjectRepository.Projects.Count() + 1); MessageBox.Show("Project Added Successfully."); } else { MessageBox.Show(FakeProjectRepository.DUPLPICATEPROJECTNAME_ERROR); } // add way to add new project to show project form this.Close(); }
public RemoveProject(FakeProjectRepository projectDatabase) { InitializeComponent(); }
public AddProject(FakeProjectRepository projectDatabase) { projects = projectDatabase.GetAll(); InitializeComponent(); }
private void CreateProject_Load(object sender, EventArgs e) { CenterToScreen(); projectNameText.Select(); FakeProjectRepository newproject = new FakeProjectRepository(); }
private void modifyProjectToolStripMenuItem_Click(object sender, EventArgs e) { // MODIFY Project ProjectToModify = null; bool validresult = false; string modifyProjectOut; FakeProjectRepository projects = new FakeProjectRepository(); using (FormSelectProject SelectProjectForm = new FormSelectProject()) { do { SelectProjectForm.ShowDialog(); if (SelectProjectForm.DialogResult == DialogResult.OK) { if (SelectProjectForm.SelectedProject == currentProject) { MessageBox.Show("Cannot modify your current session project.", "Attention"); } else { ProjectToModify = SelectProjectForm.SelectedProject; validresult = true; } } else if (SelectProjectForm.DialogResult == DialogResult.Cancel) { validresult = true; } } while (!validresult); } if (ProjectToModify != null) { using (FormModifyProject ModifyProjectForm = new FormModifyProject()) { validresult = false; do { ModifyProjectForm.ProjectsNewName = ProjectToModify.Name; if (ModifyProjectForm.ShowDialog() == DialogResult.OK) { Project ModifiedProject = new Project { Name = ModifyProjectForm.ProjectsNewName, Id = ProjectToModify.Id }; modifyProjectOut = projects.Modify(ProjectToModify.Id, ModifiedProject); if (modifyProjectOut != "") { MessageBox.Show(modifyProjectOut); } else { validresult = true; } } else if (ModifyProjectForm.DialogResult == DialogResult.Cancel) { validresult = true; } } while (!validresult); } } }
public FormSelectProject() { repo = new FakeProjectRepository(); InitializeComponent(); }