protected override CResultAErreur MyInitChamps(CCustomizableListItem item) { CResultAErreur result = base.MyInitChamps(item); CParametreDroitEditionType.CCoupleFormuleToGroupeRestrictions couple = item != null?item.Tag as CParametreDroitEditionType.CCoupleFormuleToGroupeRestrictions:null; if (item != null && couple != null) { if (!m_bIsInit) { m_bIsInit = true; m_txtFormule.Init(m_fournisseur, m_typeObjets); string strField = DescriptionFieldAttribute.GetDescriptionField(m_typeObjets, "DescriptionElement"); m_txtGroupe.Init(typeof(CGroupeRestrictionSurType), "Libelle", false); m_txtGroupe.Init(m_typeObjets, strField, false); } m_lblFormule.Visible = IsCreatingImage; m_txtFormule.Visible = !IsCreatingImage; m_lblFormule.Text = couple.Formule != null?couple.Formule.GetString() : ""; m_txtFormule.Visible = true; m_lblFormule.Visible = false; m_txtFormule.Formule = couple.Formule; m_txtGroupe.ElementSelectionne = couple.GetGroupeRestrictions(CSc2iWin32DataClient.ContexteCourant); } return(result); }
//---------------------------------------------------- public static void ShowListe( string strTitre, CListeObjetsDonnees listeAVoir, CFormNavigateur navigateurAssocié, GLColumnCollection columns, string strContexteUtilisation) { if (listeAVoir == null) { return; } //Créer une nouvelle liste dans le contexte de base CListeObjetsDonnees lst = new CListeObjetsDonnees(CSc2iWin32DataClient.ContexteCourant, listeAVoir.TypeObjets); CFiltreData filtre = CFiltreData.GetAndFiltre(listeAVoir.FiltrePrincipal, listeAVoir.Filtre); lst.Filtre = filtre; CFormListeExtraiteOld frm = new CFormListeExtraiteOld(); frm.Text = strTitre; frm.m_navigateurAssocié = navigateurAssocié != null?navigateurAssocié:m_navigateurParDefaut; Image img = CFormListeStandard.CalculeNewImage(lst.TypeObjets); frm.m_listeObjets = lst; if (columns != null) { frm.m_panelListe.AllowSerializePreferences = false; foreach (GLColumn col in columns) { GLColumn copie = CCloner2iSerializable.Clone(col) as GLColumn; frm.m_panelListe.Columns.Add(copie); } } else { frm.m_panelListe.AllowSerializePreferences = true; if (strContexteUtilisation != null) { frm.m_panelListe.ContexteUtilisation = strContexteUtilisation; } string strField = DescriptionFieldAttribute.GetDescriptionField(lst.TypeObjets, "DescriptionElement"); GLColumn col = new GLColumn(""); col.Propriete = strField; col.Width = frm.m_panelListe.ClientSize.Width; frm.m_panelListe.Columns.Add(col); } frm.Show(); }
public static CEntiteDeMemoryDb SelectionRechercheRapide( CMemoryDb dbMemory, string strInstructions, Type type, CFiltreMemoryDb filtreDeBase, CFiltreMemoryDb filtreRapide, string strTexteRechercheRapide, string strChampAffiche, string strContexte) { if (type == null || !type.IsSubclassOf(typeof(CEntiteDeMemoryDb))) { CFormAlerte.Afficher(I.T("Can not select an element from this type|30035"), EFormAlerteType.Erreur); return(null); } CFormSelectUneEntiteMemoryDb form = new CFormSelectUneEntiteMemoryDb(); form.m_filtre = filtreDeBase; form.m_strInstructions = strInstructions; form.m_contexteMemoire = dbMemory; form.m_txtRecherche.Text = strTexteRechercheRapide; form.TypeObjets = type; form.m_filtreRechercheRapide = filtreRapide; if (strChampAffiche == "") { strChampAffiche = DescriptionFieldAttribute.GetDescriptionField(type, "Libelle", true); } form.m_strProprieteAffichee = strChampAffiche; form.m_wndListeElements.Columns[0].Propriete = form.m_strProprieteAffichee; CEntiteDeMemoryDb 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); }
//----------------------------------------------------------- public void AlloueControl() { if (m_variable == null) { return; } Type typeElements = null; string strPropAffichee = ""; CFiltreData filtre = null; if (m_variable is CVariableDynamiqueSelectionObjetDonnee) { C2iExpression expression = ((CVariableDynamiqueSelectionObjetDonnee)m_variable).ExpressionAffichee; if (expression is C2iExpressionChamp) { strPropAffichee = ((C2iExpressionChamp)expression).DefinitionPropriete.NomProprieteSansCleTypeChamp; } CFiltreDynamique filtreDyn = ((CVariableDynamiqueSelectionObjetDonnee)m_variable).FiltreSelection; filtre = GetFiltre(filtreDyn); typeElements = filtreDyn.TypeElements; } else if (m_variable is CChampCustom) { CFiltreDynamique filtreDyn = ((CChampCustom)m_variable).FiltreObjetDonnee; if (filtreDyn != null) { filtre = GetFiltre(filtreDyn); } typeElements = ((CChampCustom)m_variable).TypeObjetDonnee; } if (m_control == null) { m_control = new C2iTextBoxFiltreRapide(); m_control.ElementSelectionneChanged += new EventHandler(m_control_ElementSelectionneChanged); } if (strPropAffichee == "") { strPropAffichee = DescriptionFieldAttribute.GetDescriptionField(typeElements, "DescriptionElement"); } m_control.InitAvecFiltreDeBase(typeElements, strPropAffichee, filtre, true); }
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); }
internal void CreateVariable(CObjetDonnee objet) { CVariableDynamiqueSelectionObjetDonnee variable = new CVariableDynamiqueSelectionObjetDonnee(Macro); if (objet != null) { variable.Nom = objet.DescriptionElement.Trim().Replace("[", "-").Replace("]", "-"); } else { variable.Nom = "V" + variable.IdVariable; } CFiltreDynamique filtre = new CFiltreDynamique(Macro, Macro.ContexteDonnee); filtre.TypeElements = TypeObjet; variable.FiltreSelection = filtre; variable.ExpressionRetournee = new C2iExpressionThis(TypeObjet); string strField = DescriptionFieldAttribute.GetDescriptionField(TypeObjet, "DescriptionElement"); if (strField != "") { CDefinitionProprieteDynamiqueDotNet def = new CDefinitionProprieteDynamiqueDotNet( strField, strField, new CTypeResultatExpression(typeof(string), false), false, true, ""); variable.ExpressionAffichee = new C2iExpressionChamp(def); } Macro.AddVariable(variable); Macro.SetInitialValue(variable, objet as CObjetDonneeAIdNumerique); m_strIdVariableAssociee = variable.IdVariable; CDefinitionProprieteDynamiqueVariableDynamique defSource = new CDefinitionProprieteDynamiqueVariableDynamique(variable); FormuleSelectionObjet = new C2iExpressionChamp(defSource); }
private void m_lnkTester_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (m_panelEditionConsultation.Folder != null) { m_panelEditionConsultation.MajChamps(); CFolderConsultationRacineFromElement racine = m_panelEditionConsultation.Folder as CFolderConsultationRacineFromElement; if (racine != null) { CObjetDonnee objet = CFormSelectUnObjetDonnee.SelectionRechercheRapide( I.T("Select an element for test|20735"), racine.TypeRacine, null, "", DescriptionFieldAttribute.GetDescriptionField(racine.TypeRacine, "Description"), "FORTESTCONSULT"); if (objet == null) { return; } racine.InitConsultation(objet); } CFormTestConsultationHierarchique.TestFolder(m_panelEditionConsultation.Folder); } }
//----------------------------------------------------------- public void AlloueCombo() { if (m_variable == null) { return; } Type typeElement = m_variable.TypeDonnee.TypeDotNetNatif; if (m_variable is CVariableDynamiqueSelectionObjetDonnee) { typeElement = ((CVariableDynamiqueSelectionObjetDonnee)m_variable).FiltreSelection.TypeElements; } //Combos hiérarchiques if (typeof(IObjetDonneeAutoReference).IsAssignableFrom(typeElement) && typeof(IObjetHierarchiqueACodeHierarchique).IsAssignableFrom(typeElement)) { try { if (!(m_combo is CComboBoxArbreObjetDonneesHierarchique) && m_combo != null) { m_combo.Visible = false; m_combo.Parent.Controls.Remove(m_combo); m_combo.Dispose(); m_combo = null; } CComboBoxArbreObjetDonneesHierarchique arbre; if (m_combo is CComboBoxArbreObjetDonneesHierarchique) { arbre = (CComboBoxArbreObjetDonneesHierarchique)m_combo; } else { arbre = new CComboBoxArbreObjetDonneesHierarchique(); arbre.ElementSelectionneChanged += new EventHandler(arbre_ElementSelectionneChanged); } CFiltreData filtre = null; Type tp = m_variable.TypeDonnee.TypeDotNetNatif; string strChamp = DescriptionFieldAttribute.GetDescriptionField(tp, "DescriptionElement", true); string strTextNull = ""; if (m_variable is CVariableDynamiqueSelectionObjetDonnee) { CVariableDynamiqueSelectionObjetDonnee varSel = (CVariableDynamiqueSelectionObjetDonnee)m_variable; tp = ((CVariableDynamiqueSelectionObjetDonnee)m_variable).FiltreSelection.TypeElements; CFiltreDynamique filtreDyn = varSel.FiltreSelection; filtre = GetFiltre(filtreDyn); strChamp = DescriptionFieldAttribute.GetDescriptionField(tp, "DescriptionElement", true); strTextNull = varSel.TextNull; } if (m_variable is CChampCustom) { CFiltreDynamique filtreDyn = ((CChampCustom)m_variable).FiltreObjetDonnee; filtre = GetFiltre(filtreDyn); } using (CContexteDonnee contexte = new CContexteDonnee(1, true, false)) { CObjetDonnee objet = (CObjetDonnee)Activator.CreateInstance(tp, new object[] { contexte }); arbre.Init(tp, ((IObjetDonneeAutoReference)objet).ProprieteListeFils, ((IObjetDonneeAutoReference)objet).ChampParent, strChamp, filtre, null ); if (strTextNull != "") { arbre.TextNull = strTextNull; } } m_combo = arbre; return; } catch { } } IList lst = null; lst = m_variable.Valeurs; if (m_variable is CChampCustom && ((CChampCustom)m_variable).TypeDonneeChamp.TypeDonnee == TypeDonnee.tObjetDonneeAIdNumeriqueAuto && lst is CListeObjetsDonnees) { CFiltreData filtre = ((CListeObjetsDonnees)lst).Filtre; CFiltreDynamique filtreDyn = ((CChampCustom)m_variable).FiltreObjetDonnee; if (filtreDyn != null) { filtre = GetFiltre(filtreDyn); } ((CListeObjetsDonnees)lst).Filtre = filtre; } else { lst = m_variable.Valeurs; } C2iComboBox combo = null; if (lst is CListeObjetsDonnees && ((CListeObjetsDonnees)lst).TypeObjets != typeof(CValeurChampCustom)) { CComboBoxListeObjetsDonnees cmbListe = null; if (m_combo is CComboBoxListeObjetsDonnees) { cmbListe = (CComboBoxListeObjetsDonnees)m_combo; } else { if (m_combo != null) { m_combo.Visible = false; m_combo.Parent.Controls.Remove(m_combo); m_combo.Dispose(); m_combo = null; } cmbListe = new CComboBoxListeObjetsDonnees(); cmbListe.SelectedValueChanged += new EventHandler(cmbListe_SelectedValueChanged); } cmbListe.NullAutorise = true; cmbListe.Init((CListeObjetsDonnees)lst, DescriptionFieldAttribute.GetDescriptionField(m_variable.TypeDonnee.TypeDotNetNatif, "DescriptionElement"), true); combo = cmbListe; } else { if (m_combo != null && m_combo.GetType() == typeof(C2iComboBox)) { combo = (C2iComboBox)m_combo; } else { if (m_combo != null) { m_combo.Visible = false; m_combo.Parent.Controls.Remove(m_combo); m_combo.Dispose(); m_combo = null; } combo = new C2iComboBox(); combo.SelectionChangeCommitted += new EventHandler(combo_SelectionChangeCommitted); } combo.DisplayMember = "Display"; combo.ValueMember = "Value"; combo.DataSource = lst; } combo.DropDownStyle = ComboBoxStyle.DropDownList; combo.Sorted = false; combo.IsLink = false; if (m_combo == null) { combo.CreateControl(); } m_combo = combo; }
protected override void OnChangeElementEdite(object element) { if (element != null && WndFiltreRapide != null) { CFiltreData filtreData; if (WndFiltreRapide.Filter != null) { CElementAVariablesDynamiques eltAVar = new CElementAVariablesDynamiques(); CVariableDynamiqueStatique var = new CVariableDynamiqueStatique(eltAVar); var.Nom = "EditedElement"; var.IdVariable = "0"; var.SetTypeDonnee(new CTypeResultatExpression(element.GetType(), false)); eltAVar.AddVariable(var); eltAVar.SetValeurChamp(var, element); CFiltreDynamique filtreDyn = WndFiltreRapide.Filter; filtreDyn.ElementAVariablesExterne = eltAVar; filtreData = (CFiltreData)filtreDyn.GetFiltreData().Data; } else { filtreData = null; } Type typePropriete = null; if (WndFiltreRapide.Property != null) { typePropriete = WndFiltreRapide.Property.TypeDonnee.TypeDotNetNatif; } else if (WndFiltreRapide.Filter != null) { typePropriete = WndFiltreRapide.Filter.TypeElements; } if (typePropriete != null) { string strDesc = DescriptionFieldAttribute.GetDescriptionField(typePropriete, "DescriptionElement"); C2iTextBoxFiltreRapide txtRapide = m_selectionneur as C2iTextBoxFiltreRapide; if (txtRapide != null) { txtRapide.InitAvecFiltreDeBase(typePropriete, strDesc, filtreData, true); } else { CComboBoxListeObjetsDonnees cmb = m_selectionneur as CComboBoxListeObjetsDonnees; cmb.NullAutorise = true; cmb.TextNull = I.T("None|19"); if (cmb != null) { cmb.Init( typePropriete, filtreData, strDesc, true); } } if (WndFiltreRapide.Property != null) { CObjetDonnee valeur = CInterpreteurProprieteDynamique.GetValue(EditedElement, WndFiltreRapide.Property).Data as CObjetDonnee; m_selectionneur.ElementSelectionne = valeur; } } } }