/// ///////////////////////////////////////////
        public override object Invoke(object objetAppelle, params object[] parametres)
        {
            CEtapeWorkflow etape = objetAppelle as CEtapeWorkflow;

            if (etape == null || parametres.Length > 0)
            {
                return(null);
            }

            List <CActeur>           listeActeurs     = new List <CActeur>();
            List <IAffectableAEtape> listeAffectables = new List <IAffectableAEtape>(etape.Assignments);

            foreach (IAffectableAEtape affectable in listeAffectables)
            {
                CActeur acteur = affectable as CActeur;
                if (acteur != null)
                {
                    listeActeurs.Add(acteur);
                }
                else
                {
                    CGroupeActeur groupe = affectable as CGroupeActeur;
                    if (groupe != null)
                    {
                        foreach (CRelationActeur_GroupeActeur relation in groupe.RelationsActeur)
                        {
                            listeActeurs.Add(relation.Acteur);
                        }
                    }
                    else
                    {
                        CProfilUtilisateur profil = affectable as CProfilUtilisateur;
                        if (profil != null)
                        {
                            CListeObjetDonneeGenerique <CActeur> lstActeursDansProfil =
                                new CListeObjetDonneeGenerique <CActeur>(etape.ContexteDonnee);
                            lstActeursDansProfil.Filtre = new CFiltreDataAvance(
                                CActeur.c_nomTable,
                                CDonneesActeurUtilisateur.c_nomTable + "." +
                                CRelationUtilisateur_Profil.c_nomTable + "." +
                                CProfilUtilisateur.c_nomTable + "." +
                                CProfilUtilisateur.c_champId + " = @1",
                                profil.Id);
                            foreach (CActeur acteurProfil in lstActeursDansProfil)
                            {
                                listeActeurs.Add(acteurProfil);
                            }
                        }
                    }
                }
            }

            return(listeActeurs.ToArray());
        }
Beispiel #2
0
        /// ////////////////////////////////////////////////////
        private bool ShouldAffiche(CMenuCustom menu)
        {
            bool bAfficheGroupes = false;
            bool bAfficheProfils = false;
            bool bAffiche        = true;

            CDbKey[] keysGroupes = menu.KeysGroupes;
            if (keysGroupes != null && keysGroupes.Length > 0)
            {
                bAffiche = false;
                //TESTDBKEYOK
                CDbKey[] lstGroupesSession = CTimosApp.SessionClient.GetInfoUtilisateur().ListeKeysGroupes;
                foreach (CDbKey keyVoyant in keysGroupes)
                {
                    foreach (CDbKey key in lstGroupesSession)
                    {
                        if (keyVoyant == key)
                        {
                            bAfficheGroupes = true;
                        }
                    }
                }
            }

            //TESTDBKEYOK
            CDbKey[] keysProfils = menu.KeysProfils;
            if (keysProfils != null && keysProfils.Length > 0)
            {
                bAffiche = false;
                CDonneesActeurUtilisateur user = CDonneesActeurUtilisateur.GetUserForSession(
                    CTimosApp.SessionClient.IdSession,
                    m_menuCustom.ContexteDonnee);
                foreach (CDbKey keyVoyant in keysProfils)
                {
                    CProfilUtilisateur profilVoyant = new CProfilUtilisateur(m_menuCustom.ContexteDonnee);
                    if (profilVoyant.ReadIfExists(keyVoyant))
                    {
                        if (user.IsInProfil(profilVoyant))
                        {
                            bAfficheGroupes = true;
                        }
                    }
                }
            }

            if (!bAffiche)
            {
                return(bAfficheGroupes || bAfficheProfils);
            }

            return(bAffiche);
        }
