Ejemplo n.º 1
0
 private static void InitVariablesDeForm(CFormSelectUnObjetDonnee form, Type tp)
 {
     if (typeof(IObjetHierarchiqueACodeHierarchique).IsAssignableFrom(tp))
     {
         form.m_arbre.Dock    = DockStyle.Fill;
         form.m_arbre.Visible = true;
         IObjetDonneeAutoReference obj = (IObjetDonneeAutoReference)Activator.CreateInstance(tp, CSc2iWin32DataClient.ContexteCourant);
         form.m_strProprieteListeFils    = obj.ProprieteListeFils;
         form.m_strChampParent           = obj.ChampParent;
         form.m_wndListeElements.Visible = false;
     }
     else
     {
         form.m_wndListeElements.Visible = true;
         form.m_wndListeElements.Dock    = DockStyle.Fill;
         form.m_arbre.Visible            = false;
     }
 }
Ejemplo n.º 2
0
        public static CObjetDonnee SelectionRechercheRapide(
            string strInstructions,
            Type type,
            CFiltreData filtreDeBase,
            string strTexteRechercheRapide,
            string strChampAffiche,
            string strContexte)
        {
            if (type == null || !type.IsSubclassOf(typeof(CObjetDonnee)))
            {
                CFormAlerte.Afficher(I.T("Can not select an element from this type|30035"), EFormAlerteType.Erreur);
                return(null);
            }
            CFormSelectUnObjetDonnee form = new CFormSelectUnObjetDonnee();

            form.m_filtre          = filtreDeBase;
            form.m_strInstructions = strInstructions;
            InitVariablesDeForm(form, type);
            form.m_txtRecherche.Text     = strTexteRechercheRapide;
            form.TypeObjets              = type;
            form.m_filtreRechercheRapide = CFournisseurFiltreRapide.GetFiltreRapideForType(type);
            if (strChampAffiche == "")
            {
                strChampAffiche = DescriptionFieldAttribute.GetDescriptionField(type, "Libelle", true);
            }
            form.m_strProprieteAffichee = strChampAffiche;
            form.m_wndListeElements.Columns[0].Propriete = form.m_strProprieteAffichee;
            CObjetDonnee objet = null;

            form.RefreshListe();
            bool bOk = true;

            if (form.m_listeObjets == null || form.m_listeObjets.Count != 1)
            {
                bOk = form.ShowDialog() == DialogResult.OK;
            }
            if (bOk)
            {
                objet = form.ObjetDonnee;
            }
            form.Dispose();
            return(objet);
        }
Ejemplo n.º 3
0
        public static CObjetDonnee SelectObjetDonnee(string strInstructions, CListeObjetsDonnees liste, string strPropriete)
        {
            CFormSelectUnObjetDonnee form = new CFormSelectUnObjetDonnee();

            form.m_listeObjets          = liste;
            form.m_strInstructions      = strInstructions;
            form.m_filtre               = liste.Filtre;
            form.TypeObjets             = liste.TypeObjets;
            form.m_strProprieteAffichee = strPropriete;
            InitVariablesDeForm(form, form.TypeObjets);
            form.m_wndListeElements.Columns[0].Propriete = strPropriete;
            CObjetDonnee objet = null;

            if (form.ShowDialog() == DialogResult.OK)
            {
                objet = form.ObjetDonnee;
            }
            form.Dispose();
            return(objet);
        }
Ejemplo n.º 4
0
        public static CObjetDonnee SelectObjetDonnee(string strInstructions, Type type, CFiltreData filtre, string strPropriete)
        {
            if (!type.IsSubclassOf(typeof(CObjetDonnee)))
            {
                CFormAlerte.Afficher(I.T("Impossible to select an element from this type|30035"), EFormAlerteType.Erreur);
                return(null);
            }
            CFormSelectUnObjetDonnee form = new CFormSelectUnObjetDonnee();

            form.m_filtre               = filtre;
            form.m_strInstructions      = strInstructions;
            form.TypeObjets             = type;
            form.m_strProprieteAffichee = strPropriete;
            InitVariablesDeForm(form, type);
            form.m_wndListeElements.Columns[0].Propriete = strPropriete;
            CObjetDonnee objet = null;

            if (form.ShowDialog() == DialogResult.OK)
            {
                objet = form.ObjetDonnee;
            }
            form.Dispose();
            return(objet);
        }
Ejemplo n.º 5
0
        //-------------------------------------------------
        private void SelectObject(CConfigTextBoxFiltreRapide config)
        {
            if (config != null)
            {
                m_configDefaut = config;
            }
            CObjetDonnee obj = null;
            bool         bSelectPriseEnChargeParDelegue = false;

            if (m_mySelectObjetDelegate != null)
            {
                obj = m_mySelectObjetDelegate.Invoke(config.TypeObjets, config.FiltreDeBase, m_textBox.Text, ref bSelectPriseEnChargeParDelegue);
            }
            if (m_globalSelectObjetDelegate != null && !bSelectPriseEnChargeParDelegue)
            {
                obj = m_globalSelectObjetDelegate.Invoke(config.TypeObjets, config.FiltreDeBase, m_textBox.Text, ref bSelectPriseEnChargeParDelegue);
            }
            if (!bSelectPriseEnChargeParDelegue)
            {
                obj = CFormSelectUnObjetDonnee.SelectionRechercheRapide(
                    "",
                    config.TypeObjets,
                    config.FiltreDeBase,
                    m_textBox.Text,
                    config.ProprieteAffichee,
                    "");
            }
            if (obj != null)
            {
                SelectedObject = obj;
            }
            else
            {
                SynchroniseTextEtObjet();
            }
        }