Ejemplo n.º 1
0
        private void CopyFromProject_Click(object sender, EventArgs e)
        {
            InsertProjectForm2 frm = new InsertProjectForm2();

            if (_selnode != null)
            {
                string[] opis = GetNodeAttribute(_selnode);
                int      j    = opis.Length;
                // ==========
                // 07.12.2011
                frm.SetOpis(opis, projects, _selnode.Tag as Project);
            }

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                if (_app != null)
                {
                    frm.newProject.IsModify = true;

                    Project prj = frm.newProject;

                    if (prj.Stages.Count == 0)
                    {
                        ProjectStage stage = new ProjectStage();

                        stage.Koef      = 1;
                        stage.StageName = "Этап #1";

                        prj.Stages.Add(stage);
                    }

                    DateTime now = DateTime.Now;
                    prj.Created = now;
                    prj.Dir     = string.Format("{0:00}_{1:00}_{2:00}_{3:00}_{4:00}_{5:00}",
                                                now.Year,
                                                now.Month,
                                                now.Day,
                                                now.Hour,
                                                now.Minute,
                                                now.Second);
                    prj.DB_Name = string.Format("db_{0:00}_{1:00}_{2:00}_{3:00}_{4:00}_{5:00}",
                                                now.Year,
                                                now.Month,
                                                now.Day,
                                                now.Hour,
                                                now.Minute,
                                                now.Second);

                    prj.InternalNmb = projects.maxNmb + 1;
                    prj.IsModify    = true;
                    projects.AddProject(prj, true);
                    _app.Projects.Add(prj);

                    projects.SortByName();
                    BuildProjectsTreeView();
                    this.ShowSelNode();
                    this.treeViewProjects.Select();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Создать и выбрать новый проект
        /// </summary>
        public bool CreateNewAndSelectProject(Form frame)
        {
            try
            {
                InsertProjectForm2 frm = new InsertProjectForm2();

                if (_selnode != null)
                {
                    string[] opis = GetNodeAttribute(_selnode);
                    int      j    = opis.Length;
                    // ==========
                    // 07.12.2011
                    frm.SetOpis(opis, projects, _selnode.Tag as Project);
                }

                if (frm.ShowDialog(frame) == DialogResult.OK)
                {
                    if (_app != null)
                    {
                        frm.newProject.IsModify = true;

                        Project prj = frm.newProject;

                        prj.Stages.Clear();
                        ProjectStage stage = new ProjectStage();
                        stage.Koef      = 1;
                        stage.StageName = "Этап #1";
                        prj.Stages.Add(stage);

                        DateTime now = DateTime.Now;
                        prj.Created = now;
                        prj.Dir     = string.Format("{0:00}_{1:00}_{2:00}_{3:00}_{4:00}_{5:00}",
                                                    now.Year,
                                                    now.Month,
                                                    now.Day,
                                                    now.Hour,
                                                    now.Minute,
                                                    now.Second);
                        prj.DB_Name = string.Format("db_{0:00}_{1:00}_{2:00}_{3:00}_{4:00}_{5:00}",
                                                    now.Year,
                                                    now.Month,
                                                    now.Day,
                                                    now.Hour,
                                                    now.Minute,
                                                    now.Second);

                        prj.InternalNmb = projects.maxNmb + 1;
                        prj.IsModify    = true;
                        projects.AddProject(prj, true);
                        _app.Projects.Add(prj);

                        projects.SortByName();
                        BuildProjectsTreeView();
                        this.ShowSelNode();
                        this.treeViewProjects.Select();

                        OpenProject_Click(null, EventArgs.Empty);
                        return(true);
                    }
                }
            }
            catch { }
            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Добавляем новый проект
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InsertNewProject_Click(object sender, EventArgs e)
        {
            InsertProjectForm2 frm = new InsertProjectForm2();

            if (_selnode != null)
            {
                string[] opis = GetNodeAttribute(_selnode);
                int j = opis.Length;
                // ==========
                // 07.12.2011
                frm.SetOpis(opis, projects, _selnode.Tag as Project);
            }

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                if (_app != null)
                {
                    frm.newProject.IsModify = true;

                    Project prj = frm.newProject;

                    prj.Stages.Clear();
                    ProjectStage stage = new ProjectStage();
                    stage.Koef = 1;
                    stage.StageName = "Этап #1";
                    prj.Stages.Add(stage);

                    DateTime now = DateTime.Now;
                    prj.Created = now;
                    prj.Dir = string.Format("{0:00}_{1:00}_{2:00}_{3:00}_{4:00}_{5:00}",
                        now.Year,
                        now.Month,
                        now.Day,
                        now.Hour,
                        now.Minute,
                        now.Second);
                    prj.DB_Name = string.Format("db_{0:00}_{1:00}_{2:00}_{3:00}_{4:00}_{5:00}",
                        now.Year,
                        now.Month,
                        now.Day,
                        now.Hour,
                        now.Minute,
                        now.Second);

                    prj.InternalNmb = projects.maxNmb + 1;
                    prj.IsModify = true;
                    projects.AddProject(prj, true);
                    _app.Projects.Add(prj);

                    projects.SortByName();
                    BuildProjectsTreeView();
                    this.ShowSelNode();
                    this.treeViewProjects.Select();
                }
            }
        }