/// ////////////////////////////////////////// protected override void InitChamps() { base.InitChamps(); m_wndAideFormule.FournisseurProprietes = ObjetEdite.Process; m_wndAideFormule.ObjetInterroge = typeof(CProcess); m_txtFormuleWorkflow.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); m_txtFormuleProjetParent.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); m_txtFormuleTypeEtapeDebut.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = true; if (ActionCreerSqueletteProjet.FormuleWorkflow != null) { m_txtFormuleWorkflow.Text = ActionCreerSqueletteProjet.FormuleWorkflow.GetString(); } if (ActionCreerSqueletteProjet.FormuleTypeEtapeDebut != null) { m_txtFormuleTypeEtapeDebut.Text = ActionCreerSqueletteProjet.FormuleTypeEtapeDebut.GetString(); } if (ActionCreerSqueletteProjet.FormuleProjetParent != null) { m_txtFormuleProjetParent.Text = ActionCreerSqueletteProjet.FormuleProjetParent.GetString(); } }
/// ////////////////////////////////////////// protected override void InitChamps() { base.InitChamps(); m_wndAideFormule.FournisseurProprietes = ObjetEdite.Process; m_wndAideFormule.ObjetInterroge = typeof(CProcess); m_txtFormuleTitre.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); m_txtFormuleFiltre.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = true; if (ActionSelectionFichierClient.FormuleMessage != null) { m_txtFormuleTitre.Text = ActionSelectionFichierClient.FormuleMessage.GetString(); } if (ActionSelectionFichierClient.FormuleFiltre != null) { m_txtFormuleFiltre.Text = ActionSelectionFichierClient.FormuleFiltre.GetString(); } if (ActionSelectionFichierClient.FormuleRepertoireInitial != null) { m_txtFormuleRepertoireInitial.Text = ActionSelectionFichierClient.FormuleRepertoireInitial.GetString(); } m_chkForSave.Checked = ActionSelectionFichierClient.ForSave; }
/// ////////////////////////////////////////// protected override void InitChamps() { base.InitChamps(); m_wndAideFormule.FournisseurProprietes = ObjetEdite.Process; m_wndAideFormule.ObjetInterroge = typeof(CProcess); m_txtFormule.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); FillListeVariables(); CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = false; m_comboVariables.SelectedValue = ActionModifier.VariableAModifier != null?ActionModifier.VariableAModifier:null; if (ActionModifier.ExpressionValeur != null) { m_txtFormule.Text = ActionModifier.ExpressionValeur.GetString(); } CListeObjetsDonnees liste = new CListeObjetsDonnees(ActionModifier.Process.ContexteDonnee, typeof(CVariableSurObjet)); m_comboVariablesSurObjet.ListDonnees = liste; m_comboVariablesSurObjet.ProprieteAffichee = "Nom"; foreach (CVariableSurObjet variable in liste) { if (variable.Id == ActionModifier.IdVariableSurObjet) { m_comboVariablesSurObjet.SelectedValue = variable; } } m_comboVariables_SelectedValueChanged(this, new EventArgs()); }
/// ////////////////////////////////////////// protected override void InitChamps() { base.InitChamps(); m_wndAideFormule.FournisseurProprietes = ObjetEdite.Process; m_wndAideFormule.ObjetInterroge = typeof(CProcess); m_txtFormuleFichier.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); m_txtFormuleTable.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = true; if (ActionImporterTable.FormuleFichierSource != null) { m_txtFormuleFichier.Text = ActionImporterTable.FormuleFichierSource.GetString(); } if (ActionImporterTable.FormuleTableAImporter != null) { m_txtFormuleTable.Text = ActionImporterTable.FormuleTableAImporter.GetString(); } switch (ActionImporterTable.ModeImport) { case EImportTableParametrableMode.Update_Or_Create: m_rbtUpdate.Checked = true; break; case EImportTableParametrableMode.RAZ_Puis_Import: m_rbtReset.Checked = true; break; case EImportTableParametrableMode.Delete: m_rbtDelete.Checked = true; break; } }
//-------------------------------------------------------------------------------- protected override void InitChamps() { base.InitChamps(); m_wndAideFormule.FournisseurProprietes = ObjetEdite.Process; m_wndAideFormule.ObjetInterroge = typeof(CProcess); m_txtFormuleFileName.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); m_txtFormuleArguments.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); FillListeVariables(); CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = true; if (ActionOuvrirFichier.FormuleFichier != null) { m_txtFormuleFileName.Text = ActionOuvrirFichier.FormuleFichier.GetString(); } if (ActionOuvrirFichier.FormuleArguments != null) { m_txtFormuleArguments.Text = ActionOuvrirFichier.FormuleArguments.GetString(); } m_chkWaitForExit.Checked = ActionOuvrirFichier.WaitForExit; m_chkSurServeur.Checked = ActionOuvrirFichier.SurServeur; m_comboBoxVariables.SelectedValue = ActionOuvrirFichier.VariableResultat; }
private void m_comboVariables_SelectedValueChanged(object sender, System.EventArgs e) { CVariableDynamique variable = (CVariableDynamique)m_comboVariables.SelectedValue; CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = false; }
/// ///////////////////////////////////////////////////////////////// public override void Init(CObjetPourSousProprietes objetPourSousProprietes, IFournisseurProprietesDynamiques fournisseur, CDefinitionProprieteDynamique definitionRacineDeChamps) { if (fournisseur == null) { fournisseur = new CFournisseurPropDynStd(false); } base.Init(objetPourSousProprietes, fournisseur, definitionRacineDeChamps); }
/// ////////////////////////////////////////// protected override void InitChamps() { base.InitChamps(); m_wndAideFormule.FournisseurProprietes = ObjetEdite.Process; m_wndAideFormule.ObjetInterroge = typeof(CProcess); m_txtFormule.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); DataTable table = new DataTable( ); table.Columns.Add("TEXT", typeof(string)); table.Columns.Add("VAL", typeof(CActionMessageBox.TypeMessageBox)); DataRow row = table.NewRow(); row["TEXT"] = I.T("Ok|10"); row["VAL"] = CActionMessageBox.TypeMessageBox.OK; table.Rows.Add(row); row = table.NewRow(); row["TEXT"] = I.T("Ok / Cancel|30015"); row["VAL"] = CActionMessageBox.TypeMessageBox.OKAnnuler; table.Rows.Add(row); row = table.NewRow(); row["TEXT"] = I.T("Yes / No|30016"); row["VAL"] = CActionMessageBox.TypeMessageBox.OuiNon; table.Rows.Add(row); m_cmbTypeBoite.DataSource = table; m_cmbTypeBoite.ValueMember = "VAL"; m_cmbTypeBoite.DisplayMember = "TEXT"; m_cmbTypeBoite.SelectedValue = ActionMessageBox.TypeBox; CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = true; if (ActionMessageBox.FormuleMessage != null) { m_txtFormule.Text = ActionMessageBox.FormuleMessage.GetString(); } if (ActionMessageBox.SecondesMaxiAffichage > 0) { m_chkAutoClose.Checked = true; m_panelAutoClose.Visible = true; m_txtSecondesMax.IntValue = ActionMessageBox.SecondesMaxiAffichage; } else { m_chkAutoClose.Checked = false; m_panelAutoClose.Visible = false; m_txtSecondesMax.IntValue = null; } }
//------------------------------------------------- public CDefinitionProprieteDynamique[] GetDefinitionsChamps(CObjetPourSousProprietes objet, CDefinitionProprieteDynamique defParente) { CDefinitionProprieteDynamique[] defs = new CDefinitionProprieteDynamique[0]; if (objet.TypeAnalyse == GetType()) { return(GetProprietesInstance()); } CFournisseurPropDynStd four = new CFournisseurPropDynStd(true); return(four.GetDefinitionsChamps(objet, defParente)); }
/// ///////////////////////////////////////////// /// Implémentation du IFournisseurProprietesDynamiques public CDefinitionProprieteDynamique[] GetDefinitionsChamps(Type tp, int nNbNiveaux, CDefinitionProprieteDynamique defParente) { CFournisseurPropDynStd four = new CFournisseurPropDynStd(true); ArrayList lst = new ArrayList(); lst.AddRange(four.GetDefinitionsChamps(tp, nNbNiveaux, defParente)); if (tp == typeof(CProcess)) { lst.AddRange(GetProprietesInstance()); } return((CDefinitionProprieteDynamique[])lst.ToArray(typeof(CDefinitionProprieteDynamique))); }
//--------------------------------------------------- private void FillControleMappage() { if (m_structureImport.TypeCible == null || m_structureImport.ParametreLecture == null) { m_lblIlFautDefinirLaSource.Visible = true; m_panelMappage.Visible = false; return; } m_lblIlFautDefinirLaSource.Visible = false; m_panelMappage.Visible = false; m_panelMappage.SuspendDrawing(); foreach (Control ctrl in new ArrayList(m_panelMappage.Controls)) { ctrl.Visible = false; m_panelMappage.Controls.Remove(ctrl); ctrl.Dispose(); } //Crée la liste des champs CFournisseurPropDynStd four = new CFournisseurPropDynStd(false); List <CDefinitionProprieteDynamique> lstDefs = new List <CDefinitionProprieteDynamique>(); HashSet <CDefinitionProprieteDynamique> setDefsPouvantEtreCle = new HashSet <CDefinitionProprieteDynamique>(); foreach (CDefinitionProprieteDynamique def in four.GetDefinitionsChamps(m_structureImport.TypeCible)) { if (!def.IsReadOnly && !def.TypeDonnee.IsArrayOfTypeNatif) { lstDefs.Add(def); if (CMappageChampImport.GetFiltreCle(m_structureImport.TypeCible, def, 0)) { setDefsPouvantEtreCle.Add(def); } } } foreach (DataColumn col in m_structureImport.ParametreLecture.GetColonnes()) { CControlMappageImport ctrl = new CControlMappageImport(); C2iOrigineChampImport origine = new C2iOrigineChampImportDataColumn(col); CMappageChampImport mappage = m_structureImport.GetMappage(origine); ctrl.Init( origine, mappage != null ? mappage.ProprieteDestination : null, lstDefs, setDefsPouvantEtreCle); m_panelMappage.Controls.Add(ctrl); ctrl.Dock = DockStyle.Top; ctrl.BringToFront(); } m_panelMappage.ResumeDrawing(); m_panelMappage.Visible = true; }
private void m_comboVariables_SelectedValueChanged(object sender, System.EventArgs e) { if (!(m_comboVariables.SelectedValue is CVariableDynamique)) { m_comboChamp.Enabled = false; return; } m_comboChamp.Enabled = true; CVariableDynamique variable = (CVariableDynamique)m_comboVariables.SelectedValue; CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = false; m_comboChamp.Init(four, variable.TypeDonnee.TypeDotNetNatif, null); }
private void FillListePropietes() { CFournisseurPropDynStd fournisseurPropDynStd = new CFournisseurPropDynStd(); fournisseurPropDynStd.AvecReadOnly = false; ArrayList m_listeProprietes = new ArrayList(); if (ActionCopierEntite.ExpressionEntiteDestination != null) { m_listeProprietes.AddRange(fournisseurPropDynStd.GetDefinitionsChamps(ActionCopierEntite.ExpressionEntiteDestination.TypeDonnee.TypeDotNetNatif, 0)); } m_listeProprietesACopier.AddRange(ActionCopierEntite.ProprietesDynamiquesACopier); // liste champs contient des CChampCustom ArrayList listeNomsChamps = new ArrayList(); // Filtre la liste des champs custom if (m_txtSelectDefinisseurChampsCustom.ElementSelectionne != null) { IDefinisseurChampCustom definisseurChamps = (IDefinisseurChampCustom)m_txtSelectDefinisseurChampsCustom.ElementSelectionne; foreach (CChampCustom cc in new ArrayList(definisseurChamps.TousLesChampsAssocies)) { listeNomsChamps.Add(cc.Nom.Replace(" ", "_")); } } m_wndListePropietes.Items.Clear(); foreach (CDefinitionProprieteDynamique defPropDyn in m_listeProprietes) { if (!defPropDyn.TypeDonnee.IsArrayOfTypeNatif && !defPropDyn.IsReadOnly && defPropDyn.Nom != "Id") { if (defPropDyn is CDefinitionProprieteDynamiqueChampCustom) { if (!listeNomsChamps.Contains(defPropDyn.Nom)) { continue; } } ListViewItem item = new ListViewItem(defPropDyn.Nom); item.Tag = defPropDyn; if (m_listeProprietesACopier.Contains(defPropDyn)) { item.Checked = true; } m_wndListePropietes.Items.Add(item); } } }
/// <summary> /// Surchages de CInfoStructureDynamique /// </summary> /// <param name="tp"></param> /// <param name="nDepth"></param> /// <returns></returns> //----------------------------------------------------------------- public static CInfoStructureDynamique GetStructure(Type tp, int nDepth) { if (nDepth < 0) { return(null); } CFournisseurPropDynStd fournisseur = new CFournisseurPropDynStd(false); ArrayList lst = new ArrayList(); foreach (CDefinitionProprieteDynamique def in fournisseur.GetDefinitionsChamps(tp, 0, null)) { if (!def.TypeDonnee.IsArrayOfTypeNatif) { CInfoChampDynamique info = null; CInfoStructureDynamique infoFils = GetStructure(def.TypeDonnee.TypeDotNetNatif, nDepth - 1); if (infoFils != null && infoFils.Champs.Count == 0) { infoFils = null; } //Champs simples, interpretés par CInterpreteurTextePropriete if (def.GetType() == typeof(CDefinitionProprieteDynamique)) { info = new CInfoChampDynamique( def.Nom, def.TypeDonnee.TypeDotNetNatif, def.NomPropriete, def.Rubrique, infoFils); } else { CStringSerializer serializer = new CStringSerializer(ModeSerialisation.Ecriture); I2iSerializable obj = (I2iSerializable)def; serializer.TraiteObject(ref obj); info = new CInfoChampDynamique( def.Nom, def.TypeDonnee.TypeDotNetNatif, "~#" + serializer.String + "~@#@", def.Rubrique, infoFils); } lst.Add(info); } } CInfoStructureDynamique infoStructure = new CInfoStructureDynamique(); infoStructure.NomConvivial = DynamicClassAttribute.GetNomConvivial(tp); infoStructure.Champs = lst; return(infoStructure); }
/// ////////////////////////////////////////// protected override void InitChamps() { base.InitChamps(); m_wndAideFormule.FournisseurProprietes = ObjetEdite.Process; m_wndAideFormule.ObjetInterroge = typeof(CProcess); m_txtFormule.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = false; if (ActionPurger.FormuleDateLimite != null) { m_txtFormule.Text = ActionPurger.FormuleDateLimite.GetString(); } }
/// ////////////////////////////////////////// protected override void InitChamps() { base.InitChamps (); m_wndAideFormule.FournisseurProprietes = ObjetEdite.Process; m_wndAideFormule.ObjetInterroge = typeof(CProcess); m_txtCleRegistre.Text = ActionModifier.CleRegistreAModifier; m_txtFormule.Init ( m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge ); CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = false; if ( ActionModifier.ExpressionValeur != null ) { m_txtFormule.Text = ActionModifier.ExpressionValeur.GetString(); } }
/// ////////////////////////////////////////// protected override void InitChamps() { base.InitChamps(); m_wndAideFormule.FournisseurProprietes = ObjetEdite.Process; m_wndAideFormule.ObjetInterroge = typeof(CProcess); m_txtFormule.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = true; if (ActionSetModificationContextuelle.FormuleContexte != null) { m_txtFormule.Text = ActionSetModificationContextuelle.FormuleContexte.GetString(); } }
//------------------------------------------------------------------------------------------ public CDefinitionProprieteDynamique[] GetDefinitionsChamps(CObjetPourSousProprietes objet, CDefinitionProprieteDynamique defParente) { List <CDefinitionProprieteDynamique> lst = new List <CDefinitionProprieteDynamique>(); CFournisseurPropDynStd fournisseur = new CFournisseurPropDynStd(true); if (objet.TypeAnalyse == typeof(CMacro)) { foreach (CVariableDynamique variable in Variables) { lst.Add(new CDefinitionProprieteDynamiqueVariableDynamique(variable, fournisseur.HasSubProperties(variable.TypeDonnee.TypeDotNetNatif))); } } else { lst.AddRange(fournisseur.GetDefinitionsChamps(objet, defParente)); } return(lst.ToArray()); }
/// ////////////////////////////////////////////////////// protected C2iExpression GetExpression() { IFournisseurProprietesDynamiques f = m_elementAVariables as IFournisseurProprietesDynamiques; if (f == null) { f = new CFournisseurPropDynStd(); } CContexteAnalyse2iExpression ctx = new CContexteAnalyse2iExpression(f, new CObjetPourSousProprietes(m_elementAVariables)); CAnalyseurSyntaxique analyseur = new CAnalyseurSyntaxiqueExpression(ctx); CResultAErreur result = analyseur.AnalyseChaine(m_txtFormule.Text); if (!result) { CFormAlerte.Afficher(result); return(null); } return((C2iExpression)result.Data); }
/// ////////////////////////////////////////// protected override void InitChamps() { base.InitChamps(); m_wndAideFormule.FournisseurProprietes = ObjetEdite.Process; m_wndAideFormule.ObjetInterroge = typeof(CProcess); m_txtFormule.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); FillListeVariables(); CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = false; m_comboChamp.Init(four, null, null); m_comboVariables.SelectedValue = ActionModifier.VariableAModifier != null?ActionModifier.VariableAModifier:null; m_comboChamp.DefinitionSelectionnee = ActionModifier.Propriete; if (ActionModifier.ExpressionValeur != null) { m_txtFormule.Text = ActionModifier.ExpressionValeur.GetString(); } m_comboVariables_SelectedValueChanged(this, new EventArgs()); }
/// ///////////////////////////////////////////////////////// public static CDefinitionProprieteDynamique[] ProprietesSurveillables(Type typeObjet, bool bForEvenementDate) { CDefinitionProprieteDynamique[] defs = new CFournisseurPropDynStd(false).GetDefinitionsChamps(typeObjet, 0); ArrayList lst = new ArrayList(); foreach (CDefinitionProprieteDynamique def in defs) { if (def.GetType() == typeof(CDefinitionProprieteDynamiqueDotNet)) { PropertyInfo info = typeObjet.GetProperty(def.NomProprieteSansCleTypeChamp); if (info != null && (!bForEvenementDate || info.PropertyType == typeof(DateTime) || info.PropertyType == typeof(DateTime?) || info.PropertyType == typeof(CDateTimeEx))) { object[] attribs = info.GetCustomAttributes(typeof(TableFieldPropertyAttribute), true); if (attribs.Length != 0 && ((TableFieldPropertyAttribute)attribs[0]).IsInDb) { lst.Add(def); } else { attribs = info.GetCustomAttributes(typeof(RelationAttribute), true); if (attribs.Length != 0 && !bForEvenementDate) { lst.Add(def); } } } } else if (def is CDefinitionProprieteDynamiqueChampCustom) { if (!bForEvenementDate || def.TypeDonnee.TypeDotNetNatif == typeof(DateTime)) { lst.Add(def); } } } return((CDefinitionProprieteDynamique[])lst.ToArray(typeof(CDefinitionProprieteDynamique))); }
/// ////////////////////////////////////////// protected override void InitChamps() { base.InitChamps(); m_wndAideFormule.FournisseurProprietes = ObjetEdite.Process; m_wndAideFormule.ObjetInterroge = typeof(CProcess); m_txtFormule.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); m_txtCodeAttente.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); m_txtIdUtilisateur.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = true; if (ActionAttente.FormuleMessage != null) { m_txtFormule.Text = ActionAttente.FormuleMessage.GetString(); } if (ActionAttente.FormuleCodeAttente != null) { m_txtCodeAttente.Text = ActionAttente.FormuleCodeAttente.GetString(); } m_txtIdUtilisateur.Formule = ActionAttente.FormuleUtilisateur; }
public CFormEditProprieteExpression() : base() { Fournisseur = new CFournisseurPropDynStd(true); }
public static CResultAErreur FillRichTextBox( RichTextBox txtBox, CModeleTexte modele, object sourceDuModele) { CResultAErreur result = CResultAErreur.True; byte[] data = modele.DataModele; if (data != null) { MemoryStream stream = new MemoryStream(data); try { txtBox.LoadFile(stream, RichTextBoxStreamType.RichText); } catch { result.EmpileErreur(I.T("Erreur while loading Text Model|20000")); return(result); } } CFournisseurPropDynStd fournisseur = new CFournisseurPropDynStd(); CContexteAnalyse2iExpression contexteAnalyse = new CContexteAnalyse2iExpression(fournisseur, sourceDuModele.GetType()); CAnalyseurSyntaxiqueExpression analyseur = new CAnalyseurSyntaxiqueExpression(contexteAnalyse); CContexteEvaluationExpression contexteEval = new CContexteEvaluationExpression(sourceDuModele); //recherche les zones de formule int nPosStart = txtBox.Find("{"); while (nPosStart >= 0) { int nPosFin = txtBox.Find("}", nPosStart, RichTextBoxFinds.None); if (nPosFin > 0) { txtBox.Select(nPosStart, nPosFin - nPosStart + 1); string strFormule = txtBox.SelectedText; //Supprime les accolades strFormule = strFormule.Substring(1, strFormule.Length - 2); result = analyseur.AnalyseChaine(strFormule); if (!result) { result.EmpileErreur(I.T("Error in formula @1|20001", strFormule)); return(result); } else { C2iExpression exp = (C2iExpression)result.Data; if (exp != null) { result = exp.Eval(contexteEval); if (result) { if (result.Data != null) { string strTmp = result.Data.ToString(); if (strTmp == "") { txtBox.SelectedText = " "; } else { txtBox.SelectedText = strTmp; } } else { txtBox.SelectedText = " "; } } else { txtBox.SelectedText = "##"; } } else { txtBox.SelectedText = " "; } } nPosFin = nPosStart + txtBox.SelectedText.Length; } if (nPosFin < txtBox.Text.Length) { nPosStart = txtBox.Find("{", nPosFin, RichTextBoxFinds.None); } else { nPosStart = -1; } } return(result); }
public string GetText(object sourceObject) { string strText = ModeleEnTexte; strText = strText.Replace("\n", "\r\n"); if (sourceObject == null) { return(ModeleEnTexte); } CResultAErreur result = CResultAErreur.True; CFournisseurPropDynStd fournisseur = new CFournisseurPropDynStd(); CContexteAnalyse2iExpression contexteAnalyse = new CContexteAnalyse2iExpression(fournisseur, sourceObject.GetType()); CAnalyseurSyntaxiqueExpression analyseur = new CAnalyseurSyntaxiqueExpression(contexteAnalyse); CContexteEvaluationExpression contexteEval = new CContexteEvaluationExpression(sourceObject); //recherche les zones de formule int nPosStart = strText.IndexOf('{'); while (nPosStart >= 0) { int nPosFin = strText.IndexOf("}", nPosStart); if (nPosFin > 0) { string strFormule = strText.Substring(nPosStart, nPosFin - nPosStart + 1); //Supprime les accolades strFormule = strFormule.Substring(1, strFormule.Length - 2); result = analyseur.AnalyseChaine(strFormule); string strRemplace = "###"; if (result) { C2iExpression exp = (C2iExpression)result.Data; if (exp != null) { result = exp.Eval(contexteEval); if (result) { if (result.Data != null) { strRemplace = result.Data.ToString(); } else { strRemplace = "#NULL DATA?#"; } } else { strRemplace = "#" + result.MessageErreur + "#"; } } else { strRemplace = "#NULL C2iExpression!#"; } } else { strRemplace = "#" + result.MessageErreur + "#"; } strText = strText.Remove(nPosStart, nPosFin - nPosStart + 1); strText = strText.Insert(nPosStart, strRemplace); nPosFin = nPosStart + strRemplace.Length; } if (nPosFin < strText.Length) { nPosStart = strText.IndexOf('{'); } else { nPosStart = -1; } } return(strText); }