예제 #1
0
        //-----------------------------------------------------------------------------------------------------
        private void m_menuStartStep_Click(object sender, EventArgs e)
        {
            CEtapeWorkflow etape = EtapeSelectionnee;
            CWorkflow      wkf   = m_stackWorkflows.Peek();

            using (CContexteDonnee ctx = new CContexteDonnee(wkf.ContexteDonnee.IdSession, true, false))
            {
                wkf = wkf.GetObjetInContexte(ctx) as CWorkflow;
                CTypeEtapeWorkflow typeEtape = TypeEtapeSelectionnee;
                if (etape != null)
                {
                    typeEtape = etape.TypeEtape;
                }

                CResultAErreurType <CEtapeWorkflow> resEtape = wkf.CreateOrGetEtapeInCurrentContexte(typeEtape);
                if (!resEtape)
                {
                    CFormAlerte.Afficher(resEtape.Erreur);
                    return;
                }
                etape = resEtape.DataType;



                etape = etape.GetObjetInContexte(ctx) as CEtapeWorkflow;
                etape.InternalSetInfosDemarrageInCurrentContext();
                CResultAErreur result = ctx.SaveAll(true);
                if (!result)
                {
                    CFormAlerte.Afficher(result.Erreur);
                }
                Refresh();
            }
        }
        /// ///////////////////////////////////////////
        public override object Invoke(object objetAppelle, params object[] parametres)
        {
            CWorkflow workflow = objetAppelle as CWorkflow;

            if (workflow == null || parametres.Length == 0 || parametres[0] == null)
            {
                return(null);
            }
            string        strIdType   = parametres[0].ToString();
            CTypeWorkflow typeWorkfow = workflow.TypeWorkflow;

            if (typeWorkfow == null)
            {
                return(null);
            }
            CListeObjetsDonnees etapes = typeWorkfow.Etapes;

            etapes.Filtre = new CFiltreData(CObjetDonnee.c_champIdUniversel + "=@1",
                                            strIdType);
            if (etapes.Count == 0)
            {
                return(null);
            }
            CTypeEtapeWorkflow typeEtape = etapes[0] as CTypeEtapeWorkflow;
            CEtapeWorkflow     etape     = workflow.GetEtapeForType(typeEtape);

            if (etape != null)
            {
                return(CGestionnaireProjetsDeWorkflow.GetProjetDirectementAssocie(etape));
            }
            return(null);
        }
예제 #3
0
        //-------------------------------------------------------
        private void InitComboStartStep()
        {
            CTypeWorkflow typeWorkflow = m_txtSelectWorkflow.ElementSelectionne as CTypeWorkflow;

            if (typeWorkflow != null)
            {
                m_cmbStartStep.Init(typeWorkflow.Etapes, "Libelle", true);
                m_cmbStartStep.Enabled = true;
                if (m_keyLastIdTypeEtapeSel != null)
                {
                    CTypeEtapeWorkflow typeEtape = new CTypeEtapeWorkflow(CSc2iWin32DataClient.ContexteCourant);
                    if (typeEtape.ReadIfExists(m_keyLastIdTypeEtapeSel) && typeWorkflow.Equals(typeEtape.Workflow))
                    {
                        m_cmbStartStep.ElementSelectionne = typeEtape;
                    }
                    else
                    {
                        m_cmbStartStep.ElementSelectionne = null;
                    }
                }
                else
                {
                    m_cmbStartStep.ElementSelectionne = null;
                }
            }
            else
            {
                m_cmbStartStep.Enabled = false;
            }
        }
예제 #4
0
        //---------------------------------------------------
        public override CResultAErreur RunAndSaveIfOk(CEtapeWorkflow etape)
        {
            CResultAErreur result = CResultAErreur.True;

            if (DbKeyTypeWorkflow == null)
            {
                return(EndAndSaveIfOk(etape));
            }
            CTypeEtapeWorkflow typeEtapeDémarrage = null;

            if (m_dbKeyTypeEtapeDemarrage != null)
            {
                typeEtapeDémarrage = new CTypeEtapeWorkflow(etape.ContexteDonnee);
                if (!typeEtapeDémarrage.ReadIfExists(m_dbKeyTypeEtapeDemarrage))
                {
                    typeEtapeDémarrage = null;
                }
            }
            CWorkflow workflow = GetOrCreateWorkflowInCurrentContexte(etape);

            if (workflow != null && !workflow.IsRunning)
            {
                result = PrepareToStartWorkflow(etape);
                if (workflow.TypeWorkflow.Etapes.Count == 0)
                {
                    return(EndAndSaveIfOk(etape));
                }
                result = workflow.DémarreWorkflow(typeEtapeDémarrage, false);
            }
            return(etape.ContexteDonnee.SaveAll(true));
        }
