示例#1
0
        //---------------------------------------------------------------
        private CItemBesoin CreateSoluce(CBesoin besoinSolutionné)
        {
            CBesoin newBesoin = new CBesoin(m_phaseSpecifications.ContexteDonnee);

            newBesoin.CreateNewInCurrentContexte();
            newBesoin.PhaseSpecifications = m_phaseSpecifications;

            Dictionary <int, int> dicMap = newBesoin.CopyFromTemplate(besoinSolutionné);

            if (dicMap != null)
            {
                foreach (KeyValuePair <int, int> kv in dicMap)
                {
                    CBesoin bOriginal = new CBesoin(m_phaseSpecifications.ContexteDonnee);
                    if (bOriginal.ReadIfExists(kv.Key, false))
                    {
                        if (!bOriginal.HasChildren)
                        {
                            CBesoin bNew = new CBesoin(m_phaseSpecifications.ContexteDonnee);
                            if (bNew.ReadIfExists(kv.Value, false))
                            {
                                bOriginal.AddSatisfaction(bNew, null);
                            }
                        }
                    }
                }
            }
            CItemBesoin item = new CItemBesoin(newBesoin, null);

            AddItem(item, false);
            item.Index = Items.Count();
            AddItemsFils(item);

            return(item);
        }
示例#2
0
        //--------------------------------------------------
        private void m_btnAddBesoin_LinkClicked(object sender, EventArgs e)
        {
            if (m_phaseSpecifications != null && !LockEdition)
            {
                CBesoin besoin = new CBesoin(PhaseSpecifications.ContexteDonnee);
                besoin.CreateNewInCurrentContexte();
                besoin.PhaseSpecifications = PhaseSpecifications;
                if (m_phaseSpecifications.Projet != null && m_phaseSpecifications.Projet.TypeProjet != null)
                {
                    besoin.TypeBesoinCode = m_phaseSpecifications.Projet.TypeProjet.CodeTypeBesoinParDefaut;
                }

                CItemBesoin item = new CItemBesoin(besoin, null);
                item.Tag = besoin;
                if (Items.Length > 0)
                {
                    CItemBesoin lastItem = Items[Items.Length - 1] as CItemBesoin;
                    if (lastItem != null && lastItem.Besoin != null)
                    {
                        besoin.BesoinParent = lastItem.Besoin.BesoinParent;
                    }
                }
                AddItem(item, true);
                CurrentItemIndex = item.Index;
            }
        }
 private void m_btnAddBesoin_LinkClicked(object sender, EventArgs e)
 {
     if (PhaseSpecifications != null && m_gestionnaireModeEdition.ModeEdition)
     {
         CBesoin besoin = new CBesoin(PhaseSpecifications.ContexteDonnee);
         besoin.CreateNewInCurrentContexte();
         besoin.PhaseSpecifications = PhaseSpecifications;
         CItemBesoin itemParent = null;
         if (m_wndListeBesoins.Items.Length > 0)
         {
             itemParent = m_wndListeBesoins.Items[m_wndListeBesoins.Items.Length - 1] as CItemBesoin;
             if (itemParent != null && itemParent.Besoin != null)
             {
                 besoin.BesoinParent = itemParent.Besoin.BesoinParent;
             }
         }
         CItemBesoin item = new CItemBesoin(besoin, itemParent);
         m_wndListeBesoins.AddItem(item, true);
         m_wndListeBesoins.CurrentItemIndex = item.Index;
     }
 }
示例#4
0
 //--------------------------------------------------------------------
 private bool ItemControl_OnLeaveLastControl(object sender, EventArgs args)
 {
     if (sender != null)
     {
         //Regarde si le dernier item est vide
         if (Items.Count() > 0 && !LockEdition && m_phaseSpecifications != null)
         {
             CItemBesoin item = Items.ElementAt(Items.Count() - 1) as CItemBesoin;
             if (item.Besoin != null && item.Besoin.Libelle.Trim().Length > 0)
             {
                 CBesoin besoin = new CBesoin(m_phaseSpecifications.ContexteDonnee);
                 besoin.CreateNewInCurrentContexte();
                 if (m_phaseSpecifications.Projet != null && m_phaseSpecifications.Projet.TypeProjet != null)
                 {
                     besoin.TypeBesoinCode = m_phaseSpecifications.Projet.TypeProjet.CodeTypeBesoinParDefaut;
                 }
                 besoin.PhaseSpecifications = m_phaseSpecifications;
                 CItemBesoin prec = null;
                 if (Items.Count() > 0)
                 {
                     prec = GetVisibleItemBefore(Items.Count()) as CItemBesoin;
                     if (prec != null)
                     {
                         besoin.BesoinParent = prec.Besoin.BesoinParent;
                     }
                 }
                 item = new CItemBesoin(besoin, prec != null?prec.ItemParent as CItemBesoin:null);
                 AddItem(item, true);
                 CurrentItemIndex = item.Index;
                 ItemControl.GetTabOrderedControlsList()[0].Focus();
                 return(true);
             }
         }
     }
     return(false);
 }