示例#1
0
        public DataGridRowHelper(EbMobileDataGrid dataGrid)
        {
            bool initEvaluator = false;

            DataGrid = dataGrid;

            if (!string.IsNullOrWhiteSpace(DataGrid?.RowColorExpr?.Code))
            {
                string script = DataGrid.RowColorExpr.GetCode();
                RowColorExprCode = GetComputedExpression(script);
                InitColumnDictOriginal();
                initEvaluator = true;
            }
            if (!string.IsNullOrWhiteSpace(DataGrid?.PersistRowOnlyIf?.Code))
            {
                string script = DataGrid.PersistRowOnlyIf.GetCode();
                PersistRowExprCode = GetComputedExpression(script);
                initEvaluator      = true;
            }

            if (initEvaluator)
            {
                evaluator = new EbSciptEvaluator
                {
                    OptionScriptNeedSemicolonAtTheEndOfLastExpression = false
                };

                ColumnDictionary = new Dictionary <string, MobileTableColumn>();
                foreach (EbMobileControl ctrl in DataGrid.ChildControls)
                {
                    ColumnDictionary.Add(ctrl.Name, new MobileTableColumn(ctrl.Name, ctrl.EbDbType, null));
                }
                evaluator.SetVariable("form", new EbDataGridEvaluator(ColumnDictionary));
            }
        }
        public void SetVariable(EbPdfGlobals globals)
        {
            Dictionary <string, object> dict = new Dictionary <string, object>
            {
                { "T0", globals["T0"] },
                { "T1", globals["T1"] },
                { "T2", globals["T2"] },
                { "T3", globals["T3"] },
                { "T4", globals["T4"] },
                { "T5", globals["T5"] },
                { "T6", globals["T6"] },
                { "T7", globals["T7"] },
                { "T8", globals["T8"] },
                { "T9", globals["T9"] },
                { "Params", globals["Params"] },
                { "Calc", globals["Calc"] },
                { "Summary", globals["Summary"] },
                { "CurrentField", globals["CurrentField"] }
            };

            evaluator.SetVariable(dict);
        }