예제 #5
0
 private void StartWorkflow(CTypeEtapeWorkflow typeEtape)
 {
     if (MessageBox.Show(I.T("Start workflow \"@1\"|20571", Workflow.Libelle), "",
                         MessageBoxButtons.YesNo,
                         MessageBoxIcon.Question) == DialogResult.Yes)
     {
         using (CContexteDonnee ctx = new CContexteDonnee(Workflow.ContexteDonnee.IdSession, true, false))
         {
             CWorkflow workflow = Workflow.GetObjetInContexte(ctx) as CWorkflow;
             if (typeEtape != null)
             {
                 typeEtape = typeEtape.GetObjetInContexte(ctx) as CTypeEtapeWorkflow;
             }
             CResultAErreur result = workflow.DémarreWorkflow(typeEtape, true);
             if (!result)
             {
                 CFormAlerte.Afficher(result.Erreur);
             }
             else
             {
                 InitChamps();
             }
         }
     }
 }
예제 #6
0
        //------------------------------------------------------
        protected override sc2i.common.CResultAErreur MySerialize(sc2i.common.C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            serializer.TraiteString(ref m_strIdUniverselEtape);
            if (serializer.Mode == ModeSerialisation.Lecture && m_strIdUniverselEtape.Length > 0)
            {
                serializer.TrackDbKeyReaded(m_strIdUniverselEtape);
            }
            if (serializer.Mode == ModeSerialisation.Lecture)
            {
                m_typeEtape = null;
            }

            int nCol = m_backColor.ToArgb();

            serializer.TraiteInt(ref nCol);
            m_backColor = Color.FromArgb(nCol);

            nCol = m_foreColor.ToArgb();
            serializer.TraiteInt(ref nCol);
            m_foreColor = Color.FromArgb(nCol);


            return(result);
        }
        //--------------------------------------------------------------------------
        public static CResultAErreur CreateSqueletteProjetsInCurrentContext(
            CWorkflow workflow,
            CTypeEtapeWorkflow typeEtapeDebut,
            CProjet projetParent)
        {
            CResultAErreur result = CResultAErreur.True;

            CTypeWorkflow typeWorkflow = workflow.TypeWorkflow;

            //Récupére le type d'étape de base
            CTypeEtapeWorkflow typeEtape = typeEtapeDebut;

            if (typeEtape == null)
            {
                typeEtape = typeWorkflow.EtapeDemarrageDefaut;
            }
            if (typeEtape == null)
            {
                return(result);
            }

            //règle de création : on ne suit que les liens systèmatiques (sans CodeRetour et sans formule)
            result = CreateProjets(workflow, typeEtape, projetParent);
            return(result);
        }
