private void m_menuAjouterChampDonnee_Click(object sender, EventArgs e)
        {
            Type tp = m_structureExport.TypeSource;

            if (m_tableVue == null)
            {
                return;
            }
            if (m_tableVue.ChampOrigine != null)
            {
                tp = m_tableVue.ChampOrigine.TypeDonnee.TypeDotNetNatif;
            }
            CDefinitionProprieteDynamique[] defs = CFormSelectChampPourStructure.SelectProprietes(
                tp,
                CFormSelectChampPourStructure.TypeSelectionAttendue.ChampParent,
                m_tableVue.ChampOrigine,
                m_fournisseur);
            foreach (CDefinitionProprieteDynamique def in defs)
            {
                C2iChampExport champ = new C2iChampExport();
                champ.Origine  = new C2iOrigineChampExportChamp(def);
                champ.NomChamp = def.Nom;
                ListViewItem item = new ListViewItem();
                FillItemForChamp(item, champ);
                m_wndListeChamps.Items.Add(item);
            }
        }
Beispiel #2
0
        //-------------------------------------------------------------------------
        private void OnAddChampCumule()
        {
            if (!(m_tableExportCumulee is C2iTableExportCumulee))
            {
                return;
            }

            Type tp = m_structureExport.TypeSource;
            C2iTableExportCumulee table = (C2iTableExportCumulee)m_tableExportCumulee;

            if (m_tableExportCumulee != null && table.ChampOrigine != null)
            {
                tp = table.ChampOrigine.TypeDonnee.TypeDotNetNatif;
            }
            CDefinitionProprieteDynamique[] defs = CFormSelectChampPourStructure.SelectProprietes
                                                   (
                tp,
                CFormSelectChampPourStructure.TypeSelectionAttendue.ChampParent |
                CFormSelectChampPourStructure.TypeSelectionAttendue.ChampFille |
                CFormSelectChampPourStructure.TypeSelectionAttendue.UniquementElementDeBaseDeDonnees |
                CFormSelectChampPourStructure.TypeSelectionAttendue.InclureChampsCustom,
                table.ChampOrigine);


            // Créé le nouveau champ de requete
            if (defs.Length > 0)
            {
                C2iChampDeRequete             champUnique = new C2iChampDeRequete();
                CDefinitionProprieteDynamique def1        = defs[0];
                champUnique.NomChamp = def1.Nom;
                champUnique.TypeDonneeAvantAgregation = def1.TypeDonnee.TypeDotNetNatif;

                List <CSourceDeChampDeRequete> listeSources = new List <CSourceDeChampDeRequete>();
                foreach (CDefinitionProprieteDynamique def in defs)
                {
                    CSourceDeChampDeRequete source = new CSourceDeChampDeRequete(def.NomChampCompatibleCComposantFiltreChamp);
                    listeSources.Add(source);
                }
                champUnique.Sources = listeSources.ToArray();
                ListViewItem item = new ListViewItem();
                m_wndListeChamps.Items.Add(item);
                if (champUnique != null && EditChamp(champUnique))
                {
                    FillItemForChamp(item, champUnique);
                }
            }
        }
 private void m_btnSelect_Click(object sender, System.EventArgs e)
 {
     CDefinitionProprieteDynamique[] defs = CFormSelectChampPourStructure.SelectProprietes
                                            (
         m_typeSource,
         CFormSelectChampPourStructure.TypeSelectionAttendue.ChampParent |
         CFormSelectChampPourStructure.TypeSelectionAttendue.ChampFille |
         CFormSelectChampPourStructure.TypeSelectionAttendue.UniquementElementDeBaseDeDonnees |
         CFormSelectChampPourStructure.TypeSelectionAttendue.InclureChampsCustom,
         m_definitionRacineDeChamps);
     if (defs.Length > 0)
     {
         CSourceDeChampDeRequete source = new CSourceDeChampDeRequete(defs[0].NomChampCompatibleCComposantFiltreChamp);
         m_lblSource.Text = source.Source;
         m_source         = source;
     }
 }
Beispiel #4
0
        //-----------------------------------------------------------------------
        public static CDefinitionProprieteDynamique[] SelectProprietes(
            Type tp,
            TypeSelectionAttendue typeSelection,
            CDefinitionProprieteDynamique defParente,
            IFournisseurProprietesDynamiques fournisseur)
        {
            CFormSelectChampPourStructure form = new CFormSelectChampPourStructure();

            if (fournisseur != null)
            {
                form.m_fournisseur = fournisseur;
            }
            form.m_typePrincipal = tp;
            form.m_typeSelection = typeSelection;
            form.m_lblTable.Text = DynamicClassAttribute.GetNomConvivial(form.m_typePrincipal);

            TreeNodeCollection nodes = form.m_arbre.Nodes;

            if ((typeSelection & TypeSelectionAttendue.AllowThis) == TypeSelectionAttendue.AllowThis)
            {
                TreeNode nodeThis = new TreeNode(DynamicClassAttribute.GetNomConvivial(tp));
                nodeThis.Tag = new CDefinitionProprieteDynamiqueThis(new CTypeResultatExpression(tp, false), true, true);
                form.m_arbre.Nodes.Add(nodeThis);
                nodes = nodeThis.Nodes;
            }

            form.FillTree(tp, nodes, defParente);
            if (form.m_arbre.Nodes.Count == 1)
            {
                form.m_arbre.Nodes[0].Expand();
            }
            if (form.ShowDialog() == DialogResult.OK)
            {
                ArrayList lst = new ArrayList();
                form.GetSelectedFields(lst, form.m_arbre.Nodes, null);
                return(( CDefinitionProprieteDynamique[] )lst.ToArray(typeof(CDefinitionProprieteDynamique)));
            }
            return(new CDefinitionProprieteDynamique[0]);
        }