Exemplo n.º 1
0
        public ViewResult EditBoundary(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var viewModel = new EditBoundaryViewModel();
            var viewData  = new EditBoundaryViewData(CurrentPerson, organizationPrimaryKey.EntityObject);

            return(RazorView <EditBoundary, EditBoundaryViewData, EditBoundaryViewModel>(viewData, viewModel));
        }
Exemplo n.º 2
0
        public PartialViewResult Edit(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization = organizationPrimaryKey.EntityObject;
            var viewModel    = new EditViewModel(organization);

            return(ViewEdit(viewModel, organization.IsInKeystone, organization.PrimaryContactPerson));
        }
Exemplo n.º 3
0
        public PartialViewResult ApproveUploadGis(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization = organizationPrimaryKey.EntityObject;
            var viewModel    = new ApproveUploadGisViewModel();

            return(ViewApproveUploadGis(viewModel, organization));
        }
Exemplo n.º 4
0
        public PartialViewResult DeleteOrganizationBoundary(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization = organizationPrimaryKey.EntityObject;
            var viewModel    = new ConfirmDialogFormViewModel(organization.OrganizationID);

            return(ViewDeleteOrganizationBoundary(organization, viewModel));
        }
Exemplo n.º 5
0
        public ViewResult Organization(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization = organizationPrimaryKey.EntityObject;

            var organizationHasOptedIn = organization.MatchmakerOptIn ?? false;

            var projectFinderGridSpec = new ProjectFinderGridSpec(CurrentFirmaSession);
            var projectMatchmakerScoresForOrganization = organizationHasOptedIn ? new ProjectOrganizationMatchmaker().GetPartnerOrganizationMatchMakerScoresForParticularOrganization(CurrentFirmaSession, organization) : new List <PartnerOrganizationMatchMakerScore>();
            var projectsToShow = projectMatchmakerScoresForOrganization.Select(x => x.Project).Where(x => x.ProjectStage.ShouldIncludeInMatchmaker()).ToList();


            var filterValues = ResultsController.GetDefaultFilterValuesForFilterType(ProjectMapCustomization.DefaultLocationFilterType.ToEnum, true);

            var initialCustomization         = new ProjectMapCustomization(ProjectMapCustomization.DefaultLocationFilterType, filterValues, ProjectColorByType.ProjectStage);
            var projectLocationsLayerGeoJson =
                new LayerGeoJson($"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabel()}",
                                 projectsToShow.MappedPointsToGeoJsonFeatureCollection(false, true, true), "blue", 1,
                                 LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            var projectLocationsMapInitJson = new ProjectLocationsMapInitJson(projectLocationsLayerGeoJson, initialCustomization, "ProjectLocationsMap", false);

            // Add Organization Type boundaries according to configuration
            projectLocationsMapInitJson.Layers.AddRange(HttpRequestStorage.DatabaseEntities.Organizations.GetConfiguredBoundaryLayersGeoJson());

            var profileCompletionDictionary = organization.GetMatchmakerOrganizationProfileCompletionDictionary();

            DisplayMatchMakerToastMessagesIfAny(organization, projectMatchmakerScoresForOrganization, profileCompletionDictionary, organizationHasOptedIn);

            var matchMakerAreaOfInterestGeoJson = GetMatchMakerAreaOfInterestGeoJson(organization);

            var viewData = new ProjectFinderOrganizationViewData(CurrentFirmaSession, organization, projectMatchmakerScoresForOrganization, projectFinderGridSpec, projectLocationsMapInitJson, matchMakerAreaOfInterestGeoJson);

            return(RazorView <ProjectFinderOrganization, ProjectFinderOrganizationViewData>(viewData));
        }
Exemplo n.º 6
0
        public ViewResult Detail(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization = organizationPrimaryKey.EntityObject;

            var viewData = new DetailViewData(CurrentPerson, organization);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
Exemplo n.º 7
0
        public PartialViewResult ParticipatingOrganizations(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var partnerOrganizations = GetPartnerOrganizations(organizationPrimaryKey.PrimaryKeyValue);

            var viewData = new ParticipatingOrganizationsViewData(partnerOrganizations.OrderByDescending(x => x.Count()).Take(9).ToList());

            return(RazorPartialView <ParticipatingOrganizations, ParticipatingOrganizationsViewData>(viewData));
        }
Exemplo n.º 8
0
        public PartialViewResult EditMatchMakerKeywordsModal(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization = organizationPrimaryKey.EntityObject;
            var viewModel    = new MatchmakerKeywordsModalViewModel(organization);
            var viewData     = new MatchmakerKeywordsModalViewData(organization);

            return(RazorPartialView <MatchmakerKeywordsModal, MatchmakerKeywordsModalViewData, MatchmakerKeywordsModalViewModel>(viewData, viewModel));
        }
Exemplo n.º 9
0
        public GridJsonNetJObjectResult <Project> PendingProjectsGridJsonData(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization             = organizationPrimaryKey.EntityObject;
            var gridSpec                 = new ProjectsIncludingLeadImplementingGridSpec(organization, CurrentPerson, true);
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <Project>(organization.GetAllPendingProjects(CurrentPerson), gridSpec);

            return(gridJsonNetJObjectResult);
        }
Exemplo n.º 10
0
        public ExcelResult AgreementsExcelDownload(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization  = organizationPrimaryKey.EntityObject;
            var agreements    = GetAgreementsByOrgPeople(organization);
            var workbookTitle = $"{FieldDefinition.Organization.GetFieldDefinitionLabel()} {FieldDefinition.Agreement.GetFieldDefinitionLabelPluralized()} for {organization.DisplayName}";

            return(AgreementController.AgreementsExcelDownloadImpl(agreements, workbookTitle));
        }
Exemplo n.º 11
0
        public ContentResult CkEditorUploadFileResourceForOrganizationDescription(OrganizationPrimaryKey organizationPrimaryKey, CkEditorImageUploadViewModel viewModel)
        {
            var fileResourceInfo = FileResourceModelExtensions.CreateNewFromHttpPostedFileAndSave(viewModel.upload, CurrentFirmaSession);
            var organization     = organizationPrimaryKey.EntityObject;
            var ppImage          = new OrganizationImage(organization, fileResourceInfo);

            HttpRequestStorage.DatabaseEntities.AllOrganizationImages.Add(ppImage);
            return(Content(viewModel.GetCkEditorJavascriptContentToReturn(fileResourceInfo)));
        }
        public PartialViewResult NewProgram(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization = organizationPrimaryKey.EntityObject;
            var viewModel    = new Views.Program.EditViewModel {
                IsActive = true, OrganizationID = organization.OrganizationID
            };

            return(ViewEdit(viewModel, null, organization));
        }
        public GridJsonNetJObjectResult <Program> ProgramGridJsonData(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization             = organizationPrimaryKey.EntityObject;
            var gridSpec                 = new ProgramGridSpec(CurrentPerson, organization);
            var programs                 = organization.Programs.ToList();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <Program>(programs, gridSpec);

            return(gridJsonNetJObjectResult);
        }
Exemplo n.º 14
0
        public ActionResult Edit(OrganizationPrimaryKey organizationPrimaryKey, EditViewModel viewModel)
        {
            var organization = organizationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel, organization.IsInKeystone, organization.PrimaryContactPerson));
            }
            viewModel.UpdateModel(organization, CurrentPerson);
            return(new ModalDialogFormJsonResult());
        }