예제 #8
0
        private void m_cmbStartStep_SelectionChangeCommitted(object sender, EventArgs e)
        {
            CTypeEtapeWorkflow typeEtape = m_cmbStartStep.ElementSelectionne as CTypeEtapeWorkflow;

            if (typeEtape != null)
            {
                m_keyLastIdTypeEtapeSel = typeEtape.DbKey;
            }
        }
        //--------------------------------------------------------------------------
        public static CResultAErreur LinkProjetToWorkflowStep(CProjet projet,
                                                              CWorkflow workflow,
                                                              string strTypeEtape,
                                                              bool bSynchronizeStarts)
        {
            CResultAErreur     result    = CResultAErreur.True;
            CTypeEtapeWorkflow typeEtape = new CTypeEtapeWorkflow(projet.ContexteDonnee);

            if (!typeEtape.ReadIfExists(new CFiltreData(CObjetDonnee.c_champIdUniversel + "=@1",
                                                        strTypeEtape)))
            {
                result.EmpileErreur(I.T("Workflow step type @1 doesn't exists|20196", strTypeEtape));
                return(result);
            }
            if (typeEtape.Workflow.Id != workflow.TypeWorkflow.Id)
            {
                result.EmpileErreur(I.T("Workflow step type @1 doesn't belong to workflow type @2|20197"),
                                    strTypeEtape, workflow.TypeWorkflow.Libelle);
                return(result);
            }
            CBlocWorkflowProjet blocProjet = typeEtape.Bloc as CBlocWorkflowProjet;

            if (blocProjet == null)
            {
                result.EmpileErreur(I.T("Step type @1 is not a valid project step|20198",
                                        typeEtape.Libelle));
                return(result);
            }
            CResultAErreurType <CEtapeWorkflow> resEtape = workflow.CreateOrGetEtapeInCurrentContexte(typeEtape);

            if (!resEtape)
            {
                result.EmpileErreur(resEtape.Erreur);
                return(result);
            }
            if (resEtape.DataType == null)
            {
                result.EmpileErreur(I.T("Erreur while creating step for type '@1'|20199",
                                        typeEtape.Libelle));
                return(result);
            }
            CWorkflow sousWkf = blocProjet.GetOrCreateWorkflowInCurrentContexte(resEtape.DataType);

            if (sousWkf == null)
            {
                result.EmpileErreur(I.T("Erreur while creating workflow for stef @1|20200",
                                        resEtape.DataType.Libelle));
                return(result);
            }
            sousWkf.SetValeurChamp(blocProjet.IdChampProjet.Value, projet);
            projet.GanttId = blocProjet.GetGanttId(resEtape.DataType);
            return(SynchroniseWorkflow(
                       sousWkf,
                       projet,
                       projet.DateDebutReel != null && projet.DateFinRelle == null,
                       bSynchronizeStarts));
        }
예제 #10
0
        /// ////////////////////////////////////////////////////////
        protected override CResultAErreur MyExecute(CContexteExecutionAction contexte)
        {
            CResultAErreur result = CResultAErreur.True;

            CContexteEvaluationExpression ctxEval = new CContexteEvaluationExpression(Process);

            if (FormuleProjetParent == null)
            {
                result.EmpileErreur(I.T("Invalid project formula|20147"));
                return(result);
            }
            result = FormuleProjetParent.Eval(ctxEval);
            if (!result)
            {
                return(result);
            }
            CProjet projetParent = result.Data as CProjet;

            if (FormuleWorkflow == null)
            {
                result.EmpileErreur(I.T("Invalid workflow formula|20147"));
                return(result);
            }
            result = FormuleWorkflow.Eval(ctxEval);
            if (!result)
            {
                return(result);
            }
            CWorkflow workflow = result.Data as CWorkflow;

            if (workflow == null)
            {
                result.EmpileErreur(I.T("Invalid workflow|20149"));
                return(result);
            }

            CTypeEtapeWorkflow typeEtapeDebut = null;

            if (FormuleTypeEtapeDebut != null)
            {
                result = FormuleTypeEtapeDebut.Eval(ctxEval);
                if (!result)
                {
                    result.EmpileErreur(I.T("Invalid Start step formula|20155"));
                    return(result);
                }
                typeEtapeDebut = result.Data as CTypeEtapeWorkflow;
            }

            result = CGestionnaireProjetsDeWorkflow.CreateSqueletteProjetsInCurrentContext(
                workflow,
                typeEtapeDebut,
                projetParent);

            return(result);
        }
예제 #11
0
        void m_menuStart_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem  item      = sender as ToolStripMenuItem;
            CTypeEtapeWorkflow typeEtape = item != null ? item.Tag as CTypeEtapeWorkflow : null;

            if (typeEtape != null)
            {
                StartWorkflow(typeEtape);
            }
        }
예제 #12
0
 //------------------------------------------------------------------
 public CDummyObjetWorkflowPourCreation(CTypeEtapeWorkflow typeEtape)
 {
     m_typeEtape = typeEtape;
     if (m_typeEtape.Bloc != null)
     {
         Size = m_typeEtape.Bloc.DefaultSize;
     }
     else
     {
         Size = new Size(120, 50);
     }
 }
        //-------------------------------------------------------------------------------------
        private static List <CLienEtapesWorkflow> LiensPrecedentsPourProjet(CTypeEtapeWorkflow typeEtape)
        {
            List <CLienEtapesWorkflow> lst = new List <CLienEtapesWorkflow>();

            foreach (CLienEtapesWorkflow lien in typeEtape.LiensEntrants)
            {
                if ((lien.Formule == null || lien.Formule is C2iExpressionVrai) && (lien.ActivationCode.Trim() == "" || lien.ActivationCode == CBlocWorkflowProjet.c_constIdLienProjetForce))
                {
                    lst.Add(lien);
                }
            }
            return(lst);
        }
