public GrantDetailViewData(Person currentPerson,
                                   Models.Grant grant,
                                   EntityNotesViewData grantNotesViewData,
                                   EntityNotesViewData internalNotesViewData)
            : base(currentPerson, grant)
        {
            PageTitle                  = grant.GrantTitle.ToEllipsifiedStringClean(110);
            BreadCrumbTitle            = $"{Models.FieldDefinition.Grant.GetFieldDefinitionLabel()} Detail";
            NewGrantNoteUrl            = grant.GetNewNoteUrl();
            GrantNotesViewData         = grantNotesViewData;
            InternalGrantNotesViewData = internalNotesViewData;

            GrantModificationGridSpec    = new GrantModificationGridSpec(currentPerson, grant);
            GrantModificationGridName    = "grantModificationsGridName";
            GrantModificationGridDataUrl = SitkaRoute <GrantController> .BuildUrlFromExpression(tc => tc.GrantModificationGridJsonDataByGrant(grant.PrimaryKey));

            //GrantAllocationGridSpec = new GrantAllocationGridSpec(currentPerson, GrantAllocationGridSpec.GrantAllocationGridCreateButtonType.Shown, grant);
            //GrantAllocationGridName = "grantAllocationsGridName";
            //GrantAllocationGridDataUrlTemplate = SitkaRoute<GrantController>.BuildUrlFromExpression(tc => tc.GrantAllocationGridJsonDataByGrantModification(UrlTemplate.Parameter1Int));

            GrantAllocationBudgetLineItemGridSpec    = new GrantAllocationBudgetLineItemGridSpec();
            GrantAllocationBudgetLineItemGridName    = "grantAllocationBudgetLineItemsGridName";
            GrantAllocationBudgetLineItemGridDataUrl = SitkaRoute <GrantController> .BuildUrlFromExpression(tc => tc.GrantAllocationBudgetLineItemGridJsonDataByGrant(grant));

            GrantAgreementGridSpec    = new GrantAgreementGridSpec();
            GrantAgreementGridName    = "grantAgreementGridName";
            GrantAgreementGridDataUrl = SitkaRoute <GrantController> .BuildUrlFromExpression(tc => tc.GrantAgreementGridJsonData(grant));

            GrantDetailsFileDetailsViewData = new FileDetailsViewData(
                EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(grant.GrantFileResources)),
                SitkaRoute <GrantController> .BuildUrlFromExpression(x => x.NewGrantFiles(grant.PrimaryKey)),
                new GrantEditAsAdminFeature().HasPermission(currentPerson, grant).HasPermission,
                Models.FieldDefinition.Grant
                );
        }
示例#2
0
        public DetailViewData(Person currentPerson, Models.PriorityLandscape priorityLandscape, MapInitJson mapInitJson, ViewGoogleChartViewData viewGoogleChartViewData, List <Models.PerformanceMeasure> performanceMeasures) : base(currentPerson)
        {
            PriorityLandscape       = priorityLandscape;
            MapInitJson             = mapInitJson;
            ViewGoogleChartViewData = viewGoogleChartViewData;
            PageTitle  = priorityLandscape.PriorityLandscapeName;
            EntityName = "PriorityLandscape";
            UserHasPriorityLandscapeManagePermissions = new PriorityLandscapeManageFeature().HasPermissionByPerson(currentPerson);
            IndexUrl = SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(x => x.Index());

            BasicProjectInfoGridName = "priorityLandscapeProjectListGrid";
            BasicProjectInfoGridSpec = new ProjectIndexGridSpec(CurrentPerson, false, false, new Dictionary <int, vTotalTreatedAcresByProject>())
            {
                ObjectNameSingular  = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} in this {Models.FieldDefinition.PriorityLandscape.GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} in this {Models.FieldDefinition.PriorityLandscape.GetFieldDefinitionLabel()}",
                SaveFiltersInCookie = true
            };

            BasicProjectInfoGridDataUrl = SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(tc => tc.ProjectsGridJsonData(priorityLandscape));

            PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => priorityLandscape.GetPerformanceMeasureChartViewData(x, CurrentPerson)).ToList();

            EditPriorityLandscapeBasicsUrl = SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(plc => plc.EditPriorityLandscape(priorityLandscape));

            PriorityLandscapeFileDetailsViewData = new FileDetailsViewData(
                EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(priorityLandscape.PriorityLandscapeFileResources)),
                SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(x => x.NewPriorityLandscapeFiles(priorityLandscape.PrimaryKey)),
                UserHasPriorityLandscapeManagePermissions,
                Models.FieldDefinition.PriorityLandscape
                );
        }
        public GrantModificationDetailViewData(Person currentPerson,
                                               Models.GrantModification grantModification,
                                               EntityNotesViewData internalGrantModificationNotesViewData) : base(currentPerson)
        {
            Check.EnsureNotNull(currentPerson);
            Check.EnsureNotNull(grantModification);

            GrantModification = grantModification;
            PageTitle         = grantModification.GrantModificationName;
            BreadCrumbTitle   = $"{Models.FieldDefinition.GrantModification.GetFieldDefinitionLabel()} Detail";
            InternalGrantModificationNotesViewData = internalGrantModificationNotesViewData;
            ParentGrantUrl = SitkaRoute <GrantController> .BuildUrlFromExpression(gc => gc.GrantDetail(grantModification.GrantID));

            BackToParentGrantUrlText       = $"Back to {Models.FieldDefinition.Grant.GetFieldDefinitionLabel()}: {grantModification.Grant.GrantName}";
            EditGrantModificationBasicsUrl = SitkaRoute <GrantModificationController> .BuildUrlFromExpression(gmc => gmc.EditGrantModification(grantModification.PrimaryKey));

            UserHasEditGrantModificationPermissions = new GrantModificationEditAsAdminFeature().HasPermissionByPerson(currentPerson);

            var canEditDocuments = new GrantModificationEditAsAdminFeature().HasPermission(currentPerson, grantModification).HasPermission;

            GrantModificationDetailFileDetailsViewData = new FileDetailsViewData(
                EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(grantModification.GrantModificationFileResources)),
                SitkaRoute <GrantModificationController> .BuildUrlFromExpression(x => x.NewGrantModificationFiles(grantModification.PrimaryKey)),
                canEditDocuments,
                Models.FieldDefinition.GrantModification
                );

            var relevantGrant = grantModification.Grant;

            GrantAllocationGridSpec    = new GrantAllocationGridSpec(currentPerson, GrantAllocationGridSpec.GrantAllocationGridCreateButtonType.Shown, relevantGrant);
            GrantAllocationGridName    = "grantAllocationsGridName";
            GrantAllocationGridDataUrl = SitkaRoute <GrantController> .BuildUrlFromExpression(tc => tc.GrantAllocationGridJsonDataByGrantModification(grantModification));
        }
