/// <summary>
        /// Création d'une sous-processus par l'intermédiaire de la fiche processus
        /// </summary>
        void Ajouter_SousProcessus()
        {
            Console.Ajouter("[AJOUT SOUS-PROCESSUS");
            //Recherche du code du parent pour optimiser le codage des processus
            if (lstProcessus.SelectedNode is null)
            {
                MessageBox.Show("Vous devez sélectionner un processus.", "Erreur");
                return;
            }

            frmProcessus f = new frmProcessus();

            f.Acces    = Acces;
            f.Creation = true;

            f.processus      = new Process();
            f.processus.Code = "PRO-" + processus.Code;

            f.processus.Actif = true;

            f.processusParent          = (Process)Acces.Trouver_Element(Acces.type_PROCESSUS, int.Parse(lstProcessus.SelectedNode.Name));
            f.processus.Type_Processus = TypeProcessus.GROUPE;
            if (f.processusParent.Type_Processus == TypeProcessus.GROUPE)
            {
                f.processus.Type_Processus = TypeProcessus.PROCESSUS;
            }

            Console.Ajouter("Processus parent : " + f.processusParent.Code);

            f.Initialiser();

            if (f.ShowDialog() == DialogResult.OK)
            {
                Afficher_ListeProcessus();

                TreeNode[] liste = lstProcessus.Nodes.Find(f.processusParent.ID.ToString(), true);
                if (liste.Length > 0)
                {
                    liste[0].Expand(); lstProcessus.SelectedNode = liste[0];
                }
            }
        }
        void Ajouter_SousObjectif()
        {
            string code = plan.Abrege;

            if (lstObjectif.SelectedNode is null)
            {
                MessageBox.Show("Vous devez choisir un objectif parent");
                return;
            }

            int      id  = int.Parse(lstObjectif.SelectedNode.Name);
            Objectif obj = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF, id);

            code = obj.Code;

            ctrlFicheObjectif f = new ctrlFicheObjectif();

            f.Acces          = Acces;
            f.Creation       = true;
            f.objectif       = new Objectif();
            f.objectif.Code  = code;
            f.objectif.Actif = true;
            f.objectifParent = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF, int.Parse(lstObjectif.SelectedNode.Name));;

            n_obj++;
            f.Tag              = Acces.type_OBJECTIF.Code + n_obj;
            f.EVT_Enregistrer += Handler_evt_Modifier;

            f.Initialiser();

            var D = new WeifenLuo.WinFormsUI.Docking.DockContent();

            D.TabText = "Objectif (Nouveau)";

            f.Dock = DockStyle.Fill;
            D.Controls.Add(f);

            D.Show(DP, WeifenLuo.WinFormsUI.Docking.DockState.Document);
        }
Beispiel #3
0
        /// <summary>
        /// Création d'une sous-action par l'intermédiaire de la fiche action
        /// </summary>
        void Ajouter_SousAction()
        {
            string code = CodeRef;

            Console.Ajouter("[AJOUT SOUS-ACTION");
            //Recherche du code du parent pour optimiser le codage des actions
            if (lstAction.SelectedNode is null)
            {
                MessageBox.Show("Vous devez sélectionner une action.", "Erreur");
                return;
            }

            ctrlFicheAction f = new ctrlFicheAction();

            f.Acces    = Acces;
            f.Creation = true;
            n_action++;
            f.Tag              = Acces.type_ACTION.Code + n_action;
            f.EVT_Enregistrer += Handler_evt_Modifier;

            f.action = new PATIO.CAPA.Classes.Action();
            //f.action.Code = "ACT-" + code;
            f.action.Actif = true;

            f.actionParent = (PATIO.CAPA.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION, int.Parse(lstAction.SelectedNode.Name));
            Console.Ajouter("Action parent : " + f.actionParent.Code);

            f.Initialiser();

            var D = new WeifenLuo.WinFormsUI.Docking.DockContent();

            D.TabText = "Action (nouvelle)";

            f.Dock = DockStyle.Fill;
            D.Controls.Add(f);

            D.Show(DP, WeifenLuo.WinFormsUI.Docking.DockState.Document);
        }
Beispiel #4
0
        void Ouvrir_Plan(int ID)
        {
            Plan plan = (Plan)Acces.Trouver_Element(Acces.type_PLAN.id, ID);

            var D = new WeifenLuo.WinFormsUI.Docking.DockContent();

            D.TabText = "Plan " + plan.Code;
            //MessageBox.Show(int.Parse(lstPlan.SelectedNode.Name).ToString());

            var ctrl = new ctrlPlan();

            ctrl.Acces   = Acces;
            ctrl.plan    = plan;
            ctrl.DP      = DP;
            ctrl.Console = Console;
            ctrl.Chemin  = Chemin;
            ctrl.Afficher();

            ctrl.Dock = DockStyle.Fill;
            D.Controls.Add(ctrl);

            D.Show(DP, WeifenLuo.WinFormsUI.Docking.DockState.Document);
        }
Beispiel #5
0
        void Afficher_Info()
        {
            lstInfo.Items.Clear();

            lstInfo.Items.Add("Id : " + projet.ID);
            lstInfo.Items.Add("Pilote : " + projet.Pilote.NomPrenom);

            string Enveloppe = "";

            foreach (int k in projet.EnveloppeBudget)
            {
                Enveloppe += (Enveloppe.Length > 0 ? ", " : "") +
                             ((Budget_Enveloppe)Acces.Trouver_Element(Acces.type_BUDGET_ENVELOPPE, k)).Libelle;
            }

            lstInfo.Items.Add("Enveloppe : " + (Enveloppe.Length > 0?Enveloppe :"Aucune"));
        }