예제 #14
0
        /// //////////////////////////////////////////////////
        public override CResultAErreur VerifieDonnees(sc2i.data.CObjetDonnee objet)
        {
            CResultAErreur     result            = CResultAErreur.True;
            CTypeEtapeWorkflow TypeEtapeWorkflow = objet as CTypeEtapeWorkflow;

            if (TypeEtapeWorkflow != null)
            {
                if (TypeEtapeWorkflow.Libelle.Length == 0)
                {
                    result.EmpileErreur(I.T("Workflow step type label should be set|20004"));
                }
            }
            return(result);
        }
예제 #15
0
        //---------------------------------------------------------------------------
        protected bool DessinSupplementaireItem(CContextDessinObjetGraphique ctx, C2iObjetGraphique objet)
        {
            CWorkflowEtapeDessin dessinEtape = objet as CWorkflowEtapeDessin;

            if (dessinEtape != null)
            {
                CTypeEtapeWorkflow typeEtape = dessinEtape.TypeEtape;
                if (typeEtape != null)
                {
                    CEtapeWorkflow etape = WorkflowAffiche.GetEtapeForType(typeEtape);
                    if (etape != null)
                    {
                        Brush br = null;
                        switch ((EEtatEtapeWorkflow)etape.EtatCode)
                        {
                        case EEtatEtapeWorkflow.ADemarrer:
                            br = new SolidBrush(Color.FromArgb(64, Color.Blue));
                            break;

                        case EEtatEtapeWorkflow.Démarrée:
                            br = new SolidBrush(Color.FromArgb(64, Color.Green));
                            break;

                        case EEtatEtapeWorkflow.Erreur:
                            br = new SolidBrush(Color.FromArgb(64, Color.Red));
                            break;

                        case EEtatEtapeWorkflow.Terminée:
                            br = new SolidBrush(Color.FromArgb(64, Color.Gray));
                            break;

                        case EEtatEtapeWorkflow.Annulée:
                            br = new SolidBrush(Color.FromArgb(64, Color.Orange));
                            break;

                        default:
                            break;
                        }
                        if (br != null)
                        {
                            Point[] pts = etape.TypeEtape.Bloc.GetPolygoneDessin(dessinEtape);
                            ctx.Graphic.FillPolygon(br, pts);
                            br.Dispose();
                        }
                    }
                }
            }
            return(true);
        }
예제 #16
0
        //-------------------------------------------------------
        private CResultAErreur MajChamps()
        {
            CResultAErreur     result = CResultAErreur.True;
            CTypeEtapeWorkflow tp     = m_cmbTypeEtape.ElementSelectionne as CTypeEtapeWorkflow;

            if (tp != null)
            {
                m_blocWorkflow.CleStepToStop = tp.IdUniversel;
            }
            else
            {
                m_blocWorkflow.CleStepToStop = "";
            }
            m_blocWorkflow.TypeAction = m_rbtnTerminer.Checked ? ETypeActionExterneOnWorkflowStep.End : ETypeActionExterneOnWorkflowStep.Cancel;
            return(result);
        }
        //--------------------------------------------------------------------------
        public static IEnumerable <CProjet> FindSuccesseurs(CTypeEtapeWorkflow typeEtape, CWorkflow workflow)
        {
            List <CProjet> lstProjets = new List <CProjet>();

            foreach (CTypeEtapeWorkflow tp in FindTypesSuccesseurs(typeEtape))
            {
                CEtapeWorkflow etape = workflow.GetEtapeForType(tp);
                if (etape != null)
                {
                    CProjet projet = GetProjetDirectementAssocie(etape);
                    if (projet != null)
                    {
                        lstProjets.Add(projet);
                    }
                }
            }
            return(lstProjets.AsReadOnly());
        }
예제 #18
0
        //-------------------------------------------------
        private void m_wndListeUndrawn_ItemDrag(object sender, ItemDragEventArgs e)
        {
            ListViewItem item = e.Item as ListViewItem;

            if (item == null)
            {
                return;
            }
            CTypeEtapeWorkflow typeEtape = item.Tag as CTypeEtapeWorkflow;

            if (typeEtape != null)
            {
                CDummyObjetWorkflowPourCreation dummy  = new CDummyObjetWorkflowPourCreation(typeEtape);
                CDonneeDragDropObjetGraphique   donnee = new CDonneeDragDropObjetGraphique(Name, dummy);
                DoDragDrop(donnee, DragDropEffects.Copy);
                InitListeUndrawns();
            }
        }