Beispiel #3
0
        //--------------------------------------------------------------------
        private void m_lnkAddProfil_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            CProfilUtilisateur profil = (CProfilUtilisateur)CFormSelectUnObjetDonnee.SelectObjetDonnee(
                I.T("Select user profils|20734"),
                typeof(CProfilUtilisateur),
                null,
                "Libelle");

            if (profil != null)
            {
                //Crée la relation du profil
                CRelationUtilisateur_Profil relation = profil.CreateNewRelationToRelation(m_relationEditee);
                CPanelUtilisateur_Profil    panel    = new CPanelUtilisateur_Profil();
                panel.Parent = m_panelSousProfils;
                panel.CreateControl();
                panel.Dock = DockStyle.Top;
                panel.Init(relation);
                Height = GetIdealHeight();
            }
        }
        /// ///////////////////////////////////////////
        public override object Invoke(object objetAppelle, params object[] parametres)
        {
            CEtapeWorkflow etape = objetAppelle as CEtapeWorkflow;

            if (etape == null || parametres.Length > 0)
            {
                return(null);
            }

            List <CProfilUtilisateur> listeProfils     = new List <CProfilUtilisateur>();
            List <IAffectableAEtape>  listeAffectables = new List <IAffectableAEtape>(etape.Assignments);

            foreach (IAffectableAEtape affectable in listeAffectables)
            {
                CProfilUtilisateur profil = affectable as CProfilUtilisateur;
                if (profil != null)
                {
                    listeProfils.Add(profil);
                }
            }

            return(listeProfils.ToArray());
        }
        //-------------------------------------------------------------------
        public override CResultAErreur VerifieDonnees(CObjetDonnee objet)
        {
            CResultAErreur result = CResultAErreur.True;

            try
            {
                CProfilUtilisateur ProfilUtilisateur = (CProfilUtilisateur)objet;

                if (ProfilUtilisateur.Libelle == "")
                {
                    result.EmpileErreur(I.T("The profile label cannot be empty|295"));
                }
                if (!CObjetDonneeAIdNumerique.IsUnique(ProfilUtilisateur, CProfilUtilisateur.c_champLibelle, ProfilUtilisateur.Libelle))
                {
                    result.EmpileErreur(I.T("The profile '@1' already exists|296", ProfilUtilisateur.Libelle));
                }
            }
            catch (Exception e)
            {
                result.EmpileErreur(new CErreurException(e));
            }
            return(result);
        }
Beispiel #6
0
        //-------------------------------------------------------------
        public void Init(CRelationUtilisateur_Profil relation)
        {
            m_relationEditee = relation;
            CProfilUtilisateur  profil = relation.Profil;
            CListeObjetsDonnees listeInclusionsFillesDuProfil = null;

            if (profil != null)
            {
                m_lblNomProfil.Text         = profil.Libelle;
                m_panelEnteteProfil.Visible = true;
                if (profil.Affinable && profil.EntiteOrganisationnelle != null)
                {
                    m_lblLibelleSaisie.Text     = profil.LibelleSaisieEntite;
                    m_panelSelectEntite.Visible = true;
                }
                else
                {
                    m_panelSelectEntite.Visible = false;
                }
                listeInclusionsFillesDuProfil = profil.Inclusions;
            }
            else
            {
                if (relation.Profil_Inclusion != null)
                {
                    CProfilUtilisateur_Inclusion inclusion = relation.Profil_Inclusion;
                    m_panelEnteteProfil.Visible = false;
                    if (inclusion.ProfilFils.Affinable && inclusion.ProfilFils.EntiteOrganisationnelle != null)
                    {
                        m_panelSelectEntite.Visible = true;
                        m_lblLibelleSaisie.Text     = inclusion.Libelle;
                    }
                    else
                    {
                        m_panelSelectEntite.Visible = false;
                    }
                    listeInclusionsFillesDuProfil = relation.Profil_Inclusion.InclusionsFilles;
                }
            }

            UpdateLibelleEntite();

            m_panelSousProfils.SuspendDrawing();

            foreach (Control ctrl in m_panelSousProfils.Controls)
            {
                ctrl.Parent = null;
                ctrl.Dispose();
            }
            m_panelSousProfils.Controls.Clear();
            ArrayList lstPanels = new ArrayList();
            Dictionary <int, bool> dicProfilsInclusionARelationsExistantes = new Dictionary <int, bool>();

            foreach (CRelationUtilisateur_Profil sousRel in relation.RelationFilles)
            {
                CPanelUtilisateur_Profil panel = new CPanelUtilisateur_Profil();
                panel.Dock = DockStyle.Top;
                panel.CreateControl();
                panel.LockEdition = LockEdition;
                if (sousRel.Profil_Inclusion != null)
                {
                    dicProfilsInclusionARelationsExistantes[sousRel.Profil_Inclusion.Id] = true;
                }
                panel.Init(sousRel);
                lstPanels.Add(panel);
            }
            if (!LockEdition)
            {
                //Vérifie qu'il existe bien de relations pour toutes les inclusions filles
                foreach (CProfilUtilisateur_Inclusion profInc in listeInclusionsFillesDuProfil)
                {
                    if (!dicProfilsInclusionARelationsExistantes.ContainsKey(profInc.Id))
                    {
                        //Il faut créer une relation
                        CRelationUtilisateur_Profil newRel = profInc.CreateNewRelationToRelation(relation);
                        CPanelUtilisateur_Profil    panel  = new CPanelUtilisateur_Profil();
                        panel.Dock = DockStyle.Top;
                        panel.CreateControl();
                        panel.Init(newRel);
                        lstPanels.Add(panel);
                    }
                }
            }
            m_panelSousProfils.Controls.AddRange((Control[])lstPanels.ToArray(typeof(Control)));
            Height = GetIdealHeight();
            m_panelSousProfils.Height = GetHeightSousProfils();
            m_panelSousProfils.ResumeDrawing();
            UpdateCouleurMarge();
        }