Exemplo n.º 1
0
        //------------------------------------------------------
        public CResultAErreur MajChamps()
        {
            CResultAErreur result = CResultAErreur.True;

            if (m_besoin == null || m_calculProjet != null && m_items != null)
            {
                //Trouve les éléments avec les indexs demandés
                string[] strIndexs = m_txtReferences.Text.Split(';');
                Dictionary <CBesoin, bool> dicDepsASupprimer = new Dictionary <CBesoin, bool>();
                foreach (CBesoinDependance dep in m_besoin.LiensBesoinsDontJeDepend)
                {
                    dicDepsASupprimer[dep.BesoinReference] = true;
                }
                foreach (string strIndex in strIndexs)
                {
                    try{
                        int nItem = Int32.Parse(strIndex);
                        if (nItem >= 0 && nItem < m_items.Count())
                        {
                            CItemBesoin item = m_items.ElementAt(nItem);
                            if (item != null && item.Besoin != null && item.Besoin.TypeBesoinCode == (int)ETypeDonneeBesoin.Projet)
                            {
                                m_besoin.AddDependance(item.Besoin);
                                dicDepsASupprimer[item.Besoin] = false;
                            }
                        }
                    }
                    catch {}
                }
                foreach (KeyValuePair <CBesoin, bool> kv in dicDepsASupprimer)
                {
                    if (kv.Value)
                    {
                        m_besoin.RemoveDependance(kv.Key);
                    }
                }
                m_calculProjet.SetTypePRojet(m_txtSelectTypeProjet.ElementSelectionne as CTypeProjet);
                if (m_txtDuree.UnitValue != null)
                {
                    m_calculProjet.DureeJours = m_txtDuree.UnitValue.ConvertTo(CClasseUniteTemps.c_idDAY).Valeur;
                }
                else
                {
                    m_calculProjet.DureeJours = 0;
                }
                m_calculProjet.CleProjetTemplate = m_txtTemplateKey.Text.Trim();
            }
            return(result);
        }
Exemplo n.º 2
0
        //------------------------------------------------------
        public CResultAErreur MajChamps()
        {
            CResultAErreur result = CResultAErreur.True;

            if (m_besoin == null || m_calculPourcentage != null && m_items != null)
            {
                if (m_txtPourcentage.DoubleValue != null)
                {
                    m_calculPourcentage.Pourcentage = m_txtPourcentage.DoubleValue.Value;
                }
                else
                {
                    m_calculPourcentage.Pourcentage = 0;
                }
                //Trouve les éléments avec les indexs demandés
                string[] strIndexs = m_txtReferences.Text.Split(';');
                Dictionary <CBesoin, bool> dicDepsASupprimer = new Dictionary <CBesoin, bool>();
                foreach (CBesoinDependance dep in m_besoin.LiensBesoinsDontJeDepend)
                {
                    dicDepsASupprimer[dep.BesoinReference] = true;
                }
                foreach (string strIndex in strIndexs)
                {
                    try{
                        int nItem = Int32.Parse(strIndex);
                        if (nItem >= 0 && nItem < m_items.Count())
                        {
                            CItemBesoin item = m_items.ElementAt(nItem);
                            if (item != null && item.Besoin != null)
                            {
                                m_besoin.AddDependance(item.Besoin);
                                dicDepsASupprimer[item.Besoin] = false;
                            }
                        }
                    }
                    catch {}
                }
                foreach (KeyValuePair <CBesoin, bool> kv in dicDepsASupprimer)
                {
                    if (kv.Value)
                    {
                        m_besoin.RemoveDependance(kv.Key);
                    }
                }
            }
            return(result);
        }