/// <summary> /// peforms an assign rule by assigning an expression to a variable. return the variable that was assigned /// </summary> /// <returns>object</returns> public override object Execute() { object result = null; object[] args = null; if (!string.IsNullOrEmpty(this.ClassName)) { // this is a dll call // and is NOT implemented as of 11/05/2010 if (this.Context.DLLClassList.ContainsKey(this.ClassName.ToLower())) { if (this.ParameterList.Count > 0) { args = new object[this.ParameterList.Count]; for (int i = 0; i < this.ParameterList.Count; i++) { args[i] = this.ParameterList[i].Execute(); } } else { args = new object[0]; } IDLLClass DLLObject = this.Context.DLLClassList[this.ClassName.ToLower()]; result = DLLObject.Execute (this.MethodName, args); } } IVariable var; //DataType dataType = DataType.Unknown; string dataValue = string.Empty; var = (IVariable) this.Context.CurrentScope.Resolve(this.QualifiedId); if (var != null) { if (var.VarType == VariableType.DataSource) { IVariable fieldVar = new DataSourceVariableRedefined(var.Name, var.DataType); fieldVar.PromptText = var.PromptText; fieldVar.Expression = result.ToString(); this.Context.CurrentScope.Undefine(var.Name); this.Context.CurrentScope.Define((EpiInfo.Plugin.IVariable)fieldVar); } else { if (result != null) { var.Expression = result.ToString(); } else { var.Expression = "Null"; } } } else { if (result != null) { this.Context.EnterCheckCodeInterface.Assign(this.QualifiedId, result); } } return result; }
/// <summary> /// peforms an assign rule by assigning an expression to a variable. return the variable that was assigned /// </summary> /// <returns>object</returns> public override object Execute() { object result = null; object[] args = null; if (!string.IsNullOrEmpty(this.ClassName)) { // this is a dll call // and is NOT implemented as of 11/05/2010 if (this.Context.DLLClassList.ContainsKey(this.ClassName.ToLowerInvariant())) { if (this.ParameterList.paramList != null) { args = new object[this.ParameterList.paramList.Count]; for (int i = this.ParameterList.paramList.Count - 1; i > -1; i--) { args[i] = this.ParameterList.paramList.Pop().Execute(); } } else { args = new object[0]; } object DLLObject = this.Context.DLLClassList[this.ClassName.ToLowerInvariant()]; result = Microsoft.VisualBasic.Interaction.CallByName(DLLObject, this.MethodName, Microsoft.VisualBasic.CallType.Method, args); } } IVariable var; //DataType dataType = DataType.Unknown; string dataValue = string.Empty; if (this.Context.MemoryRegion.TryGetVariable(this.QualifiedId, out var)) { if (var.VarType == VariableType.DataSource) { IVariable fieldVar = new DataSourceVariableRedefined(var.Name, var.DataType); fieldVar.PromptText = var.PromptText; fieldVar.Expression = result.ToString(); this.Context.MemoryRegion.UndefineVariable(var.Name); this.Context.MemoryRegion.DefineVariable(fieldVar); } else { if (result != null) { var.Expression = result.ToString(); } else { var.Expression = "Null"; } } } else { /* * if (result != null) * { * this.Context.AnalysisCheckCodeInterface.Assign(this.QualifiedId, result); * }*/ } return(result); }
/// <summary> /// peforms an assign rule by assigning an expression to a variable. return the variable that was assigned /// </summary> /// <returns>object</returns> public override object Execute() { object result = null; object[] args = null; if (!string.IsNullOrEmpty(this.ClassName)) { // this is a dll call // and is NOT implemented as of 11/05/2010 if (this.Context.DLLClassList.ContainsKey(this.ClassName.ToLowerInvariant())) { if (this.ParameterList.Count > 0) { args = new object[this.ParameterList.Count]; for (int i = 0; i < this.ParameterList.Count; i++) { args[i] = this.ParameterList[i].Execute(); } } else { args = new object[0]; } IDLLClass DLLObject = this.Context.DLLClassList[this.ClassName.ToLowerInvariant()]; result = DLLObject.Execute(this.MethodName, args); } } IVariable var; //DataType dataType = DataType.Unknown; string dataValue = string.Empty; var = (IVariable)this.Context.CurrentScope.Resolve(this.QualifiedId); if (var != null) { if (var.VarType == VariableType.DataSource) { IVariable fieldVar = new DataSourceVariableRedefined(var.Name, var.DataType); fieldVar.PromptText = var.PromptText; fieldVar.Expression = result.ToString(); this.Context.CurrentScope.Undefine(var.Name); this.Context.CurrentScope.Define((EpiInfo.Plugin.IVariable)fieldVar); } else { if (result != null) { var.Expression = result.ToString(); } else { var.Expression = "Null"; } } } else { if (result != null) { this.Context.EnterCheckCodeInterface.Assign(this.QualifiedId, result); } } return(result); }
/// <summary> /// peforms an assign rule by assigning an expression to a variable. return the variable that was assigned /// </summary> /// <returns>object</returns> public override object Execute() { object result = null; object[] args = null; if (!string.IsNullOrEmpty(this.ClassName)) { // this is a dll call // and is NOT implemented as of 11/05/2010 if (this.Context.DLLClassList.ContainsKey(this.ClassName.ToLower())) { if (this.ParameterList.paramList != null) { args = new object[this.ParameterList.paramList.Count]; for (int i = this.ParameterList.paramList.Count -1; i > -1; i--) { args[i] = this.ParameterList.paramList.Pop().Execute(); } } else { args = new object[0]; } object DLLObject = this.Context.DLLClassList[this.ClassName.ToLower()]; result = Microsoft.VisualBasic.Interaction.CallByName(DLLObject, this.MethodName, Microsoft.VisualBasic.CallType.Method, args); } } IVariable var; //DataType dataType = DataType.Unknown; string dataValue = string.Empty; if (this.Context.MemoryRegion.TryGetVariable(this.QualifiedId, out var)) { if (var.VarType == VariableType.DataSource) { IVariable fieldVar = new DataSourceVariableRedefined(var.Name, var.DataType); fieldVar.PromptText = var.PromptText; fieldVar.Expression = result.ToString(); this.Context.MemoryRegion.UndefineVariable(var.Name); this.Context.MemoryRegion.DefineVariable(fieldVar); } else { if (result != null) { var.Expression = result.ToString(); } else { var.Expression = "Null"; } } } else { /* if (result != null) { this.Context.AnalysisCheckCodeInterface.Assign(this.QualifiedId, result); }*/ } return result; }