Exemplo n.º 1
0
 /// /////////////////////////////////////////////////////////
 public CActionLancerProcess(CProcess process)
     : base(process)
 {
     Libelle = I.T("Sub process|189");
     m_mapVariablesProcessToFormule = new Hashtable();
     VariableRetourCanBeNull        = true;
 }
Exemplo n.º 2
0
        /// /////////////////////////////////////////////////////////////
        public static CResultAErreur StartProcessMultiples(CProcess process,
                                                           CInfoDeclencheurProcess infoDeclencheur,
                                                           CReferenceObjetDonnee[] refsCible,
                                                           int nIdSession,
                                                           int?nIdVersion,
                                                           IIndicateurProgression indicateur)
        {
            process.InfoDeclencheur = infoDeclencheur;
            ///TODO
            ///Problème VersionObjet
            IProcessEnExecutionInDbServeur processServeur = (IProcessEnExecutionInDbServeur)CContexteDonnee.GetTableLoader(c_nomTable, null, nIdSession);

            using (C2iSponsor sponsor = new C2iSponsor())
            {
                sponsor.Register(processServeur);
                CAppelleurFonctionAsynchrone appelleur = new CAppelleurFonctionAsynchrone();
                CResultAErreur defaultResult           = CResultAErreur.True;
                defaultResult.EmpileErreur(I.T("Asynchronous call error @1|20032", "StartProcessMultiples"));
                return(appelleur.StartFonctionAndWaitAvecCallback(
                           typeof(IProcessEnExecutionInDbServeur),
                           processServeur,
                           "StartProcessMultiples",
                           "",
                           defaultResult,
                           new CValise2iSerializable(process),
                           refsCible,
                           nIdVersion,
                           indicateur) as CResultAErreur);
            }
        }
Exemplo n.º 3
0
        /// ////////////////////////////////////////////////////////
        public override CResultAErreur VerifieDonnees()
        {
            CResultAErreur result      = CResultAErreur.True;
            CProcessInDb   processInDB = new CProcessInDb(Process.ContexteDonnee);

            if (!processInDB.ReadIfExists(m_dbKeyProcess))
            {
                result.EmpileErreur(I.T("Invalid action to start|192"));
                return(result);
            }
            //Vérifie le type des variables
            CProcess process = processInDB.Process;

            foreach (string strIdVariable in m_mapVariablesProcessToFormule.Keys)
            {
                IVariableDynamique variable = process.GetVariable(strIdVariable);
                if (variable != null)
                {
                    CTypeResultatExpression typeVariable = variable.TypeDonnee;
                    C2iExpression           expression   = (C2iExpression)m_mapVariablesProcessToFormule[strIdVariable];
                    if (expression != null)
                    {
                        if (!expression.TypeDonnee.Equals(typeVariable))
                        {
                            result.EmpileErreur(I.T("The formula of '@1' variable value must return a @2 type|193", variable.Nom, typeVariable.ToStringConvivial()));
                        }
                    }
                }
            }
            return(result);
        }
Exemplo n.º 4
0
 /// ////////////////////////////////////////////////////////
 public CAction(CProcess process)
 {
     m_process = process;
     m_nId     = m_process.GetIdNouvelObjetDeProcess();
     Position  = new Point(0, 0);
     Size      = DefaultSize;
     Parent    = process;
 }
Exemplo n.º 5
0
 /// ////////////////////////////////////////////////////////
 public CProcess(CProcess processParent)
 {
     m_contexteDonnee = processParent.ContexteDonnee;
     Position         = new Point(0, 0);
     Size             = new Size(3000, 3000);
     m_listeActions.Add(new CActionDebut(this));
     m_ordreZ.Add((IObjetDeProcess)m_listeActions[0]);
     m_processParent = processParent;
 }
Exemplo n.º 6
0
        //---------------------------------------------------------------------
        /// <summary>
        /// Recherche un objet dans le process in DB
        /// </summary>
        /// <param name="objetCherche"></param>
        /// <param name="resultat"></param>
        public void RechercheObjet(object objetCherche, CResultatRequeteRechercheObjet resultat)
        {
            CProcess process = Process;

            if (process != null)
            {
                resultat.PushChemin(new CNoeudRechercheObjet_ObjetDonnee(this));
                try
                {
                    process.ChercheObjet(objetCherche, resultat);
                }
                finally
                {
                    resultat.PopChemin();
                }
            }
        }
