/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.dgrConfig.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgrConfig_ItemCommand); this.dgrConfig.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgrConfig_ItemDataBound); SmartNav smartNav = new SmartNav(); this.Controls.Add(smartNav); }
/// <summary> /// This function will take and process formula. /// </summary> /// <param name="formula"></param> /// Supports smart parameters as part of the formula or target /// <returns></returns> public bool ProcessFormula(string formula) { try { CurrentDCO.Variable[Const.DCOResultVar] = Const.True; var localSmartObj = new SmartNav(this); WriteLog(Messages.PFStart); WriteLog(string.Format(Messages.PFProcessing, formula)); string eval; //formula to be processed string target; // target DCO node to have result assigned to var isAssignement = TestForAssignement(formula, out target, out eval); var res = RunCalculations(eval); WriteLog($"{eval} = {res}"); if (isAssignement) { localSmartObj.DCONavSetValue(target, res); } else { return(Convert.ToBoolean(bool.Parse(RunCalculations(eval)))); } } catch (Exception ex) { CurrentDCO.Variable[Const.DCOResultVar] = Const.False; //CallFormulaProcessor(ReadSmartParameter(formula)); // It is a best practice to have a try catch in every action to prevent any unexpected errors // from being thrown back to RRS. WriteLog(string.Format(Messages.PFProcessingException, formula, ex.Message)); return(false); } finally { WriteLog(Messages.PFEnd); } return(true); }