コード例 #1
0
        public ActionResult GetAuthorByRoleId(int roleid)
        {
            TreeTable <AuthorUIModel> authorlist = roleservice.GetAuthorByRoleId(roleid);

            ViewBag.authorlist = authorlist.data;
            return(Json(authorlist, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public TreeTable <RoleUIModel> GetRoleList()
        {
            using (var db = new EFContext())
            {
                List <RoleUIModel> rolelist = db.SysRoles
                                              .Select(x => new RoleUIModel()
                {
                    RoleIdUIModel     = x.RoleId,
                    RoleGuidUIModel   = x.RoleGuid,
                    RoleNameUIModel   = x.RoleName,
                    RolePathUIModel   = x.RolePath,
                    ParentGuidUIModel = x.ParentGuid,
                    IsParent          = x.ParentGuid == null ? true : false,
                    IsHavChild        = db.SysRoles.Any(m => m.ParentGuid == x.RoleGuid),
                })
                                              .ToList();
                TreeTable <RoleUIModel> TreeTable = new TreeTable <RoleUIModel>();

                TreeTable.code  = 0;
                TreeTable.count = rolelist.Count;
                TreeTable.data  = rolelist;
                TreeTable.msg   = "ok";


                return(TreeTable);
            }
        }
コード例 #3
0
        /// <summary>
        /// 权限列表
        /// </summary>
        /// <returns></returns>
        public TreeTable <AuthorUIModel> GetAuthorList()
        {
            List <AuthorUIModel> authorist = new List <AuthorUIModel>();

            using (var db = new EFContext())
            {
                authorist = db.SysAuthors
                            .Select(x => new AuthorUIModel()
                {
                    AuthorIdUIModel       = x.AuthorId,
                    ActionNameUIModel     = x.ActionName,
                    AuthorGuidUIModel     = x.AuthorGuid,
                    AuthorPathUIModel     = x.AuthorPath,
                    AuthorTypeUIModel     = x.AuthorType,
                    AuthorNameUIModel     = x.AuthorName,
                    ControllerNameUIModel = x.ControllerName,
                    ParentGuidUIModel     = x.ParentGuid,
                    IsHavChild            = db.SysAuthors.Any(m => m.ParentGuid == x.AuthorGuid),//是否有子菜单
                })
                            .ToList();

                TreeTable <AuthorUIModel> TreeTable = new TreeTable <AuthorUIModel>();


                TreeTable.data  = authorist;
                TreeTable.code  = 0;
                TreeTable.msg   = "ok";
                TreeTable.count = authorist.Count;

                return(TreeTable);
            }
        }
コード例 #4
0
 /// <summary>
 /// Initializes a new <see cref="GenericTreeTable{V}"/>.
 /// </summary>
 /// <param name="sorted"></param>
 public GenericTreeTable(bool sorted)
 {
     thisTree = new TreeTable(sorted)
     {
         Tag = this
     };
 }
コード例 #5
0
ファイル: Host.cs プロジェクト: pwdlugosz/Spectre
        /// <summary>
        /// Creates a table with a cluster index
        /// </summary>
        /// <param name="Alias"></param>
        /// <param name="Alias"></param>
        /// <param name="Columns"></param>
        /// <param name="ClusterColumns"></param>
        /// <param name="State"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        public TreeTable CreateTable(string Path, Schema Columns, Key ClusterColumns, BinaryRecordTree.TreeAffinity State, int PageSize)
        {
            this._Cache.DropTable(Path);
            TreeTable t = new TreeTable(this, Path, Columns, ClusterColumns, State, PageSize);

            return(t);
        }
コード例 #6
0
        public TreeTable <AuthorUIModel> GetAuthorByRoleId(int rolid)
        {
            using (var db = new EFContext())
            {
                ICollection <Author> list = db.SysRoles.Find(rolid).Authors;
                //.Authors.Select(x => new AuthorUIModel()
                //{
                //    AuthorNameUIModel = x.AuthorName,
                //    AuthorTypeUIModel = x.AuthorType,
                //    ControllerNameUIModel = x.ControllerName,
                //    ActionNameUIModel = x.ActionName,
                //    AuthorPathUIModel = x.AuthorPath,
                //    AuthorGuidUIModel = x.AuthorGuid,
                //    AuthorIdUIModel = x.AuthorId,
                //    ParentGuidUIModel = x.ParentGuid,

                //})

                List <AuthorUIModel> authorlist = new AuthorService().GetAuthorList().data;

                foreach (var item in authorlist)
                {
                    item.LAY_CHECKED = list.Any(m => m.AuthorId == item.AuthorIdUIModel) ? true : false;
                }

                ////查询所有的权限列表
                //List<AuthorUIModel> authorlist = db.SysAuthors
                //.Select(x => new AuthorUIModel()
                //{
                //    AuthorNameUIModel = x.AuthorName,
                //    AuthorTypeUIModel = x.AuthorType,
                //    ControllerNameUIModel = x.ControllerName,
                //    ActionNameUIModel = x.ActionName,
                //    AuthorPathUIModel = x.AuthorPath,
                //    AuthorGuidUIModel = x.AuthorGuid,
                //    AuthorIdUIModel = x.AuthorId,
                //    ParentGuidUIModel = x.ParentGuid,
                //    LAY_CHECKED = list.Any(m => m.AuthorId==x.AuthorId)?true:false,
                //})
                //.ToList();



                TreeTable <AuthorUIModel> tretableauthorlist = new TreeTable <AuthorUIModel>();

                tretableauthorlist.code  = 0;
                tretableauthorlist.count = authorlist.Count;
                tretableauthorlist.data  = authorlist;
                tretableauthorlist.msg   = "ok";
                return(tretableauthorlist);
            }
        }
コード例 #7
0
        public static MvcHtmlString TreeTable <T>(this HtmlHelper htmlHelper, IEnumerable <T> dataSource,
                                                  params Expression <Func <TreeTable <T>, Column <T> > >[] columns)
            where T : ITreeEnumerable <T>
        {
            var table = new TreeTable <T>(htmlHelper)
                        .Class("table table-bordered table-striped")
                        .DataSource(dataSource);

            foreach (var column in columns)
            {
                column.Compile()(table);
            }
            return(MvcHtmlString.Create(table.ToString()));
        }
コード例 #8
0
        private static void AddTreeTable(
            this CellCursor cursor,
            TreeTable treeTable,
            ReportToWorkbookProjectionContext context,
            PassKind passKind)
        {
            if (passKind == PassKind.Formatting)
            {
                // Format whole table
                cursor.CanvassedRange.ApplyTableFormat(treeTable.Format);

                // Format columns
                var tableColumns = treeTable.TableColumns;

                var topLeftDataCellReference = cursor.HasMarker(TopLeftDataCellMarker) ? cursor.GetMarkedCellReference(TopLeftDataCellMarker) : null;

                var bottomRightNonSummaryDataCellReference = cursor.HasMarker(BottomRightNonSummaryDataCellMarker) ? cursor.GetMarkedCellReference(BottomRightNonSummaryDataCellMarker) : null;

                var bottomRightHeaderCellReference = cursor.HasMarker(BottomRightHeaderCellMarker) ? cursor.GetMarkedCellReference(BottomRightHeaderCellMarker) : null;

                foreach (var column in tableColumns.Columns)
                {
                    var wholeColumnRange = cursor.Worksheet.GetRange(cursor.RowNumber, cursor.MaxRowNumber, cursor.ColumnNumber, cursor.ColumnNumber);

                    // ReSharper disable once PossibleNullReferenceException
                    var dataCellsRange = topLeftDataCellReference == null
                        ? null
                        : cursor.Worksheet.GetRange(topLeftDataCellReference.RowNumber, bottomRightNonSummaryDataCellReference.RowNumber, cursor.ColumnNumber, cursor.ColumnNumber);

                    var lastHeaderCellToLastNonSummaryDataCellRange = bottomRightHeaderCellReference == null
                        ? null
                        : dataCellsRange == null
                            ? null
                            : cursor.Worksheet.GetRange(bottomRightHeaderCellReference.RowNumber, bottomRightNonSummaryDataCellReference.RowNumber, cursor.ColumnNumber, cursor.ColumnNumber);

                    // Individual column format will override the format applied to all table columns,
                    // that's why we first apply the table columns format and then the individual column's format.
                    wholeColumnRange.ApplyColumnFormat(dataCellsRange, lastHeaderCellToLastNonSummaryDataCellRange, tableColumns.ColumnsFormat);

                    wholeColumnRange.ApplyColumnFormat(dataCellsRange, lastHeaderCellToLastNonSummaryDataCellRange, column.Format);

                    cursor.MoveRight();
                }

                cursor.ResetColumn();
            }

            // Add rows
            cursor.AddTableRows(treeTable.TableRows, context, passKind);
        }
コード例 #9
0
        void RenderObjectResult(BsonDocument bsonDocument)
        {
            tabOutput.SelectedIndex = 0;
            txtOutput.Text          = "";
            var root = TreeTable.GetSingleNodeTree(bsonDocument);

            treeListViewOutput.Nodes.Add(root);

            if (treeListViewOutput.Nodes.Count > 0)
            {
                treeListViewOutput.ShowLines     = true;
                treeListViewOutput.ShowRootLines = false;
                treeListViewOutput.Nodes[0].Expand();
            }
        }
        public static void GetAllCells___Should_return_all_rows_in_order___When_all_kinds_of_rows_present()
        {
            // Arrange
            var tableRowsResult = GetTableRowsForTesting();

            var treeTable = new TreeTable(new TableColumns(Some.ReadOnlyDummies <Column>(3).ToList()), tableRowsResult.Item1);

            var expected = tableRowsResult.Item2;

            // Act
            var actual = treeTable.GetAllCells();

            // Assert
            actual.AsTest().Must().BeEqualTo(expected);
        }
コード例 #11
0
        void RenderListResult(List <BsonDocument> list)
        {
            tabOutput.SelectedIndex = 0;
            txtOutput.Text          = "";
            var root = TreeTable.GetTree(list);

            treeListViewOutput.Nodes.AddRange(root.ToArray());

            if (treeListViewOutput.Nodes.Count > 0)
            {
                treeListViewOutput.ShowLines     = true;
                treeListViewOutput.ShowRootLines = false;
                treeListViewOutput.Nodes[0].Expand();
            }
        }
        public static void GetAllRowsInOrder___Should_return_all_rows_in_order___When_only_footer_rows_present()
        {
            // Arrange
            var tableRows = new TableRows(footerRows: GetFooterRowsForTesting().Item1);

            var treeTable = new TreeTable(new TableColumns(Some.ReadOnlyDummies <Column>(3).ToList()), tableRows);

            var expectedIds = Enumerable.Range(15, 3).Select(_ => _.ToString()).ToList();

            // Act
            var actual = treeTable.GetAllRowsInOrder();

            // Assert
            var actualIds = actual.Select(_ => _.Id).ToList();

            actualIds.AsTest().Must().BeEqualTo(expectedIds);
        }
コード例 #13
0
 /// <summary>
 /// Initializes a new <see cref="TreeTableWithCounterEnumerator"/>.
 /// </summary>
 /// <param name="tree"></param>
 public TreeTableWithCounterEnumerator(TreeTable tree)
     : base(tree)
 {
 }
コード例 #14
0
 /// <summary>
 /// Creates a branch that can hold this entry when new leaves are inserted into the tree.
 /// </summary>
 /// <param name="tree"></param>
 /// <returns></returns>
 public override ITreeTableBranch CreateBranch(TreeTable tree)
 {
     return(new TreeTableWithSummaryBranch(tree));
 }
コード例 #15
0
 /// <summary>
 /// Initializes a new <see cref="TreeTableWithSummaryEnumerator"/>.
 /// </summary>
 /// <param name="tree"></param>
 public TreeTableWithSummaryEnumerator(TreeTable tree)
     : base(tree)
 {
 }
コード例 #16
0
 public GenericTreeTableEntry(TreeTable tree, V value)
 {
     thisValue = value;
     Tree      = tree;
 }
コード例 #17
0
 /// <summary>
 /// Initializes a new <see cref="TreeTableWithCounterBranch"/>.
 /// </summary>
 /// <param name="tree"></param>
 public TreeTableWithCounterBranch(TreeTable tree)
     : base(tree)
 {
 }
コード例 #18
0
 /// <summary>
 /// Creates a branch that can hold this entry when new leaves are inserted into the tree.
 /// </summary>
 /// <param name="tree"></param>
 /// <returns></returns>
 public virtual ITreeTableBranch CreateBranch(TreeTable tree)
 {
     return(new TreeTableBranch(tree));
 }
コード例 #19
0
 /// <summary>
 /// Creates a branch that can hold this entry when new leaves are inserted into the tree.
 /// </summary>
 /// <param name="tree"></param>
 /// <returns></returns>
 public override ITreeTableBranch CreateBranch(TreeTable tree)
 {
     return(new TreeTableWithCounterBranch(tree));
 }
        public DataStructureDummyFactory()
        {
            // <------------------- ENUMS ------------------------>
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(Availability.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(AvailabilityCheckStatus.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(AvailabilityCheckStepAction.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(BorderStyle.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(BorderWeight.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(BytesPayloadLinkedResourceKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(CellOpExecutionOutcome.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(CellOpExecutionStatus.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(CompareOperator.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(FillPatternStyle.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(HorizontalAlignment.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(InnerBorderEdges.None);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(LinkTarget.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(MediaReferenceKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(MessageFormatKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(NumberFormatDigitGroupKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(NumberFormatNegativeDisplayKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(NumberFormatPercentDisplayKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(OuterBorderSides.None);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(SlotSelectionStrategy.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(StringPayloadLinkedResourceKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(UrlLinkedResourceKind.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(ValidationStatus.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(ValidationStepAction.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(Validity.Unknown);
            AutoFixtureBackedDummyFactory.ConstrainDummyToExclude(VerticalAlignment.Unknown);

            // <------------------- INTERFACES ------------------------>
            AutoFixtureBackedDummyFactory.AddDummyCreator <IAvailabilityCheckCell>(A.Dummy <NotSlottedCellBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <ICell>(A.Dummy <CellBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <INotSlottedCell>(A.Dummy <NotSlottedCellBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <IValidationCell>(A.Dummy <NotSlottedCellBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <ICellValueFormat <Version> >(A.Dummy <CellValueFormatBase <Version> >);
            AutoFixtureBackedDummyFactory.AddDummyCreator <IHoverOver>(A.Dummy <HoverOverBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <ILink>(A.Dummy <SimpleLink>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <ILinkedResource>(A.Dummy <LinkedResourceBase>);
            AutoFixtureBackedDummyFactory.AddDummyCreator <IOperationOutputCell <Version> >(A.Dummy <OperationCell <Version> >);

            // <------------------- OPERATIONS ------------------------>
            RegisterReturningOperation <bool>();
            RegisterReturningOperation <decimal>();
            RegisterReturningOperation <string>();
            RegisterReturningOperation <ValidationResult>();
            RegisterReturningOperation <AvailabilityCheckResult>();
            RegisterReturningOperation <Availability>();
            RegisterReturningOperation <Validity>();
            RegisterReturningOperation <CellLocatorBase>();
            RegisterReturningOperation <CompareOperator>();

            // <------------------- MODELS ------------------------>

            // Report
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var numberOfSections = ThreadSafeRandom.Next(1, 4);

                var result = new Report(A.Dummy <string>(), Some.ReadOnlyDummies <Section>(numberOfSections).ToList(), A.Dummy <string>(), A.Dummy <UtcDateTime>(), Some.ReadOnlyDummies <SimpleLink>().ToList(), A.Dummy <AdditionalReportInfo>(), A.Dummy <ReportFormat>());

                return(result);
            });

            // TreeTable
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var numberOfColumns = GetRandomNumberOfColumns();

                var columns = Some.ReadOnlyDummies <Column>(numberOfColumns).ToList();

                var tableColumns = new TableColumns(columns, A.Dummy <ColumnFormat>());

                var tableRows = BuildTableRows(columns.Count);

                var result = new TreeTable(tableColumns, tableRows, A.Dummy <TableFormat>());

                return(result);
            });

            // TableRows
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = BuildTableRows(GetRandomNumberOfColumns());

                return(result);
            });

            // HeaderRows
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var headerRows = BuildFlatRows(GetRandomNumberOfColumns());

                var result = new HeaderRows(headerRows, A.Dummy <HeaderRowsFormat>());

                return(result);
            });

            // DataRows
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var allDataRows = BuildDataRows(GetRandomNumberOfColumns());

                var result = new DataRows(allDataRows, A.Dummy <DataRowsFormat>());

                return(result);
            });

            // FooterRows
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var footerRows = BuildFlatRows(GetRandomNumberOfColumns());

                var result = new FooterRows(footerRows, A.Dummy <FooterRowsFormat>());

                return(result);
            });

            // Row
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = BuildDataRow(GetRandomNumberOfColumns());

                return(result);
            });

            // FlatRow
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = BuildFlatRow(GetRandomNumberOfColumns(), allowSpanningCells: true);

                return(result);
            });

            // SlottedCell
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var columnsSpanned = GetRandomColumnsSpannedByCell();

                var cells = Some.ReadOnlyDummies <NotSlottedCellBase>().Select(_ => _.DeepCloneWithColumnsSpanned(columnsSpanned)).Cast <NotSlottedCellBase>().ToList();

                var slotIdToCellMap = cells.ToDictionary(_ => A.Dummy <string>(), _ => (INotSlottedCell)_);

                var defaultSlotId = slotIdToCellMap.ElementAt(ThreadSafeRandom.Next(0, slotIdToCellMap.Count)).Key;

                var result = new SlottedCell(slotIdToCellMap, defaultSlotId, A.Dummy <string>(), columnsSpanned, A.Dummy <string>());

                return(result);
            });

            // InputCell<Version>
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new InputCell <Version>(
                    A.Dummy <string>(),
                    GetRandomColumnsSpannedByCell(),
                    A.Dummy <string>(),
                    A.Dummy <Validation>(),
                    Some.ReadOnlyDummies <CellValidationEventBase>().ToList(),
                    A.Dummy <Availability>(),
                    A.Dummy <AvailabilityCheck>(),
                    Some.ReadOnlyDummies <CellAvailabilityCheckEventBase>().ToList(),
                    Some.ReadOnlyDummies <CellInputEventBase>().ToList(),
                    A.Dummy <ICellValueFormat <Version> >(),
                    A.Dummy <CellFormat>(), A.Dummy <IHoverOver>());

                return(result);
            });

            // NullCell
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new NullCell(
                    A.Dummy <string>(),
                    GetRandomColumnsSpannedByCell(),
                    A.Dummy <string>(),
                    A.Dummy <Validation>(),
                    Some.ReadOnlyDummies <CellValidationEventBase>().ToList(),
                    A.Dummy <Availability>(),
                    A.Dummy <AvailabilityCheck>(),
                    Some.ReadOnlyDummies <CellAvailabilityCheckEventBase>().ToList(),
                    A.Dummy <CellFormat>(),
                    A.Dummy <IHoverOver>(),
                    A.Dummy <ILink>());

                return(result);
            });

            // ConstCell<Version>
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new ConstCell <Version>(
                    A.Dummy <Version>(),
                    A.Dummy <string>(),
                    GetRandomColumnsSpannedByCell(),
                    A.Dummy <string>(),
                    A.Dummy <Validation>(),
                    Some.ReadOnlyDummies <CellValidationEventBase>().ToList(),
                    A.Dummy <Availability>(),
                    A.Dummy <AvailabilityCheck>(),
                    Some.ReadOnlyDummies <CellAvailabilityCheckEventBase>().ToList(),
                    A.Dummy <ICellValueFormat <Version> >(),
                    A.Dummy <CellFormat>(),
                    A.Dummy <IHoverOver>(),
                    A.Dummy <ILink>());

                return(result);
            });

            // OperationOutputCell<Version>
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new OperationCell <Version>(
                    A.Dummy <IReturningOperation <Version> >(),
                    A.Dummy <string>(),
                    GetRandomColumnsSpannedByCell(),
                    A.Dummy <string>(),
                    A.Dummy <Validation>(),
                    Some.ReadOnlyDummies <CellValidationEventBase>().ToList(),
                    A.Dummy <Availability>(),
                    A.Dummy <AvailabilityCheck>(),
                    Some.ReadOnlyDummies <CellAvailabilityCheckEventBase>().ToList(),
                    Some.ReadOnlyDummies <CellOpExecutionEventBase>().ToList(),
                    A.Dummy <ICellValueFormat <Version> >(),
                    A.Dummy <CellFormat>(),
                    A.Dummy <IHoverOver>(),
                    A.Dummy <ILink>());

                return(result);
            });

            // DateTimeFormat
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var localize = A.Dummy <bool>();

                var result = new DateTimeFormat(A.Dummy <DateTimeFormatKind>(), A.Dummy <CultureKind>(), localize, localize ? A.Dummy <StandardTimeZone>() : (StandardTimeZone?)null);

                return(result);
            });

            // ReportFormat
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var displayTimestamp = A.Dummy <bool>();

                var result = new ReportFormat(displayTimestamp, displayTimestamp ? A.Dummy <DateTimeFormat>() : null, A.Dummy <ReportFormatOptions>());

                return(result);
            });

            // Color
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = Color.FromArgb(A.Dummy <byte>(), A.Dummy <byte>(), A.Dummy <byte>());

                return(result);
            });

            // Events
            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellAvailabilityCheckClearedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellAvailabilityCheckDeterminedCellDisabledEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellAvailabilityCheckDeterminedCellEnabledEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellAvailabilityCheckFailedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellInputAppliedEvent <Version>(A.Dummy <UtcDateTime>(), A.Dummy <Version>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellInputClearedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellOpExecutionAbortedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellOpExecutionClearedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellOpExecutionCompletedEvent <Version>(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <Version>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellOpExecutionDeemedNotApplicableEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellOpExecutionFailedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationAbortedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationClearedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationDeemedNotApplicableEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationDeterminedCellInvalidEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationDeterminedCellValidEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>(), A.Dummy <string>());

                return(result);
            });

            AutoFixtureBackedDummyFactory.AddDummyCreator(() =>
            {
                var result = new CellValidationFailedEvent(A.Dummy <UtcDateTime>(), A.Dummy <string>());

                return(result);
            });
        }
