Пример #1
0
        private void ControlVersion_Invoking(object sender, CommandInvokeEventArgs e)
        {
            try
            {
                //Création des services
                var projectService = _Application.ServiceManager.GetService <IProjectService>();
                var OpenedProject  = projectService.ActiveProject;

                var ucControlVersionControl = new ucControlVersion(_Application);
                using (var controlVersionForm = new frmUserControl(ucControlVersionControl, "Gestion des versions de controls", true, false))
                {
                    ucControlVersionControl.Close   += (s, d) => controlVersionForm.Close();
                    controlVersionForm.StartPosition = FormStartPosition.CenterParent;
                    controlVersionForm.Width         = 1200;
                    controlVersionForm.Height        = 800;

                    controlVersionForm.ShowDialog();

                    if (ucControlVersionControl.SaveNeeded)
                    {
                        MessageBox.Show("Veuillez sauvegarder le projet pour conserver les modifications sur les contrôles");
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ShowInMessageBox();
            }
        }
Пример #2
0
        private void WhereUsedTableGroup_Invoking(object sender, CommandInvokeEventArgs e)
        {
            try
            {
                var groupService = _Application.ServiceManager.GetService <IGroupService>();
                var activeGroup  = groupService.ActiveGroup;

                if (!Tools.Tools.IsAdminCurrentUser(activeGroup))
                {
                    throw new Exception("Seul l'admin peut executer cette fonction");
                }

                var usedTableUserControl = new ucWhereUsedGroup(_Application, activeGroup);
                using (var usedTableForm = new frmUserControl(usedTableUserControl, "Cas d'emploi des tables", true, false))
                {
                    usedTableUserControl.Close += (s, d) => usedTableForm.Close();
                    usedTableForm.StartPosition = FormStartPosition.CenterParent;
                    usedTableForm.Width         = 1000;
                    usedTableForm.Height        = 800;

                    usedTableForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ex.ShowInMessageBox();
            }
        }
Пример #3
0
        private void cmdImportFromProjectExcelFile_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (_IsLoading.Value)
                {
                    return;
                }
                using (var locker = new BoolLocker(ref _IsLoading))
                {
                    Tools.Tools.ThrowExceptionIfCurrentUserIsNotAdmin(_Group);

                    var ucImportTaskControl = new ucImportTaskFromPDC(_Group);
                    using (var ImportTaskForm = new frmUserControl(ucImportTaskControl, "Importation Tâche", true, false))
                    {
                        ucImportTaskControl.Close   += (s, d) => ImportTaskForm.Close();
                        ImportTaskForm.StartPosition = FormStartPosition.CenterParent;
                        ucImportTaskControl.Initialize();
                        ImportTaskForm.ShowDialog();

                        InternalReLoadControl();
                        dgvMain.Refresh();
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ShowInMessageBox();
            }
        }
Пример #4
0
        private void cmdSetTaskPriority_Click(object sender, EventArgs e)
        {
            try
            {
                var selectedTask = GetSelectedMainTask();

                if (_IsLoading.Value)
                {
                    return;
                }
                using (var locker = new BoolLocker(ref _IsLoading))
                {
                    Tools.Tools.ThrowExceptionIfCurrentUserIsNotAdmin(_Group);

                    if (selectedTask == null)
                    {
                        return;
                    }

                    var priorityInputBoxUC = new Library.Control.UserControls.ucInputBox("Saisir la nouvelle priorité : ", InputTypeAllowEnum.Numeric);

                    using (var inProgressForm = new frmUserControl(priorityInputBoxUC, "Priorité", false, false))
                    {
                        inProgressForm.ShowDialog();

                        if (priorityInputBoxUC.DialogResult != DialogResult.OK)
                        {
                            return;
                        }

                        using (var releaseService = new Service.Release.Front.ReleaseService(_Group.GetEnvironment().GetSQLExtendConnectionString()))
                        {
                            releaseService.SetTaskPriority(selectedTask, priorityInputBoxUC.AnswerString.ToInt32());
                        }
                    }
                }
                InternalReLoadControl();
            }
            catch (Exception ex)
            {
                ex.ShowInMessageBox();
            }
        }
Пример #5
0
        private void cmdAddTask_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (_IsLoading.Value)
                {
                    return;
                }
                using (var locker = new BoolLocker(ref _IsLoading))
                {
                    var selectedExternalProject = GetSelectedExternalProject();

                    if (selectedExternalProject != null)
                    {
                        var ucMainTaskEditControl = new ucMainTaskEdit();
                        using (var mainTaskForm = new frmUserControl(ucMainTaskEditControl, "Importation Tâche", false, false))
                        {
                            ucMainTaskEditControl.Close += (s, d) => mainTaskForm.Close();
                            mainTaskForm.StartPosition   = FormStartPosition.CenterParent;
                            ucMainTaskEditControl.Initialize(_Group);
                            ucMainTaskEditControl.LoadFromExternalProject(selectedExternalProject);
                            mainTaskForm.ShowDialog();

                            if (ucMainTaskEditControl.DialogResult == DialogResult.OK)
                            {
                                //traite le projet pour ne plus qu'il soit visible
                                using (var releaseService = new ReleaseService(_Group.GetEnvironment().GetSQLExtendConnectionString()))
                                    releaseService.ProcessedExternalProject(selectedExternalProject);

                                LoadDatagridview();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ShowInMessageBox();
            }
        }
Пример #6
0
        private void WhereUsedTableProject_Invoking(object sender, CommandInvokeEventArgs e)
        {
            try
            {
                var groupService = _Application.ServiceManager.GetService <IGroupService>();
                var activeGroup  = groupService.ActiveGroup;

                var usedTableUserControl = new ucWhereUsedProject(_Application, activeGroup);
                using (var usedTableForm = new frmUserControl(usedTableUserControl, "Cas d'emploi des tables", true, false))
                {
                    usedTableUserControl.Close += (s, d) => usedTableForm.Close();
                    usedTableForm.StartPosition = FormStartPosition.CenterParent;
                    usedTableForm.Width         = 1000;
                    usedTableForm.Height        = 800;

                    usedTableForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ex.ShowInMessageBox();
            }
        }
Пример #7
0
        private void mApplication_StateChanged(object sender, System.EventArgs e)
        {
            try
            {
                //Seulement pour driveworks administrator
                if (_Application.Name != "DriveWorks Administrator")
                {
                    return;
                }

                if (_Application.State.Contains(StandardStates.ProjectLoaded))
                {
                    //Chargement des boutons
                    this.RegisterProjectCommandButton();

                    if (!Consts.Consts.DontShowCheckTaskOnStartup.Value)
                    {
                        //Affichage des tâches ouvertes sur ce projet
                        var groupService = _Application.ServiceManager.GetService <IGroupService>();
                        var activeGroupe = groupService.ActiveGroup;

                        var projectService = _Application.ServiceManager.GetService <IProjectService>();
                        var activeProject  = projectService.ActiveProject;

                        if (groupService.ActiveGroup.Name == EnvironmentEnum.Developpement.GetName("FR"))
                        {
                            var ucCheckTaskOnStartupControl = new ucCheckTaskOnStartup(activeProject);
                            using (var checkTaskOnStartupForm = new frmUserControl(ucCheckTaskOnStartupControl, "Vérification des tâches", false, false))
                            {
                                ucCheckTaskOnStartupControl.Close   += (s, d) => checkTaskOnStartupForm.Close();
                                checkTaskOnStartupForm.StartPosition = FormStartPosition.CenterParent;
                                checkTaskOnStartupForm.Width         = 500;
                                checkTaskOnStartupForm.Height        = 500;
                                if (ucCheckTaskOnStartupControl.RunCheckup())
                                {
                                    checkTaskOnStartupForm.ShowDialog();
                                }

                                if (ucCheckTaskOnStartupControl.DialogResult == ucCheckTaskOnStartup.OpenModeEnum.NotAllowed)
                                {
                                    projectService.CloseProject();
                                }
                                else if (ucCheckTaskOnStartupControl.DialogResult == ucCheckTaskOnStartup.OpenModeEnum.ReadOnly)
                                {
                                    File.SetAttributes(activeProject.ProjectFilePath, FileAttributes.ReadOnly);
                                }
                                else if (ucCheckTaskOnStartupControl.DialogResult == ucCheckTaskOnStartup.OpenModeEnum.Writable)
                                {
                                    File.SetAttributes(activeProject.ProjectFilePath, File.GetAttributes(activeProject.ProjectFilePath) & ~FileAttributes.ReadOnly);
                                }
                            }
                        }
                    }
                }
                else if (_Application.State.Contains(StandardStates.GroupLoaded))
                {
                    //Chargement des boutons
                    this.RegisterGroupCommandButton();
                }
            }
            catch (Exception ex)
            {
                ex.ShowInMessageBox();
            }
        }