Beispiel #6
0
        void Modifier_Modele()
        {
            if (treeModele.SelectedNode == null)
            {
                return;
            }
            string Module = treeModele.SelectedNode.Name.Split('-')[0];
            int    ID     = int.Parse(treeModele.SelectedNode.Name.Split('-')[1]);

            ModeleDoc md = (ModeleDoc)Acces.Trouver_Element(Acces.type_MODELEDOC, ID);

            if (Module == "TYPE")
            {
                string Libelle = Microsoft.VisualBasic.Interaction.InputBox("Saisir le libellé du type de modèle",
                                                                            "Création d'un type de modèle", md.Libelle);

                if (Libelle.Length == 0 || md.Libelle == Libelle)
                {
                    return;
                }

                md.Libelle = Libelle;

                Acces.Enregistrer(Acces.type_MODELEDOC, md);
                treeModele.SelectedNode.Text = Libelle;
            }

            if (Module == "MODELE")
            {
                frmModeleDoc f = new frmModeleDoc();
                f.Acces      = Acces;
                f.Creation   = false;
                f.modele_doc = md;
                f.Parent_ID  = md.Parent_ID;
                f.Initialiser();

                if (f.ShowDialog() == DialogResult.OK)
                {
                    treeModele.SelectedNode.Text = f.modele_doc.Libelle;
                }
            }
        }
Beispiel #7
0
        void Modifier_User()
        {
            if (lstUser.SelectedNode != null)
            {
                var f = new frmUser();
                f.Acces    = Acces;
                f.Creation = false;

                f.User = (Utilisateur)Acces.Trouver_Element(Acces.type_UTILISATEUR.id, int.Parse(lstUser.SelectedNode.Name));

                f.Initialise();

                if (f.ShowDialog(this) == DialogResult.OK)
                {
                    Afficher_ListeUser();
                }
            }
        }
        public void Editer_Fiche_Direction()
        {
            if (lstDirection.SelectedIndex < 0)
            {
                return;
            }

            //Extrait les informations de l'arborescence
            List <Element> Liste = new List <Element>();

            foreach (TreeNode nd in tree.Nodes)
            {
                if (nd.Checked)
                {
                    Extrait_Info(nd, ref Liste);
                }
            }

            //Création de l'application Excel
            app = new Microsoft.Office.Interop.Excel.Application();
            app.DisplayAlerts = false;

            var modele  = Chemin + "\\Modeles\\Fiche_PLAN_DIRECTION.xltx";
            var fichier = Chemin + "\\Fichiers\\" + "FD-" + ListeDirection[lstDirection.SelectedIndex].Code + "-" + string.Format("{0:yyMMddHHmmss}", DateTime.Now);

            app.Workbooks.Open(modele);

            Workbooks wk = app.Workbooks;
            Workbook  wb = app.ActiveWorkbook;
            Worksheet ws = wb.Sheets[1];
            Range     r;

            r       = ws.Cells[2, 5];
            r.Value = lstDirection.Text;
            r       = ws.Cells[3, 5];
            r.Value = string.Format("{0:dd/MM/yyyy}", DateTime.Now); //Groupe interne

            //Affichage des éléments
            int n_ligne = 7;

            //Efface la zone
            ws.Range["A8:Y10000"].Clear();

            //Traitement de la liste des éléments extraits
            foreach (Element e in Liste)
            {
                if (e.Element_Type == Acces.type_PLAN.id)
                {
                    Plan plan1 = (Plan)Acces.Trouver_Element(Acces.type_PLAN.id, e.ID);

                    n_ligne++;
                    r       = ws.Cells[n_ligne, 1];
                    r.Value = plan1.Libelle;
                    r       = ws.Cells[n_ligne, 2];
                    string pilote = "";
                    pilote  = (plan1.Pilote != null) ? "\n" + plan1.Pilote.Nom + " " + plan1.Pilote.Prenom : "";
                    r.Value = pilote;

                    r       = ws.Cells[n_ligne, 24];
                    r.Value = plan1.Code.Replace("PAR-", "");
                }

                if (e.Element_Type == Acces.type_OBJECTIF.id)
                {
                    Objectif obj = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF.id, e.ID);

                    n_ligne++;
                    r       = ws.Cells[n_ligne, 3];
                    r.Value = obj.Libelle;

                    r       = ws.Cells[n_ligne, 24];
                    r.Value = obj.Code.Replace("OBJ-", "");
                }

                if (e.Element_Type == Acces.type_ACTION.id)
                {
                    PATIO.Classes.Action action = (PATIO.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION.id, e.ID);

                    if (action.TypeAction == TypeAction.ACTION)
                    {
                        n_ligne++;
                        r       = ws.Cells[n_ligne, 4];
                        r.Value = action.Libelle;

                        r = ws.Cells[n_ligne, 5];
                        string pilote = "";
                        pilote  = Acces.Donner_Chaine_Liste(action.DirectionPilote, "DIRECTION_METIER", "", true);
                        pilote += (action.Pilote != null) ? "\n" + action.Pilote.Nom + " " + action.Pilote.Prenom : "";
                        r.Value = pilote;

                        r       = ws.Cells[n_ligne, 24];
                        r.Value = action.Code.Replace("ACT-", "");
                    }

                    if (action.TypeAction == TypeAction.OPERATION)
                    {
                        n_ligne++;
                        r       = ws.Cells[n_ligne, 6];
                        r.Value = action.Libelle;

                        r = ws.Cells[n_ligne, 7];
                        string pilote = "";
                        pilote  = Acces.Donner_Chaine_Liste(action.DirectionPilote, "DIRECTION_METIER", "", true);
                        pilote += (action.Pilote != null) ? "\n" + action.Pilote.Nom + " " + action.Pilote.Prenom : "";
                        r.Value = pilote;

                        r       = ws.Cells[n_ligne, 24];
                        r.Value = action.Code.Replace("OPE-", "");
                    }

                    r       = ws.Cells[n_ligne, 8];
                    r.Value = Acces.Donner_Chaine_Liste(action.DirectionAssocie, "DIRECTION_METIER", "", true);

                    r       = ws.Cells[n_ligne, 9];
                    r.Value = (action.ActionPhare ? "X" : "");
                    if (action.OrdreActionPhare > 0)
                    {
                        r.Value = Acces.Trouver_TableValeur(action.OrdreActionPhare).Valeur;
                    }

                    r = ws.Cells[n_ligne, 10]; //Année 2018
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2018") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2018;
                    r = ws.Cells[n_ligne, 11]; //Année 2019
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2019") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2019;
                    r = ws.Cells[n_ligne, 12]; //Année 2020
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2020") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2020;
                    r = ws.Cells[n_ligne, 13]; //Année 2021
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2021") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2021;
                    r = ws.Cells[n_ligne, 14]; //Année 2022
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2022") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2022;
                    r = ws.Cells[n_ligne, 15]; //Année 2023
                    r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2023") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r.Value          = action.Mt_2023;
                    r       = ws.Cells[n_ligne, 16]; //Financement
                    r.Value = action.CoutFinancier;
                    if (action.Mt_Total != null)
                    {
                        if (action.Mt_Total.Length > 0)
                        {
                            r.Value += "\n TOTAL : " + action.Mt_Total + " k€";
                        }
                    }

                    r                = ws.Cells[n_ligne, 17]; //TDS MF
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS591") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_591", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 18]; //TDS Hainaut
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS592") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_592", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 19]; //TDS 62
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS62") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_62", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 20]; //TDS 80
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS80") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_80", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 21]; //TDS 60
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS60") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_60", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 22]; //TDS 02
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "TS02") ? "X" : "";
                    r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_02", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                    r                = ws.Cells[n_ligne, 23]; //REGION
                    r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "REGION") ? "X" : "";
                }
            }

            //Tri des lignes
            Range r_data = ws.Range["A8:Y" + n_ligne];

            r_data.Sort(r_data.Columns[24, Type.Missing], Microsoft.Office.Interop.Excel.XlSortOrder.xlAscending);

            r_data.Cells.VerticalAlignment = XlVAlign.xlVAlignCenter;

            //Mise en forme
            {
                r_data.WrapText = true; //Renvoie à la ligne
                //Bordures
                Borders border = r_data.Borders;

                border.LineStyle = XlLineStyle.xlContinuous;
                border.Weight    = 2d;
                border[XlBordersIndex.xlEdgeLeft].LineStyle   = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeTop].LineStyle    = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeBottom].LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeRight].LineStyle  = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;

                //Alignement
                ws.Columns[2].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[5].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[7].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[8].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                ws.Columns[9].HorizontalAlignment  = XlHAlign.xlHAlignCenter;
                ws.Columns[10].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[11].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[12].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[13].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[14].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[15].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                ws.Columns[17].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[18].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[19].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[20].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[21].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[22].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[23].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                //Colonnes masquées
                ws.Columns["X"].Hidden = true; //Colonne Code
            }

            //Sauvegarde du fichier
            wb.SaveAs(fichier + ".xlsx");
            wb.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, fichier + ".pdf");

            wb.Close(false);
            wk.Close();

            //Fermeture de l'application Excel
            app.Quit();
            app = null;

            Process.Start(fichier + ".xlsx");
        }
