Exemple #1
0
        /// <summary>
        /// Ajouter une gestion ManyToOne à l'interface
        /// </summary>
        /// <param name="form"></param>
        private void AddManyToOneManager(EntityManagementControl form, PropertyInfo item, BaseEntity obj)
        {
            // Annotation de l'propriété
            DisplayPropertyAttribute affichageProperty = new ConfigProperty(item, this.ConfigEntity)
                                                         .DisplayProperty;


            // Préparation de l'interface s'il n'est pas encors préparer
            if (this.tabControlManagers.Visible == false)
            {
                this.tabControlManagers.Visible  = true;
                this.tabControl_MainManager.Dock = DockStyle.Fill;
                this.tabControlManagers.TabPages["main"].Text = this.ConfigEntity.ManagementForm.FormTitle;
                this.tabControlManagers.TabPages["main"].Controls.Add(this.tabControl_MainManager);
                this.tabControlManagers.Dock = DockStyle.Fill;
                this.panelDataGrid.Controls.Add(this.tabControlManagers);
            }

            // Création d'une TabPage dans TabControlManagers
            TabPage TabPageManyToOne = new TabPage();

            TabPageManyToOne.Name = obj + item.Name;
            TabPageManyToOne.Text = affichageProperty.Titre + " : " + obj;

            this.tabControlManagers.TabPages.Add(TabPageManyToOne);

            // Insertion du formulaire
            form.Dock = DockStyle.Fill;
            TabPageManyToOne.Controls.Add(form);
            this.tabControlManagers.SelectedTab = TabPageManyToOne;
        }
Exemple #2
0
        /// <summary>
        /// Edit the collection OneToMany
        /// </summary>
        private void DataGridControl_EditManyToOneCollection(object sender, EventArgs e)
        {
            // Params
            BaseEntity   obj  = this.DataGridControl.SelectedEntity;
            PropertyInfo item = this.DataGridControl.SelectedProperty;

            // Annuler si la collection en Edition
            if (tabControlManagers.TabPages.ContainsKey(obj + item.Name))
            {
                tabControlManagers.SelectedTab = tabControlManagers.TabPages[obj + item.Name];
                return;
            }

            // Obient le Service de l'objet de Collection<Objet>
            Type            type_objet_of_collection    = item.PropertyType.GetGenericArguments()[0];
            IBaseRepository service_objet_of_collection = this.Service.CreateInstance_Of_Service_From_TypeEntity(type_objet_of_collection);
            // Valeur Initial du Filtre
            Dictionary <string, object> ValeursFiltre = new Dictionary <string, object>();

            ValeursFiltre[item.DeclaringType.Name] = obj.Id;
            EntityManagementControl form = new EntityManagementControl(service_objet_of_collection, ValeursFiltre, this.MdiParent);

            form.ShowFilter(false);
            // Insertion de la gestion à l'interface
            this.AddManyToOneManager(form, item, obj);
        }
        /// <summary>
        /// Ajouter une gestion ManyToOne à l'interface
        /// </summary>
        /// <param name="form"></param>
        private void AddManyToOneManager(EntityManagementControl form, PropertyInfo item, BaseEntity obj)
        {
            // Annotation de l'propriété
            AffichageProprieteAttribute affichageProperty = (AffichageProprieteAttribute)item
                                                            .GetCustomAttribute(typeof(AffichageProprieteAttribute), true);


            // Préparation de l'interface s'il n'est pas encors préparer
            if (this.tabControlManagers.Visible == false)
            {
                this.tabControlManagers.Visible  = true;
                this.tabControl_MainManager.Dock = DockStyle.Fill;
                this.tabControlManagers.TabPages["main"].Text = "Gestion des " + obj.GetAffichageClasseAttribute().Majuscule;
                this.tabControlManagers.TabPages["main"].Controls.Add(this.tabControl_MainManager);
                this.tabControlManagers.Dock = DockStyle.Fill;
                this.panelDataGrid.Controls.Add(this.tabControlManagers);
            }

            // Création d'une TabPage dans TabControlManagers
            TabPage TabPageManyToOne = new TabPage();

            TabPageManyToOne.Name = obj + item.Name;
            TabPageManyToOne.Text = affichageProperty.Titre + " : " + obj;

            this.tabControlManagers.TabPages.Add(TabPageManyToOne);

            // Insertion du formulaire
            form.Dock = DockStyle.Fill;
            TabPageManyToOne.Controls.Add(form);
            this.tabControlManagers.SelectedTab = TabPageManyToOne;
        }
Exemple #4
0
        /// <summary>
        ///  Création d'une interface de gestion des entity
        /// </summary>
        /// <param name="Service">Le service de gestion</param>
        /// <param name="formulaire">
        /// Le formulaire spécifique à l'objet Entity,
        /// pour ne pas utiliser le formulaire générique
        /// </param>
        /// <param name="ValeursFiltre">Les valeurs de filtre</param>
        public EntityManagementForm(
            IBaseRepository Service,
            BaseEntryForm formulaire,
            Dictionary <string, object> ValeursFiltre,
            Form FormApplicationMdi)
        {
            InitializeComponent();
            EntityManagementControl = new EntityManagementControl(Service,
                                                                  formulaire,
                                                                  null, null,
                                                                  ValeursFiltre, FormApplicationMdi);
            EntityManagementControl.Dock = DockStyle.Fill;

            this.Name = Service.GetType().ToString();
            this.Text = Service.getAffichageDansFormGestionAttribute().Titre;
            this.Controls.Add(EntityManagementControl);
        }