public void Int32Filed_Horizontal_Virtical_FieldChanged_Test() { Size SizeLabel = new Size(100, 20); Size SizeControl = new Size(100, 20); Int32Filed int32Filed_Horizontal = new Int32Filed(); int32Filed_Horizontal.SizeLabel = SizeLabel; int32Filed_Horizontal.SizeControl = SizeControl; int32Filed_Horizontal.OrientationField = Orientation.Horizontal; int32Filed_Horizontal.ValueChanged += Int32Filed_FieldChanged; int32Filed_Horizontal.Value = 5; Int32Filed int32Filed_Vertical = new Int32Filed(); int32Filed_Horizontal.StopAutoSizeConfig(); int32Filed_Horizontal.SizeLabel = SizeLabel; int32Filed_Horizontal.SizeControl = SizeControl; int32Filed_Horizontal.OrientationField = Orientation.Vertical; int32Filed_Horizontal.ConfigSizeField(); int32Filed_Vertical.ValueChanged += Int32Filed_FieldChanged; int32Filed_Vertical.Value = 5; Assert.AreEqual(int32Filed_Vertical.Value, 5); Assert.AreEqual(int32Filed_Horizontal.Value, 5); Assert.AreEqual(ValueAfterEvent, 10); }
public void ValueChanged(BaseEntryForm EntryForm, object sender) { BaseField field = sender as BaseField; switch (field.Name) { case nameof(LeaveAsk.leaveCategory): { //ComboBoxField leavecatfield = field as ComboBoxField; //ManyToOneField Stafffield = EntryForm.Fields[nameof(LeaveAsk.staff)] as ManyToOneField; //Staff staff = Stafffield.SelectedItem as Staff; //Int32Filed nbdays = EntryForm.Fields[nameof(LeaveAsk.nbDaysWanted)] as Int32Filed; ManyToOneField leavecatfield = EntryForm.Fields[nameof(LeaveAsk.leaveCategory)] as ManyToOneField; LeaveCategory leavecategory = leavecatfield.SelectedItem as LeaveCategory; ManyToOneField stafffield = EntryForm.Fields[nameof(LeaveAsk.staff)] as ManyToOneField; Staff staff = stafffield.SelectedItem as Staff; Int32Filed nbdays = EntryForm.Fields[nameof(LeaveAsk.nbDaysWanted)] as Int32Filed; if (leavecategory.Reference == "Administrativeleave") { staff.nbTotalDaysAdmin = staff.nbTotalDaysAdmin - nbdays; } } break; } }
public object GetFieldValue_From_Filter(Control FilterContainer, ConfigProperty ConfigProperty) { Int32Filed int32Filed = (Int32Filed)FilterContainer.Controls.Find(ConfigProperty.PropertyInfo.Name, true).First(); if ((int)int32Filed.Value != 0) { return(int32Filed.Value); } else { return(null); } }
public BaseField CreateField_In_Filter(CreateField_In_Filter_Params param) { Int32Filed int32Filed = new Int32Filed(); int32Filed.StopAutoSizeConfig(); int32Filed.Name = param.ConfigProperty.PropertyInfo.Name; int32Filed.SizeLabel = param.SizeLabel; int32Filed.SizeControl = param.SizeControl; int32Filed.OrientationField = Orientation.Horizontal; int32Filed.TabIndex = param.TabIndex; int32Filed.Text_Label = param.ConfigProperty.DisplayProperty.Titre; int32Filed.ConfigSizeField(); param.FilterContainer.Controls.Add(int32Filed); return(int32Filed); }
/// <summary> /// CreateField in EntryForm /// /// </summary> /// <param name="param"> /// param.PropertyInfo /// param.Location /// param.OrientationField /// param.SizeLabel /// param.SizeControl /// param.ConfigProperty /// param.TabIndex /// param.Service /// param.ConfigEntity /// param.TabControlForm /// param.Entity /// param.ConteneurFormulaire /// </param> /// <returns>the created field</returns> public BaseField CreateField_In_EntryForm(CreateFieldParams param) { Int32Filed int32Filed = new Int32Filed(); int32Filed.StopAutoSizeConfig(); int32Filed.Name = param.PropertyInfo.Name; int32Filed.Location = param.Location; int32Filed.OrientationField = param.OrientationField; int32Filed.SizeLabel = param.SizeLabel; int32Filed.SizeControl = param.SizeControl; int32Filed.TabIndex = param.TabIndex; int32Filed.Text_Label = param.ConfigProperty.DisplayProperty.Titre; int32Filed.ConfigSizeField(); // Insertion à l'interface param.ConteneurFormulaire.Controls.Add(int32Filed); return(int32Filed); }
/// <summary> /// Création et Initalisation des contrôles du formulaire /// </summary> private void GenerateFormIfNotGenerated() { // Generate if not generated if (!this.AutoGenerateField || this.isGeneratedForm) { return; } this.isGeneratedForm = true; #region Taille par défaut // Positions et Tailles par défaut int y_field = 0; int x_field = 0; int width_label = 100; int height_label = 10; int width_control = 200; int height_control = 25; int width_groueBox = 100; int height_groueBox = 200; // il ne sera pas utilisé // Orientation par défaut Orientation orientation = Orientation.Vertical; #endregion #region Préparation de l'interface par Panel et GroupeBox // Initalisation de l'interface avec TabControl this.InitTabPageInterface(); // Création des groupBox s'il existe Dictionary <string, Control> GroupesBoxMainContainers = new Dictionary <string, Control>(); this.CreateGroupesBoxes(GroupesBoxMainContainers, width_groueBox, height_groueBox); #endregion // L'index de la touche Entrer int TabIndex = 0; var listeProprite = from i in this.Service.TypeEntity.GetProperties() where i.GetCustomAttribute(typeof(EntryFormAttribute)) != null orderby((EntryFormAttribute)i.GetCustomAttribute(typeof(EntryFormAttribute))).Ordre select i; // Affichage des champs par leurs type foreach (PropertyInfo item in listeProprite) { #region Recalcule des valeurs pardéfaut selon l'annotation de chauqe champs // l'annotation ConfigProperty configProperty = new ConfigProperty(item, this.ConfigEntity); // Taile du Field int width_control_config = width_control; if (configProperty.EntryForm?.WidthControl != 0) { width_control_config = configProperty.EntryForm.WidthControl; } // Orientation Orientation orientation_config = orientation; if (configProperty.EntryForm?.UseOrientationField == true) { orientation_config = configProperty.EntryForm.OrientationField; } #endregion Control field_control = null; Control FiledContainner = this.ConteneurFormulaire; if (configProperty.EntryForm?.GroupeBox != null && configProperty.EntryForm?.GroupeBox != string.Empty) { FiledContainner = GroupesBoxMainContainers[configProperty.EntryForm?.GroupeBox]; } switch (item.PropertyType.Name) { #region Champs String case "String": StringField stringFiled = new StringField( item, orientation_config, new Size(width_label, height_label), new Size(width_control_config, height_control), this.ConfigEntity); stringFiled.Location = new System.Drawing.Point(x_field, y_field); stringFiled.Name = item.Name; stringFiled.TabIndex = ++TabIndex; stringFiled.Text_Label = configProperty.DisplayProperty.Titre; stringFiled.FieldChanged += ControlPropriete_ValueChanged; if (configProperty.EntryForm?.isOblegatoir == true) { stringFiled.ValidatingFiled += textBoxString_Validating; } // Insertion à l'interface this.ConteneurFormulaire.Controls.Add(stringFiled); field_control = stringFiled; break; #endregion #region Champs Int32 case "Int32": Int32Filed int32Filed = new Int32Filed( item, orientation_config, new Size(width_label, height_label), new Size(width_control_config, height_control), this.ConfigEntity); int32Filed.Location = new System.Drawing.Point(x_field, y_field); int32Filed.Name = item.Name; int32Filed.TabIndex = ++TabIndex; int32Filed.Text_Label = configProperty.DisplayProperty.Titre; int32Filed.FieldChanged += ControlPropriete_ValueChanged; if (configProperty.EntryForm?.isOblegatoir == true) { int32Filed.ValidatingFiled += TextBoxInt32_Validating; } // Insertion à l'interface this.ConteneurFormulaire.Controls.Add(int32Filed); field_control = int32Filed; break; #endregion #region Champs DateTime case "DateTime": DateTimeField dateTimeField = new DateTimeField( item, orientation_config, new Size(width_label, height_label), new Size(width_control_config, height_control), this.ConfigEntity); dateTimeField.Location = new System.Drawing.Point(x_field, y_field); dateTimeField.Name = item.Name; dateTimeField.TabIndex = ++TabIndex; dateTimeField.Text_Label = configProperty.DisplayProperty.Titre; dateTimeField.FieldChanged += ControlPropriete_ValueChanged; if (configProperty.EntryForm?.isOblegatoir == true) { dateTimeField.ValidatingFiled += DateTimePicker_Validating; } // Insertion à l'interface this.ConteneurFormulaire.Controls.Add(dateTimeField); field_control = dateTimeField; break; #endregion default: { #region Champs : ManyToOne if (configProperty.Relationship?.Relation == RelationshipAttribute.Relations.ManyToOne) { // Déterminer le contenue du Field ManyToOne : GroupeBox ou Panel Control ConteneurManyToMany = this.ConteneurFormulaire; if (configProperty.EntryForm?.GroupeBox != null && configProperty.EntryForm?.GroupeBox != string.Empty) { ConteneurManyToMany = GroupesBoxMainContainers[configProperty.EntryForm?.GroupeBox]; } // Création de champs ManyToOneField Int64 InitValue = 0; //if (ValeursFiltre != null && ValeursFiltre.Keys.Contains(properperty.DisplayProperty.TitretyInfo.Name)) // default_value = (Int64)ValeursFiltre[propertyInfo.Name]; ManyToOneField manyToOneField = new ManyToOneField(this.Service, item, ConteneurManyToMany, orientation_config, new Size(width_label, height_label), new Size(width_control_config, height_control), InitValue, this.ConfigEntity ); manyToOneField.Location = new System.Drawing.Point(x_field, y_field); manyToOneField.Name = item.Name; manyToOneField.TabIndex = ++TabIndex; manyToOneField.Text_Label = configProperty.DisplayProperty.Titre; manyToOneField.FieldChanged += ControlPropriete_ValueChanged; if (configProperty.EntryForm?.isOblegatoir == true) { manyToOneField.Validating += ComboBox_Validating; } this.ConteneurFormulaire.Controls.Add(manyToOneField); field_control = manyToOneField; } #endregion #region Champs ManyToMany if (configProperty.Relationship?.Relation == RelationshipAttribute.Relations.ManyToMany) { if (configProperty.EntryForm?.TabPage == true) { TabPage tabPage = new TabPage(); tabPage.Name = "tabPage" + item.Name; tabPage.Text = configProperty.DisplayProperty.Titre; tabControlForm.TabPages.Add(tabPage); FiledContainner = tabPage; } //Trouver les Valeurs par défaut List <BaseEntity> ls_default_value = null; if (this.Entity != null) { IList ls_obj = item.GetValue(this.Entity) as IList; if (ls_obj != null) { ls_default_value = ls_obj.Cast <BaseEntity>().ToList(); } } ManyToManyField manyToManyField = new ManyToManyField(item, orientation_config, new Size(width_label, height_label), new Size(width_control_config, height_control), this.ConfigEntity, FiledContainner, this.Service); manyToManyField.Name = item.Name; manyToManyField.FieldChanged += ControlPropriete_ValueChanged; if (configProperty.EntryForm?.TabPage == true) { manyToManyField.Dock = DockStyle.Fill; } field_control = manyToManyField; } #endregion } break; } // Fin de suitch FiledContainner.Controls.Add(field_control); // Insertion du Champs dans sa GroupeBox si il existe // [Bug] il n'est pas supprimé de l'inrface, car il est déja ajouté }// Fin de for // TabControl sur Enregistrer et Annuler this.btEnregistrer.TabIndex = ++TabIndex; this.btAnnuler.TabIndex = ++TabIndex; foreach (GroupBox item in this.ConteneurFormulaire.Controls.Cast <Control>().Where(c => c.GetType() == typeof(GroupBox))) { // item.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold); item.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); } foreach (FlowLayoutPanel item in GroupesBoxMainContainers.Values) { item.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); } }
/// <summary> /// Obtient les valeurs du filtre /// </summary> /// <returns></returns> public Dictionary <string, object> CritereRechercheFiltre() { // Application de filtre Dictionary <string, object> RechercheInfos = new Dictionary <string, object>(); foreach (PropertyInfo propertyInfo in PropertyListFilter()) { // Trouver l'objet AffichagePropriete depuis l'annotation avec Filtre = True Attribute getAffichagePropriete = propertyInfo.GetCustomAttribute(typeof(AffichageProprieteAttribute)); if (getAffichagePropriete == null) { continue; } AffichageProprieteAttribute AffichagePropriete = (AffichageProprieteAttribute)getAffichagePropriete; if (AffichagePropriete.Filtre == false) { continue; } switch (propertyInfo.PropertyType.Name) { case "String": { StringFiled stringFiled = (StringFiled)this.groupBoxFiltrage.Controls.Find(propertyInfo.Name, true).First(); if (stringFiled.Value != String.Empty) { RechercheInfos[propertyInfo.Name] = stringFiled.Value; } } break; case "Int32": { Int32Filed int32Filed = (Int32Filed)this.groupBoxFiltrage.Controls.Find(propertyInfo.Name, true).First(); if ((int)int32Filed.Value != 0) { RechercheInfos[propertyInfo.Name] = int32Filed.Value; } } break; case "DateTime": { DateTimeField dateTimeField = (DateTimeField)this.groupBoxFiltrage.Controls.Find(propertyInfo.Name, true).First(); if ((DateTime)dateTimeField.Value != DateTime.MinValue) { RechercheInfos[propertyInfo.Name] = dateTimeField.Value; } } break; default: // Dans le cas d'un objet de type BaseEntity { // [bug] groupBoxFiltrage doit être MainContainner ManyToOneField ComboBoxEntity = (ManyToOneField)this.groupBoxFiltrage.Controls.Find(propertyInfo.Name, true).First(); BaseEntity obj = (BaseEntity)ComboBoxEntity.SelectedItem; if (obj != null && Convert.ToInt32(obj.Id) != 0) { RechercheInfos[propertyInfo.Name] = obj.Id; } } break; } } return(RechercheInfos); }
/// <summary> /// Initialisation de filtre /// </summary> protected void initFiltre() { // Postion et Taille par défaut int width_label = 50; int height_label = 20; int width_control = 50; int height_control = 20; int TabIndex = 0; // Insertion des critère de recherche par Type foreach (PropertyInfo propertyInfo in PropertyListFilter()) { // Trouver l'objet AffichagePropriete depuis l'annotation Attribute getAffichagePropriete = propertyInfo.GetCustomAttribute(typeof(AffichageProprieteAttribute)); if (getAffichagePropriete == null) { continue; } AffichageProprieteAttribute AffichagePropriete = (AffichageProprieteAttribute)getAffichagePropriete; if (AffichagePropriete.Filtre == false) { continue; } // Utiliser le Largeur de la configuration s'il existe int item_width_control = width_control; if (AffichagePropriete.WidthColonne != 0) { item_width_control = AffichagePropriete.WidthColonne; } if (propertyInfo.PropertyType.Name == "String") { StringFiled stringFiled = new StringFiled(propertyInfo, Orientation.Horizontal, new Size(width_label, height_label), new Size(item_width_control, height_control)); stringFiled.Name = propertyInfo.Name; stringFiled.TabIndex = TabIndex++; stringFiled.Text_Label = AffichagePropriete.Titre; stringFiled.FieldChanged += Filtre_TextBox_SelectedValueChanged; MainContainer.Controls.Add(stringFiled); } if (propertyInfo.PropertyType.Name == "Int32") { Int32Filed int32Filed = new Int32Filed(propertyInfo, Orientation.Vertical, new Size(width_label, height_label), new Size(item_width_control, height_control) ); int32Filed.Name = propertyInfo.Name; int32Filed.TabIndex = TabIndex++; int32Filed.Text_Label = AffichagePropriete.Titre; int32Filed.FieldChanged += Filtre_TextBox_SelectedValueChanged; MainContainer.Controls.Add(int32Filed); } if (propertyInfo.PropertyType.Name == "DateTime") { DateTimeField dateTimeField = new DateTimeField(propertyInfo, Orientation.Vertical, new Size(width_label, height_label), new Size(item_width_control, height_control) ); dateTimeField.Name = propertyInfo.Name; dateTimeField.TabIndex = TabIndex++; dateTimeField.Text_Label = AffichagePropriete.Titre; dateTimeField.FieldChanged += Filtre_TextBox_SelectedValueChanged; MainContainer.Controls.Add(dateTimeField); } // // Relation ManyToOne // if (AffichagePropriete.Relation != String.Empty && AffichagePropriete.Relation == AffichageProprieteAttribute.RELATION_MANYTOONE) { // La valeurs pardéfaut Int64 default_value = 0; if (ValeursFiltre != null && ValeursFiltre.Keys.Contains(propertyInfo.Name)) { default_value = (Int64)ValeursFiltre[propertyInfo.Name]; } ManyToOneField manyToOneField = new ManyToOneField(this.Service, propertyInfo, this.MainContainer, Orientation.Horizontal, new Size(width_label, height_label), new Size(item_width_control, height_control), default_value ); manyToOneField.Name = propertyInfo.Name; manyToOneField.TabIndex = TabIndex++; manyToOneField.Text_Label = AffichagePropriete.Titre; manyToOneField.FieldChanged += Filtre_ComboBox_SelectedValueChanged; MainContainer.Controls.Add(manyToOneField); // // Remplissage de ComboBox // //Type ServicesEntityEnRelationType = typeof(BaseRepository<>).MakeGenericType(propertyInfo.PropertyType); //IBaseRepository ServicesEntity = (IBaseRepository)Activator.CreateInstance(ServicesEntityEnRelationType); //List<object> ls = ServicesEntity.GetAllDetached(); //manyToOneField.ValueMember = "Id"; //manyToOneField.DisplayMember = AffichagePropriete.DisplayMember; //manyToOneField.DataSource = ls; //if (AffichagePropriete.isValeurFiltreVide) manyToOneField.SelectedIndex = -1; //// Affectation de valeur initial //if (this.ValeursFiltre != null && this.ValeursFiltre.ContainsKey(propertyInfo.Name)) //{ // manyToOneField.CreateControl(); // manyToOneField.Value = Convert.ToInt64(this.ValeursFiltre[propertyInfo.Name]); //} } //if (MainContainer.Controls.Count > 0) //{ // int max_h = this.MainContainer.Controls.Cast<Control>().Max(c => c.Size.Height); // this.MainContainer.Size = new Size(this.MainContainer.Size.Width, max_h); //} } // End For }
/// <summary> /// Obtient les valeurs du filtre /// </summary> /// <returns></returns> public Dictionary <string, object> CritereRechercheFiltre() { // Application de filtre Dictionary <string, object> RechercheInfos = new Dictionary <string, object>(); var PropertyListFilter = from i in Service.TypeEntity.GetProperties() where i.GetCustomAttribute(typeof(FilterAttribute)) != null orderby((FilterAttribute)i.GetCustomAttribute(typeof(FilterAttribute))).Ordre select i; foreach (PropertyInfo propertyInfo in PropertyListFilter) { switch (propertyInfo.PropertyType.Name) { case "String": { StringField stringFiled = (StringField)this.groupBoxFiltrage.Controls.Find(propertyInfo.Name, true).First(); if (stringFiled.Value != String.Empty) { RechercheInfos[propertyInfo.Name] = stringFiled.Value; } } break; case "Int32": { Int32Filed int32Filed = (Int32Filed)this.groupBoxFiltrage.Controls.Find(propertyInfo.Name, true).First(); if ((int)int32Filed.Value != 0) { RechercheInfos[propertyInfo.Name] = int32Filed.Value; } } break; case "DateTime": { DateTimeField dateTimeField = (DateTimeField)this.groupBoxFiltrage.Controls.Find(propertyInfo.Name, true).First(); if ((DateTime)dateTimeField.Value != DateTime.MinValue) { RechercheInfos[propertyInfo.Name] = dateTimeField.Value; } } break; default: // Dans le cas d'un objet de type BaseEntity { ConfigProperty ConfigProperty = new ConfigProperty(propertyInfo, this.ConfigEntity); if (ConfigProperty.Relationship.Relation == RelationshipAttribute.Relations.ManyToOne) { // [bug] groupBoxFiltrage doit être MainContainner ManyToOneField ComboBoxEntity = (ManyToOneField)this.groupBoxFiltrage.Controls.Find(propertyInfo.Name, true).First(); BaseEntity obj = (BaseEntity)ComboBoxEntity.SelectedItem; if (obj != null && Convert.ToInt32(obj.Id) != 0) { RechercheInfos[propertyInfo.Name] = obj.Id; } } } break; } } return(RechercheInfos); }
/// <summary> /// Initialisation de filtre /// </summary> protected void initFiltre() { // Postion et Taille par défaut int width_label = 100; int height_label = 25; int width_control = 100; int height_control = 20; int TabIndex = 0; var propertyListFilter = from i in Service.TypeEntity.GetProperties() where i.GetCustomAttribute(typeof(FilterAttribute)) != null orderby((FilterAttribute)i.GetCustomAttribute(typeof(FilterAttribute))).Ordre select i; // Insertion des critère de recherche par Type foreach (PropertyInfo propertyInfo in propertyListFilter) { ConfigProperty attributesOfProperty = new ConfigProperty(propertyInfo, this.ConfigEntity); // Utiliser le Largeur de la configuration s'il existe int item_width_control = width_control; if (attributesOfProperty.Filter?.WidthControl != 0) { item_width_control = attributesOfProperty.Filter.WidthControl; } if (propertyInfo.PropertyType.Name == "String") { StringField stringFiled = new StringField( propertyInfo, Orientation.Horizontal, new Size(width_label, height_label), new Size(item_width_control, height_control) , this.ConfigEntity); stringFiled.Name = propertyInfo.Name; stringFiled.TabIndex = TabIndex++; stringFiled.Text_Label = attributesOfProperty.DisplayProperty.Titre; stringFiled.FieldChanged += Filtre_TextBox_SelectedValueChanged; MainContainer.Controls.Add(stringFiled); } if (propertyInfo.PropertyType.Name == "Int32") { Int32Filed int32Filed = new Int32Filed(propertyInfo, Orientation.Vertical, new Size(width_label, height_label), new Size(item_width_control, height_control), this.ConfigEntity ); int32Filed.Name = propertyInfo.Name; int32Filed.TabIndex = TabIndex++; int32Filed.Text_Label = attributesOfProperty.DisplayProperty.Titre; int32Filed.FieldChanged += Filtre_TextBox_SelectedValueChanged; MainContainer.Controls.Add(int32Filed); } if (propertyInfo.PropertyType.Name == "DateTime") { DateTimeField dateTimeField = new DateTimeField(propertyInfo, Orientation.Vertical, new Size(width_label, height_label), new Size(item_width_control, height_control), this.ConfigEntity ); dateTimeField.Name = propertyInfo.Name; dateTimeField.TabIndex = TabIndex++; dateTimeField.Text_Label = attributesOfProperty.DisplayProperty.Titre; dateTimeField.FieldChanged += Filtre_TextBox_SelectedValueChanged; MainContainer.Controls.Add(dateTimeField); } // // Relation ManyToOne // if (attributesOfProperty.Relationship?.Relation != RelationshipAttribute.Relations.Empty && attributesOfProperty.Relationship?.Relation == RelationshipAttribute.Relations.ManyToOne) { // La valeurs pardéfaut Int64 default_value = 0; if (ValeursFiltre != null && ValeursFiltre.Keys.Contains(propertyInfo.PropertyType.Name)) { default_value = (Int64)ValeursFiltre[propertyInfo.PropertyType.Name]; } ManyToOneField manyToOneField = new ManyToOneField(this.Service, propertyInfo, this.MainContainer, Orientation.Horizontal, new Size(width_label, height_label), new Size(item_width_control, height_control), default_value, ConfigEntity ); manyToOneField.Name = propertyInfo.Name; manyToOneField.TabIndex = TabIndex++; manyToOneField.Text_Label = attributesOfProperty.DisplayProperty.Titre; manyToOneField.FieldChanged += Filtre_ComboBox_SelectedValueChanged; MainContainer.Controls.Add(manyToOneField); // // Remplissage de ComboBox // //Type ServicesEntityEnRelationType = typeof(BaseRepository<>).MakeGenericType(propertyInfo.PropertyType); //IBaseRepository ServicesEntity = (IBaseRepository)Activator.CreateInstance(ServicesEntityEnRelationType); //List<object> ls = ServicesEntity.GetAllDetached(); //manyToOneField.ValueMember = "Id"; //manyToOneField.DisplayMember = AffichagePropriete.DisplayMember; //manyToOneField.DataSource = ls; //if (AffichagePropriete.isValeurFiltreVide) manyToOneField.SelectedIndex = -1; //// Affectation de valeur initial //if (this.ValeursFiltre != null && this.ValeursFiltre.ContainsKey(propertyInfo.Name)) //{ // manyToOneField.CreateControl(); // manyToOneField.Value = Convert.ToInt64(this.ValeursFiltre[propertyInfo.Name]); //} } //if (MainContainer.Controls.Count > 0) //{ // int max_h = this.MainContainer.Controls.Cast<Control>().Max(c => c.Size.Height); // this.MainContainer.Size = new Size(this.MainContainer.Size.Width, max_h); //} } // End For }