Exemplo n.º 15
0
        public ActionResult DeleteOrganization(OrganizationPrimaryKey organizationPrimaryKey, ConfirmDialogFormViewModel viewModel)
        {
            var organization = organizationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewDeleteOrganization(organization, viewModel));
            }

            HttpRequestStorage.DatabaseEntities.Organizations.DeleteOrganization(organization);
            return(new ModalDialogFormJsonResult());
        }
Exemplo n.º 16
0
        public ActionResult EditBoundary(OrganizationPrimaryKey organizationPrimaryKey, EditBoundaryViewModel viewModel)
        {
            var organization = organizationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                var viewData = new EditBoundaryViewData(CurrentPerson, organization);
                return(RazorPartialView <EditBoundaryErrors, EditBoundaryViewData, EditBoundaryViewModel>(viewData, viewModel));
            }

            viewModel.UpdateModel(organization);

            return(RedirectToAction(new SitkaRoute <OrganizationController>(c => c.ApproveUploadGis(organizationPrimaryKey))));
        }
Exemplo n.º 17
0
        public ActionResult DeleteOrganizationBoundary(OrganizationPrimaryKey organizationPrimaryKey,
                                                       ConfirmDialogFormViewModel viewModel)
        {
            var organization = organizationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewDeleteOrganizationBoundary(organization, viewModel));
            }

            organization.OrganizationBoundary = null;

            return(new ModalDialogFormJsonResult());
        }
