コード例 #1
0
        public virtual XVar refineOpenFilters(dynamic _param_openFilters)
        {
            #region pass-by-value parameters
            dynamic openFilters = XVar.Clone(_param_openFilters);
            #endregion

            dynamic openFiltersRefined = XVar.Array();
            openFiltersRefined = XVar.Clone(XVar.Array());
            foreach (KeyValuePair <XVar, dynamic> panelFiled in this.panelSearchFields.GetEnumerator())
            {
                dynamic key = null;
                key = XVar.Clone(MVCFunctions.array_search((XVar)(panelFiled.Value), (XVar)(openFilters)));
                if (!XVar.Equals(XVar.Pack(key), XVar.Pack(false)))
                {
                    MVCFunctions.array_splice((XVar)(openFilters), (XVar)(key), new XVar(1));
                }
            }
            foreach (KeyValuePair <XVar, dynamic> field in openFilters.GetEnumerator())
            {
                if (XVar.Pack(MVCFunctions.in_array((XVar)(field.Value), (XVar)(this.allSearchFields))))
                {
                    openFiltersRefined.InitAndSetArrayItem(field.Value, null);
                }
            }
            return(openFiltersRefined);
        }
コード例 #2
0
        public virtual XVar removeRowsColumns(dynamic _param_cellRemoveFlag, dynamic _param_rowsOnly = null)
        {
            #region default values
            if (_param_rowsOnly as Object == null)
            {
                _param_rowsOnly = new XVar(false);
            }
            #endregion

            #region pass-by-value parameters
            dynamic cellRemoveFlag = XVar.Clone(_param_cellRemoveFlag);
            dynamic rowsOnly       = XVar.Clone(_param_rowsOnly);
            #endregion

            dynamic canDeleteRow = null, cell = null, i = null, ret = XVar.Array(), row = null, rowCells = XVar.Array(), rowIdx = null, rowsArr = null;
            ret = XVar.Clone(new XVar("cols", XVar.Array(), "rows", XVar.Array()));
            if (XVar.Pack(!(XVar)(rowsOnly)))
            {
                dynamic canDeleteCol = null, col = null, colCells = XVar.Array(), colIdx = null, colsArr = null;
                col = new XVar(0);
                for (; col < this.width; ++(col))
                {
                    colCells     = XVar.Clone(getColumnCells((XVar)(col)));
                    canDeleteCol = new XVar(true);
                    foreach (KeyValuePair <XVar, dynamic> _cell in colCells.GetEnumerator())
                    {
                        if ((XVar)(!(XVar)(this.cells[_cell.Value][cellRemoveFlag])) && (XVar)(MVCFunctions.count(this.cells[_cell.Value]["cols"]) == 1))
                        {
                            canDeleteCol = new XVar(false);
                            break;
                        }
                    }
                    if (XVar.Pack(!(XVar)(canDeleteCol)))
                    {
                        continue;
                    }
                    i = new XVar(0);
                    for (; i < MVCFunctions.count(colCells); ++(i))
                    {
                        cell   = XVar.Clone(colCells[i]);
                        colIdx = XVar.Clone(MVCFunctions.array_search((XVar)(col), (XVar)(this.cells[cell]["cols"])));
                        MVCFunctions.array_splice((XVar)(this.cells[cell]["cols"]), (XVar)(colIdx), new XVar(1));
                        colsArr = this.cells[cell]["cols"];
                        MVCFunctions.array_splice((XVar)(colsArr), (XVar)(colIdx), new XVar(1));
                        this.cells.InitAndSetArrayItem(colsArr, cell, "cols");
                    }
                    ret.InitAndSetArrayItem(col, "cols", null);
                }
            }
            row = XVar.Clone(this.height - 1);
            for (; XVar.Pack(0) <= row; --(row))
            {
                rowCells     = XVar.Clone(getRowCells((XVar)(row)));
                canDeleteRow = new XVar(true);
                foreach (KeyValuePair <XVar, dynamic> _cell in rowCells.GetEnumerator())
                {
                    if ((XVar)(!(XVar)(this.cells[_cell.Value][cellRemoveFlag])) && (XVar)((XVar)(MVCFunctions.count(this.cells[_cell.Value]["rows"]) == 1) || (XVar)(XVar.Equals(XVar.Pack(this.cells[_cell.Value]["rows"][0]), XVar.Pack(row)))))
                    {
                        canDeleteRow = new XVar(false);
                        break;
                    }
                }
                if (XVar.Pack(!(XVar)(canDeleteRow)))
                {
                    continue;
                }
                i = new XVar(0);
                for (; i < MVCFunctions.count(rowCells); ++(i))
                {
                    cell    = XVar.Clone(rowCells[i]);
                    rowIdx  = XVar.Clone(MVCFunctions.array_search((XVar)(row), (XVar)(this.cells[cell]["rows"])));
                    rowsArr = XVar.Clone(this.cells[cell]["rows"]);
                    MVCFunctions.array_splice((XVar)(rowsArr), (XVar)(rowIdx), new XVar(1));
                    this.cells.InitAndSetArrayItem(rowsArr, cell, "rows");
                }
                ret.InitAndSetArrayItem(row, "rows", null);
            }
            return(ret);
        }