Esempio n. 1
0
        //-------------------------------------------------------------
        public CResultAErreur StartProcess(CEtapeWorkflow etape)
        {
            CResultAErreur result  = CResultAErreur.True;
            CProcess       process = m_process;

            if (process == null)
            {
                if (m_dbKeyProcess != null)
                {
                    CProcessInDb processInDb = new CProcessInDb(etape.ContexteDonnee);
                    if (processInDb.ReadIfExists(m_dbKeyProcess))
                    {
                        process = processInDb.Process;
                    }
                }
            }
            if (process != null)
            {
                if (process.Libelle.Trim().Length == 0 && etape != null)
                {
                    process.Libelle = I.T("Step @1|20109", etape.Libelle);
                }
                result = CProcessEnExecutionInDb.StartProcess(process, new CInfoDeclencheurProcess(TypeEvenement.Specifique),
                                                              new CReferenceObjetDonnee(etape),
                                                              etape.ContexteDonnee.IdSession,
                                                              null,
                                                              null);
                if (result)
                {
                    etape.Refresh();//Relit l'étape car elle a pu être modifiée par le process
                    if (m_bUtiliserSortieDeProcessCommeCodeRetour && (result.Data is string || result.Data is string[]))
                    {
                        if (result.Data is string)
                        {
                            etape.CodesRetour = new string[] { (string)result.Data }
                        }
                        ;
                        if (result.Data is string[])
                        {
                            etape.CodesRetour = (string[])result.Data;
                        }
                    }
                    result = EndAndSaveIfOk(etape);
                }
            }
            return(result);
        }
    }