Exemplo n.º 18
0
        public ActionResult DeleteOrganization(OrganizationPrimaryKey organizationPrimaryKey, ConfirmDialogFormViewModel viewModel)
        {
            var organization = organizationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewDeleteOrganization(organization, viewModel));
            }
            var message = $"{FieldDefinition.Organization.GetFieldDefinitionLabel()} \"{organization.OrganizationName}\" successfully deleted.";

            organization.DeleteFull(HttpRequestStorage.DatabaseEntities);
            SetMessageForDisplay(message);

            return(new ModalDialogFormJsonResult());
        }
Exemplo n.º 19
0
        public ActionResult ApproveUploadGis(OrganizationPrimaryKey organizationPrimaryKey, ApproveUploadGisViewModel viewModel)
        {
            var organization = organizationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewApproveUploadGis(viewModel, organization));
            }

            viewModel.UpdateModel(organization);
            HttpRequestStorage.DatabaseEntities.OrganizationBoundaryStagings.RemoveRange(organization
                                                                                         .OrganizationBoundaryStagings);

            SetMessageForDisplay($"{FieldDefinition.Organization.GetFieldDefinitionLabel()} Boundary for {organization.GetDisplayNameAsUrl()} successfully updated.");
            return(new ContentResult());
        }
        public ActionResult NewProgram(OrganizationPrimaryKey organizationPrimaryKey, Views.Program.EditViewModel viewModel)
        {
            var organization = organizationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel, null, organization));
            }

            var program = new Program(organization, true, DateTime.Now, CurrentPerson, false);

            viewModel.UpdateModel(program, CurrentPerson, true);
            HttpRequestStorage.DatabaseEntities.Programs.Add(program);
            HttpRequestStorage.DatabaseEntities.SaveChanges();
            SetMessageForDisplay($"{FieldDefinition.Program.GetFieldDefinitionLabel()} {program.DisplayName} successfully created.");
            return(new ModalDialogFormJsonResult());
        }
Exemplo n.º 21
0
        public ViewResult Detail(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization = organizationPrimaryKey.EntityObject;
            var expendituresDirectlyFromOrganizationViewGoogleChartViewData       = GetCalendarYearExpendituresFromOrganizationGrantAllocationsLineChartViewData(organization);
            var expendituresReceivedFromOtherOrganizationsViewGoogleChartViewData = GetCalendarYearExpendituresFromProjectGrantAllocationsLineChartViewData(organization, CurrentPerson);

            var mapInitJson = GetMapInitJson(organization, out var hasSpatialData, CurrentPerson);

            var performanceMeasures = organization.GetAllActiveProjectsAndProposals(CurrentPerson).ToList()
                                      .SelectMany(x => x.PerformanceMeasureActuals)
                                      .Select(x => x.PerformanceMeasure).Distinct()
                                      .OrderBy(x => x.PerformanceMeasureDisplayName)
                                      .ToList();
            var agreements = GetAgreementsByOrgPeople(organization);
            var viewData   = new DetailViewData(CurrentPerson, organization, mapInitJson, hasSpatialData, performanceMeasures, expendituresDirectlyFromOrganizationViewGoogleChartViewData, expendituresReceivedFromOtherOrganizationsViewGoogleChartViewData, agreements.Any(x => x.AgreementFileResourceID.HasValue));

            return(RazorView <Detail, DetailViewData>(viewData));
        }
Exemplo n.º 22
0
        public ActionResult EditMatchMakerKeywordsModal(OrganizationPrimaryKey organizationPrimaryKey, MatchmakerKeywordsModalViewModel viewModel)
        {
            var organization = organizationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                var viewData = new MatchmakerKeywordsModalViewData(organization);
                return(RazorPartialView <MatchmakerKeywordsModal, MatchmakerKeywordsModalViewData, MatchmakerKeywordsModalViewModel>(viewData, viewModel));
            }

            viewModel.UpdateModel(organization, HttpRequestStorage.DatabaseEntities, CurrentFirmaSession);
            HttpRequestStorage.DatabaseEntities.SaveChanges();

            // Clean up any orphaned MatchmakerKeywords (just for this Tenant)
            var orphanedMatchmakerKeywords = HttpRequestStorage.DatabaseEntities.MatchmakerKeywords
                                             .Where(mk => !mk.OrganizationMatchmakerKeywords.Any()).ToList();

            orphanedMatchmakerKeywords.ForEach(omk => omk.Delete(HttpRequestStorage.DatabaseEntities));
            HttpRequestStorage.DatabaseEntities.SaveChanges();

            return(new ModalDialogFormJsonResult(SitkaRoute <OrganizationController> .BuildUrlFromExpression(x => x.Detail(organization, OrganizationDetailViewData.OrganizationDetailTab.Profile))));
        }