예제 #19
0
 //---------------------------------------------------
 public override CResultAErreur RunAndSaveIfOk(CEtapeWorkflow etape)
 {
     foreach (CLienEtapesWorkflow lien in etape.TypeEtape.LiensEntrants)
     {
         CTypeEtapeWorkflow typeEtapePrecedente = lien.EtapeSource;
         if (typeEtapePrecedente != null)
         {
             CEtapeWorkflow etapePrecedente = etape.Workflow.GetEtapeForType(typeEtapePrecedente);
             if (etapePrecedente == null || //Pas encore créée
                 etapePrecedente.DateFin == null ||//Pas encore executée
                 etapePrecedente.RunGeneration != etape.RunGeneration   //Pas la même génération d'execution
                 )
             {
                 return(etape.ContexteDonnee.SaveAll(true));
             }
         }
     }
     return(EndAndSaveIfOk(etape));
 }
        //--------------------------------------------------------------------------
        public static IEnumerable <CTypeEtapeWorkflow> FindTypesSuccesseurs(CTypeEtapeWorkflow typeEtape)
        {
            HashSet <CTypeEtapeWorkflow> retour = new HashSet <CTypeEtapeWorkflow>();

            foreach (CLienEtapesWorkflow lien in LiensSuivantsPourProjet(typeEtape))
            {
                if (lien.EtapeDestination.Bloc is CBlocWorkflowProjet)
                {
                    retour.Add(lien.EtapeDestination);
                }
                else
                {
                    IEnumerable <CTypeEtapeWorkflow> parents = FindTypesSuccesseurs(lien.EtapeDestination);
                    foreach (CTypeEtapeWorkflow tp in parents)
                    {
                        retour.Add(tp);
                    }
                }
            }
            return(retour.ToArray());
        }
        //-------------------------------------------------------------------------------------
        private static CResultAErreur CreateProjets(CWorkflow workflow, CTypeEtapeWorkflow typeEtape, CProjet projetParent)
        {
            CResultAErreur result = CResultAErreur.True;

            if (workflow == null || typeEtape == null)
            {
                return(result);
            }
            CBlocWorkflowProjet blocProjet = typeEtape.Bloc as CBlocWorkflowProjet;

            if (blocProjet != null)
            {
                CResultAErreurType <CEtapeWorkflow> resEtape = workflow.CreateOrGetEtapeInCurrentContexte(typeEtape);
                if (!resEtape)
                {
                    result.EmpileErreur(resEtape.Erreur);
                    return(result);
                }
                if (resEtape.DataType != null)
                {
                    CResultAErreurType <CProjet> resProjet = blocProjet.GetOrCreateProjetInCurrentContexte(resEtape.DataType, projetParent, FindPredecesseurs(resEtape.DataType));
                    if (!resProjet)
                    {
                        result.EmpileErreur(resProjet.Erreur);
                        return(result);
                    }
                    CWorkflow workflowDuProjet = blocProjet.GetOrCreateWorkflowInCurrentContexte(resEtape.DataType);
                    result = CreateSqueletteProjetsInCurrentContext(workflowDuProjet, null, resProjet.DataType);
                    if (!result)
                    {
                        return(result);
                    }
                }
            }
            foreach (CLienEtapesWorkflow lien in LiensSuivantsPourProjet(typeEtape))
            {
                result += CreateProjets(workflow, lien.EtapeDestination, projetParent);
            }
            return(result);
        }