Exemplo n.º 7
0
 /// /////////////////////////////////////////
 public CActionSupprimerEntite(CProcess process)
     : base(process)
 {
     Libelle = I.T("Delete an entity|239");
 }
 /// /////////////////////////////////////////
 public CActionCopierMultiLocalDansGed(CProcess process)
     : base(process)
 {
     Libelle = I.T("Add multiple files to EDM document|20105");
     VariableRetourCanBeNull = true;
 }
 /// /////////////////////////////////////////////////////////
 public CActionAttenteUtilisateur(CProcess process)
     : base(process)
 {
     Libelle = I.T("User waiting|120");
 }
Exemplo n.º 10
0
 /// ///////////////////////////////////////////////
 public CActionFonction(CProcess process)
     : base(process)
 {
 }
Exemplo n.º 11
0
 /// /////////////////////////////////////
 public CBrancheProcess(CProcess process)
 {
     m_process = process;
 }
Exemplo n.º 12
0
 public CActionCondition(CProcess process)
     : base(process)
 {
     Libelle = I.T("Condition|129");
 }
Exemplo n.º 13
0
 /// //////////////////////////////////////////////////////////////
 public CLienAction(CProcess process)
 {
     m_process = process;
     m_nId     = m_process.GetIdNouvelObjetDeProcess();
     Parent    = process;
 }
Exemplo n.º 14
0
 /// /////////////////////////////////////////////////////////
 public CActionModeAssynchrone(CProcess process)
     : base(process)
 {
     Libelle = I.T("Switch to asynchronous mode|207");
 }
Exemplo n.º 15
0
 /// ///////////////////////////////////////////////////
 public CLienUtilisateurAbsent(CProcess process)
     : base(process)
 {
 }
Exemplo n.º 16
0
 /// ///////////////////////////////////////////////////
 public CLienFromDialog(CProcess process)
     : base(process)
 {
 }
 /// /////////////////////////////////////////////////////////
 public CActionChangerVersionDonnees(CProcess process)
     : base(process)
 {
     Libelle = I.T("Change active version|304");
 }
Exemplo n.º 18
0
 /// /////////////////////////////////////////
 public CActionModifierVariableSurObjet(CProcess process)
     : base(process)
 {
     Libelle = I.T("Modify a variable on an element|229");
 }