示例#4
0
        /// <summary>
        /// Gets or creates an binder document with the specified ID.
        /// </summary>
        /// <typeparam name="TDocument">The binder document type.</typeparam>
        /// <param name="id">The document ID.</param>
        /// <exception cref="KeyNotFoundException">
        /// Thrown if <typeparamref name="TDocument"/> was not previously registered by a call to
        /// <see cref="EntityDatabase.Register(Func{Document, IEntityDocument}, Func{IDictionary{string, object}, EntityDatabase, Revision, IEntityDocument}, string[])"/>.
        /// </exception>
        /// <returns>The existing or newly created document.</returns>
        public TDocument GetBinderDocument <TDocument>(string id)
            where TDocument : class, IEntityDocument
        {
            Covenant.Requires <ArgumentNullException>(!string.IsNullOrEmpty(id));

            return(EntityDocument <StubEntity> .Create <TDocument>(Base.GetDocument(id)));
        }
示例#5
0
        /// <inheritdoc/>
        public TDocument LoadDocument <TDocument>(string link, out Func <bool> isDeletedFunc)
            where TDocument : class, IDynamicDocument
        {
            Covenant.Requires <ArgumentNullException>(!string.IsNullOrEmpty(link));

            var baseDocument = Base.GetExistingDocument(link);

            if (baseDocument == null)
            {
                isDeletedFunc = null;
                return(null);
            }

            var document = EntityDocument <StubEntity> .Create(typeof(TDocument), baseDocument);

            if (document != null)
            {
                isDeletedFunc = () => document.IsDeleted;

                return((TDocument)document);
            }

            isDeletedFunc = null;
            return(null);
        }
        public InteractionEventDetailViewData(Person currentPerson, Models.InteractionEvent interactionEvent, string locationMapFormID, MapInitJson interactionEventLocationSummaryMapInitJson) : base(currentPerson)
        {
            IndexUrl = SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x => x.Index());

            EditInteractionEventBasicsUrl = SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x => x.EditInteractionEvent(interactionEvent.PrimaryKey));

            EditInteractionEventLocationSimpleUrl =
                SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x =>
                                                                                x.EditInteractionEventLocation(interactionEvent.PrimaryKey));

            UserHasInteractionEventManagePermissions = new InteractionEventManageFeature().HasPermissionByPerson(currentPerson);
            InteractionEvent         = interactionEvent;
            InteractionEventContacts = interactionEvent.InteractionEventContacts.ToList();
            InteractionEventProjects = interactionEvent.InteractionEventProjects.ToList();
            LocationMapFormID        = locationMapFormID;
            InteractionEventLocationSummaryMapInitJson = interactionEventLocationSummaryMapInitJson;
            PageTitle = interactionEvent.InteractionEventTitle;

            var canEditDocuments = new InteractionEventManageFeature().HasPermissionByPerson(CurrentPerson);

            InteractionEventDetailFileDetailsViewData = new FileDetailsViewData(
                EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(interactionEvent.InteractionEventFileResources)),
                SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x => x.NewInteractionEventFiles(interactionEvent.PrimaryKey)),
                canEditDocuments,
                Models.FieldDefinition.InteractionEvent
                );
        }
    void Start()
    {
        playerContext        = Contexts.sharedInstance.player;
        serializationService = new EntitySerializationService();

        PlayerEntity e = playerContext.CreateEntity();

        e.AddHealth(100);
        e.AddUser("userID12345", "SatanIsEverywhere", "*****@*****.**");
        //as this flag Component got a [DontPersistComponent] attribute it is opted out from serialization
        e.isTest = true;

        //serialize this entity to Json by using the new generic entity serializer
        entityJson = serializationService.SerializeEntityToJson(e);
        Debug.Log("Serialized Player Entity: " + entityJson);

        //serialize this Entity to a EntityDocument (for easily saving it to NoSql databases like mongodb)
        entityDocument = serializationService.SerializeEntity(e);

        // Deserialize and recreate another entity by using the entityDocument game state object
        PlayerEntity playerEntityCopy = playerContext.CreateEntity();

        foreach (var _component in serializationService.DeserializeEntity(playerContext.contextInfo.name, entityDocument))
        {
            playerEntityCopy.ReplaceComponent(_component.Key, _component.Value);
        }
        // Deserialize and recreate another entity by using the game state as json string
        PlayerEntity playerEntityJsonCopy = playerContext.CreateEntity();

        foreach (var _component in serializationService.DeserializeEntityFromJson(playerContext.contextInfo.name, entityJson))
        {
            playerEntityJsonCopy.ReplaceComponent(_component.Key, _component.Value);
        }
    }
        public hOOt.Document CreateComment(CommentDTO comment)
        {
            var name = EntityDocument.CreateName(comment.CommentID);
            var text = _textOperations.Prepare(string.Format("{0}", comment.Description ?? string.Empty));

            return(new hOOt.Document(name, text)
            {
                DocNumber = -1
            });
        }