コード例 #21
0
        public ActionResult GetMenuExpand()
        {
            TreeTable <MenUIModel> TreeTableMenUIModel = menuservice.GetMenuExpand();

            return(Json(TreeTableMenUIModel, JsonRequestBehavior.AllowGet));
        }
コード例 #22
0
 public GenericTreeTableWithCounterEntry(TreeTable tree, V value)
 {
     base.Value = value;
     Tree       = tree;
 }
コード例 #23
0
        public ActionResult GetAuthorExpand()
        {
            TreeTable <AuthorUIModel> treebaleAuthorUIModel = authorservice.GetAuthorList();

            return(Json(treebaleAuthorUIModel, JsonRequestBehavior.AllowGet));
        }
コード例 #24
0
        static TreeTableTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <TreeTable>
            {
                Name             = "constructor should throw ArgumentNullException when parameter 'tableColumns' is null scenario",
                ConstructionFunc = () =>
                {
                    var referenceObject = A.Dummy <TreeTable>();

                    var result = new TreeTable(
                        null,
                        referenceObject.TableRows,
                        referenceObject.Format);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentNullException),
                ExpectedExceptionMessageContains = new[] { "tableColumns", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <TreeTable>
            {
                Name             = "constructor should throw ArgumentException when parameter 'tableRows' contains a header row that does not span all of the columns in tableColumns",
                ConstructionFunc = () =>
                {
                    var tableColumns = new TableColumns(Some.ReadOnlyDummies <Column>(2).ToList());

                    var rows = new[]
                    {
                        new FlatRow(Some.ReadOnlyDummies <NotSlottedCellBase>(2).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                        new FlatRow(Some.ReadOnlyDummies <NotSlottedCellBase>(3).ToList()),
                    };

                    var headerRows = new HeaderRows(rows, null);

                    var tableRows = new TableRows(headerRows, null);

                    var result = new TreeTable(
                        tableColumns,
                        tableRows);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "tableRows contains a row or descendant row that does not span all 2 of the defined columns", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <TreeTable>
            {
                Name             = "constructor should throw ArgumentException when parameter 'tableRows' contains a data row that does not span all of the columns in tableColumns",
                ConstructionFunc = () =>
                {
                    var tableColumns = new TableColumns(Some.ReadOnlyDummies <Column>(2).ToList());

                    var rows = new[]
                    {
                        new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(2).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                        new Row(
                            Some.ReadOnlyDummies <NotSlottedCellBase>(2).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList(),
                            childRows: new[]
                        {
                            new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(2).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                            new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(3)),
                            new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(2).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                        }),
                        new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(2).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                    };

                    var dataRows = new DataRows(rows, null);

                    var tableRows = new TableRows(null, dataRows);

                    var result = new TreeTable(
                        tableColumns,
                        tableRows);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "tableRows contains a row or descendant row that does not span all 2 of the defined columns", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <TreeTable>
            {
                Name             = "constructor should throw ArgumentException when parameter 'footerRows' contains a footer row that does not span all of the columns in tableColumns",
                ConstructionFunc = () =>
                {
                    var tableColumns = new TableColumns(Some.ReadOnlyDummies <Column>(2).ToList());

                    var rows = new[]
                    {
                        new FlatRow(Some.ReadOnlyDummies <NotSlottedCellBase>(2).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                        new FlatRow(Some.ReadOnlyDummies <NotSlottedCellBase>(3).ToList()),
                    };

                    var footerRows = new FooterRows(rows, null);

                    var tableRows = new TableRows(footerRows: footerRows);

                    var result = new TreeTable(
                        tableColumns,
                        tableRows);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "tableRows contains a row or descendant row that does not span all 2 of the defined columns", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <TreeTable>
            {
                Name             = "constructor should throw ArgumentException when two columns have the same identifier",
                ConstructionFunc = () =>
                {
                    var tableColumns = new TableColumns(new[]
                    {
                        new Column("column-1"),
                        new Column("column-2"),
                        new Column("column-1"),
                    });

                    var headerRows = new HeaderRows(
                        new[]
                    {
                        new FlatRow(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                        new FlatRow(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                    },
                        null);

                    var dataRows = new DataRows(
                        new[]
                    {
                        new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                        new Row(
                            Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList(),
                            childRows:
                            new[]
                        {
                            new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                        }),
                    });

                    var tableRows = new TableRows(headerRows, dataRows);

                    var result = new TreeTable(
                        tableColumns,
                        tableRows);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "Two or more elements (i.e. columns, rows, cells) have the same identifier.", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <TreeTable>
            {
                Name             = "constructor should throw ArgumentException when two rows have the same identifier",
                ConstructionFunc = () =>
                {
                    var tableColumns = new TableColumns(Some.ReadOnlyDummies <Column>(3).ToList());

                    var headerRows = new HeaderRows(
                        new[]
                    {
                        new FlatRow(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList(), "row-1"),
                        new FlatRow(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList(), "row-2"),
                    },
                        null);

                    var dataRows = new DataRows(
                        new[]
                    {
                        new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList(), "row-3"),
                        new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList(), childRows:
                                new[]
                        {
                            new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList(), "row-1"),
                        }),
                    });

                    var tableRows = new TableRows(headerRows, dataRows);

                    var result = new TreeTable(
                        tableColumns,
                        tableRows);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "Two or more elements (i.e. columns, rows, cells) have the same identifier.", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <TreeTable>
            {
                Name             = "constructor should throw ArgumentException when two cells have the same identifier",
                ConstructionFunc = () =>
                {
                    var tableColumns = new TableColumns(Some.ReadOnlyDummies <Column>(3).ToList());

                    var headerRows = new HeaderRows(
                        new[]
                    {
                        new FlatRow(
                            new ICell[]
                        {
                            A.Dummy <NotSlottedCellBase>().DeepCloneWithColumnsSpanned(1).DeepCloneWithId(null),
                            A.Dummy <NotSlottedCellBase>().DeepCloneWithColumnsSpanned(1).DeepCloneWithId("cell-1"),
                            A.Dummy <NotSlottedCellBase>().DeepCloneWithColumnsSpanned(1).DeepCloneWithId(null),
                        }),
                        new FlatRow(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                    },
                        null);

                    var dataRows = new DataRows(
                        new[]
                    {
                        new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                        new Row(
                            Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList(),
                            childRows:
                            new[]
                        {
                            new Row(
                                new ICell[]
                            {
                                A.Dummy <NotSlottedCellBase>().DeepCloneWithColumnsSpanned(null).DeepCloneWithId(null),
                                A.Dummy <NotSlottedCellBase>().DeepCloneWithColumnsSpanned(null).DeepCloneWithId(null),
                                A.Dummy <NotSlottedCellBase>().DeepCloneWithColumnsSpanned(null).DeepCloneWithId("cell-1"),
                            }),
                        }),
                    });

                    var tableRows = new TableRows(headerRows, dataRows);

                    var result = new TreeTable(
                        tableColumns,
                        tableRows);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "Two or more elements (i.e. columns, rows, cells) have the same identifier.", },
            })
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <TreeTable>
            {
                Name             = "constructor should throw ArgumentException when a cell object is used multiple times",
                ConstructionFunc = () =>
                {
                    var tableColumns = new TableColumns(Some.ReadOnlyDummies <Column>(3).ToList());

                    var cell = A.Dummy <CellBase>().DeepCloneWithColumnsSpanned(1).DeepCloneWithId(null);

                    var headerRows = new HeaderRows(
                        new[]
                    {
                        new FlatRow(
                            new ICell[]
                        {
                            A.Dummy <NotSlottedCellBase>().DeepCloneWithColumnsSpanned(1).DeepCloneWithId(null),
                            cell,
                            A.Dummy <NotSlottedCellBase>().DeepCloneWithColumnsSpanned(1).DeepCloneWithId(null),
                        }),
                        new FlatRow(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                    },
                        null);

                    var dataRows = new DataRows(
                        new[]
                    {
                        new Row(Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList()),
                        new Row(
                            Some.ReadOnlyDummies <NotSlottedCellBase>(3).Select(_ => _.DeepCloneWithColumnsSpanned(1)).ToList(),
                            childRows:
                            new[]
                        {
                            new Row(
                                new ICell[]
                            {
                                A.Dummy <NotSlottedCellBase>().DeepCloneWithColumnsSpanned(null).DeepCloneWithId(null),
                                A.Dummy <NotSlottedCellBase>().DeepCloneWithColumnsSpanned(null).DeepCloneWithId(null),
                                cell,
                            }),
                        }),
                    });

                    var tableRows = new TableRows(headerRows, dataRows);

                    var result = new TreeTable(
                        tableColumns,
                        tableRows);

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "One or more ICell objects are used multiple times in the tree table.", },
            });

            DeepCloneWithTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new DeepCloneWithTestScenario <TreeTable>
            {
                Name             = "DeepCloneWithTableColumns should deep clone object and replace TableColumns with the provided tableColumns",
                WithPropertyName = "TableColumns",
                SystemUnderTestDeepCloneWithValueFunc = () =>
                {
                    var systemUnderTest = A.Dummy <TreeTable>();

                    var referenceObject = A.Dummy <TreeTable>().ThatIs(_ => !systemUnderTest.TableColumns.IsEqualTo(_.TableColumns) && (_.TableColumns.Columns.Count == systemUnderTest.TableColumns.Columns.Count));

                    var result = new SystemUnderTestDeepCloneWithValue <TreeTable>
                    {
                        SystemUnderTest    = systemUnderTest,
                        DeepCloneWithValue = referenceObject.TableColumns,
                    };

                    return(result);
                },
            })
            .AddScenario(() =>
                         new DeepCloneWithTestScenario <TreeTable>
            {
                Name             = "DeepCloneWithTableRows should deep clone object and replace TableRows with the provided tableRows",
                WithPropertyName = "TableRows",
                SystemUnderTestDeepCloneWithValueFunc = () =>
                {
                    var systemUnderTest = A.Dummy <TreeTable>();

                    var referenceObject = A.Dummy <TreeTable>().ThatIs(_ =>
                                                                       !systemUnderTest.TableRows.IsEqualTo(_.TableRows) &&
                                                                       ((!_.TableRows.GetAllRowsInOrder().Any()) || (_.TableRows.GetAllRowsInOrder().First().GetNumberOfColumnsSpanned() == systemUnderTest.TableColumns.Columns.Count)));

                    var result = new SystemUnderTestDeepCloneWithValue <TreeTable>
                    {
                        SystemUnderTest    = systemUnderTest,
                        DeepCloneWithValue = referenceObject.TableRows,
                    };

                    return(result);
                },
            })
            .AddScenario(() =>
                         new DeepCloneWithTestScenario <TreeTable>
            {
                Name             = "DeepCloneWithFormat should deep clone object and replace Format with the provided format",
                WithPropertyName = "Format",
                SystemUnderTestDeepCloneWithValueFunc = () =>
                {
                    var systemUnderTest = A.Dummy <TreeTable>();

                    var referenceObject = A.Dummy <TreeTable>().ThatIs(_ => !systemUnderTest.Format.IsEqualTo(_.Format));

                    var result = new SystemUnderTestDeepCloneWithValue <TreeTable>
                    {
                        SystemUnderTest    = systemUnderTest,
                        DeepCloneWithValue = referenceObject.Format,
                    };

                    return(result);
                },
            });

            EquatableTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new EquatableTestScenario <TreeTable>
            {
                Name            = "Default Code Generated Scenario",
                ReferenceObject = ReferenceObjectForEquatableTestScenarios,
                ObjectsThatAreEqualToButNotTheSameAsReferenceObject = new TreeTable[]
                {
                    new TreeTable(
                        ReferenceObjectForEquatableTestScenarios.TableColumns,
                        ReferenceObjectForEquatableTestScenarios.TableRows,
                        ReferenceObjectForEquatableTestScenarios.Format),
                },
                ObjectsThatAreNotEqualToReferenceObject = new TreeTable[]
                {
                    new TreeTable(
                        A.Dummy <TreeTable>().Whose(_ => !_.TableColumns.IsEqualTo(ReferenceObjectForEquatableTestScenarios.TableColumns) && (_.TableColumns.Columns.Count == ReferenceObjectForEquatableTestScenarios.TableColumns.Columns.Count)).TableColumns,
                        ReferenceObjectForEquatableTestScenarios.TableRows,
                        ReferenceObjectForEquatableTestScenarios.Format),
                    new TreeTable(
                        ReferenceObjectForEquatableTestScenarios.TableColumns,
                        A.Dummy <TreeTable>().Whose(_ => (!_.TableRows.IsEqualTo(ReferenceObjectForEquatableTestScenarios.TableRows) && ((!_.TableRows.GetAllRowsInOrder().Any()) || (_.TableRows.GetAllRowsInOrder().First().GetNumberOfColumnsSpanned() == ReferenceObjectForEquatableTestScenarios.TableColumns.Columns.Count)))).TableRows,
                        ReferenceObjectForEquatableTestScenarios.Format),
                    new TreeTable(
                        ReferenceObjectForEquatableTestScenarios.TableColumns,
                        ReferenceObjectForEquatableTestScenarios.TableRows,
                        A.Dummy <TreeTable>().Whose(_ => !_.Format.IsEqualTo(ReferenceObjectForEquatableTestScenarios.Format)).Format),
                },
                ObjectsThatAreNotOfTheSameTypeAsReferenceObject = new object[]
                {
                    A.Dummy <object>(),
                    A.Dummy <string>(),
                    A.Dummy <int>(),
                    A.Dummy <int?>(),
                    A.Dummy <Guid>(),
                },
            });
        }
コード例 #25
0
        public ActionResult GetRoleExpand()
        {
            TreeTable <RoleUIModel> treetablerole = roleservice.GetRoleList();

            return(Json(treetablerole, JsonRequestBehavior.AllowGet));
        }
コード例 #26
0
 public GenericTreeTableWithSummaryEntry(TreeTable tree, V value)
 {
     base.Value = value;
     Tree       = tree;
 }
コード例 #27
0
 /// <summary>
 /// Initializes a new <see cref="TreeTableWithSummaryBranch"/>.
 /// </summary>
 /// <param name="tree"></param>
 public TreeTableWithSummaryBranch(TreeTable tree)
     : base(tree)
 {
 }