Ejemplo n.º 1
0
        private void AddProject()
        {
            Project project = new Project();
            ProjectDetailsForm form = new ProjectDetailsForm();
            form.ProjectDetailsUserControl.ShowProject(project);

            Again:
            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // Check name.
                if (string.IsNullOrWhiteSpace(form.ProjectDetailsUserControl.ProjectName))
                {
                    MessageBox.Show
                    (
                        Resources.String_TheProjectNameCannotBeBlank,
                        Resources.String_Error,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error,
                        MessageBoxDefaultButton.Button1,
                        FormMessageBoxOptions
                    );
                    goto Again;
                }

                form.ProjectDetailsUserControl.RetrieveProject(project);

                // Add.
                project.Add();

                // Flush.
                Database.Flush();

                // Show projects.
                ShowProjects();

                // Select new project.
                projectsListUserControl.ProjectsListView.SelectedItems.Clear();
                foreach (ListViewItem item in projectsListUserControl.ProjectsListView.Items)
                {
                    Project p = (Project)item.Tag;
                    if (p.ID == project.ID)
                    {
                        item.Selected = true;
                        break;
                    }
                }

                UpdateControlsEnabledProperty();

                // Show edit project form.
                EditProject();

                projectsListUserControl.Focus();
            }

            return;
        }
Ejemplo n.º 2
0
        private void ChangeProjectDetails()
        {
            using (var form = new ProjectDetailsForm(mContext, Project)) {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                Project = form.RetrieveProject(Project);

                // Update project.
                Project.Update(mContext);

                // Flush.
                mContext.Flush();

                UpdateTitlebar();
                ShowProjectDetails();

                mMainForm.UpdateProject();
            }
        }
Ejemplo n.º 3
0
        private void ChangeProjectDetails()
        {
            ProjectDetailsForm form = new ProjectDetailsForm();

            form.ProjectDetailsUserControl.ShowProject(Project);

            Again:
            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // Check name.
                if (string.IsNullOrWhiteSpace(form.ProjectDetailsUserControl.ProjectName))
                {
                    MessageBox.Show
                    (
                        Resources.String_TheProjectNameCannotBeBlank,
                        Resources.String_Error,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error,
                        MessageBoxDefaultButton.Button1,
                        FormMessageBoxOptions
                    );
                    goto Again;
                }

                form.ProjectDetailsUserControl.RetrieveProject(Project);

                // Update project.
                Project.Update();

                // Flush.
                Database.Flush();

                ShowProjectDetails();
            }

            return;
        }