Exemplo n.º 23
0
        public GridJsonNetJObjectResult <Agreement> AgreementGridForOrganizationJsonData(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization = organizationPrimaryKey.EntityObject;
            var gridSpec     = new AgreementGridSpec(CurrentFirmaSession);
            var agreementsForOrganization = organization.Agreements.ToList().OrderBy(x => x.AgreementNumber).ToList();
            var gridJsonNetJObjectResult  = new GridJsonNetJObjectResult <Agreement>(agreementsForOrganization, gridSpec);

            return(gridJsonNetJObjectResult);
        }
Exemplo n.º 24
0
 public ContentResult CkEditorUploadFileResourceForOrganizationDescription(OrganizationPrimaryKey organizationPrimaryKey)
 {
     return(Content(String.Empty));
 }
Exemplo n.º 25
0
        public GridJsonNetJObjectResult <ProjectGrantAllocationExpenditure> ProjectGrantAllocationExpendituresForOrganizationGridJsonData(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var givenOrganization = organizationPrimaryKey.EntityObject;

            // received
            var projects = givenOrganization.GetAllActiveProjectsAndProposalsWhereOrganizationIsStewardOrPrimaryContact(CurrentPerson).ToList();
            var projectGrantAllocationExpenditures = projects.SelectMany(x => x.ProjectGrantAllocationExpenditures).Where(x => x.GrantAllocation.BottommostOrganization != givenOrganization).ToList();

            // provided
            projectGrantAllocationExpenditures.AddRange(givenOrganization.GrantAllocations.SelectMany(x => x.ProjectGrantAllocationExpenditures));

            var projectGrantAllocationExpendituresToShow =
                projectGrantAllocationExpenditures.Where(x => x.ExpenditureAmount > 0).ToList();
            var gridSpec = new ProjectGrantAllocationExpendituresForOrganizationGridSpec(givenOrganization);
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <ProjectGrantAllocationExpenditure>(projectGrantAllocationExpendituresToShow, gridSpec);

            return(gridJsonNetJObjectResult);
        }
Exemplo n.º 26
0
        public GridJsonNetJObjectResult <PartnerOrganizationMatchMakerScore> ProjectFinderGridFullJsonData(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization           = organizationPrimaryKey.EntityObject;
            var organizationHasOptedIn = organization.MatchmakerOptIn ?? false;
            var gridSpec = new ProjectFinderGridSpec(CurrentFirmaSession);
            var projectMatchmakerScoresForOrganization        = organizationHasOptedIn ? new ProjectOrganizationMatchmaker().GetPartnerOrganizationMatchMakerScoresForParticularOrganization(CurrentFirmaSession, organization) : new List <PartnerOrganizationMatchMakerScore>();
            var projectMatchmakerScoresExcludingInvalidStages = projectMatchmakerScoresForOrganization.Where(x => x.Project.ProjectStage.ShouldIncludeInMatchmaker()).ToList();

            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <PartnerOrganizationMatchMakerScore>(projectMatchmakerScoresExcludingInvalidStages, gridSpec, x => x.Project.PrimaryKey);

            return(gridJsonNetJObjectResult);
        }
Exemplo n.º 27
0
        public GridJsonNetJObjectResult <Agreement> AgreementOrganizationGridJsonData(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization = organizationPrimaryKey.EntityObject;
            var agreements   = GetAgreementsByOrgPeople(organization);
            var gridSpec     = new AgreementGridSpec(CurrentPerson, agreements.Any(x => x.AgreementFileResourceID.HasValue), false, false)
            {
                CustomExcelDownloadUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(tc => tc.AgreementsExcelDownload(organizationPrimaryKey))
            };

            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <Agreement>(agreements, gridSpec);

            return(gridJsonNetJObjectResult);
        }
Exemplo n.º 28
0
        public ActionResult GetProjectsByOrganization(WebServiceReturnTypeEnum webServiceReturnTypeEnum, WebServiceToken webServiceToken, OrganizationPrimaryKey organizationPK)
        {
            var projects = WebServiceProject.GetProjectsByOrganization(organizationPK.PrimaryKeyValue);
            var gridSpec = new WebServiceProjectGridSpec();

            return(GetResultsAsCsvDowloadOrJsonResult(webServiceReturnTypeEnum, projects, gridSpec, "ProjectsByOrganization"));
        }