static private void ProjectRefresh() { string projectName = MOG_ControllerProject.GetProjectName(); string branchName = MOG_ControllerProject.GetBranchName(); string userName = MOG_ControllerProject.GetUserName(); // Refresh all my user list controls if (guiProject.SetLoginProject(projectName, branchName)) { // Set the login user guiUser guiUsers = new guiUser(mainForm); if (!guiUsers.SetLoginUser(userName)) { // Error MOG_Prompt.PromptResponse("Refresh Project", "Unable to refresh user! Try re-logging in to your project"); } } else { // Error MOG_Prompt.PromptResponse("Refresh Project", "No local workspace or login to project failed!, Try re-logging in to your project"); } // Refresh all my project lists }
static public void MOGGlobalLaunchProjectLogin(string projectName, bool forceLogin) { // Launch the login dialog LoginForm login = new LoginForm(projectName); mainForm.Enabled = false; Login: // Show the dialog if (login.ShowDialog(mainForm) == DialogResult.OK) { try { // Login to the specified Project if (guiProject.SetLoginProject(login.LoginProjectsComboBox.Text, login.LoginBranchesComboBox.Text)) { // Set the login user guiUser guiUsers = new guiUser(mainForm); if ((string.Compare(login.LoginUsersComboBox.Text, "Choose Valid User", true) == 0) || (login.LoginUsersComboBox.Text.Length == 0)) { MessageBox.Show("A valid user must be selected!", "Missing User"); goto Login; } if (guiUsers.SetLoginUser(login.LoginUsersComboBox.Text)) { mainForm.Enabled = true; // Disable the Change SQL Server menu item if the logged in user is not an administrator MOGGlobalSetSQLConnectionMenuItemEnabled(login.LoginUsersComboBox.Text); // Disable the Configure Project menu item if the logged in user is not an administrator MOGGlobalSetToolsConfigureProjectMenuItemEnabled(login.LoginUsersComboBox.Text); // Disable the Set MOG Repository menu item if the logged in user is not an administrator MOGGlobalSetFileMOGRepositoryMenuItemEnabled(login.LoginUsersComboBox.Text); } else { MessageBox.Show("A valid user must be selected!", "Login Error"); goto Login; } } else { MessageBox.Show("A valid project and branch must be selected!", "Login Error"); goto Login; } } catch (Exception e) { MOG_Report.ReportMessage("Login Project", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR); goto Login; } } else if (login.DialogResult == DialogResult.Cancel && forceLogin) { if (MessageBox.Show(mainForm, "Do you wish to exit MOG?", "Exit?", MessageBoxButtons.YesNo) == DialogResult.Yes) { mainForm.Close(); mainForm.Shutdown(); } else { goto Login; } } else { if (!MOG_ControllerProject.IsProject() || !MOG_ControllerProject.IsUser()) { MessageBox.Show("A valid project and user must be selected!", "Missing Project or User"); goto Login; } mainForm.Enabled = true; } // Always initialize our Database before leaving because the dialog loads projects that will leave us in a dirty state MOG_ControllerSystem.InitializeDatabase("", MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName()); }