private void SetControlValues(EbDataRow masterRow)
        {
            foreach (var pair in this.Form.ControlDictionary)
            {
                EbMobileControl ctrl = pair.Value;
                object          data = masterRow[ctrl.Name];
                try
                {
                    if (ctrl is IFileUploadControl)
                    {
                        this.SetFileData(ctrl, data);
                    }
                    else if (ctrl is ILinesEnabled line)
                    {
                        EbDataTable lines = this.formData.Tables.Find(table => table.TableName == line.TableName);
                        ctrl.SetValue(lines);
                    }
                    else
                    {
                        ctrl.SetValue(data);
                    }

                    if (this.IsEditButtonVisible)
                    {
                        ctrl.SetAsReadOnly(true);
                    }
                }
                catch (Exception ex)
                {
                    EbLog.Error("Error when setting value to controls on edit");
                    EbLog.Error(ex.Message);
                }
            }
        }
        private void EvaluateDefaultValueExpr(EbMobileControl ctrl, string parent)
        {
            string expr = ctrl.DefaultValueExpression.GetCode();

            string computed = GetComputedExpression(expr, ctrl.Name, parent);

            try
            {
                object value = evaluator.Execute(computed);
                ctrl.SetValue(value);
                ctrl.DefaultExprEvaluated = true;
            }
            catch (Exception ex)
            {
                EbLog.Info($"Default script evaluation error in control '{ctrl.Name}'");
                EbLog.Error(ex.Message);
            }
        }
        private void EvaluateValueExpr(EbMobileControl ctrl, string trigger_control, string parent)
        {
            string expr = ctrl.ValueExpr.GetCode();

            string computed = GetComputedExpression(expr, ctrl.Name, parent);

            try
            {
                object value = evaluator.Execute(computed);
                ctrl.SetValue(value);
                ctrl.ValueChanged(trigger_control);
            }
            catch (Exception ex)
            {
                EbLog.Info($"Value script evaluation error in control '{ctrl.Name}'");
                EbLog.Error(ex.Message);
            }
        }
        private void SetFileData(EbMobileControl ctrl, object data)
        {
            FUPSetValueMeta fup = new FUPSetValueMeta
            {
                TableName  = this.Form.TableName,
                RowId      = this.RowId,
                FileRefIds = data?.ToString()
            };

            if (ctrl is EbMobileFileUpload)
            {
                if (this.filesData != null && this.filesData.ContainsKey(ctrl.Name))
                {
                    fup.Files.AddRange(this.filesData[ctrl.Name]);
                }
            }
            ctrl.SetValue(fup);
        }