public async Task <IActionResult> ShowProjects([FromRoute] UserRoute route)
        {
            // Getting field _user based on route.
            await Init(route);

            var request = new HandlerData <User, IEnumerable <ProjectTableData> > {
                Data = _user
            };

            IEnumerable <ProjectTableData> data = await _mediator.Send(request);

            string projectLocationTemplate = "/{0}/{1}";

            // Getting references to user projects.
            string[] projectReferences = data
                                         .Select(rowData => String.Format(projectLocationTemplate, rowData.CreatorName, rowData.ProjectName))
                                         .ToArray();

            // Creation all user project table.
            var table = new ReferencedTable(
                new NumberedTable(new ObjectTable <ProjectTableData>(data)),
                new Dictionary <string, string[]>
            {
                { "ProjectName", projectReferences }
            }
                );

            return(View("Projects", new ProjectsInfo {
                Table = table, UserName = route.UserName
            }));
        }
        public async Task <IActionResult> Show([FromRoute] ProjectRoute route)
        {
            //Getting field _project based on route.
            await Init(route);

            var request = new HandlerData <Project, Dictionary <ProjectSnapshotsTableRow, IEnumerable <string> > >
            {
                Data = _project
            };

            Dictionary <ProjectSnapshotsTableRow, IEnumerable <string> > dataAndComments = await _mediator.Send(request);

            string [] snapshotNames = dataAndComments.Select(data => data.Key.Name).ToArray();

            string [] snaspshotReferences = dataAndComments.Select(data =>
                                                                   $"{HttpContext.Request.Path}/{data.Key.Name}")
                                            .ToArray();

            // Creation table for project snapshots.
            var table = new ReferencedTable(
                new NumberedTable(new ObjectTable <ProjectSnapshotsTableRow>(dataAndComments
                                                                             .Select(data => data.Key).ToArray())),
                new Dictionary <string, string[]>()
            {
                { "Name", snaspshotReferences }
            }
                );

            return(View("Project", new ProjectInfo
            {
                Name = _project.Name,
                IsActive = _project.isActive,
                SnapshotAddingLocation = HttpContext.Request.Path,
                StateLocation = $"{HttpContext.Request.Path}/state",
                FormData = new CommentAddingFormData
                {
                    CommentLocation = $"{HttpContext.Request.Path}/comment",
                    SnapshotChoice = new SelectList(snapshotNames)
                },
                Data = new ProjectSnapshotsTableData
                {
                    Table = table,
                    Comments = dataAndComments.Select(data => data.Value).ToArray()
                }
            }));
        }
        ///--------------------------------------------------------------------------------
        /// <summary>This method determines whether or not any metadata is
        /// different between the input instance and the current instance.</summary>
        ///
        /// <param name="inputSqlViewProperty">The sqlviewproperty to compare metadata.</param>
        ///--------------------------------------------------------------------------------
        public bool IsIdenticalMetadata(SqlViewProperty inputSqlViewProperty)
        {
            if (DbID.GetInt() != inputSqlViewProperty.DbID.GetInt())
            {
                return(false);
            }
            if (SqlViewID.GetGuid() != inputSqlViewProperty.SqlViewID.GetGuid())
            {
                return(false);
            }
            if (ReferencedTable.GetString() != inputSqlViewProperty.ReferencedTable.GetString())
            {
                return(false);
            }
            if (ReferencedColumn.GetString() != inputSqlViewProperty.ReferencedColumn.GetString())
            {
                return(false);
            }
            if (Urn.GetString() != inputSqlViewProperty.Urn.GetString())
            {
                return(false);
            }
            if (State.GetString() != inputSqlViewProperty.State.GetString())
            {
                return(false);
            }
            if (Description.GetString() != inputSqlViewProperty.Description.GetString())
            {
                return(false);
            }

            #region protected
            #endregion protected

            return(true);
        }
Exemple #4
0
		public ColumnReference (ReferencedTable refTable, string relationName, string columnName)
		{
			this.refTable = refTable;
			this.relationName = relationName;
			this.columnName = columnName;
		}
 public ColumnReference(ReferencedTable refTable, string relationName, string columnName)
 {
     this.refTable     = refTable;
     this.relationName = relationName;
     this.columnName   = columnName;
 }