public CResultAErreurType <CAffectationsEtapeWorkflow> CalculeAffectations(CWorkflow workflow)
        {
            CResultAErreurType <CAffectationsEtapeWorkflow> resultAff = new CResultAErreurType <CAffectationsEtapeWorkflow>();

            resultAff.Result = true;

            CAffectationsEtapeWorkflow    affectations = new CAffectationsEtapeWorkflow();
            CContexteEvaluationExpression ctx          = new CContexteEvaluationExpression(workflow);

            foreach (CFormuleNommee formule in Formules)
            {
                CResultAErreur result = formule.Formule.Eval(ctx);
                if (result)
                {
                    if (result.Data is IAffectableAEtape)
                    {
                        affectations.AddAffectable(result.Data as IAffectableAEtape);
                    }
                    else if (result.Data is IEnumerable)
                    {
                        foreach (object obj in (IEnumerable)result.Data)
                        {
                            IAffectableAEtape a = obj as IAffectableAEtape;
                            if (a != null)
                            {
                                affectations.AddAffectable(a);
                            }
                        }
                    }
                }
            }
            resultAff.DataType = affectations;
            return(resultAff);
        }
Exemplo n.º 2
0
 //--------------------------------------------------------------------------
 public static string GetCleAffectation(IAffectableAEtape affectable)
 {
     if (affectable != null)
     {
         return((affectable.RacineCleAffectationWorkflow + c_strSepCleId + affectable.Id).ToUpper());
     }
     return(c_strBadKey);
 }
Exemplo n.º 3
0
        //--------------------------------------------------------------------------
        public void AddAffectable(IAffectableAEtape affectable)
        {
            string strCle = GetCleAffectation(affectable);

            if (strCle != c_strBadKey && !m_listeStringAffectations.Contains(strCle))
            {
                m_listeStringAffectations.Add(strCle);
                m_listeAffectables = null;
            }
        }
Exemplo n.º 4
0
        //--------------------------------------------------------------------------
        public void RemoveAffectable(IAffectableAEtape affectable)
        {
            string strCle = GetCleAffectation(affectable);

            if (m_listeStringAffectations.Contains(strCle))
            {
                m_listeStringAffectations.Remove(strCle);
                m_listeAffectables = null;
            }
        }
Exemplo n.º 5
0
        public void RemoveAssignment(IAffectableAEtape affectable)
        {
            if (affectable == null)
            {
                return;
            }
            CAffectationsEtapeWorkflow aff = Affectations;

            aff.RemoveAffectable(affectable);
            Affectations = aff;
        }
Exemplo n.º 6
0
        //------------------------------------------------
        private void AddAffectable(IAffectableAEtape affectable)
        {
            foreach (ListViewItem item in m_wndListeAffectations.Items)
            {
                IAffectableAEtape affectableExistant = item.Tag as IAffectableAEtape;
                if (affectableExistant != null &&
                    affectableExistant.Equals(affectable))
                {
                    return;
                }
            }
            ListViewItem newItem = new ListViewItem();

            InitItem(newItem, affectable);
            m_wndListeAffectations.Items.Add(newItem);
        }
Exemplo n.º 7
0
 //--------------------------------------------------------------------------
 public IEnumerable <IAffectableAEtape> GetAffectables(CContexteDonnee contexte)
 {
     if (m_listeAffectables != null)
     {
         return(m_listeAffectables.AsReadOnly());
     }
     m_listeAffectables = new List <IAffectableAEtape>();
     foreach (string strCle in m_listeStringAffectations)
     {
         IAffectableAEtape aff = GetAffectable(strCle, contexte);
         if (aff != null)
         {
             m_listeAffectables.Add(aff);
         }
     }
     return(m_listeAffectables.AsReadOnly());
 }
Exemplo n.º 8
0
        //------------------------------------------------
        private void  itemAdd_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = sender as ToolStripMenuItem;
            Type tp = item != null ? item.Tag as Type : null;

            if (tp != null)
            {
                CReferenceTypeForm refFrm = CFormFinder.GetTypeFormToList(tp);
                if (refFrm != null)
                {
                    CFormListeStandard frm = refFrm.GetForm() as CFormListeStandard;
                    if (frm != null)
                    {
                        IAffectableAEtape affectable = CFormNavigateurPopupListe.SelectObject(frm, null, "") as IAffectableAEtape;
                        if (affectable != null)
                        {
                            AddAffectable(affectable);
                        }
                    }
                }
            }
        }
Exemplo n.º 9
0
        //--------------------------------------------------------------------------
        public static IAffectableAEtape GetAffectable(string strCleAffectation, CContexteDonnee contexte)
        {
            string strCode = "";
            int    nId     = 0;

            if (!DecomposeCleAffectation(strCleAffectation, out strCode, out nId))
            {
                return(null);
            }
            Type tpObjet = null;

            if (!m_dicRacineCleToAffectation.TryGetValue(strCode, out tpObjet))
            {
                return(null);
            }
            IAffectableAEtape affectable = Activator.CreateInstance(tpObjet, new object[] { contexte }) as IAffectableAEtape;

            if (affectable != null &&
                affectable.ReadIfExists(nId))
            {
                return(affectable);
            }
            return(null);
        }
Exemplo n.º 10
0
 //------------------------------------------------
 private void InitItem(ListViewItem item, IAffectableAEtape affectable)
 {
     item.Text = affectable.DescriptionElement;
     item.Tag  = affectable;
 }