Beispiel #9
0
        /// <summary>
        /// Repositionne les éléments selon la hiérarchie définie
        /// </summary>
        void Repositionner(Plan plan)
        {
            int nbObjectif = 0; int nbAction = 0; int nbOpération = 0; int nbIndicateur = 0;

            //Placement des objectifs/sous-objectifs
            listeLien = Acces.Remplir_ListeLien_Niv0(Acces.type_PLAN, plan.ID.ToString());
            listeLien.Sort();

            //On balaye la liste des éléments
            //On crée l'élément sous le parent
            foreach (var p in listeLien)
            {
                //Recherche du parent
                string   Parent    = Acces.Trouver_TableValeur(p.Element1_Type).Code + "-" + p.Element1_ID.ToString();
                TreeNode NodParent = NodG;

                if (!(Parent == NodG.Name))
                {
                    TreeNode[] NodP = NodG.Nodes.Find(Parent, true);
                    if (NodP.Length > 0)
                    {
                        NodParent = NodP[0];
                    }
                }

                string Enfant = Acces.Trouver_TableValeur(p.Element2_Type).Code + "-" + p.Element2_ID.ToString();
                if (!(Enfant is null))
                {
                    Boolean Ajoute = true;
                    //Création de l'élément enfant
                    TreeNode NodEnfant = new TreeNode()
                    {
                        Name = Enfant,
                        Tag  = p,
                    };

                    if (p.Element2_Type == Acces.type_OBJECTIF.ID)
                    //if (p.Element2_Type == Acces.Trouver_TableValeur_ID("TYPE_ELEMENT", p.Element1_Type.ToString()))
                    {
                        Objectif q = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF, p.Element2_ID);
                        if (!(q is null))
                        {
                            NodEnfant.Text        = q.Libelle;
                            NodEnfant.Name        = Acces.type_OBJECTIF.Code + "-" + q.ID;
                            NodEnfant.ImageIndex  = Donner_ImageIndex(Acces.type_OBJECTIF, p.Element2_ID);
                            NodEnfant.ToolTipText = q.Code;
                            nbObjectif++;
                        }
                        else
                        {
                            Console.Ajouter("[Objectif non trouvé] ID:" + p.Element2_ID + " Code :" + p.Element2_Code);
                        }
                    }

                    if (p.Element2_Type == Acces.type_ACTION.ID)
                    {
                        PATIO.CAPA.Classes.Action q = (PATIO.CAPA.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION, p.Element2_ID);
                        if (!(q is null))
                        {
                            NodEnfant.Text       = q.Libelle;
                            NodEnfant.Name       = Acces.type_ACTION.Code + "-" + q.ID;
                            NodEnfant.ImageIndex = Donner_ImageIndex(Acces.type_ACTION, p.Element2_ID);
                            if (q.ActionPhare)
                            {
                                NodEnfant.ImageIndex = imgs[PosImageActionPhare].Id;
                            }
                            NodEnfant.ToolTipText = q.Code + " [" + p.ordre + "]";
                            if (q.TypeAction == TypeAction.ACTION)
                            {
                                nbAction++;
                            }
                            if (q.TypeAction == TypeAction.OPERATION)
                            {
                                nbOpération++;
                            }
                        }
                        else
                        {
                            Console.Ajouter("[Action non trouvée] ID:" + p.Element2_ID + " CODE:" + p.Element2_Code);
                        }
                    }

                    if (p.Element2_Type == Acces.type_INDICATEUR.ID)
                    {
                        Indicateur q = (Indicateur)Acces.Trouver_Element(Acces.type_INDICATEUR, p.Element2_ID);
                        if (!(q is null))
                        {
                            NodEnfant.Text        = q.Libelle;
                            NodEnfant.Name        = Acces.type_INDICATEUR.Code + "-" + q.ID;
                            NodEnfant.ImageIndex  = Donner_ImageIndex(Acces.type_INDICATEUR, p.Element2_ID);
                            NodEnfant.ToolTipText = q.Code;
                            nbIndicateur++;
                        }
                        else
                        {
                            Console.Ajouter("[Indicateur non trouvée] ID:" + p.Element2_ID + " CODE:" + p.Element2_Code);
                        }
                    }
Beispiel #10
0
        /// <summary>
        /// Edition de la fiche pour un plan
        /// </summary>
        public string Editer_Fiche_Plan()
        {
            //Création de l'application Excel
            app = new Microsoft.Office.Interop.Excel.Application();
            app.DisplayAlerts = false;

            Plan plan = (Plan)Acces.Trouver_Element(Acces.type_PLAN, id_element);

            var modele  = Chemin + "\\Modeles\\Fiche_PLAN.xltx";
            var fichier = Chemin + "\\Fichiers\\" + "FP-" + plan.Code + "-" + string.Format("{0:yyMMddHHmmss}", DateTime.Now);

            app.Workbooks.Open(modele);

            Workbooks wk = app.Workbooks;
            Workbook  wb = app.ActiveWorkbook;
            Worksheet ws = wb.Sheets[1];
            Range     r;

            r       = ws.Cells[2, 4];
            r.Value = plan.Libelle;
            r       = ws.Cells[3, 4];
            if (plan.Pilote != null)
            {
                r.Value = plan.Pilote.Nom + " " + plan.Pilote.Prenom;
            }
            r       = ws.Cells[4, 4];
            r.Value = Acces.Donner_Chaine_Liste_Utilisateur(plan.Equipe);; //Groupe interne
            r       = ws.Cells[5, 4];
            r.Value = plan.GroupeExterne;                                  //Groupe externe
            r       = ws.Cells[6, 4];
            r.Value = string.Format("{0:dd/MM/yyyy}", DateTime.Now);       //Groupe interne
            r       = ws.Cells[6, 14];
            r.Value = plan.Code;

            //Affichage des éléments
            int n_ligne = 10;

            //Efface la zone
            ws.Range["A11:Z10000"].Clear();

            List <Lien> listeLien = Acces.Remplir_ListeLien_Niv0(Acces.type_PLAN, plan.ID.ToString());

            listeLien.Sort();

            //Passe 1 : les objectifs
            foreach (Lien l in listeLien)
            {
                if (l.Element2_Type != Acces.type_OBJECTIF.ID)
                {
                    goto Suite1;
                }

                Objectif obj = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF, l.Element2_ID);

                n_ligne++;
                r       = ws.Cells[n_ligne, 1];
                r.Value = obj._op;
                r       = ws.Cells[n_ligne, 2];
                r.Value = obj.Libelle;

                r       = ws.Cells[n_ligne, 22];
                r.Value = obj.Code.Replace("OBJ-", "");
                Suite1 :;
            }

            //Passe 2 : les actions
            foreach (Lien l in listeLien)
            {
                if (l.Element2_Type != Acces.type_ACTION.ID)
                {
                    goto Suite2;
                }

                PATIO.CAPA.Classes.Action action = (PATIO.CAPA.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION, l.Element2_ID);

                if (action.TypeAction != TypeAction.ACTION)
                {
                    goto Suite2;
                }
                n_ligne++;
                r       = ws.Cells[n_ligne, 3];
                r.Value = action.Libelle;

                r = ws.Cells[n_ligne, 4];
                string pilote = "";
                pilote  = Acces.Donner_Chaine_Liste(action.DirectionPilote, "DIRECTION_METIER", "", true);
                pilote += (action.Pilote != null) ? "\n" + action.Pilote.Nom + " " + action.Pilote.Prenom : plan.Pilote.Nom + " " + plan.Pilote.Prenom;
                r.Value = pilote;

                r       = ws.Cells[n_ligne, 7];
                r.Value = (action.ActionPhare ? "X" : "");
                if (action.OrdreActionPhare > 0)
                {
                    r.Value = Acces.Trouver_TableValeur(action.OrdreActionPhare).Valeur;
                }

                r = ws.Cells[n_ligne, 8]; //Année 2018
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2018", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2018;
                r = ws.Cells[n_ligne, 9]; //Année 2019
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2019", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2019;
                r = ws.Cells[n_ligne, 10]; //Année 2020
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2020", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2020;
                r = ws.Cells[n_ligne, 11]; //Année 2021
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2021", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2021;
                r = ws.Cells[n_ligne, 12]; //Année 2022
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2022", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2022;
                r = ws.Cells[n_ligne, 13]; //Année 2023
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2023", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2023;
                r       = ws.Cells[n_ligne, 14]; //Financement
                r.Value = action.CoutFinancier;
                if (action.Mt_Total != null)
                {
                    if (action.Mt_Total.Length > 0)
                    {
                        r.Value += "\n TOTAL : " + action.Mt_Total + " k€";
                    }
                }

                r                = ws.Cells[n_ligne, 15]; //TDS MF
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS591") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_591", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 16]; //TDS Hainaut
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS592") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_592", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 17]; //TDS 62
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS62") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_62", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 18]; //TDS 80
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS80") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_80", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 19]; //TDS 60
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS60") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_60", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 20]; //TDS 02
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS02") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_02", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 21]; //REGION
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "REGION", "") ? "X" : "";

                r       = ws.Cells[n_ligne, 22];
                r.Value = action.Code.Replace("ACT-", "");
                Suite2 :;
            }

            //Passe 3 : les opérations
            foreach (Lien l in listeLien)
            {
                if (l.Element2_Type != Acces.type_ACTION.ID)
                {
                    goto Suite3;
                }

                PATIO.CAPA.Classes.Action action = (PATIO.CAPA.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION, l.Element2_ID);

                if (action.TypeAction != TypeAction.OPERATION)
                {
                    goto Suite3;
                }
                n_ligne++;
                r       = ws.Cells[n_ligne, 5];
                r.Value = action.Libelle;

                r = ws.Cells[n_ligne, 6];
                string pilote = "";
                pilote  = Acces.Donner_Chaine_Liste(action.DirectionPilote, "DIRECTION_METIER", "", true);
                pilote += (action.Pilote != null) ? "\n" + action.Pilote.Nom + " " + action.Pilote.Prenom : plan.Pilote.Nom + " " + plan.Pilote.Prenom;
                r.Value = pilote;

                r       = ws.Cells[n_ligne, 7];
                r.Value = (action.ActionPhare ? "X" : "");
                if (action.OrdreActionPhare > 0)
                {
                    r.Value = Acces.Trouver_TableValeur(action.OrdreActionPhare).Valeur;
                }

                r = ws.Cells[n_ligne, 8]; //Année 2018
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2018", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2018;
                r = ws.Cells[n_ligne, 9]; //Année 2019
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2019", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2019;
                r = ws.Cells[n_ligne, 10]; //Année 2020
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2020", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2020;
                r = ws.Cells[n_ligne, 11]; //Année 2021
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2021", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2021;
                r = ws.Cells[n_ligne, 12]; //Année 2022
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2022", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2022;
                r = ws.Cells[n_ligne, 13]; //Année 2023
                r.Interior.Color = Acces.Exister_Valeur(action.AnneeMiseOeuvre, "ANNEE_MO", "2023", "") ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r.Value          = action.Mt_2023;
                r       = ws.Cells[n_ligne, 14]; //Financement
                r.Value = action.CoutFinancier;
                if (action.Mt_Total != null)
                {
                    if (action.Mt_Total.Length > 0)
                    {
                        r.Value += "\n TOTAL : " + action.Mt_Total + " k€";
                    }
                }

                r                = ws.Cells[n_ligne, 15]; //TDS MF
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS591") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_591", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 16]; //TDS Hainaut
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS592") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_592", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 17]; //TDS 62
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS62") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_62", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 18]; //TDS 80
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS80") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_80", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 19]; //TDS 60
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS60") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_60", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 20]; //TDS 02
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "", "TS02") ? "X" : "";
                r.Interior.Color = Acces.Exister_Valeur(action.Priorite_CTS, "PRIO_CTS_02", "", "", true) ? XlRgbColor.rgbLightBlue : XlRgbColor.rgbWhite;
                r                = ws.Cells[n_ligne, 21]; //REGION
                r.Value          = Acces.Exister_Valeur(action.TSante, "TSANTE", "REGION", "") ? "X" : "";

                //Définition de l'ordre : différent d'action car la structure diffère avec les directions métier
                r = ws.Cells[n_ligne, 22];
                PATIO.CAPA.Classes.Action parent = (PATIO.CAPA.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION, l.Element1_ID);
                string ordre = parent.Code.Replace("ACT-", "") + "-" + string.Format("{0:x3}", l.ordre);
                r.Value = ordre;
                //r.Value = action.Code.Replace("OPE-", "");
                Suite3 :;
            }

            //Tri des lignes
            Range r_data = ws.Range["A11:W" + n_ligne];

            r_data.Sort(r_data.Columns[22, Type.Missing], Microsoft.Office.Interop.Excel.XlSortOrder.xlAscending);

            r_data.Cells.VerticalAlignment = XlVAlign.xlVAlignCenter;

            //Mise en forme
            {
                r_data.WrapText = true; //Renvoie à la ligne
                //Bordures
                Borders border = r_data.Borders;

                border.LineStyle = XlLineStyle.xlContinuous;
                border.Weight    = 2d;
                border[XlBordersIndex.xlEdgeLeft].LineStyle   = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeTop].LineStyle    = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeBottom].LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
                border[XlBordersIndex.xlEdgeRight].LineStyle  = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;

                //Alignement
                ws.Columns[1].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[4].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[6].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[7].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                ws.Columns[8].HorizontalAlignment  = XlHAlign.xlHAlignCenter;
                ws.Columns[9].HorizontalAlignment  = XlHAlign.xlHAlignCenter;
                ws.Columns[10].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[11].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[12].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[13].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                ws.Columns[15].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[16].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[17].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[18].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[19].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[20].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                ws.Columns[21].HorizontalAlignment = XlHAlign.xlHAlignCenter;

                //Colonnes masquées
                ws.Columns["A"].Hidden = true;
                ws.Columns["V"].Hidden = true;
            }

            //Sauvegarde du fichier
            wb.SaveAs(fichier + ".xlsx");
            wb.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, fichier + ".pdf");

            wb.Close(false);
            wk.Close();

            //Fermeture de l'application Excel
            app.Quit();
            app = null;

            if (OuvertureAuto)
            {
                OuvertureFichier(fichier + ".pdf");
            }

            return(fichier);
        }
