Example #1
0
        //---------------------------------------------------
        public static void EditeProjet(
            CProjet projet,
            bool bModeEdition,
            CFormEditionStandard formAppelante)
        {
            CFormQuickEditProjet form = new CFormQuickEditProjet();

            form.m_formAppelante = formAppelante;
            form.m_gestionnaireModeEdition.ModeEdition = bModeEdition;
            form.m_projet = projet;

            IInfoUtilisateur info = CTimosApp.SessionClient.GetInfoUtilisateur();

            if (info != null)
            {
                CRestrictionUtilisateurSurType restriction = info.GetRestrictionsSurObjet(projet, projet.ContexteDonnee.IdVersionDeTravail);
                if (restriction != null)
                {
                    form.m_listeRestrictions.SetRestriction(restriction);
                }
            }
            CListeRestrictionsUtilisateurSurType restrictionsEnPlus = CDroitEditionType.GetDroits(projet);

            if (restrictionsEnPlus != null)
            {
                form.m_listeRestrictions.Combine(restrictionsEnPlus);
            }

            CRestrictionUtilisateurSurType rest = form.m_listeRestrictions.GetRestriction(typeof(CProjet));

            form.m_gestionnaireModeEdition.ModeEdition = bModeEdition && (rest.RestrictionGlobale & ERestriction.ReadOnly) != ERestriction.ReadOnly;

            form.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width / 2 - form.Width / 2,
                                      Screen.PrimaryScreen.WorkingArea.Height / 2 - form.Height / 2);
            form.ShowDialog();
            form.Dispose();
        }