示例#9
0
 public static Document Map(this EntityDocument entity)
 {
     return(new Document()
     {
         CreateDate = entity.CreateDate,
         Id = entity.Id,
         UserId = entity.UserId,
         Files = entity.Files.Select(f => f.ToFichierEntete()).ToList(),
         Tags = entity.Tags.Select(t => t.Map())
     });
 }
示例#10
0
        public DetailViewData(Person currentPerson, Models.GrantAllocation grantAllocation
                              , GrantAllocationBasicsViewData grantAllocationBasicsViewData
                              , EntityNotesViewData grantAllocationNotesViewData
                              , EntityNotesViewData grantAllocationNoteInternalsViewData
                              , ViewGoogleChartViewData viewGoogleChartViewData
                              , GridSpec <Models.ProjectGrantAllocationRequest> projectGrantAllocationRequestsGridSpec
                              , GrantAllocationExpendituresGridSpec grantAllocationExpendituresGridSpec)
            : base(currentPerson, grantAllocation)
        {
            PageTitle       = grantAllocation.GrantAllocationName.ToEllipsifiedStringClean(110);
            BreadCrumbTitle = $"{Models.FieldDefinition.GrantAllocation.GetFieldDefinitionLabel()} Detail";

            GrantAllocationBasicsViewData = grantAllocationBasicsViewData;
            GrantAllocationNotesViewData  = grantAllocationNotesViewData;

            NewGrantAllocationNoteUrl            = grantAllocation.GetNewNoteUrl();
            GrantAllocationNoteInternalsViewData = grantAllocationNoteInternalsViewData;

            ViewGoogleChartViewData = viewGoogleChartViewData;

            var projectGrantAllocationExpenditures = GrantAllocation.ProjectGrantAllocationExpenditures.ToList();

            CalendarYearsForProjectExpenditures = projectGrantAllocationExpenditures.CalculateCalendarYearRangeForExpenditures(grantAllocation);

            ProjectCalendarYearExpendituresGridSpec = new ProjectCalendarYearExpendituresGridSpec(CalendarYearsForProjectExpenditures)
            {
                ObjectNameSingular  = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };

            ProjectCalendarYearExpendituresGridName    = "projectsCalendarYearExpendituresFromGrantAllocationGrid";
            ProjectCalendarYearExpendituresGridDataUrl = SitkaRoute <GrantAllocationController> .BuildUrlFromExpression(tc => tc.ProjectCalendarYearExpendituresGridJsonData(grantAllocation));

            ProjectGrantAllocationRequestsGridSpec    = projectGrantAllocationRequestsGridSpec;
            ProjectGrantAllocationRequestsGridName    = "projectsGrantAllocationRequestsFromGrantAllocationGrid";
            ProjectGrantAllocationRequestsGridDataUrl = SitkaRoute <GrantAllocationController> .BuildUrlFromExpression(tc => tc.ProjectGrantAllocationRequestsGridJsonData(grantAllocation));

            GrantAllocationExpendituresGridSpec    = grantAllocationExpendituresGridSpec;
            GrantAllocationExpendituresGridName    = "grantAllocationExpendituresGrid";
            GrantAllocationExpendituresGridDataUrl = SitkaRoute <GrantAllocationController> .BuildUrlFromExpression(gac => gac.GrantAllocationExpendituresGridJsonData(grantAllocation));

            GrantAllocationBudgetLineItemsViewData = new GrantAllocationBudgetLineItemsViewData(currentPerson, grantAllocation, grantAllocation.GrantAllocationBudgetLineItems.ToList());
            GrantAllocationBudgetVsActualsViewData = new GrantAllocationBudgetVsActualsViewData(currentPerson, grantAllocation);

            var canEditDocuments = new GrantAllocationEditAsAdminFeature().HasPermission(currentPerson, grantAllocation).HasPermission;

            GrantAllocationDetailsFileDetailsViewData = new FileDetailsViewData(
                EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(grantAllocation.GrantAllocationFileResources)),
                SitkaRoute <GrantAllocationController> .BuildUrlFromExpression(x => x.NewGrantAllocationFiles(grantAllocation.PrimaryKey)),
                canEditDocuments,
                Models.FieldDefinition.GrantAllocation
                );
        }
