コード例 #1
0
 protected virtual string[] GetBooPaths(Controller controller, string[] myBoos){
     var paths = new List<string>();
     foreach (var s in myBoos){
         paths.Add(controller.Context.Server.MapPath("~/views/report/" + s + ".boo"));
     }
     return paths.ToArray();
 }
コード例 #2
0
ファイル: Table.cs プロジェクト: Qorpent/comdiv.oldcore
        public ITable RemoveZeroRows(Func<ITable, int, bool> skipRowPredicate,
                                     Func<ITable, int, bool> skipColumnPredicate, Func<ICell, bool> isNullPredicate){
            //performance - exit before params checking on empty table
            if (0 == RowsCount){
                return this;
            }

            if (null == skipRowPredicate){
                skipRowPredicate = (t, r) => false;
            }
            if (null == skipColumnPredicate){
                skipColumnPredicate = (t, c) => false;
            }
            if (null == isNullPredicate){
                isNullPredicate = cell => cell.Text.noContent();
            }

            var rowsToRemove = new List<int>();


            //обходим все строки насчет выявления

            for (int row = 0; row < RowsCount; row ++){
                if (skipRowPredicate(this, row)){
                    continue;
                }
                if (Body[row].CellCount != ColumnCount){
                    continue;
                }
                if (Body[row].Attributes.ContainsKey("istitle")){
                    continue;
                }


                bool hasNoZeroes = false;
                for (int col = 0; col < ColumnCount; col++){
                    if (skipColumnPredicate(this, col)){
                        continue;
                    }
                    if (!isNullPredicate(Body[row, col])){
                        hasNoZeroes = true;
                        break;
                    }
                }
                if (!hasNoZeroes){
                    rowsToRemove.Add(row);
                }
            }


            //удаляем теперь отобранные нулевые строки

            foreach (int row in rowsToRemove.OrderByDescending(i => i)){
                Body.Rows.RemoveAt(row);
            }

            Normalize();

            return this;
        }