/// ////////////////////////////////////////// protected override CResultAErreur MAJ_Champs() { CResultAErreur result = base.MAJ_Champs(); if (!result) { return(result); } if (!(m_comboVariableListe.SelectedValue is CVariableDynamique)) { result.EmpileErreur(I.T("Select the list to browse|30042")); return(result); } ActionForEach.VariableListe = (CVariableDynamique)m_comboVariableListe.SelectedValue; if (!(m_comboVariable.SelectedValue is CVariableDynamique)) { result.EmpileErreur(I.T("Select the browsing variable|30043")); return(result); } CVariableDynamique variable = (CVariableDynamique)m_comboVariable.SelectedValue; if (variable.IdVariable == "") { m_variableNew = new CVariableProcessTypeComplexe(ActionForEach.Process); m_variableNew.Nom = variable.Nom; m_variableNew.SetTypeDonnee(ActionForEach.VariableListe.TypeDonnee.GetTypeElements()); ActionForEach.Process.AddVariable(m_variableNew); variable = m_variableNew; } ActionForEach.VariableElementEnCours = variable; return(result); }
//------------------------------------------- public override object[] GetObjets(CNodeConsultationHierarchique nodeParent, CContexteDonnee contexte) { try { if (m_filtreDynamique == null || m_filtreDynamique.TypeElements == null) { return(new object[0]); } CVariableDynamique variable = AssureVariableParent(); if (variable != null) { m_filtreDynamique.SetValeurChamp(variable, nodeParent); } CResultAErreur result = m_filtreDynamique.GetFiltreData(); if (!result) { return(new object[0]); } CListeObjetsDonnees lst = new CListeObjetsDonnees(contexte, m_filtreDynamique.TypeElements); lst.Filtre = (CFiltreData)result.Data; return((object[])lst.ToArray(typeof(object))); } catch { } return(new object[0]); }
/// //////////////////////////////////////////////////////// public override CResultAErreur VerifieDonnees() { CResultAErreur result = base.VerifieDonnees(); CVariableDynamique variable = VariableElement; if (variable == null) { result.EmpileErreur(I.T("The variable containing the element for which the events are started must be exist|161")); } if (!(variable is CVariableProcessTypeComplexe) || !typeof(IObjetDonneeAIdNumerique).IsAssignableFrom(variable.TypeDonnee.TypeDotNetNatif)) { //ce n'est pas un CObjetDonneeAIdNumeriqueAuto result.EmpileErreur(I.T("The variable containing the element for which the events are started is incorrect|162")); return(result); } if (CodeEvenement.Trim() == "") { result.EmpileErreur(I.T("Indicate the code of event to be removed|246")); } return(result); }
/// ////////////////////////////////////////// protected override sc2i.common.CResultAErreur MAJ_Champs() { CResultAErreur result = base.MAJ_Champs(); if (!result) { return(result); } if (!(m_comboBoxVariables.SelectedValue is CVariableDynamique) && !ActionFonction.VariableRetourCanBeNull) { result.EmpileErreur(I.T("Select a variable to store the action value|30012")); return(result); } if (m_comboBoxVariables.SelectedValue is CVariableDynamique) { CVariableDynamique variable = (CVariableDynamique)m_comboBoxVariables.SelectedValue; if (variable.IdVariable == "") { m_variableNew = new CVariableProcessTypeComplexe(ActionFonction.Process); m_variableNew.Nom = variable.Nom; m_variableNew.SetTypeDonnee(ActionFonction.TypeResultat); ActionFonction.Process.AddVariable(m_variableNew); variable = m_variableNew; FillListeVariables(); m_comboBoxVariables.SelectedValue = m_variableNew; } ActionFonction.VariableResultat = variable; } else { ActionFonction.VariableResultat = null; } return(result); }
//------------------------------------------------------------ public object GetValeurPropriete(object objetInterroge, CDefinitionProprieteDynamique propriete) { if (objetInterroge is CProcess && propriete is CDefinitionProprieteDynamiqueVariableDynamique) { byte[] bt = m_process.GetSerialisationValeurVariable(((CDefinitionProprieteDynamiqueVariableDynamique)propriete).IdChamp); if (bt == null) { return(null); } MemoryStream stream = new MemoryStream(bt); BinaryReader reader = new BinaryReader(stream); CSerializerReadBinaire serializer = new CSerializerReadBinaire(reader); object valeur = null; CVariableDynamique variable = m_process.GetVariable(((CDefinitionProprieteDynamiqueVariableDynamique)propriete).IdChamp); CResultAErreur result = CSerializerValeursVariablesProcess.SerializeValeurVariable(ref valeur, variable, serializer, m_contexte); if (result) { return(valeur); } return(null); } else { return(CInterpreteurProprieteDynamique.GetValue(objetInterroge, propriete.NomPropriete).Data); } }
/// ////////////////////////////////////////////////// public override void OnChangeVariable(CFiltreDynamique filtre, CVariableDynamique variable) { foreach (CComposantFiltreDynamique composant in m_listeComposantsFils) { composant.OnChangeVariable(filtre, variable); } }
/// ////////////////////////////////////////// protected void FillListeVariables() { if (!(m_comboVariableListe.SelectedValue is CVariableDynamique)) { m_comboVariable.Enabled = false; return; } m_comboVariable.Enabled = true; CVariableDynamique varListe = (CVariableDynamique)m_comboVariableListe.SelectedValue; ArrayList lstVariables = new ArrayList(); foreach (CVariableDynamique variable in ObjetEdite.Process.ListeVariables) { if (variable.TypeDonnee.Equals(varListe.TypeDonnee.GetTypeElements())) { lstVariables.Add(variable); } } if (m_variableNew != null) { lstVariables.Add(m_variableNew); } lstVariables.Sort(); m_comboVariable.ProprieteAffichee = "Nom"; m_comboVariable.ListDonnees = lstVariables; }
private void m_comboVariables_SelectedValueChanged(object sender, System.EventArgs e) { CVariableDynamique variable = (CVariableDynamique)m_comboVariables.SelectedValue; CFournisseurPropDynStd four = new CFournisseurPropDynStd(); four.AvecReadOnly = false; }
/// //////////////////////////////////////////////////////// protected virtual void DrawVariableEntree(Graphics g, CVariableDynamique variable) { Font ft = new Font("Arial", 7, FontStyle.Regular); string strNomVariable = "< " + (variable == null?"":variable.Nom); SizeF size = g.MeasureString(strNomVariable, ft); Rectangle rect = RectangleCadre; int nHeight = (int)size.Height + 2; int nWidth = (int)size.Width + 2; rect.Offset(rect.Width - nWidth, 0); rect.Height = nHeight; rect.Width = nWidth; Pen pBlack = new Pen(Color.Black); Brush br = new LinearGradientBrush(new Point(rect.Left, rect.Top), new Point(rect.Right, rect.Bottom), Color.Green, Color.DarkGreen); g.FillRectangle(br, rect); g.DrawRectangle(pBlack, rect); br.Dispose(); pBlack.Dispose(); Brush bBlack = new SolidBrush(Color.White); g.DrawString(strNomVariable, ft, bBlack, rect.Left + 1, rect.Top + 1); bBlack.Dispose(); ft.Dispose(); }
/// //////////////////////////////////////// private void m_lnkNouvelleVariable_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { string strNom = ""; if (!(m_comboVariableListe.SelectedValue is CVariableDynamique)) { CFormAlerte.Afficher(I.T("Select list variable first|30055"), EFormAlerteType.Exclamation); return; } CVariableDynamique variable = (CVariableDynamique)m_comboVariableListe.SelectedValue; CTypeResultatExpression type = variable.TypeDonnee.GetTypeElements(); CDbKey dbKey = null; if (CFormEditNomVariable.EditeNomVariable(ref strNom, ref type, ref dbKey, false)) { if (m_variableNew == null) { m_variableNew = new CVariableProcessTypeComplexe(); m_variableNew.SetTypeDonnee(type); } m_variableNew.Nom = strNom; FillListeVariables(); m_comboVariable.SelectedValue = m_variableNew; } }
/// //////////////////////////////////////////////////////// public override CResultAErreur VerifieDonnees() { CResultAErreur result = base.VerifieDonnees(); CVariableDynamique variable = VariableElement; if (variable == null) { result.EmpileErreur(I.T("The variable containing the element attach with the event isn't defined or doesn't exist|144")); } if (!typeof(IObjetDonneeAIdNumerique).IsAssignableFrom(variable.TypeDonnee.TypeDotNetNatif)) { //ce n'est pas un CObjetDonneeAIdNumeriqueAuto result.EmpileErreur(I.T("The variable containing the element attach with the event is incorrect|145")); return(result); } if (Libelle.Trim() == "") { result.EmpileErreur(I.T("The label can't be null|146")); } result = ParametreDeclencheur.VerifieDonnees(); if (!result) { return(result); } return(result); }
//------------------------------------------------------------------------- private void RefillListeVariables() { if (m_macro == null) { return; } int nItem = -1; if (m_wndListeVariables.SelectedIndices.Count != 0) { nItem = m_wndListeVariables.SelectedIndices[0]; } m_wndListeVariables.Remplir(m_macro.ListeVariables); try { m_wndListeVariables.Items[nItem].Selected = true; } catch { } foreach (ListViewItem item in m_wndListeVariables.Items) { CVariableDynamique variable = item.Tag as CVariableDynamique; if (variable.IdVariable == m_macro.IdVariableTargetElement) { item.BackColor = Color.LightGreen; } } }
//------------------------------------------------------------------------- private bool EditeVariable(CVariableDynamique variable) { if (variable == null) { return(false); } bool bRetour = true; if (variable is CVariableDynamiqueSaisie) { bRetour = CFormEditVariableDynamiqueSaisie.EditeVariable((CVariableDynamiqueSaisie)variable, m_mapDatabaseGenerator); } else if (variable is CVariableDynamiqueCalculee) { bRetour = CFormEditVariableFiltreCalculee.EditeVariable((CVariableDynamiqueCalculee)variable, m_mapDatabaseGenerator); } else if (variable is CVariableDynamiqueSelectionObjetDonnee) { bRetour = CFormEditVariableDynamiqueSelectionObjetDonnee.EditeVariable((CVariableDynamiqueSelectionObjetDonnee)variable); } else if (variable is CVariableDynamiqueListeObjets) { bRetour = CFormEditVariableDynamiqueListeObjets.EditeVariable((CVariableDynamiqueListeObjets)variable, m_mapDatabaseGenerator); } else { bRetour = false; } return(bRetour); }
//----------------------------------------------------------- public CVariableDynamique SelectVariable(CVariableDynamique variableToSel) { CFormSelectVariableDynamiqueAInterfaceUtilisateur form = new CFormSelectVariableDynamiqueAInterfaceUtilisateur(ElementEdite); CVariableDynamique variable = form.SelectVariable(variableToSel); form.Dispose(); return(variable); }
/// ////////////////////////////////////////////////// public override bool IsVariableUtilisee(CVariableDynamique variable) { if (DoesExpressionUtiliseVariable(m_expressionConditionApplication, variable)) { return(true); } return(false); }
//-------------------------------------------------------------- public void AddVariable(IVariableDynamique variable) { CVariableDynamique v = variable as CVariableDynamique; if (v != null) { m_listeVariables.Add(v); } }
/// //////////////////////////////////////////////////////// protected virtual void DrawVariableSortie(Graphics g, CVariableDynamique variable) { Rectangle rect = RectangleCadre; Brush br = new LinearGradientBrush(new Point(rect.Left, rect.Top), new Point(rect.Right, rect.Bottom), Color.Yellow, Color.DarkOrange); DrawSortie(g, variable == null?"":variable.Nom, br); br.Dispose(); }
/// ////////////////////////////////////////////////////////////////////// public CDefinitionProprieteDynamiqueVariableDynamique(CVariableDynamique variable, bool bHasSubProperties) : base( variable.Nom, variable.Id.ToString(), variable.TypeDonnee, bHasSubProperties, false) { m_variable = variable; }
/// ///////////////////////////////////////////////////////////// public void SelectAndClose() { if (m_wndListeVariables.SelectedItems.Count == 0) { return; } m_variableSelectionnee = (CVariableDynamique)m_wndListeVariables.SelectedItems[0].Tag; DialogResult = DialogResult.OK; Close(); }
/// ////////////////////////////////////////////////////////////////////// public CDefinitionProprieteDynamiqueVariableDynamique(CVariableDynamique variable) : base( variable.Nom, variable.Id.ToString(), variable.TypeDonnee, false, false) { m_variable = variable; }
/// ////////////////////////////////////////////////// public override bool IsVariableUtilisee(CVariableDynamique variable) { foreach (CComposantFiltreDynamique composant in m_listeComposantsFils) { if (composant.IsVariableUtilisee(variable)) { return(true); } } return(false); }
private void m_btnSupprimerChamp_LinkClicked(object sender, EventArgs e) { CVariableDynamique variable = VariableSelectionnee; if (m_mapDatabaseGenerator.IsVariableUtilisee(variable)) { CFormAlerte.Afficher(I.T("Impossible to delete this variabe because it is used|10005"), EFormAlerteType.Erreur); return; } m_mapDatabaseGenerator.RemoveVariable(variable); RefillListeVariables(); }
/// //////////////////////////////////////////////////////// public static CResultAErreur SerializeValeurVariable( ref object valeur, CVariableDynamique variable, C2iSerializer serializer, CContexteDonnee contexteDonnee) { return(SerializeValeurVariable( ref valeur, variable, serializer, contexteDonnee, false)); }
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); }
/// ////////////////////////////////////////////////// public override CResultAErreur VerifieIntegrite(CFiltreDynamique filtre) { CResultAErreur result = CResultAErreur.True; if (m_champ == null) { result.EmpileErreur(I.T("Field not defined|144")); } if (m_strIdOperateur == null) { result.EmpileErreur(I.T("Operator not defined|158")); } if (m_champValeur is CDefinitionProprieteDynamiqueChampCustom && m_champ is CDefinitionProprieteDynamiqueChampCustom) { result.EmpileErreur(I.T("Test function not supported : Custom field = Custom field|159")); return(result); } if (ExpressionValeur == null && m_champValeur == null) { result.EmpileErreur(I.T("Value formula is incorrect|145")); } else if (ExpressionValeur != null) { ArrayList lstChamps = ExpressionValeur.ExtractExpressionsType(typeof(C2iExpressionChamp)); foreach (C2iExpressionChamp expChamp in lstChamps) { CDefinitionProprieteDynamique def = expChamp.DefinitionPropriete; if (def == null) { result.EmpileErreur(I.T("Null field in value formula|160")); } else { if (def is CDefinitionProprieteDynamiqueVariableDynamique) { CDefinitionProprieteDynamiqueVariableDynamique defVar = (CDefinitionProprieteDynamiqueVariableDynamique)def; CVariableDynamique variable = filtre.GetVariable(defVar.IdChamp); if (variable == null) { result.EmpileErreur(I.T("The variable @1 doesn't exist|147", defVar.Nom)); } } } } } return(result); }
/// ////////////////////////////////////////////////// protected override CResultAErreur MySerialize(C2iSerializer serializer) { int nVersion = GetNumVersion(); CResultAErreur result = serializer.TraiteVersion(ref nVersion); if (!result) { return(result); } result = base.MySerialize(serializer); if (!result) { return(result); } string strIdVariable = ""; if (m_variable != null && serializer.Mode == ModeSerialisation.Ecriture) { strIdVariable = m_variable.IdVariable; } if (nVersion < 1 && serializer.Mode == ModeSerialisation.Lecture) { int nIdTemp = -1; serializer.TraiteInt(ref nIdTemp); strIdVariable = nIdTemp.ToString(); } else { serializer.TraiteString(ref strIdVariable); } if (serializer.Mode == ModeSerialisation.Lecture) { if (strIdVariable == "") { m_variable = null; } else { m_variable = ((IElementAVariablesDynamiquesBase)serializer.GetObjetAttache(typeof(IElementAVariablesDynamiquesBase))).GetVariable(strIdVariable); } } return(result); }
/// ////////////////////////////////////////// protected override sc2i.common.CResultAErreur MAJ_Champs() { CResultAErreur result = base.MAJ_Champs(); CContexteAnalyse2iExpression contexte = new CContexteAnalyse2iExpression(ObjetEdite.Process, typeof(CProcess)); CAnalyseurSyntaxiqueExpression analyseur = new CAnalyseurSyntaxiqueExpression(contexte); result = analyseur.AnalyseChaine(m_txtFormuleFileName.Text); if (!result) { return(result); } ActionOuvrirFichier.FormuleFichier = (C2iExpression)result.Data; result = analyseur.AnalyseChaine(m_txtFormuleArguments.Text); if (!result) { return(result); } ActionOuvrirFichier.FormuleArguments = (C2iExpression)result.Data; if (m_comboBoxVariables.SelectedValue is CVariableDynamique) { CVariableDynamique variable = (CVariableDynamique)m_comboBoxVariables.SelectedValue; if (variable.IdVariable == "") { m_variableNew = new CVariableProcessTypeComplexe(ActionOuvrirFichier.Process); m_variableNew.Nom = variable.Nom; m_variableNew.SetTypeDonnee(new CTypeResultatExpression(typeof(int), false)); ActionOuvrirFichier.Process.AddVariable(m_variableNew); variable = m_variableNew; FillListeVariables(); m_comboBoxVariables.SelectedValue = m_variableNew; } ActionOuvrirFichier.VariableResultat = variable; } else { ActionOuvrirFichier.VariableResultat = null; } ActionOuvrirFichier.WaitForExit = m_chkWaitForExit.Checked; ActionOuvrirFichier.SurServeur = m_chkSurServeur.Checked; return(result); }
/// //////////////////////////////////////////////////////// public override CResultAErreur VerifieDonnees() { CResultAErreur result = CResultAErreur.True; CVariableDynamique variable = VariableAModifier; if (IdVariableAModifier != "") { string strTypeVariable = ""; if (variable == null) { result.EmpileErreur(I.T("The variable to be modified isn't defined or doesn't exist|215")); } else { strTypeVariable = DynamicClassAttribute.GetNomConvivial(variable.TypeDonnee.TypeDotNetNatif); } if (variable is CVariableProcessTypeComplexe && typeof(IObjetDonneeAIdNumerique).IsAssignableFrom(variable.TypeDonnee.TypeDotNetNatif)) { //C'est une objetAIdAuto CTypeResultatExpression type = ExpressionValeur.TypeDonnee; if (!type.TypeDotNetNatif.Equals(typeof(int)) && !type.TypeDotNetNatif.Equals(variable.TypeDonnee.TypeDotNetNatif)) { result.EmpileErreur(I.T("The value must be a @1 or an integer because it's the @2 id|226", strTypeVariable, strTypeVariable)); } else { if (type.IsArrayOfTypeNatif && !variable.TypeDonnee.IsArrayOfTypeNatif) { result.EmpileErreur(I.T("The value must be a @1 or an integer because it's the @2 id|226", strTypeVariable, strTypeVariable)); } } } else if (!ExpressionValeur.TypeDonnee.Equals(VariableAModifier.TypeDonnee)) { result.EmpileErreur(I.T("The formula of value isn't of the awaited type by the variable (@1)|227", strTypeVariable)); } } return(result); }
/// ////////////////////////////////////////////////// protected bool DoesExpressionUtiliseVariable(C2iExpression expression, CVariableDynamique variable) { if (expression == null) { return(false); } foreach (C2iExpressionChamp exp in expression.ExtractExpressionsType(typeof(C2iExpressionChamp))) { if (exp.DefinitionPropriete is CDefinitionProprieteDynamiqueVariableDynamique) { CDefinitionProprieteDynamiqueVariableDynamique def = (CDefinitionProprieteDynamiqueVariableDynamique)exp.DefinitionPropriete; if (def.IdChamp == variable.IdVariable) { return(true); } } } return(false); }
//---------------------------------- private bool FillMacroValeurWithValue(CMacroObjetValeur mv, object data, Dictionary <CObjetDonneeAIdNumerique, CMacroObjet> dicObjetToMacroObjet) { C2iExpression formule = null; string strIdVariableRef = ""; CObjetDonneeAIdNumerique obj = data as CObjetDonneeAIdNumerique; if (obj != null) { CMacroObjet mr = null; if (dicObjetToMacroObjet.TryGetValue(obj, out mr)) { strIdVariableRef = mr.IdVariableAssociee; } else { CMacroObjet macroObjet = new CMacroObjet(Macro); macroObjet.TypeObjet = obj.GetType(); macroObjet.TypeOperation = new CTypeOperationSurObjet(CTypeOperationSurObjet.TypeOperation.Aucune); macroObjet.DesignationObjet = obj.DescriptionElement; macroObjet.IdObjet = obj.Id; Macro.AddObjet(macroObjet); dicObjetToMacroObjet[obj] = macroObjet; macroObjet.CreateVariable(obj); strIdVariableRef = macroObjet.IdVariableAssociee; } } if (strIdVariableRef == "") { formule = GetFormuleValeur(data); } if (formule == null && strIdVariableRef == "") { return(false); } if (strIdVariableRef != "") { CVariableDynamique variable = Macro.GetVariable(strIdVariableRef); formule = new C2iExpressionChamp(new CDefinitionProprieteDynamiqueVariableDynamique(variable)); } mv.FormuleValeur = formule; return(true); }