Esempio n. 1
0
        //-------------------------------------
        void txtSelectTemplate_OnSelectObject(object sender, CObjetDonneeEventArgs args)
        {
            CPhaseSpecifications phase = args.Objet as CPhaseSpecifications;

            if (phase != null)
            {
                CElementDeGanttProjet prj = m_gantt.SelectedElement as CElementDeGanttProjet;
                CProjet projetParent      = prj != null ? prj.ProjetAssocie : null;
                if (projetParent != null)
                {
                    if (CFormAlerte.Afficher(I.T("Apply template '@1' to project '@2'|20730",
                                                 phase.Libelle, projetParent.Libelle),
                                             EFormAlerteBoutons.OuiNon,
                                             EFormAlerteType.Question) == DialogResult.Yes)
                    {
                        CListeObjetsDonnees lst = phase.Besoins;
                        lst.Filtre = new CFiltreData(CBesoin.c_champTypeBesoin + "=@1 and " +
                                                     CTypeProjet.c_champId + " is null",
                                                     (int)ETypeDonneeBesoin.Projet);
                        CTypeProjet typeProjetDefault = null;
                        if (lst.Count > 0)
                        {
                            typeProjetDefault = CFormSelectUnObjetDonnee.SelectObjetDonnee(
                                I.T("Select default project type (for needs without project type)|20737"),
                                typeof(CTypeProjet), null, "Libelle") as CTypeProjet;
                            if (typeProjetDefault == null)
                            {
                                return;
                            }
                        }
                        using (CWaitCursor waiter = new CWaitCursor())
                        {
                            projetParent.ApplySpecificationTemplate(phase, typeProjetDefault);
                            Reinit();
                        }
                    }
                }
            }
        }