Ejemplo n.º 1
0
        /// <summary>
        /// Affichage du filtre dans l'interface
        /// Remplissage de ListeComboBox
        /// </summary>
        private void InitInterface()
        {
            this.DisplayMember = "";
            this.ValueMember   = "Id";


            int index = 10;

            // Si un objet du critère de selection exite dans la classe
            // Nous cherchons sa valeur pour l'utiliser
            foreach (Type item in this.ConfigProperty.SelectionCriteria.CriteriasTypes)
            {
                // Meta information d'affichage du de Critère
                GwinEntityAttribute DisplayEntityAttributeCritere = (GwinEntityAttribute)item.GetCustomAttribute(typeof(GwinEntityAttribute));

                // Size Filter Item
                Size SizeControlFilter = new Size(this.SizeControl.Width, 25);

                ManyToOneField manyToOneFilter = new ManyToOneField(this.Service, item, null, null,
                                                                    this.OrientationFiled,
                                                                    this.SizeLabel,
                                                                    SizeControlFilter, 0, this.ConfigProperty.ConfigEntity, this.ValueEntity
                                                                    );
                manyToOneFilter.Name = item.Name;
                //manyToOneFilter.Size = new System.Drawing.Size(this.widthField, this.HeightField);

                manyToOneFilter.TabIndex   = ++index;
                manyToOneFilter.Text_Label = item.Name;

                manyToOneFilter.ValueMember   = "Id";
                manyToOneFilter.DisplayMember = DisplayEntityAttributeCritere.DisplayMember;
                // pour le chargement de comboBox Suivant
                manyToOneFilter.ValueChanged += Value_SelectedIndexChanged;

                manyToOneFilter.Visible = true;

                // [bug] Le contôle ne s'affiche pas dans le formilaire ??
                //Form f = new Form();
                //f.Controls.Add(manyToOneFilter);
                //f.Show();

                this.MainContainner.Controls.Add(manyToOneFilter);

                ListeComboBox.Add(item.Name, manyToOneFilter);
                LsiteTypeObjetCritere.Add(item.Name, item);
            }
        }
        /// <summary>
        /// Affichage du filtre dans l'interface
        /// Remplissage de ListeComboBox
        /// </summary>
        private void InitAndLoadData()
        {
            this.DisplayMember = "";
            this.ValueMember   = "Id";


            if (this.PropertyInfo != null)
            {
                // DisplayMember de combobox actuel
                // Annotation : Affichage de l'objet

                DisplayEntityAttribute MetaAffichageClasse = this.ConfigEntity.DisplayEntity;

                this.DisplayMember = MetaAffichageClasse.DisplayMember;
                this.Text_Label    = MetaAffichageClasse.SingularName;

                Attribute getAffichagePropriete             = PropertyInfo.GetCustomAttribute(typeof(DisplayPropertyAttribute));
                DisplayPropertyAttribute AffichagePropriete = (DisplayPropertyAttribute)getAffichagePropriete;

                #region Annotatin
                // Annotation : Critère de filtre
                Attribute metaSelectionCriteriaAttribute = this.PropertyInfo.PropertyType
                                                           .GetCustomAttribute(typeof(SelectionCriteriaAttribute));


                if (metaSelectionCriteriaAttribute != null)
                {
                    SelectionCriteriaAttribute MetaSelectionCriteria =
                        (SelectionCriteriaAttribute)metaSelectionCriteriaAttribute;

                    #endregion


                    int index = 10;

                    // Si un objet du critère de selection exite dans la classe
                    // Nous cherchons sa valeur pour l'utiliser
                    foreach (Type item in MetaSelectionCriteria.Criteria)
                    {
                        // Meta information d'affichage du de Critère
                        DisplayEntityAttribute MetaAffichageClasseCritere = (DisplayEntityAttribute)item.GetCustomAttribute(typeof(DisplayEntityAttribute));


                        ManyToOneField manyToOneFilter = new ManyToOneField(this.Service, item, null, null,
                                                                            this.orientationFiled,
                                                                            this.SizeLabel,
                                                                            this.SizeControl, 0, ConfigEntity
                                                                            );
                        manyToOneFilter.Name = item.Name;
                        //manyToOneFilter.Size = new System.Drawing.Size(this.widthField, this.HeightField);

                        manyToOneFilter.TabIndex   = ++index;
                        manyToOneFilter.Text_Label = item.Name;

                        manyToOneFilter.ValueMember   = "Id";
                        manyToOneFilter.DisplayMember = MetaAffichageClasseCritere.DisplayMember;
                        // pour le chargement de comboBox Suivant
                        manyToOneFilter.FieldChanged += Value_SelectedIndexChanged;

                        manyToOneFilter.Visible = true;

                        // [bug] Le contôle ne s'affiche pas dans le formilaire ??
                        //Form f = new Form();
                        //f.Controls.Add(manyToOneFilter);
                        //f.Show();

                        this.MainContainner.Controls.Add(manyToOneFilter);

                        ListeComboBox.Add(item.Name, manyToOneFilter);
                        LsiteTypeObjetCritere.Add(item.Name, item);
                    }
                }

                // Insertion du ComBox Actuel pour qu'il sera remplit par les données
                ListeComboBox.Add(this.PropertyInfo.PropertyType.Name, this);
                LsiteTypeObjetCritere.Add(this.PropertyInfo.PropertyType.Name, this.PropertyInfo.PropertyType);
            }
            else
            {
                // Cas des sous ComBobox de filtre

                // Insertion du ComBox Actuel pour qu'il sera remplit par les données
                ListeComboBox.Add(this.TypeOfObject.Name, this);
                LsiteTypeObjetCritere.Add(this.TypeOfObject.Name, this.TypeOfObject);
            }
            this.FieldChanged += Value_SelectedIndexChanged;
        }
        /// <summary>
        /// Affichage du filtre dans l'interface
        /// Remplissage de ListeComboBox
        /// </summary>
        private void InitInterface()
        {
            this.DisplayMember = "";
            this.ValueMember   = "Id";

            Attribute selectionCriteriaAttribute = this.PropertyInfo.PropertyType.GetGenericArguments()[0]
                                                   .GetCustomAttribute(typeof(SelectionCriteriaAttribute));

            if (selectionCriteriaAttribute == null)
            {
                return;
            }


            SelectionCriteriaAttribute MetaSelectionCriteria =
                (SelectionCriteriaAttribute)selectionCriteriaAttribute;

            if (MetaSelectionCriteria == null)
            {
                this.isHasFilter = false;
            }
            else
            {
                this.isHasFilter = true;
            }


            int index = 10;

            // Si un objet du critère de selection exite dans la classe
            // Nous cherchons sa valeur pour l'utiliser
            foreach (Type item in MetaSelectionCriteria.Criteria)
            {
                // Meta information d'affichage du de Critère
                DisplayEntityAttribute DisplayEntityAttributeCritere = (DisplayEntityAttribute)item.GetCustomAttribute(typeof(DisplayEntityAttribute));


                ManyToOneField manyToOneFilter = new ManyToOneField(this.Service, item, null, null,
                                                                    this.OrientationFiled,
                                                                    this.SizeLabel,
                                                                    this.SizeControl, 0, this.ConfigEntity
                                                                    );
                manyToOneFilter.Name = item.Name;
                //manyToOneFilter.Size = new System.Drawing.Size(this.widthField, this.HeightField);

                manyToOneFilter.TabIndex   = ++index;
                manyToOneFilter.Text_Label = item.Name;

                manyToOneFilter.ValueMember   = "Id";
                manyToOneFilter.DisplayMember = DisplayEntityAttributeCritere.DisplayMember;
                // pour le chargement de comboBox Suivant
                manyToOneFilter.FieldChanged += Value_SelectedIndexChanged;

                manyToOneFilter.Visible = true;

                // [bug] Le contôle ne s'affiche pas dans le formilaire ??
                //Form f = new Form();
                //f.Controls.Add(manyToOneFilter);
                //f.Show();

                this.MainContainner.Controls.Add(manyToOneFilter);

                ListeComboBox.Add(item.Name, manyToOneFilter);
                LsiteTypeObjetCritere.Add(item.Name, item);
            }
        }