Exemplo n.º 19
0
        /// <summary>
        /// Execute une action
        /// </summary>
        /// <param name="action"></param>
        /// <param name="contexte"></param>
        /// <param name="bIsActionPrincipaleProcess">Si vrai, considère que le process en execution est fermé en sortie,
        /// si non, il s'agit d'une action appelée dans une boucle par exemple</param>
        /// <returns></returns>
        public CResultAErreur ExecuteAction(
            CAction action,
            CContexteExecutionAction contexte,
            object objetCible,
            bool bIsActionPrincipaleProcess)
        {
            CResultAErreur result = CResultAErreur.True;

            m_pile.Add(new CInfoPileExecution(null, action));
            m_nIdActionEnCours = action.IdObjetProcess;
            action.Process.SetValeurChamp(CProcess.c_strIdVariableElement, objetCible);
            bool                      bFermerLaSessionEnSortant = IsModeAsynchrone && bIsActionPrincipaleProcess;
            CSessionClient            sessionClient             = CSessionClient.GetSessionForIdSession(contexte.IdSession);
            CConfigurationsImpression oldConf = null;

            contexte.SetInfoProgression(action.Libelle);
            try
            {
                if (contexte.IndicateurProgression != null && contexte.IndicateurProgression.CancelRequest)
                {
                    result.EmpileErreur(I.T("User cancellation|182"));
                    result.Data = null;
                    return(result);
                }
            }
            catch { }
            if (sessionClient != null)
            {
                oldConf = sessionClient.ConfigurationsImpression;
            }
            try
            {
                if (sessionClient != null)
                {
                    sessionClient.ConfigurationsImpression = ConfigurationImpression;
                }
                action.Process.ContexteExecution = contexte;
                result = action.Execute(contexte);
                while (result.Data != null && result)
                {
                    //retourne un lien : on continue
                    if (result.Data is CLienAction)
                    {
                        m_nIdActionEnCours = action.IdObjetProcess;
                        CLienAction lien = (CLienAction)result.Data;
                        m_pile.Add(new CInfoPileExecution(lien, lien.ActionArrivee));
                        contexte.ProcessEnExecution.LibelleActionEnCours = lien.ActionArrivee.Libelle;
                        if (lien is CLienAsynchrone && !IsModeAsynchrone)
                        {
                            IsModeAsynchrone = true;
                            //Execution de l'action en mode asynchrone et fin
                            m_actionAsynchroneAExecuter = lien.ActionArrivee;
                            m_contexteAsynchrone        = contexte;
                            Thread th = new Thread(new ThreadStart(ExecuteActionAsynchrone));
                            th.Start();
                            bFermerLaSessionEnSortant = false;
                            result.Data = null;
                            return(result);
                        }
                        else
                        {
                            action = ((CLienAction)result.Data).ActionArrivee;
                            action.Process.ContexteExecution = contexte;

                            contexte.SetInfoProgression(action.Libelle);
                            try
                            {
                                if (contexte.IndicateurProgression != null && contexte.IndicateurProgression.CancelRequest)
                                {
                                    result.EmpileErreur(I.T("User cancellation|182"));
                                    result.Data = null;
                                    return(result);
                                }
                            }
                            catch { }

                            result = action.Execute(contexte);
                        }
                    }
                    else if (result.Data is CMetteurDeProcessEnPause)
                    {
                        //Mise en pause du process
                        result      = contexte.ProcessEnExecution.PauseProcess(contexte);
                        result.Data = null;
                        return(result);
                    }
                    else
                    {
                        result.Data = null;
                    }
                }
                if (bIsActionPrincipaleProcess && result)
                {
                    CResultAErreur resultTmp = contexte.ProcessEnExecution.EnProcess(contexte);
                    if (!resultTmp)
                    {
                        result.Erreur += resultTmp.Erreur;
                        result.Result  = false;
                    }
                }
            }
            catch (Exception e)
            {
                result.EmpileErreur(new CErreurException(e));
            }
            finally
            {
                if (sessionClient != null)
                {
                    sessionClient.ConfigurationsImpression = oldConf;
                }
                if (!result && bIsActionPrincipaleProcess)
                {
                    //Pour ne modifier que le process et ne surtout pas faire les sauvegardes autres
                    contexte.ProcessEnExecution.BeginEdit();
                    contexte.ProcessEnExecution.Etat           = EtatProcess.Erreur;
                    contexte.ProcessEnExecution.BrancheEnCours = this;
                    contexte.ProcessEnExecution.InfoEtat       = result.Erreur.ToString();

                    if (IsModeAsynchrone)
                    {
                        //Notifie l'utilisateur qu'un erreur est survenue
                        CBesoinInterventionProcess intervention = new CBesoinInterventionProcess(contexte.ProcessEnExecution.ContexteDonnee);
                        intervention.CreateNewInCurrentContexte();
                        intervention.Libelle     = I.T("@1 action error|259", contexte.ProcessEnExecution.Libelle);
                        intervention.DateDemande = DateTime.Now;
                        //Crée une boite de message pour afficher l'erreur
                        CProcess          process     = contexte.Branche.Process;
                        CActionMessageBox actionNotif = new CActionMessageBox(process);
                        actionNotif.FormuleMessage = new sc2i.expression.C2iExpressionConstante(intervention.Libelle + "\r\n" + result.Erreur.ToString());
                        actionNotif.Libelle        = I.T("Error notification|260");
                        process.AddAction(actionNotif);
                        intervention.IdAction = actionNotif.IdObjetProcess;
                        //TESTDBKEYOK
                        intervention.KeyUtilisateur                = KeyUtilisateur;
                        intervention.ProcessEnExecution            = contexte.ProcessEnExecution;
                        contexte.ProcessEnExecution.BrancheEnCours = contexte.Branche;
                    }
                    contexte.ProcessEnExecution.CommitEdit();
                }
                if (IsModeAsynchrone && bFermerLaSessionEnSortant)
                {
                    //Ferme la session
                    try
                    {
                        CSessionClient session = CSessionClient.GetSessionForIdSession(contexte.IdSession);
                        session.CloseSession();
                    }
                    catch {}
                }
            }
            result.Data = null;
            return(result);
        }
