/// <summary> /// Initialisation et Création des controles /// </summary> /// <param name="service"></param> /// <param name="formulaire"></param> protected void initControls() { // // Interface de gestion // AffichageDansFormGestionAttribute AffichageDansFormGestion = this.Service.getAffichageDansFormGestionAttribute(); this.Name = "Interface_Gestion_" + this.Service.TypeEntity.ToString(); this.Text = AffichageDansFormGestion.Titre; this.bt_Ajouter.Text = AffichageDansFormGestion.TitreButtonAjouter; lbl_titre_gestion.Text = AffichageDansFormGestion.Titre; // // Initialisation de filtre // this.BaseFilterControl = new EntityFilterControl(this.Service, this.ValeursFiltre); this.BaseFilterControl.Dock = DockStyle.Fill; this.panel_Filtre.Controls.Add(this.BaseFilterControl); this.BaseFilterControl.RefreshEvent += BaseFilterControl_RefreshEvent; // // Initialisation de DataGrid // this.EntityManagerControl = new EntityTabControl( this.Service, this.BaseFilterControl, this.FormApplicationMdi, this.Formulaire); this.EntityManagerControl.Dock = DockStyle.Fill; this.panelDataGrid.Controls.Add(this.EntityManagerControl); }
protected void setTitre() { AffichageDansFormGestionAttribute AffichageDansFormGestion = this.Service.getAffichageDansFormGestionAttribute(); this.Text = AffichageDansFormGestion.Titre; TabPage tabGrid = this.tabControl.TabPages["TabGrid"]; tabGrid.Text = AffichageDansFormGestion.TitrePageGridView; }
/// <summary> /// Obtien l'annotion 'AffichageDansFormGestion' de la classe Entity /// pour le paramétrage des titre de l'interface de gestion /// </summary> /// <returns></returns> public AffichageDansFormGestionAttribute getAffichageDansFormGestionAttribute() { Object[] ls_attribut = this.TypeEntity.GetCustomAttributes(typeof(AffichageDansFormGestionAttribute), false); if (ls_attribut == null || ls_attribut.Count() == 0) { return(new AffichageDansFormGestionAttribute()); } AffichageDansFormGestionAttribute AffichageDansFormGestion = (AffichageDansFormGestionAttribute)ls_attribut[0]; return(AffichageDansFormGestion); }
/// <summary> /// Initialisation et Création des controles /// </summary> /// <param name="service"></param> /// <param name="formulaire"></param> protected void initControls() { // // TabControlManager, il contient tous les autres manager // this.tabControl_MainManager.Dock = DockStyle.Fill; this.tabControlManagers.Visible = false; this.panelDataGrid.Controls.Add(this.tabControl_MainManager); // // Formulaire // if (this.Formulaire == null) { this.Formulaire = new EntryForm(this.Service); } // // Filtre // if (this.FilterControl == null) { this.FilterControl = new EntityFilterControl(this.Service, this.ValeursFiltre); } this.FilterControl.Dock = DockStyle.Fill; this.panel_Filtre.Controls.Add(this.FilterControl); this.FilterControl.RefreshEvent += BaseFilterControl_RefreshEvent; // // DataGrid // if (this.DataGridControl == null) { this.DataGridControl = new EntityDataGridControl(this.Service, this.ValeursFiltre); } this.DataGridControl.Dock = DockStyle.Fill; this.tabControl_MainManager.TabPages["TabGrid"].Controls.Add(this.DataGridControl); this.DataGridControl.EditClick += EntityDataGridControl_EditClick; this.DataGridControl.EditManyToOneCollection += DataGridControl_EditManyToOneCollection; this.DataGridControl.EditManyToManyCollection += DataGridControl_EditManyToManyCollection; // // Modification des Titre // AffichageDansFormGestionAttribute AffichageDansFormGestion = this.Service.getAffichageDansFormGestionAttribute(); this.Name = "Interface_Gestion_" + this.Service.TypeEntity.ToString(); this.Text = AffichageDansFormGestion.Titre; this.tabPageAdd.ToolTipText = AffichageDansFormGestion.TitreButtonAjouter; lbl_titre_gestion.Text = AffichageDansFormGestion.Titre; this.tabControl_MainManager.TabPages["TabGrid"].Text = AffichageDansFormGestion.TitrePageGridView; }
/// <summary> /// Insertion des colonne selon les annotation : AffichageProprieteAttribute /// </summary> private void InitDataGridView() { InitPropertyListDataGrid(); int index_colonne = 0; AffichageDansFormGestionAttribute AffichageDansFormGestion = this.Service.getAffichageDansFormGestionAttribute(); foreach (PropertyInfo propertyInfo in this.ListePropriete) { if (propertyInfo.Name == "Ordre" && !AffichageDansFormGestion.siAffichageAvecOrdre) { continue; } // Trouver l'objet AffichagePropriete depuis l'annotation Attribute getAffichagePropriete = propertyInfo.GetCustomAttribute(typeof(AffichageProprieteAttribute)); if (getAffichagePropriete == null) { continue; } AffichageProprieteAttribute AffichagePropriete = (AffichageProprieteAttribute)getAffichagePropriete; // Insertion des la colonne selon le tupe de la propriété DataGridViewColumn colonne = new DataGridViewTextBoxColumn();; index_colonne++; switch (propertyInfo.PropertyType.Name) { case "String": { colonne.ValueType = typeof(String); colonne.DataPropertyName = propertyInfo.Name; } break; case "Integer": { colonne.ValueType = typeof(String); colonne.DataPropertyName = propertyInfo.Name; } break; case "DateTime": { colonne = new DataGridViewTextBoxColumn(); colonne.ValueType = typeof(DateTime); colonne.DataPropertyName = propertyInfo.Name; } break; case "List`1": { DataGridViewButtonColumn c = new DataGridViewButtonColumn(); c.UseColumnTextForButtonValue = true; c.Text = propertyInfo.Name; colonne = c; colonne.ReadOnly = true; } break; default: { colonne.DataPropertyName = propertyInfo.Name; } break; } colonne.HeaderText = AffichagePropriete.Titre; colonne.Name = propertyInfo.Name; colonne.ReadOnly = true; if (AffichagePropriete.WidthColonne != 0) { colonne.Width = AffichagePropriete.WidthColonne; } this.dataGridView.Columns.Insert(index_colonne, colonne); } }