Example #1
0
 //--------------------------------------------------------------
 public void SetTypePRojet(CTypeProjet tp)
 {
     if (tp == null)
     {
         m_nIdTypeProjet = null;
     }
     else
     {
         m_nIdTypeProjet = tp.Id;
     }
 }
        //-------------------------------------------------------
        private void InitChamps()
        {
            if (m_blocWorkflow == null)
            {
                return;
            }
            m_txtSelectWorkflow.Init(typeof(CTypeWorkflow),
                                     "Libelle",
                                     false);
            if (m_blocWorkflow.DbKeyTypeWorkflow != null)
            {
                CTypeWorkflow wkf = new CTypeWorkflow(CSc2iWin32DataClient.ContexteCourant);
                if (wkf.ReadIfExists(m_blocWorkflow.DbKeyTypeWorkflow))
                {
                    m_txtSelectWorkflow.ElementSelectionne = wkf;
                }
            }
            m_txtSelectTypeProjet.Init(typeof(CTypeProjet),
                                       "Libelle",
                                       false);
            if (m_blocWorkflow.DbKeyTypeProjet != null)
            {
                CTypeProjet typeProjet = new CTypeProjet(CSc2iWin32DataClient.ContexteCourant);
                if (typeProjet.ReadIfExists(m_blocWorkflow.DbKeyTypeProjet))
                {
                    m_txtSelectTypeProjet.ElementSelectionne = typeProjet;
                }
            }
            m_cmbProjectField.Init(typeof(CChampCustom),
                                   CFiltreData.GetAndFiltre(CChampCustom.GetFiltreChampsForRole(CWorkflow.c_roleChampCustom),
                                                            new CFiltreData(
                                                                CChampCustom.c_champTypeObjetDonnee + "=@1",
                                                                typeof(CProjet).ToString())),
                                   "Nom",
                                   false);
            if (m_blocWorkflow.IdChampProjet != null)
            {
                CChampCustom champ = new CChampCustom(CSc2iWin32DataClient.ContexteCourant);
                if (champ.ReadIfExists(m_blocWorkflow.IdChampProjet.Value))
                {
                    m_cmbProjectField.ElementSelectionne = champ;
                }
            }

            m_listeAffectations.Clear();
            m_listeAffectations.AddRange(m_blocWorkflow.AffectationsCreationEtDemarrage);

            m_txtFormuleGanttId.Init(new CFournisseurPropDynStd(),
                                     typeof(CEtapeWorkflow));
            m_txtFormuleGanttId.Formule = m_blocWorkflow.FormuleGanttId;

            m_chkGererIterations.Checked = m_blocWorkflow.GererIteration;
        }
Example #3
0
 //--------------------------------------------------------------
 public CTypeProjet GetTypeProjet(CContexteDonnee ctx)
 {
     if (m_nIdTypeProjet != null)
     {
         CTypeProjet tp = new CTypeProjet(ctx);
         if (tp.ReadIfExists(m_nIdTypeProjet.Value))
         {
             return(tp);
         }
     }
     return(null);
 }
        //-------------------------------------------------------
        private CResultAErreur MajChamps()
        {
            CResultAErreur result = CResultAErreur.True;
            CTypeWorkflow  wkf    = m_txtSelectWorkflow.ElementSelectionne as CTypeWorkflow;

            if (wkf != null)
            {
                m_blocWorkflow.DbKeyTypeWorkflow = wkf.DbKey;
            }
            else
            {
                m_blocWorkflow.DbKeyTypeWorkflow = null;
            }

            CTypeProjet typeProjet = m_txtSelectTypeProjet.ElementSelectionne as CTypeProjet;

            if (typeProjet != null)
            {
                m_blocWorkflow.DbKeyTypeProjet = typeProjet.DbKey;
            }
            else
            {
                m_blocWorkflow.DbKeyTypeProjet = null;
            }

            CChampCustom champ = m_cmbProjectField.ElementSelectionne as CChampCustom;

            if (champ != null)
            {
                m_blocWorkflow.IdChampProjet = champ.Id;
            }
            else
            {
                m_blocWorkflow.IdChampProjet = null;
            }

            m_blocWorkflow.AffectationsCreationEtDemarrage = m_listeAffectations;

            m_blocWorkflow.FormuleGanttId = m_txtFormuleGanttId.Formule;

            m_blocWorkflow.GererIteration = m_chkGererIterations.Checked;

            return(result);
        }
Example #5
0
        //----------------------------------------------------------------------------------------
        private void m_lnkSubTypes_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            m_menuSousTypes.Items.Clear();
            CTypeProjet           typeProjet        = m_selectTypeProjet.ElementSelectionne as CTypeProjet;
            HashSet <CTypeProjet> typeProjetsInMenu = new HashSet <CTypeProjet>();

            if (typeProjet != null)
            {
                if (m_gestionnaireModeEdition.ModeEdition)
                {
                    foreach (CRelationTypeProjet_SousTypeProjet rel in typeProjet.RelationsSousTypesProjetsPossibles)
                    {
                        ToolStripMenuItem itemSousType = new ToolStripMenuItem(rel.SousTypeProjet.Libelle);
                        itemSousType.Tag     = rel.SousTypeProjet;
                        itemSousType.Click  += new EventHandler(itemSousType_Click);
                        itemSousType.Checked = Projet.IsDefiniPar(rel.SousTypeProjet);
                        m_menuSousTypes.Items.Add(itemSousType);
                        typeProjetsInMenu.Add(rel.SousTypeProjet);
                    }
                }
                foreach (CProjet_SousType st in Projet.RelationsSousTypes)
                {
                    if (!typeProjetsInMenu.Contains(st.SousType))
                    {
                        ToolStripMenuItem itemSousType = new ToolStripMenuItem(st.SousType.Libelle);
                        itemSousType.Tag     = st.SousType;
                        itemSousType.Click  += new EventHandler(itemSousType_Click);
                        itemSousType.Checked = Projet.IsDefiniPar(st.SousType);
                        m_menuSousTypes.Items.Add(itemSousType);
                        typeProjetsInMenu.Add(st.SousType);
                        if (m_gestionnaireModeEdition.ModeEdition)
                        {
                            itemSousType.BackColor = Color.Red;
                        }
                        itemSousType.Enabled = m_gestionnaireModeEdition.ModeEdition;
                    }
                }
            }
            if (m_menuSousTypes.Items.Count > 0)
            {
                m_menuSousTypes.Show(m_lnkSubTypes, new Point(0, m_lnkSubTypes.Height));
            }
        }