示例#11
0
        public hOOt.Document CreateTestStep(TestStepDTO testStep)
        {
            var name = EntityDocument.CreateName(testStep.TestStepID);
            var descriptionWithResult =
                _textOperations.Prepare(string.Format("{0} {1}", testStep.Description ?? string.Empty,
                                                      testStep.Result ?? string.Empty));

            return(new hOOt.Document(name, descriptionWithResult)
            {
                DocNumber = -1
            });
        }
        public EntityDocument CreateAssignable(AssignableDTO assignable)
        {
            var name = EntityDocument.CreateName(assignable.AssignableID);
            var text = _textOperations.Prepare(string.Format("{0} {1} ", assignable.Name, assignable.Description ?? string.Empty));

            return(new EntityDocument(name, text)
            {
                ProjectId = _documentIdFactory.CreateProjectId(assignable.ProjectID.GetValueOrDefault()),
                EntityTypeId = _documentIdFactory.CreateEntityTypeId(assignable.EntityTypeID.GetValueOrDefault()),
                SquadId = _documentIdFactory.CreateSquadId(assignable.SquadID.GetValueOrDefault()),
                DocNumber = -1
            });
        }
        public EntityDocument CreateGeneral(GeneralDTO general)
        {
            string name = EntityDocument.CreateName(general.GeneralID);
            string text = _textOperations.Prepare(String.Format("{0} {1} ", general.Name, general.Description ?? String.Empty));

            return(new EntityDocument(name, text)
            {
                ProjectId = _documentIdFactory.CreateProjectId(general.ParentProjectID.GetValueOrDefault()),
                EntityTypeId = _documentIdFactory.CreateEntityTypeId(general.EntityTypeID.GetValueOrDefault()),
                SquadId = _documentIdFactory.CreateSquadId(0),
                DocNumber = -1
            });
        }
示例#14
0
        /// <summary>
        /// Gets an existing binder document with the specified ID.
        /// </summary>
        /// <typeparam name="TDocument">The binder document type.</typeparam>
        /// <param name="id">The document ID.</param>
        /// <exception cref="KeyNotFoundException">
        /// Thrown if <typeparamref name="TDocument"/> was not previously registered by a call to
        /// <see cref="EntityDatabase.Register{TDocument}(Func{Document, IEntityDocument}, Func{IDictionary{string, object}, EntityDatabase, Revision, IEntityDocument}, string[])"/>.
        /// </exception>
        /// <returns>The existing document if present or <c>null</c>.</returns>
        public TDocument GetExistingBinderDocument <TDocument>(string id)
            where TDocument : class, IEntityDocument
        {
            Covenant.Requires <ArgumentNullException>(!string.IsNullOrEmpty(id));

            var document = Base.GetExistingDocument(id);

            if (document == null)
            {
                return(null);
            }

            return(EntityDocument <StubEntity> .Create <TDocument>(document));
        }
        public DocumentsAndNotesViewData(Person currentPerson, ProjectUpdateBatch projectUpdateBatch, UpdateStatus updateStatus, string diffUrl) : base(currentPerson, projectUpdateBatch, updateStatus, new List <string>(), ProjectUpdateSection.NotesAndDocuments.ProjectUpdateSectionDisplayName)
        {
            EntityNotesViewData = new EntityNotesViewData(EntityNote.CreateFromEntityNote(new List <IEntityNote>(projectUpdateBatch.ProjectNoteUpdates)),
                                                          SitkaRoute <ProjectNoteUpdateController> .BuildUrlFromExpression(x => x.New(projectUpdateBatch)),
                                                          projectUpdateBatch.Project.DisplayName,
                                                          IsEditable);
            ProjectDocumentsViewData = new ProjectDocumentsDetailViewData(EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(projectUpdateBatch.ProjectDocumentUpdates)),
                                                                          SitkaRoute <ProjectDocumentUpdateController> .BuildUrlFromExpression(x => x.New(projectUpdateBatch)),
                                                                          projectUpdateBatch.Project.DisplayName,
                                                                          IsEditable);
            RefreshUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.RefreshNotesAndDocuments(projectUpdateBatch.Project));

            DiffUrl = diffUrl;
        }
        public EntityDocument CreateImpediment(ImpedimentDTO impediment)
        {
            string name                        = EntityDocument.CreateName(impediment.ImpedimentID);
            string nameDescription             = string.Format("{0} {1}", impediment.Name, impediment.Description ?? String.Empty);
            var    nameDescriptionCustomFields = AppendCustomFields(nameDescription, impediment.CustomFieldsMetaInfo);
            string text                        = _textOperations.Prepare(nameDescriptionCustomFields);

            return(new EntityDocument(name, text)
            {
                ProjectId = _documentIdFactory.CreateProjectId(impediment.ProjectID.GetValueOrDefault()),
                EntityTypeId = _documentIdFactory.CreateEntityTypeId(impediment.EntityTypeID.GetValueOrDefault()),
                SquadId = _documentIdFactory.CreateSquadId(0),
                DocNumber = -1
            });
        }
