Пример #1
0
        private void AddBranch()
        {
            MOG_Privileges privs = MOG_ControllerProject.GetPrivileges();

            if (privs.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.CreateBranch))
            {
                CreateBranchForm newBranch = new CreateBranchForm();
                newBranch.BranchSourceTextBox.Text = MOG_ControllerProject.GetBranchName();

                if (newBranch.ShowDialog() == DialogResult.OK)
                {
                    // Create the branch
                    if (MOG_ControllerProject.BranchCreate(MOG_ControllerProject.GetBranchName(), newBranch.BranchNameTextBox.Text))
                    {
                        MOG_DBBranchInfo branch = MOG_DBProjectAPI.GetBranch(newBranch.BranchNameTextBox.Text);

                        AddBranchListViewItem(branch);

                        MOG_Prompt.PromptMessage("Create Branch", "New branch successfully created.\n" +
                                                 "BRANCH: " + newBranch.BranchNameTextBox.Text);
                    }
                }
            }
            else
            {
                MOG_Prompt.PromptResponse("Insufficient Privileges", "Your privileges do not allow you to create branches.");
            }
        }
Пример #2
0
        static private void MOGGlobalBranchCreate_Click(object sender, System.EventArgs e)
        {
            string branch = ((ToolStripMenuItem)sender).Text;

            CreateBranchForm newBranch = new CreateBranchForm();

            newBranch.BranchSourceTextBox.Text = MOG_ControllerProject.GetBranchName();

            if (newBranch.ShowDialog() == DialogResult.OK)
            {
                if (MOG_ControllerProject.BranchCreate(MOG_ControllerProject.GetBranchName(), newBranch.BranchNameTextBox.Text))
                {
                    // Rebuild the branch menu
                    MainMenuProjectsClass.MOGGlobalBranchesInit(true);
                    MOG_Prompt.PromptMessage("Create Branch", "New branch successfully created.\n" +
                                             "BRANCH: " + newBranch.BranchNameTextBox.Text);
                }
            }
        }
Пример #3
0
        private void CreateProject_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            MOG_Project project = new MOG_Project();

            try
            {
                MOG_System sys = MOG_ControllerSystem.GetSystem();
                if (sys != null)
                {
                    project = sys.ProjectCreate(this.projectInfoControl.ProjectName);
                    if (project != null)
                    {
                        worker.ReportProgress(0, "Setting project info...");

                        // project info
                        project.SetProjectPath(this.projectInfoControl.ProjectPath);
                        project.SetProjectToolsPath(this.projectInfoControl.ProjectPath + "\\Tools");
                        project.SetProjectUsersPath(this.projectInfoControl.ProjectPath + "\\Users");

                        worker.ReportProgress(0, "Copying tools...");

                        worker.ReportProgress(0, "Saving and logging in...");

                        // create project and login
                        project.Save();

                        MOG_ControllerProject.LoginProject(this.projectInfoControl.ProjectName, "");

                        worker.ReportProgress(0, "Creating current branch...");

                        // create default branch
                        MOG_ControllerProject.BranchCreate("", "Current");

                        worker.ReportProgress(0, "Creating classification tree...");

                        // platforms
                        MOG_Platform pcPlatform = new MOG_Platform();
                        pcPlatform.mPlatformName = "PC";
                        project.PlatformAdd(pcPlatform);

                        // create classifications
                        MogUtil_ClassificationLoader classLoader = new MogUtil_ClassificationLoader();
                        classLoader.ProjectName = this.projectInfoControl.ProjectName;
                        foreach (MOG_Properties props in classLoader.GetClassPropertiesListFromFiles())
                        {
                            if (props.Classification.ToLower() == project.GetProjectName().ToLower())
                            {
                                // create only project name root class node
                                project.ClassificationAdd(props.Classification);
                                MOG_Properties properties = project.GetClassificationProperties(props.Classification);
                                properties.SetImmeadiateMode(true);
                                properties.SetProperties(props.GetPropertyList());
                                break;
                            }
                        }

                        project.Save();
                    }
                    else
                    {
                        throw new Exception("Failed to create the project.");
                    }
                }
                else
                {
                    throw new Exception("System not initialized.");
                }
            }
            catch (Exception ex)
            {
                MOG_Report.ReportMessage("Project Creation Failed", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL);
            }

            e.Result = project;
        }