예제 #22
0
        //-------------------------------------------------------
        private CResultAErreur MajChamps()
        {
            CResultAErreur result  = CResultAErreur.True;
            CTypeWorkflow  wkfType = m_txtSelectWorkflow.ElementSelectionne as CTypeWorkflow;

            if (wkfType != null)
            {
                m_blocWorkflow.DbKeyTypeWorkflow = wkfType.DbKey;
            }
            else
            {
                m_blocWorkflow.DbKeyTypeWorkflow = null;
            }

            CTypeEtapeWorkflow typeEtape = m_cmbStartStep.ElementSelectionne as CTypeEtapeWorkflow;

            if (typeEtape != null)
            {
                m_blocWorkflow.DbKeyTypeEtapeDémarrage = typeEtape.DbKey;
            }
            else
            {
                m_blocWorkflow.DbKeyTypeEtapeDémarrage = null;
            }

            if (m_txtWorkflowInit.Formule == null)
            {
                if (!m_txtWorkflowInit.ResultAnalyse)
                {
                    result.EmpileErreur(m_txtWorkflowInit.ResultAnalyse.Erreur);
                }
            }
            else
            {
                m_blocWorkflow.FormuleInitialisationWorkflowLance = m_txtWorkflowInit.Formule;
            }


            return(result);
        }
 //-------------------------------------------------------------------------
 public CFormEditionTypeEtapeWorkflow(CTypeEtapeWorkflow typeEtape, CListeObjetsDonnees liste)
     : base(typeEtape, liste)
 {
     // Cet appel est requis par le Concepteur Windows Form.
     InitializeComponent();
 }
예제 #24
0
 //---------------------------------------------------
 public CBlocWorkflow(CTypeEtapeWorkflow typeEtape)
     : this()
 {
     m_typeEtape = typeEtape;
 }
예제 #25
0
 //-----------------------------------------------------
 public CBlocWorkflowFormulaire(CTypeEtapeWorkflow typeEtape)
     : base(typeEtape)
 {
 }
예제 #26
0
 //-----------------------------------------------------
 public CBlocWorkflowAttente(CTypeEtapeWorkflow typeEtape)
     : base(typeEtape)
 {
 }
예제 #27
0
 //-----------------------------------------------------
 public CBlocWorkflowChoix(CTypeEtapeWorkflow typeEtape)
     : base(typeEtape)
 {
 }
예제 #28
0
 //-----------------------------------------------------
 public CBlocWorkflowEt(CTypeEtapeWorkflow typeEtape)
     : base(typeEtape)
 {
 }
예제 #29
0
 //-----------------------------------------------------
 public CBlocWorkflowStopStep(CTypeEtapeWorkflow typeEtape)
     : base(typeEtape)
 {
 }