示例#17
0
        public int InsertDocument(EntityDocument entDocument)
        {
            int cnt = 0;
            List <SqlParameter> lstParam = new List <SqlParameter>();

            try
            {
                Commons.ADDParameter(ref lstParam, "@DocumentName", DbType.String, entDocument.DocumentNAme);
                Commons.ADDParameter(ref lstParam, "@FileContent", DbType.Binary, entDocument.File);
                Commons.ADDParameter(ref lstParam, "@PatientId", DbType.Int32, entDocument.PatientId);
                Commons.ADDParameter(ref lstParam, "@UploadDate", DbType.DateTime, entDocument.UploadDate);
                cnt = mobjDataAccess.ExecuteQuery("sp_InsertDocument", lstParam);
            }
            catch (Exception ex)
            {
                Commons.FileLog("DocumentBLL - InsertDocument(EntityDocument entDocument)", ex);
            }
            return(cnt);
        }
示例#18
0
        public Guid AddDocument(IFormCollection fileCollection, Guid userId)
        {
            if (fileCollection == null)
            {
                return(Guid.Empty);
            }
            var document = new EntityDocument();

            document.UserId     = userId;
            document.Files      = new List <EntityFile>();
            document.CreateDate = DateTime.Now;

            foreach (var file in fileCollection.Files)
            {
                if (file.Length > 0)
                {
                    var fileName      = Path.GetFileName(file.FileName);
                    var fileExtension = Path.GetExtension(fileName);
                    var newFileName   = String.Concat(fileName, fileExtension);

                    var fichier = new EntityFile()
                    {
                        Name       = newFileName,
                        Type       = fileExtension,
                        UserId     = document.UserId,
                        CreateDate = DateTime.Now
                    };

                    using (var target = new MemoryStream())
                    {
                        file.CopyTo(target);
                        fichier.File = target.ToArray();
                    }
                    document.Files.Add(fichier);
                }
            }

            this._context.Documents.Add(document);
            this._context.SaveChanges();
            return(document.Id);
        }
        public DetailViewData(Person currentPerson, Models.Project project, List <ProjectStage> projectStages,
                              ProjectBasicsViewData projectBasicsViewData, ProjectAttributesViewData projectAttributesViewData,
                              ProjectLocationSummaryViewData projectLocationSummaryViewData,
                              ProjectFundingDetailViewData projectFundingDetailViewData,
                              PerformanceMeasureExpectedSummaryViewData performanceMeasureExpectedSummaryViewData,
                              PerformanceMeasureReportedValuesGroupedViewData performanceMeasureReportedValuesGroupedViewData,
                              ProjectExpendituresDetailViewData projectExpendituresDetailViewData,
                              ImageGalleryViewData imageGalleryViewData, EntityNotesViewData projectNotesViewData,
                              EntityNotesViewData internalNotesViewData,
                              EntityExternalLinksViewData entityExternalLinksViewData,
                              ProjectBasicsTagsViewData projectBasicsTagsViewData, bool userHasProjectAdminPermissions,
                              bool userHasEditProjectPermissions, bool userHasProjectUpdatePermissions,
                              bool userHasPerformanceMeasureActualManagePermissions, string mapFormID,
                              string editSimpleProjectLocationUrl, string editDetailedProjectLocationUrl,
                              string editProjectOrganizationsUrl, string editPerformanceMeasureExpectedsUrl,
                              string editPerformanceMeasureActualsUrl, string editReportedExpendituresUrl,
                              AuditLogsGridSpec auditLogsGridSpec, string auditLogsGridDataUrl,
                              string editExternalLinksUrl, ProjectNotificationGridSpec projectNotificationGridSpec,
                              string projectNotificationGridName, string projectNotificationGridDataUrl, bool userCanEditProposal,
                              ProjectOrganizationsDetailViewData projectOrganizationsDetailViewData,
                              List <Models.ClassificationSystem> classificationSystems,
                              string editProjectBoundingBoxFormID, ProjectPeopleDetailViewData projectPeopleDetailViewData,
                              TreatmentAreaGridSpec treatmentAreaGridSpec,
                              string treatmentAreaGridDataUrl
                              , TreatmentGridSpec treatmentGridSpec
                              , string treatmentGridDataUrl
                              , string editProjectRegionUrl
                              , string editProjectPriorityLandscapeUrl,
                              InteractionEventGridSpec projectInteractionEventsGridSpec, string projectInteractionEventsGridDataUrl)
            : base(currentPerson, project)
        {
            PageTitle       = project.DisplayName.ToEllipsifiedStringClean(110);
            BreadCrumbTitle = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} Detail";

            ProjectStages = projectStages;

            EditProjectUrl = project.GetEditUrl();

            EditProjectAttributesUrl = project.GetEditProjectAttributesUrl();

            CanViewProjectFactSheet = ProjectController.FactSheetIsAvailable(project);

            UserHasProjectAdminPermissions = userHasProjectAdminPermissions;
            UserHasEditProjectPermissions  = userHasEditProjectPermissions;
            UserHasPerformanceMeasureActualManagePermissions = userHasPerformanceMeasureActualManagePermissions;

            var projectAlerts          = new List <string>();
            var proposedProjectListUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Proposed());

            var backToAllProposalsText = "Back to all Applications";
            var pendingProjectsListUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Pending());

            var backToAllPendingProjectsText = $"Back to all Pending {Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}";

            if (project.IsRejected())
            {
                var projectApprovalStatus = project.ProjectApprovalStatus;
                ProjectUpdateButtonText =
                    projectApprovalStatus == ProjectApprovalStatus.Draft ||
                    projectApprovalStatus == ProjectApprovalStatus.Returned
                        ? $"Edit Pending {Models.FieldDefinition.Project.GetFieldDefinitionLabel()}"
                        : $"Review Pending {Models.FieldDefinition.Project.GetFieldDefinitionLabel()}";
                ProjectWizardUrl =
                    SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID));

                CanLaunchProjectOrProposalWizard = userCanEditProposal;
                if (project.IsProposal())
                {
                    ProjectListUrl     = proposedProjectListUrl;
                    BackToProjectsText = backToAllProposalsText;
                }
                else if (project.IsPendingProject())
                {
                    ProjectListUrl     = pendingProjectsListUrl;
                    BackToProjectsText = backToAllPendingProjectsText;
                }

                if (userHasProjectAdminPermissions || currentPerson.CanStewardProject(project))
                {
                    projectAlerts.Add(
                        $"This {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} was rejected and can no longer be edited. It can be deleted, or preserved for archival purposes.");
                }
            }
            else if (project.IsProposal())
            {
                var projectApprovalStatus = project.ProjectApprovalStatus;
                ProjectUpdateButtonText =
                    projectApprovalStatus == ProjectApprovalStatus.Draft ||
                    projectApprovalStatus == ProjectApprovalStatus.Returned
                        ? "Edit Application"
                        : "Review Application";
                ProjectWizardUrl =
                    SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID));

                CanLaunchProjectOrProposalWizard = userCanEditProposal;
                ProjectListUrl     = proposedProjectListUrl;
                BackToProjectsText = backToAllProposalsText;
                if (userHasProjectAdminPermissions || currentPerson.CanStewardProject(project))
                {
                    projectAlerts.Add(
                        $"This {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} is in the {Models.FieldDefinition.Application.GetFieldDefinitionLabel()} stage. Any edits to this {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} must be made using the Add New {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} workflow.");
                }
            }
            else if (project.IsPendingProject())
            {
                var projectApprovalStatus = project.ProjectApprovalStatus;
                ProjectUpdateButtonText =
                    projectApprovalStatus == ProjectApprovalStatus.Draft ||
                    projectApprovalStatus == ProjectApprovalStatus.Returned
                        ? $"Edit Pending {Models.FieldDefinition.Project.GetFieldDefinitionLabel()}"
                        : $"Review Pending {Models.FieldDefinition.Project.GetFieldDefinitionLabel()}";
                ProjectWizardUrl =
                    SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID));

                CanLaunchProjectOrProposalWizard = userCanEditProposal;
                ProjectListUrl     = pendingProjectsListUrl;
                BackToProjectsText = backToAllPendingProjectsText;
                if (userHasProjectAdminPermissions || currentPerson.CanStewardProject(project))
                {
                    projectAlerts.Add(
                        $"This {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} is pending. Any edits to this {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} must be made using the Add New {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} workflow.");
                }
            }
            else
            {
                var latestUpdateState = project.GetLatestUpdateState();
                ProjectUpdateButtonText =
                    latestUpdateState == ProjectUpdateState.Submitted ||
                    latestUpdateState == ProjectUpdateState.Returned
                        ? "Review Update"
                        : $"Update {Models.FieldDefinition.Project.GetFieldDefinitionLabel()}";
                ProjectWizardUrl = project.GetProjectUpdateUrl();
                CanLaunchProjectOrProposalWizard = userHasProjectUpdatePermissions;
                ProjectListUrl     = FullProjectListUrl;
                BackToProjectsText = $"Back to all {Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}";


                if (currentPerson.PersonIsProjectOwnerWhoCanStewardProjects)
                {
                    if (currentPerson.CanStewardProject(project))
                    {
                        projectAlerts.Add(
                            $"You are a {Models.FieldDefinition.ProjectSteward.GetFieldDefinitionLabel()} for this {Models.FieldDefinition.Project.GetFieldDefinitionLabel()}. You may edit this {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} by using the <i class=\"glyphicon glyphicon-edit\"></i> icon on each panel.<br/>");
                    }
                    else
                    {
                        projectAlerts.Add(
                            $"You are a {Models.FieldDefinition.ProjectSteward.GetFieldDefinitionLabel()}, but not for this {Models.FieldDefinition.Project.GetFieldDefinitionLabel()}. You may only edit {Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} that are associated with your {Models.FieldDefinition.ProjectStewardshipArea.GetFieldDefinitionLabel()}.");
                    }
                }
            }


            if (project.GetLatestNotApprovedUpdateBatch() != null)
            {
                if (userHasProjectAdminPermissions || currentPerson.CanStewardProject(project))
                {
                    projectAlerts.Add($"This {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} has an Update in progress. Changes made through this page will be overwritten when the Update is approved.");
                }
                else
                {
                    projectAlerts.Add($"This {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} has an Update in progress.");
                }
            }

            ProjectAlerts = projectAlerts;

            ProjectBasicsViewData     = projectBasicsViewData;
            ProjectBasicsTagsViewData = projectBasicsTagsViewData;

            ProjectLocationSummaryViewData = projectLocationSummaryViewData;
            MapFormID = mapFormID;
            EditSimpleProjectLocationUrl    = editSimpleProjectLocationUrl;
            EditDetailedProjectLocationUrl  = editDetailedProjectLocationUrl;
            EditProjectRegionUrl            = editProjectRegionUrl;
            EditProjectPriorityLandscapeUrl = editProjectPriorityLandscapeUrl;

            EditProjectBoundingBoxUrl = SitkaRoute <ProjectLocationController> .BuildUrlFromExpression(c => c.EditProjectBoundingBox(project));

            EditProjectBoundingBoxFormID = editProjectBoundingBoxFormID;
            ProjectAttributesViewData    = projectAttributesViewData;

            EditProjectOrganizationsUrl = editProjectOrganizationsUrl;

            PerformanceMeasureExpectedSummaryViewData = performanceMeasureExpectedSummaryViewData;
            EditPerformanceMeasureExpectedsUrl        = editPerformanceMeasureExpectedsUrl;

            PerformanceMeasureReportedValuesGroupedViewData = performanceMeasureReportedValuesGroupedViewData;
            EditPerformanceMeasureActualsUrl = editPerformanceMeasureActualsUrl;

            ProjectFundingDetailViewData = projectFundingDetailViewData;
            EditExpectedFundingUrl       =
                SitkaRoute <ProjectGrantAllocationRequestController> .BuildUrlFromExpression(c =>
                                                                                             c.EditProjectGrantAllocationRequestsForProject(project));

            ProjectExpendituresDetailViewData = projectExpendituresDetailViewData;
            EditReportedExpendituresUrl       = editReportedExpendituresUrl;
            ProjectPeopleDetailViewData       = projectPeopleDetailViewData;
            EditExternalLinksUrl = editExternalLinksUrl;
            ImageGalleryViewData = imageGalleryViewData;

            ProjectNotesViewData  = projectNotesViewData;
            InternalNotesViewData = internalNotesViewData;

            EntityExternalLinksViewData = entityExternalLinksViewData;

            ProjectUpdateBatchGridSpec = new ProjectUpdateBatchGridSpec
            {
                ObjectNameSingular  = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} Update",
                ObjectNamePlural    = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} Updates",
                SaveFiltersInCookie = true
            };
            ProjectUpdateBatchGridName    = "projectUpdateBatch";
            ProjectUpdateBatchGridDataUrl =
                SitkaRoute <ProjectController> .BuildUrlFromExpression(x =>
                                                                       x.ProjectUpdateBatchGridJsonData(project.ProjectID));

            AuditLogsGridSpec    = auditLogsGridSpec;
            AuditLogsGridName    = "projectAuditLogsGrid";
            AuditLogsGridDataUrl = auditLogsGridDataUrl;

            ProjectNotificationGridSpec        = projectNotificationGridSpec;
            ProjectNotificationGridName        = projectNotificationGridName;
            ProjectNotificationGridDataUrl     = projectNotificationGridDataUrl;
            ProjectOrganizationsDetailViewData = projectOrganizationsDetailViewData;

            EditProjectPriorityLandscapeFormID = ProjectPriorityLandscapeController.GetEditProjectPriorityLandscapesFormID();
            EditProjectRegionFormID            = ProjectRegionController.GetEditProjectRegionsFormID();

            ProjectStewardCannotEditUrl =
                SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.ProjectStewardCannotEdit());

            ProjectStewardCannotEditPendingApprovalUrl =
                SitkaRoute <ProjectController> .BuildUrlFromExpression(c =>
                                                                       c.ProjectStewardCannotEditPendingApproval(project));

            ClassificationSystems = classificationSystems;

            ProjectCostShareViewData = new ProjectCostShareViewData(project, currentPerson);

            ProjectDocumentsDetailViewData = new ProjectDocumentsDetailViewData(
                EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(project.ProjectDocuments)),
                SitkaRoute <ProjectDocumentController> .BuildUrlFromExpression(x => x.New(project)), project.ProjectName,
                new ProjectEditAsAdminFeature().HasPermission(currentPerson, project).HasPermission);

            EditProjectPeopleUrl =
                SitkaRoute <ProjectPersonController> .BuildUrlFromExpression(x => x.EditPeople(project));

            TreatmentAreaGridSpec    = treatmentAreaGridSpec;
            TreatmentAreaGrid        = "treatmentAreaGrid";
            TreatmentAreaGridDataUrl = treatmentAreaGridDataUrl;


            TreatmentGridSpec    = treatmentGridSpec;
            TreatmentGrid        = "treatmentGrid";
            TreatmentGridDataUrl = treatmentGridDataUrl;

            ProjectInteractionEventsGridSpec    = projectInteractionEventsGridSpec;
            ProjectInteractionEventsGridName    = "projectInteractionEventsGrid";
            ProjectInteractionEventsGridDataUrl = projectInteractionEventsGridDataUrl;

            ProjectAgreementByGrantAllocations = ProjectAgreementByGrantAllocation.MakeAgreementProjectsByGrantAllocation(Project.ProjectGrantAllocationRequests.ToList());
        }