Example #6
0
 //----------------------------------------------------------------------------------------
 void itemSousType_Click(object sender, EventArgs e)
 {
     if (m_gestionnaireModeEdition.ModeEdition)
     {
         ToolStripMenuItem item = sender as ToolStripMenuItem;
         CTypeProjet       type = item != null ? item.Tag as CTypeProjet : null;
         if (type != null)
         {
             if (Projet.IsDefiniPar(type))
             {
                 Projet.RemoveSubType(type);
             }
             else
             {
                 Projet.AddSubType(type);
             }
         }
         m_PanelChamps.ElementEdite = Projet;
     }
     RefreshLinkSousTypes();
 }
Example #7
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();
                        }
                    }
                }
            }
        }
Example #8
0
        //---------------------------------------------------
        //S'assure que le projet est bien créé
        internal CResultAErreurType <CProjet> GetOrCreateProjetInCurrentContexte(CEtapeWorkflow etape, CProjet projetParent, IEnumerable <CProjet> predecesseurs)
        {
            CResultAErreurType <CProjet> resProjet = new CResultAErreurType <CProjet>();
            CWorkflow workflow = GetOrCreateWorkflowInCurrentContexte(etape);

            if (workflow == null)
            {
                resProjet.EmpileErreur(I.T("Can not create workflow for step @1|20143", etape.Libelle));
                return(resProjet);
            }
            if (m_nIdChampProjet == null)
            {
                resProjet.EmpileErreur(I.T("Workflow step @1 doesn't define a field to store associated project|20142", etape.Libelle));
                return(resProjet);
            }
            CProjet projet = workflow.GetValeurChamp(m_nIdChampProjet.Value) as CProjet;

            //SC 8/5/2013 : s'assure que le projet a le bon parent !
            if (projetParent != null && projet != null &&
                projetParent != projet.Projet)
            {
                projet = null;
            }
            string strGanttId = GetGanttId(etape);

            if (projet == null)
            {
                //Création du projet
                projet = new CProjet(etape.ContexteDonnee);
                CTypeProjet typeProjet = null;
                if (m_dbKeyTypeProjet != null) //s'il est null, pas d'erreur ça peut être les formules d'initialisation qui le remplissent
                {
                    typeProjet = new CTypeProjet(etape.ContexteDonnee);
                    if (!typeProjet.ReadIfExists(m_dbKeyTypeProjet))
                    {
                        resProjet.EmpileErreur(I.T("Project type @1 for step @2 doesn't exists|20144", m_dbKeyTypeProjet.StringValue, etape.Libelle));
                        return(resProjet);
                    }
                }
                projet.CreateNewInCurrentContexte();
                projet.TypeProjet = typeProjet;
                projet.GanttId    = strGanttId;
                DateTime?dateDebut = null;
                foreach (CProjet pred in predecesseurs)
                {
                    if (dateDebut == null || pred.DateFinGantt > dateDebut.Value)
                    {
                        dateDebut = pred.DateFinGantt;
                    }
                }
                if (dateDebut == null)
                {
                    dateDebut = DateTime.Now;
                }
                projet.DateDebutPlanifiee = dateDebut;
                if (typeProjet != null)
                {
                    projet.DateFinPlanifiee = projet.DateDebutPlanifiee.Value.AddHours(typeProjet.DureeDefautHeures);
                }
                projet.Projet  = projetParent;
                projet.Libelle = etape.Libelle;
                CContexteEvaluationExpression ctxEval = new CContexteEvaluationExpression(etape);
                foreach (CAffectationsProprietes affectation in AffectationsCreationEtDemarrage)
                {
                    bool bAppliquer = affectation.FormuleCondition == null || affectation.FormuleCondition is C2iExpressionVrai;
                    if (affectation.FormuleCondition != null)
                    {
                        CResultAErreur res = affectation.FormuleCondition.Eval(ctxEval);
                        if (res && res.Data != null && CUtilBool.BoolFromString(res.Data.ToString()) == true)
                        {
                            bAppliquer = true;
                        }
                    }
                    if (bAppliquer)
                    {
                        affectation.AffecteProprietes(projet, etape, new CFournisseurPropDynStd());
                    }
                }
                foreach (CProjet predecesseur in predecesseurs)
                {
                    projet.AddPredecessor(predecesseur);
                }
                CResultAErreur result = workflow.SetValeurChamp(m_nIdChampProjet.Value, projet);
                if (!result)
                {
                    resProjet.EmpileErreur(result.MessageErreur);
                    return(resProjet);
                }
            }
            resProjet.DataType = projet;
            return(resProjet);
        }