Exemplo n.º 20
0
        /// /////////////////////////////////////
        public CResultAErreur Serialize(C2iSerializer serializer)
        {
            int            nVersion = GetNumVersion();
            CResultAErreur result   = serializer.TraiteVersion(ref nVersion);

            if (!result)
            {
                return(result);
            }
            //TESTDBKEYOK
            if (nVersion < 3)
            {
                serializer.ReadDbKeyFromOldId(ref m_keyUtilisateur, null);
            }
            else
            {
                serializer.TraiteDbKey(ref m_keyUtilisateur);
            }
            serializer.TraiteInt(ref m_nIdActionEnCours);

            //Sérialize les données des actions
            int nNb = m_tableDataAction.Count;

            serializer.TraiteInt(ref nNb);
            switch (serializer.Mode)
            {
            case ModeSerialisation.Ecriture:
                foreach (int nIdAction in m_tableDataAction.Keys)
                {
                    int nIdActionPourRef = nIdAction;
                    serializer.TraiteInt(ref nIdActionPourRef);
                    I2iSerializable donnee = (I2iSerializable)m_tableDataAction[nIdAction];
                    result = serializer.TraiteObject(ref donnee);
                    if (!result)
                    {
                        return(result);
                    }
                }
                break;

            case ModeSerialisation.Lecture:
                m_tableDataAction.Clear();
                for (int nData = 0; nData < nNb; nData++)
                {
                    int nIdAction = 0;
                    serializer.TraiteInt(ref nIdAction);
                    I2iSerializable donnee = null;
                    result = serializer.TraiteObject(ref donnee);
                    if (!result)
                    {
                        return(result);
                    }
                    m_tableDataAction[nIdAction] = donnee;
                }
                break;
            }

            //Sérialize le process
            I2iSerializable objet = m_process;

            result = serializer.TraiteObject(ref objet);
            if (!result)
            {
                return(result);
            }
            m_process = (CProcess)objet;

            //Serialize la trace
            result = serializer.TraiteArrayListOf2iSerializable(m_pile);
            if (!result)
            {
                return(result);
            }

            if (nVersion >= 1)
            {
                objet = m_configurationImpression;
                serializer.TraiteObject(ref objet);
                m_configurationImpression = (CConfigurationsImpression)objet;
            }
            else
            {
                m_configurationImpression = new CConfigurationsImpression();
            }

            if (nVersion >= 2)
            {
                serializer.TraiteBool(ref m_bExecutionSurContexteClient);
            }

            return(result);
        }
 /// /////////////////////////////////////////
 public CActionSupprimerHandlerEvenement(CProcess process)
     : base(process)
 {
     Libelle = I.T("Delete event|244");
 }
Exemplo n.º 22
0
 /// /////////////////////////////////////////
 public CActionCopierEntite(CProcess process)
     : base(process)
 {
     Libelle = I.T("Copy an entity|291");
 }
Exemplo n.º 23
0
 /// /////////////////////////////////////////
 public CActionNettoyageRelationsTypeId(CProcess process)
     : base(process)
 {
     Libelle = I.T("Clean non RI relations|20201");
 }
Exemplo n.º 24
0
 /// /////////////////////////////////////////
 public CActionExporterDonnees(CProcess process)
     : base(process)
 {
     Libelle = I.T("Export data|403");
     VariableRetourCanBeNull = true;
 }
Exemplo n.º 25
0
 /// ///////////////////////////////////////////////////
 public CLienFromCondition(CProcess process)
     : base(process)
 {
 }
Exemplo n.º 26
0
 /// /////////////////////////////////////////
 public CActionCopierLocalDansGed(CProcess process)
     : base(process)
 {
     Libelle = I.T("Create EDM document|20019");
     VariableRetourCanBeNull = true;
 }
Exemplo n.º 27
0
 //------------------------------------------------------------
 public CFournisseurValeursSerializeesProcess(CProcess process, CContexteDonnee contexte)
 {
     m_process  = process;
     m_contexte = contexte;
 }
 /// /////////////////////////////////////////////////////////
 public CActionChangerOptionsImpression(CProcess process)
     : base(process)
 {
     Libelle = I.T("Change print settings|123");
 }
 /// /////////////////////////////////////////////////////////
 public CActionAnnulerAttenteUtilisateur(CProcess process)
     : base(process)
 {
     Libelle = I.T("Cancellation of user attempt|102");
 }
Exemplo n.º 30
0
 /// ///////////////////////////////////////////////////
 public CLienFromDialog(CProcess process, E2iDialogResult result)
     : base(process)
 {
     m_result = result;
 }