示例#20
0
 private bool IsImpediment(EntityDocument entityDocument)
 {
     return(entityDocument.EntityTypeId == _impedimentType);
 }
示例#21
0
 private bool IsTestCase(EntityDocument entityDocument)
 {
     return(entityDocument.EntityTypeId == _testCaseType);
 }
示例#22
0
 private bool IsAssignable(EntityDocument entityDocument)
 {
     return(_assignableTypeIds.ContainsKey(entityDocument.EntityTypeId));
 }
示例#23
0
 private bool IsGeneral(EntityDocument entityDocument)
 {
     return(_generalTypeIds.ContainsKey(entityDocument.EntityTypeId));
 }
示例#24
0
 public CreateRequest()
 {
     BankAccounts = new List <BankAccount>();
     Contacts     = new List <Contact>();
     Document     = new EntityDocument();
 }
示例#25
0
 /// <summary>
 /// Creates a new binder document with a unique ID.
 /// </summary>
 /// <typeparam name="TDocument">The binder document type.</typeparam>
 /// <returns>The new document.</returns>
 /// <exception cref="KeyNotFoundException">
 /// Thrown if <typeparamref name="TDocument"/> was not previously registered by a call to
 /// <see cref="EntityDatabase.Register(Func{Document, IEntityDocument}, Func{IDictionary{string, object}, EntityDatabase, Revision, IEntityDocument}, string[])"/>.
 /// </exception>
 /// <remarks>
 /// <para>
 /// New documents are empty when initially created and are implicitly read/write
 /// and have their <see cref="EntityDocument{TEntity}.IsModified"/> property
 /// set to <c>true</c>.
 /// </para>
 /// </remarks>
 public TDocument CreateBinderDocument <TDocument>()
     where TDocument : class, IEntityDocument
 {
     return(EntityDocument <StubEntity> .Create <TDocument>(Base.CreateDocument()));
 }
        public static DoxygenModule TryRead(string Name, string BaseSrcDir, string BaseXmlDir)
        {
            // Load the index
            XmlDocument Document;

            if (!TryReadXmlDocument(Path.Combine(BaseXmlDir, "index.xml"), out Document))
            {
                return(null);
            }

            // Create all the compound entities
            List <string> CompoundIdList = new List <string>();

            using (XmlNodeList NodeList = Document.SelectNodes("doxygenindex/compound"))
            {
                foreach (XmlNode Node in NodeList)
                {
                    CompoundIdList.Add(Node.Attributes["refid"].Value);
                }
            }

            // Read all the compound id nodes
            List <DoxygenCompound> Compounds = new List <DoxygenCompound>();

            foreach (string CompoundId in CompoundIdList)
            {
                string      EntityPath = Path.Combine(BaseXmlDir, CompoundId + ".xml");
                XmlDocument EntityDocument;
                if (TryReadXmlDocument(EntityPath, out EntityDocument))
                {
                    Compounds.Add(DoxygenCompound.FromXml(EntityDocument.SelectSingleNode("doxygen/compounddef")));
                }
                else
                {
                    Console.WriteLine("Couldn't read entity document: '{0}'", EntityPath);
                }
            }

            // Create the module
            DoxygenModule Module = new DoxygenModule(Name, BaseSrcDir);

            // Create all the other namespaces
            Dictionary <string, DoxygenEntity> Scopes = new Dictionary <string, DoxygenEntity>();

            foreach (DoxygenCompound Compound in Compounds)
            {
                if (Compound.Kind == "namespace")
                {
                    ReadMembers(Module, Compound, Compound.Name + "::", null, Compound.Node, Module.Entities);
                }
                else if (Compound.Kind == "class" || Compound.Kind == "struct" || Compound.Kind == "union")
                {
                    DoxygenEntity Entity = DoxygenEntity.FromXml(Module, Compound.Name, Compound.Node, null);
                    ReadMembers(Module, Compound, "", Entity, null, Entity.Members);
                    Scopes.Add(Entity.Name, Entity);
                }
            }

            // Go back over all the scopes and fixup their parents
            foreach (KeyValuePair <string, DoxygenEntity> Scope in Scopes)
            {
                int ScopeIdx = Scope.Key.LastIndexOf("::");
                if (ScopeIdx != -1 && Scopes.TryGetValue(Scope.Key.Substring(0, ScopeIdx), out Scope.Value.Parent))
                {
                    Scope.Value.Parent.Members.Add(Scope.Value);
                }
                else
                {
                    Module.Entities.Add(Scope.Value);
                }
            }

            // Create the module
            return(Module);
        }