/// <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>
        /// Création et Initalisation des contrôles du formulaire
        /// </summary>
        private void GenerateForm()
        {
            #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;

            // Affichage des champs par leurs type
            foreach (PropertyInfo item in ListeChampsFormulaire())
            {
                #region Recalcule des valeurs pardéfaut selon l'annotation de chauqe champs
                // l'annotation
                AffichageProprieteAttribute AffichagePropriete = (AffichageProprieteAttribute)item.GetCustomAttribute(typeof(AffichageProprieteAttribute));

                // Taile du Field
                int width_control_config = width_control;
                if (AffichagePropriete.WidthControl != 0)
                {
                    width_control_config = AffichagePropriete.WidthControl;
                }

                // Orientation
                Orientation orientation_config = orientation;
                if (AffichagePropriete.UseOrientationField)
                {
                    orientation_config = AffichagePropriete.OrientationField;
                }
                #endregion

                Control field_control = null;
                switch (item.PropertyType.Name)
                {
                    #region Champs String
                case "String":


                    StringFiled stringFiled = new StringFiled(
                        item,
                        orientation_config,
                        new Size(width_label, height_label),
                        new Size(width_control_config, height_control));
                    stringFiled.Location      = new System.Drawing.Point(x_field, y_field);
                    stringFiled.Name          = item.Name;
                    stringFiled.TabIndex      = ++TabIndex;
                    stringFiled.Text_Label    = AffichagePropriete.Titre;
                    stringFiled.FieldChanged += ControlPropriete_ValueChanged;
                    if (AffichagePropriete.isOblegatoir)
                    {
                        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));
                    int32Filed.Location      = new System.Drawing.Point(x_field, y_field);
                    int32Filed.Name          = item.Name;
                    int32Filed.TabIndex      = ++TabIndex;
                    int32Filed.Text_Label    = AffichagePropriete.Titre;
                    int32Filed.FieldChanged += ControlPropriete_ValueChanged;
                    if (AffichagePropriete.isOblegatoir)
                    {
                        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));
                    dateTimeField.Location      = new System.Drawing.Point(x_field, y_field);
                    dateTimeField.Name          = item.Name;
                    dateTimeField.TabIndex      = ++TabIndex;
                    dateTimeField.Text_Label    = AffichagePropriete.Titre;
                    dateTimeField.FieldChanged += ControlPropriete_ValueChanged;
                    if (AffichagePropriete.isOblegatoir)
                    {
                        dateTimeField.ValidatingFiled += DateTimePicker_Validating;
                    }
                    // Insertion à l'interface
                    this.ConteneurFormulaire.Controls.Add(dateTimeField);
                    field_control = dateTimeField;
                    break;
                    #endregion

                default:
                {
                    #region Champs : ManyToOne
                    if (AffichagePropriete.Relation == "ManyToOne")
                    {
                        // Déterminer le contenue du Field ManyToOne : GroupeBox ou Panel
                        Control ConteneurManyToMany = this.ConteneurFormulaire;
                        if (AffichagePropriete.GroupeBox != null && AffichagePropriete.GroupeBox != string.Empty)
                        {
                            ConteneurManyToMany = GroupesBoxMainContainers[AffichagePropriete.GroupeBox];
                        }

                        // Création de champs ManyToOneField
                        Int64 InitValue = 0;
                        //if (ValeursFiltre != null && ValeursFiltre.Keys.Contains(propertyInfo.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
                                                                           );
                        manyToOneField.Location      = new System.Drawing.Point(x_field, y_field);
                        manyToOneField.Name          = item.Name;
                        manyToOneField.TabIndex      = ++TabIndex;
                        manyToOneField.Text_Label    = AffichagePropriete.Titre;
                        manyToOneField.FieldChanged += ControlPropriete_ValueChanged;
                        if (AffichagePropriete.isOblegatoir)
                        {
                            manyToOneField.Validating += ComboBox_Validating;
                        }
                        this.ConteneurFormulaire.Controls.Add(manyToOneField);
                        field_control = manyToOneField;
                    }
                    #endregion

                    #region Champs ManyToMany
                    if (AffichagePropriete.Relation == "ManyToMany")
                    {
                        //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();
                            }
                        }

                        InputCollectionControle InputCollectionControle = new InputCollectionControle(this.Service, item, ls_default_value, this.Entity);
                        InputCollectionControle.Name          = item.Name;
                        InputCollectionControle.ValueChanged += ControlPropriete_ValueChanged;

                        if (AffichagePropriete.TabPage)
                        {
                            InputCollectionControle.Dock = DockStyle.Fill;
                            TabPage tabPage = new TabPage();
                            tabPage.Name = "tabPage" + item.Name;
                            tabPage.Text = AffichagePropriete.Titre;
                            tabPage.Controls.Add(InputCollectionControle);
                            tabControlForm.TabPages.Add(tabPage);
                        }
                        else
                        {
                            this.ConteneurFormulaire.Controls.Add(InputCollectionControle);
                            field_control = InputCollectionControle;
                        }
                    }
                    #endregion
                }
                break;
                } // Fin de suitch

                // Insertion du Champs dans sa GroupeBox si il existe
                // [Bug] il n'est pas supprimé de l'inrface, car il est déja ajouté
                if (field_control != null && AffichagePropriete.GroupeBox != null && AffichagePropriete.GroupeBox != string.Empty)
                {
                    GroupesBoxMainContainers[AffichagePropriete.GroupeBox].Controls.Add(field_control);
                }
            }// 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>
        /// 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
        }