예제 #30
0
        /// //////////////////////////////////////////////////
        protected override void Editeur_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            if (ObjetEdite == null)
            {
                return;
            }
            if (LockEdition)
            {
                return;
            }

            if (e.Data.GetDataPresent(typeof(CReferenceObjetDonnee)))
            {
                CReferenceObjetDonnee reference = e.Data.GetData(typeof(CReferenceObjetDonnee)) as CReferenceObjetDonnee;
                if (reference.TypeObjet == typeof(CModeleAffectationUtilisateurs))
                {
                    Point pt        = PointToClient(new Point(e.X, e.Y));
                    Point ptLogique = GetLogicalPointFromDisplay(pt);
                    CWorkflowEtapeDessin dessinEtape = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as CWorkflowEtapeDessin;
                    if (dessinEtape != null)
                    {
                        CModeleAffectationUtilisateurs modele = reference.GetObjet(CSc2iWin32DataClient.ContexteCourant) as CModeleAffectationUtilisateurs;
                        if (modele != null)
                        {
                            CParametresAffectationEtape parametres = modele.ParametresAffectation;
                            if (parametres != null)
                            {
                                CParametresInitialisationEtape parametre = dessinEtape.Initializations;
                                CParametresAffectationEtape    parAff    = parametre.Affectations;
                                if (parAff != null)
                                {
                                    if (MessageBox.Show(I.T("Replace current assignments(Yes) or add new assignemnts(No) ?|20135"), "",
                                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                    {
                                        parAff = new CParametresAffectationEtape();
                                    }
                                    parAff.AddFormules(parametres.Formules);
                                    parametre.Affectations      = parAff;
                                    dessinEtape.Initializations = parametre;
                                    e.Effect = DragDropEffects.Link;
                                    Refresh();
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            List <CDonneeDragDropObjetGraphique> datas = GetDragDropData(e.Data);

            if (datas == null || datas.Count == 0)
            {
                return;
            }

            List <I2iObjetGraphique> candidats = new List <I2iObjetGraphique>();

            foreach (CRectangleDragForObjetGraphique rct in RectsDrags)
            {
                candidats.Add(rct.ObjetGraphique);
            }

            Point             ptLocal = GetLogicalPointFromDisplay(PointToClient(new Point(e.X, e.Y)));
            I2iObjetGraphique parent  = ObjetEdite.SelectionnerElementConteneurDuDessus(ptLocal, candidats);

            parent = DessinWorkflow;;
            if (parent == null)
            {
                e.Effect = DragDropEffects.None;
            }
            else
            {
                List <I2iObjetGraphique> nouveaux = new List <I2iObjetGraphique>();
                foreach (CRectangleDragForObjetGraphique rct in RectsDrags)
                {
                    rct.RectangleDrag = rct.Datas.GetDragDropPosition(ptLocal);
                    rct.RectangleDrag = GetRectangleSelonModesActives(rct.RectangleDrag, ptLocal);
                    // rct.RectangleDrag.Offset((int)(AutoScrollPosition.X / Echelle), (int)(AutoScrollPosition.Y / Echelle));

                    //Si dummy de création (type de bloc), création d'une nouvelle étape
                    I2iObjetGraphique objetGraphique = rct.Datas.ObjetDragDrop;
                    CDummyObjetWorkflowPourCreation dummyCreation = objetGraphique as CDummyObjetWorkflowPourCreation;
                    if (dummyCreation != null)
                    {
                        CTypeEtapeWorkflow typeEtape = dummyCreation.TypeEtape;
                        if (typeEtape == null)
                        {
                            typeEtape = new CTypeEtapeWorkflow(DessinWorkflow.TypeWorkflow.ContexteDonnee);
                            typeEtape.CreateNewInCurrentContexte();
                            typeEtape.Workflow = DessinWorkflow.TypeWorkflow;
                            typeEtape.Bloc     = Activator.CreateInstance(dummyCreation.TypeBloc, new object[] { typeEtape }) as CBlocWorkflow;
                        }
                        CWorkflowEtapeDessin graphEtape = new CWorkflowEtapeDessin();
                        graphEtape.TypeEtape = typeEtape;
                        objetGraphique       = graphEtape;
                        objetGraphique.Size  = dummyCreation.Size;
                    }

                    JusteBeforePositionneSurApresDragDrop(objetGraphique);
                    bool bParentIsInSelec = objetGraphique.Parent != null && candidats.Contains(objetGraphique.Parent);

                    bool bHasMove = false;

                    if (e.Effect == DragDropEffects.Copy)
                    {
                        Dictionary <Type, object> dicObjetsPourCloner = new Dictionary <Type, object>();
                        AddObjectsForClonerSerializer(dicObjetsPourCloner);
                        objetGraphique = (I2iObjetGraphique)objetGraphique.GetCloneAMettreDansParent(parent, dicObjetsPourCloner);

                        if (objetGraphique == null || !parent.AddChild(objetGraphique))
                        {
                            e.Effect = DragDropEffects.None;
                            objetGraphique.CancelClone();
                            continue;
                        }
                        else
                        {
                            objetGraphique.Parent = parent;
                            nouveaux.Add(objetGraphique);
                        }
                        bHasMove = true;
                    }
                    else
                    {
                        bHasMove = true;
                        if (objetGraphique.Parent != parent)
                        {
                            if (objetGraphique.Parent != null)
                            {
                                if (!bParentIsInSelec)
                                {
                                    objetGraphique.Parent.RemoveChild(objetGraphique);
                                }
                            }
                            else
                            {
                                nouveaux.Add(objetGraphique);
                            }
                            if (!bParentIsInSelec)
                            {
                                if (!parent.AddChild(objetGraphique))
                                {
                                    e.Effect = DragDropEffects.None;
                                    continue;
                                }
                                else
                                {
                                    objetGraphique.Parent = parent;
                                }
                            }
                        }
                    }


                    if (!bParentIsInSelec && bHasMove)
                    {
                        Point ptDrop = new Point(rct.RectangleDrag.Left, rct.RectangleDrag.Top);
                        objetGraphique.PositionAbsolue = ptDrop;
                    }
                }
                if (nouveaux.Count > 0)
                {
                    RefreshSelectionChanged = false;
                    Selection.Clear();
                    Selection.AddRange(nouveaux);
                    RefreshSelectionChanged = true;
                    DeclencheAfterAddElements(nouveaux);
                    Refresh();
                }
            }


            ElementModifie();
            EnDeplacement = false;
            Dessiner(true, true);
        }