Beispiel #11
0
        /// <summary>
        /// Repositionne les éléments selon la hiérarchie définie
        /// </summary>
        void CreeStructure()
        {
            int nbObjectif = 0; int nbAction = 0; int nbOpération = 0; int nbIndicateur = 0;

            //Affichage de la structure actuelle du plan d'actions
            tree.Nodes.Clear();
            TreeNode NodG = new TreeNode()
            {
                Text       = "Plan d'actions de " + plan.NiveauPlan,
                Name       = Acces.type_PLAN.code + "-" + plan.ID,
                ImageIndex = 1,
                Tag        = Acces.type_PLAN.id,
            };

            NodG.Expand();
            n = 1;

            //Placement des objectifs/sous-objectifs
            List <Lien> listeLien = Acces.Remplir_ListeLien(Acces.type_PLAN, plan.ID.ToString());

            listeLien.Sort();

            //On balaye la liste des éléments
            //On crée l'élément sous le parent
            foreach (var p in listeLien)
            {
                //Recherche du parent
                string   Parent    = Acces.Trouver_TableValeur(p.element1_type).Code + "-" + p.element1_id.ToString();
                TreeNode NodParent = NodG;

                if (!(Parent == NodG.Name))
                {
                    TreeNode[] NodP = NodG.Nodes.Find(Parent, true);
                    if (NodP.Length > 0)
                    {
                        NodParent = NodP[0];
                    }
                }

                string Enfant = Acces.Trouver_TableValeur(p.element2_type).Code + "-" + p.element2_id.ToString();
                if (!(Enfant is null))
                {
                    Boolean Ajoute = true;
                    //Création de l'élément enfant
                    TreeNode NodEnfant = new TreeNode()
                    {
                        Name = Enfant,
                        Tag  = p,
                    };

                    if (p.element2_type == Acces.type_OBJECTIF.id)
                    //if (p.element2_type == Acces.Trouver_TableValeur_ID("TYPE_ELEMENT", p.element1_type.ToString()))
                    {
                        Objectif q = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF.id, p.element2_id);
                        if (!(q is null))
                        {
                            NodEnfant.Text = q.Libelle;
                            NodEnfant.Name = Acces.type_OBJECTIF.code + "-" + q.ID;
                            //NodEnfant.ImageIndex = Donner_ImageIndex(Acces.type_OBJECTIF.id, p.element2_id);
                            NodEnfant.ToolTipText = q.Code;
                            nbObjectif++;
                        }
                        else
                        {
                            Console.Ajouter("[Objectif non trouvé] ID:" + p.element2_id + " Code :" + p.element2_code);
                        }
                    }

                    if (p.element2_type == Acces.type_ACTION.id)
                    {
                        PATIO.Classes.Action q = (PATIO.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION.id, p.element2_id);
                        if (!optOpération.Checked)
                        {
                            Ajoute = (q.TypeAction == TypeAction.ACTION);
                        }
                        if (!(q is null))
                        {
                            NodEnfant.Text = q.Libelle;
                            NodEnfant.Name = Acces.type_ACTION.code + "-" + q.ID;
                            //NodEnfant.ImageIndex = Donner_ImageIndex(Acces.type_ACTION.id, p.element2_id);
                            //if (q.ActionPhare) { NodEnfant.ImageIndex = imgs[PosImageActionPhare].Id; }
                            NodEnfant.ToolTipText = q.Code + " [" + p.ordre + "]";
                            if (q.TypeAction == TypeAction.ACTION)
                            {
                                nbAction++;
                            }
                            if (q.TypeAction == TypeAction.OPERATION)
                            {
                                nbOpération++;
                            }
                        }
                        else
                        {
                            Console.Ajouter("[Action non trouvée] ID:" + p.element2_id + " CODE:" + p.element2_code);
                        }
                    }

                    if (p.element2_type == Acces.type_INDICATEUR.id)
                    {
                        Ajoute = optIndicateur.Checked;
                        Indicateur q = (Indicateur)Acces.Trouver_Element(Acces.type_INDICATEUR.id, p.element2_id);
                        if (!(q is null))
                        {
                            NodEnfant.Text = q.Libelle;
                            NodEnfant.Name = Acces.type_INDICATEUR.code + "-" + q.ID;
                            //NodEnfant.ImageIndex = Donner_ImageIndex(Acces.type_INDICATEUR.id, p.element2_id);
                            NodEnfant.ToolTipText = q.Code;
                            nbIndicateur++;
                        }
                        else
                        {
                            Console.Ajouter("[Indicateur non trouvée] ID:" + p.element2_id + " CODE:" + p.element2_code);
                        }
                    }
Beispiel #12
0
        void Ouvrir_Element_Appel_Externe()
        {
            foreach (string f in System.IO.Directory.GetFiles(Chemin + "\\Fichiers", "EXT_*.*"))
            {
                try {
                    string cmd     = System.IO.File.ReadAllText(f);
                    string element = cmd.Split(':')[0].ToUpper().Trim();
                    string id      = cmd.Split(':')[1];

                    switch (element)
                    {
                    case "PLAN":
                    {
                        CAPA.Interfaces.ctrlListePlan ctrl = new ctrlListePlan();
                        ctrl.Acces   = Acces;
                        ctrl.DP      = DP;
                        ctrl.Chemin  = Chemin;
                        ctrl.Console = Console;
                        ctrl.plan    = (Plan)Acces.Trouver_Element(Acces.type_PLAN, int.Parse(id));
                        ctrl.Ouvrir_Plan();
                        break;
                    }

                    case "OBJECTIF":
                    {
                        CAPA.Interfaces.ctrlListeObjectif ctrl = new ctrlListeObjectif();
                        ctrl.Acces   = Acces;
                        ctrl.DP      = DP;
                        ctrl.Chemin  = Chemin;
                        ctrl.Console = Console;
                        ctrl.obj     = (Objectif)Acces.Trouver_Element(Acces.type_OBJECTIF, int.Parse(id));
                        ctrl.Modifier_Objectif();
                        break;
                    }

                    case "ACTION":
                    {
                        CAPA.Interfaces.ctrlListeAction ctrl = new ctrlListeAction();
                        ctrl.Acces   = Acces;
                        ctrl.DP      = DP;
                        ctrl.Chemin  = Chemin;
                        ctrl.Console = Console;
                        ctrl.action  = (CAPA.Classes.Action)Acces.Trouver_Element(Acces.type_ACTION, int.Parse(id));
                        ctrl.Modifier_Action();
                        break;
                    }

                        /*case "INDICATEUR":
                         *  {
                         *      CAPA.Interfaces.ctrlListeIndicateur ctrl = new ctrlListeIndicateur();
                         *      ctrl.Acces = Acces;
                         *      ctrl.DP = DP;
                         *      ctrl.Chemin = Chemin;
                         *      ctrl.Console = Console;
                         *      ctrl.indicateur = (Indicateur)Acces.Trouver_Element(Acces.type_INDICATEUR, int.Parse(id));
                         *      ctrl.Ouvrir_Indicateur();
                         *      break;
                         *  }*/
                    }
                    //Suppression du fichier de commande externe
                    System.IO.File.Delete(f);
                } catch { }
            }
        }
Beispiel #13
0
        void Stat_S01() //Nombre d'éléments par plan
        {
            string fichier = Chemin + "\\Fichiers\\F_S01.html";

            //Requête
            string sql;

            sql  = "SELECT distinct Element0_ID, Element2_Type, Element2_ID from lien";
            sql += " WHERE Element0_Code <>'SYSTEME'";

            DataSet Sn = Acces.cls.ContenuRequete(sql);

            if (Acces.cls.NbLignes == 0)
            {
                goto Suite;
            }

            List <LigneS01> Liste = new List <LigneS01>();

            //Ligne total
            LigneS01 lg = new LigneS01();

            lg.id        = 0;
            lg.libelle   = "zzTOTAL";
            lg.nb_obj    = 0;
            lg.nb_action = 0;
            lg.nb_ope    = 0;
            lg.nb_indic  = 0;
            Liste.Add(lg);

            foreach (DataRow r in Sn.Tables["dataset"].Rows)
            {
                int         id_plan    = int.Parse(r[0].ToString());
                TypeElement id_type    = Acces.Trouver_Type_Element(int.Parse(r[1].ToString()));
                int         id_element = int.Parse(r[2].ToString());

                //Détermine l'incrément affecté
                int i_obj = 0; int i_action = 0; int i_ope = 0; int i_indic = 0;

                if (id_type == Acces.type_OBJECTIF)
                {
                    i_obj = 1;
                }
                if (id_type == Acces.type_ACTION) //Cas d'une action
                {
                    PATIO.CAPA.Classes.Action action = (PATIO.CAPA.Classes.Action)Acces.Trouver_Element(id_type, id_element);
                    try
                    {
                        if (action.TypeAction == TypeAction.ACTION)
                        {
                            i_action = 1;
                        }
                        if (action.TypeAction == TypeAction.OPERATION)
                        {
                            i_ope = 1;
                        }
                    } catch { /*MessageBox.Show(r[2].ToString()); */ }
                }
                if (id_type == Acces.type_INDICATEUR)
                {
                    i_indic = 1;
                }

                //Intégration si la ligne (du plan) existe
                Boolean ok = false;
                for (int i = 0; i < Liste.Count; i++)
                {
                    LigneS01 l = Liste[i];
                    if (id_plan.ToString() == l.id.ToString())
                    {
                        ok           = true;
                        l.nb_obj    += i_obj;
                        l.nb_action += i_action;
                        l.nb_ope    += i_ope;
                        l.nb_indic  += i_indic;
                        break;
                    }
                }

                if (!ok) //Création de la ligne
                {
                    Plan     plan = (Plan)Acces.Trouver_Element(Acces.type_PLAN, id_plan);
                    LigneS01 l    = new LigneS01();
                    l.id         = plan.ID;
                    l.libelle    = plan.Libelle;
                    l.nb_obj    += i_obj;
                    l.nb_action += i_action;
                    l.nb_ope    += i_ope;
                    l.nb_indic  += i_indic;
                    Liste.Add(l);
                }

                //Incrémentation sur la ligne total
                LigneS01 lt = Liste[0];
                lt.nb_obj    += i_obj;
                lt.nb_action += i_action;
                lt.nb_ope    += i_ope;
                lt.nb_indic  += i_indic;
                Console.Ajouter(lt.nb_obj.ToString());
            }

            //Affichage du résultat
            string Texte = "<table width=\"100%\" border=\"1\">";

            Texte += "<tr>";
            Texte += "<td>Plan</td>";
            Texte += "<td>Nb objectifs</td>";
            Texte += "<td>Nb actions</td>";
            Texte += "<td>Nb opérations</td>";
            Texte += "<td>Nb indicateurs</td>";
            Texte += "</tr>\n";

            foreach (LigneS01 l in Liste)
            {
                Texte += "<tr>";
                Texte += "<td>" + l.libelle + "</td>";
                Texte += "<td>" + l.nb_obj + "</td>";
                Texte += "<td>" + l.nb_action + "</td>";
                Texte += "<td>" + l.nb_ope + "</td>";
                Texte += "<td>" + l.nb_indic + "</td>";
                Texte += "</tr>\n";
            }
            Texte += "</table>";

            //Ecriture du fichier
            System.IO.File.WriteAllText(fichier, Texte);

            Suite :;
            //Affichag du fichier
            wb.Navigate(fichier);
        }
Beispiel #14
0
        void Valider()
        {
            var LibProcessus  = lblLibelleProcessus.Text.Trim();
            var CodeProcessus = lblCodeProcessus.Text.Trim().ToUpper();
            var OptActive     = OptActiveProcessus.Checked;
            var TypeProcessus = (TypeProcessus)lstTypeProcessus.SelectedIndex;


            if (LibProcessus.Length == 0)
            {
                MessageBox.Show("Libellé du processus obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (CodeProcessus.Length == 0)
            {
                MessageBox.Show("Code du processus obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            bool ok = false;

            if (Creation)
            {
                ok = Acces.Existe_Element(Acces.type_PROCESSUS, "CODE", CodeProcessus);
            }
            else
            {
                //ok = fonc.ExisteCode(Acces.type_INDICATEUR, CodeGroupe, groupe.ID);
            }

            if (ok)
            {
                MessageBox.Show("Pb avec le code", "Erreur", MessageBoxButtons.OK); return;
            }

            processus.Acces          = Acces;
            processus.Libelle        = LibProcessus;
            processus.Code           = CodeProcessus;
            processus.Actif          = OptActive;
            processus.Type_Processus = TypeProcessus;
            processus.DonneeEntrante = ChoixDonneeEntrant.ListeSelectionId;
            processus.DonneeSortante = ChoixDonneeSortant.ListeSelectionId;

            TypeElement Type = Acces.type_PROCESSUS;

            if (Creation)
            {
                if (!(Acces.Existe_Element(Type, "CODE", processus.Code)))
                {
                    processus.ID = Acces.Ajouter_Element(Type, processus);

                    if (processusParent != null)
                    {
                        Lien p = new Lien()
                        {
                            Acces = Acces
                        };
                        p.Element0_Type = Acces.type_PLAN.ID; //SYSTEME
                        p.Element0_ID   = 1;                  //SYSTEME
                        p.Element0_Code = "SYSTEME";          //SYSTEME
                        p.Element1_Type = Acces.type_PROCESSUS.ID;
                        p.Element1_ID   = processusParent.ID;
                        p.Element1_Code = ((Process)Acces.Trouver_Element(Acces.type_PROCESSUS, p.Element1_ID)).Code;
                        p.Element2_Type = Acces.type_PROCESSUS.ID;
                        p.Element2_ID   = processus.ID;
                        p.Element2_Code = ((Process)Acces.Trouver_Element(Acces.type_PROCESSUS, p.Element2_ID)).Code;
                        p.ordre         = p.Donner_Ordre() + 1;

                        p.Ajouter();
                        Acces.Ajouter_Lien(p);
                    }
                }
                else
                {
                    MessageBox.Show("Processus existant (Code)", "Erreur"); return;
                }
            }
            else
            {
                Acces.Enregistrer(Type, processus);
            }

            this.DialogResult = DialogResult.OK;
        }