private void SetMatchmakerKeywordsJson(ProjectFirmaModels.Models.Organization organization)
        {
            List <string> matchmakerKeywordStrings       = organization.OrganizationMatchmakerKeywords.Select(mmk => mmk.MatchmakerKeyword.MatchmakerKeywordName).ToList();
            string        matchmakerKeywordStringsAsJson = JsonConvert.SerializeObject(matchmakerKeywordStrings);

            this.MatchmakerKeywordsJson = matchmakerKeywordStringsAsJson;
        }
 public ApproveUploadGisViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Organization organization,
                                 MapInitJson mapInitJson) : base(currentFirmaSession)
 {
     MapInitJson           = mapInitJson;
     OrganizationDetailUrl =
         SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.Detail(organization, null));
 }
        public void UpdateModel(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Organization organization, DatabaseEntities databaseEntities)
        {
            var allCurrentMatchmakerClassifications =
                databaseEntities.MatchmakerOrganizationClassifications.Where(x =>
                                                                             x.OrganizationID == organization.OrganizationID).ToList();

            var matchmakerOrganizationClassificationIDsSubmitted = new List <int>();

            if (ClassificationSystemListboxes != null)
            {
                matchmakerOrganizationClassificationIDsSubmitted.AddRange(ClassificationSystemListboxes.SelectMany(x => x.SelectedItems.Select(y => Int32.Parse(y))).ToList());
            }

            var matchmakerClassificationsToRemove = allCurrentMatchmakerClassifications.Where(x => !matchmakerOrganizationClassificationIDsSubmitted.Contains(x.ClassificationID));
            var matchmakerClassificationIDsToAdd  = matchmakerOrganizationClassificationIDsSubmitted.Where(x =>
                                                                                                           !allCurrentMatchmakerClassifications.Select(y => y.ClassificationID).Contains(x)).ToList();

            foreach (var matchmakerOrganizationClassificationToRemove in matchmakerClassificationsToRemove)
            {
                matchmakerOrganizationClassificationToRemove.Delete(databaseEntities);
            }

            foreach (var classificationIDToAdd in matchmakerClassificationIDsToAdd)
            {
                organization.MatchmakerOrganizationClassifications.Add(new MatchmakerOrganizationClassification(organization.OrganizationID, classificationIDToAdd));
            }
        }
Esempio n. 4
0
        public void Setup()
        {
            _project = TestFramework.TestProject.Create();

            _organization1 = TestFramework.TestOrganization.Create();
            _organization1.OrganizationID   = 77777;
            _organization1.OrganizationName = "Organization 77777";
            _organization2 = TestFramework.TestOrganization.Create();
            _organization2.OrganizationID   = 88888;
            _organization2.OrganizationName = "Organization 88888";
            _organization3 = TestFramework.TestOrganization.Create();
            _organization3.OrganizationID   = 99999;
            _organization3.OrganizationName = "Organization 99999";

            var projectOrganization1 = TestFramework.TestProjectOrganization.Create(_project, _organization1);
            var projectOrganization2 = TestFramework.TestProjectOrganization.Create(_project, _organization2);
            var projectOrganization3 = TestFramework.TestProjectOrganization.Create(_project, _organization3);

            _projectOrganizations = new List <ProjectFirmaModels.Models.ProjectOrganization> {
                projectOrganization1, projectOrganization2, projectOrganization3
            };
            _allOrganizations = new List <ProjectFirmaModels.Models.Organization> {
                _organization1, _organization2, _organization3
            };
        }
Esempio n. 5
0
        public void UpdateModel(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Organization organization, DatabaseEntities databaseEntities)
        {
            var allCurrentMatchmakerPerformanceMeasures =
                databaseEntities.MatchmakerOrganizationPerformanceMeasures.Where(x =>
                                                                                 x.OrganizationID == organization.OrganizationID).ToList();

            var matchmakerOrganizationPerformanceMeasureIDsSubmitted = new List <int>();

            if (PerformanceMeasureListbox != null)
            {
                matchmakerOrganizationPerformanceMeasureIDsSubmitted.AddRange(PerformanceMeasureListbox.SelectedItems.Select(y => Int32.Parse(y)).ToList());
            }

            var matchmakerPerformanceMeasuresToRemove = allCurrentMatchmakerPerformanceMeasures.Where(x => !matchmakerOrganizationPerformanceMeasureIDsSubmitted.Contains(x.PerformanceMeasureID));
            var matchmakerPerformanceMeasureIDsToAdd  = matchmakerOrganizationPerformanceMeasureIDsSubmitted.Where(x =>
                                                                                                                   !allCurrentMatchmakerPerformanceMeasures.Select(y => y.PerformanceMeasureID).Contains(x)).ToList();

            foreach (var matchmakerOrganizationPerformanceMeasureToRemove in matchmakerPerformanceMeasuresToRemove)
            {
                matchmakerOrganizationPerformanceMeasureToRemove.Delete(databaseEntities);
            }

            foreach (var performanceMeasureIDToAdd in matchmakerPerformanceMeasureIDsToAdd)
            {
                organization.MatchmakerOrganizationPerformanceMeasures.Add(new MatchmakerOrganizationPerformanceMeasure(organization.OrganizationID, performanceMeasureIDToAdd));
            }
        }
        public void UpdateModel(ProjectFirmaModels.Models.Organization organization,
                                DatabaseEntities databaseEntities,
                                FirmaSession currentFirmaSession)
        {
            // Keyword strings coming off the form
            List <String> matchmakerKeywordStringsFromForm = GetKeywordStringsFromJsonFormVariable();

            // Find MatchmakerKeywords that aren't already saved, across all Organizations for this Tenant
            List <string> matchmakerKeywordStringsThatAreNotAlreadySavedInTable
                = matchmakerKeywordStringsFromForm.Where(ks => !databaseEntities.MatchmakerKeywords.Any(dmk => dmk.MatchmakerKeywordName == ks)).ToList();

            // Make sure we save these all-new MatchmakerKeywords
            var previouslyUnknownMatchmakerKeywordsForThisTenant = matchmakerKeywordStringsThatAreNotAlreadySavedInTable
                                                                   .Select(ks => new MatchmakerKeyword(ks)).ToList();

            databaseEntities.AllMatchmakerKeywords.AddRange(previouslyUnknownMatchmakerKeywordsForThisTenant);

            // Delete ALL OrganizationMatchmakerKeywords for this particular Organization
            organization.OrganizationMatchmakerKeywords.ToList().ForEach(omk => omk.Delete(databaseEntities));

            // Get the MatchmakerKeywords for all the incoming form variables. Some of these may be existing, some may be newly created.

            // First, the existing
            var matchMakerKeywordsWeNeedToAssociateToThisOrg = databaseEntities.MatchmakerKeywords.Where(mk => matchmakerKeywordStringsFromForm.Contains(mk.MatchmakerKeywordName)).ToList();

            // Next, the new
            matchMakerKeywordsWeNeedToAssociateToThisOrg.AddRange(previouslyUnknownMatchmakerKeywordsForThisTenant);

            // Make new OrganizationMatchmakerKeywords
            organization.OrganizationMatchmakerKeywords = matchMakerKeywordsWeNeedToAssociateToThisOrg.OrderBy(mk => mk.MatchmakerKeywordName).Select(mk => new OrganizationMatchmakerKeyword(organization, mk)).ToList();
        }
Esempio n. 7
0
 public ViewPageContentViewData(ProjectFirmaModels.Models.Organization organization, FirmaSession currentFirmaSession)
 {
     FirmaPageContentHtmlString = organization.GetFirmaPageContentHtmlString();
     FirmaPageDisplayName       = organization.GetFirmaPageDisplayName();
     ShowEditButton             = new OrganizationBackgroundEditFeature().HasPermission(currentFirmaSession, organization).HasPermission;
     HasPageContent             = organization.HasPageContent();
     EditPageContentUrl         = SitkaRoute <OrganizationController> .BuildUrlFromExpression(t => t.EditDescriptionInDialog(organization));
 }
Esempio n. 8
0
        private static Person CreateNewFirmaPersonWithoutKeystone(Organization userOrganization, CreateAccountViewModel viewModel)
        {
            var firmaPerson = new Person(Guid.NewGuid(), viewModel.FirstName, viewModel.LastName,
                                         viewModel.Email, Role.Unassigned, DateTime.Now, true, userOrganization, false,
                                         viewModel.Email);

            HttpRequestStorage.DatabaseEntities.AllPeople.Add(firmaPerson);
            return(firmaPerson);
        }
Esempio n. 9
0
        public MatchmakerOrganizationPerformanceMeasuresViewModel(ProjectFirmaModels.Models.Organization organization, List <ProjectFirmaModels.Models.PerformanceMeasure> allPerformanceMeasures)
        {
            var allSelectListItems      = allPerformanceMeasures.OrderBy(x => x.GetSortOrder()).ToList();
            var selectedClassifications = organization.MatchmakerOrganizationPerformanceMeasures.Select(x => x.PerformanceMeasure).ToList();
            var selectListItems         = allSelectListItems.ToSelectList(x => Convert.ToString(x.PerformanceMeasureID), x => x.GetDisplayName(),
                                                                          selectedClassifications.Select(y => Convert.ToString(y.PerformanceMeasureID)).ToList()).ToList();

            PerformanceMeasureListbox = new SitkaLeftRightListbox("PerformanceMeasure", selectListItems);;
        }
Esempio n. 10
0
        private string GetMatchmakerProjectFinderButtonContent(ProjectFirmaModels.Models.Organization organization, Dictionary <MatchmakerSubScoreTypeEnum, bool> matchmakerProfileCompletionDictionary)
        {
            if (!matchmakerProfileCompletionDictionary.Values.Any(x => x))
            {
                return
                    ($"Your profile is empty, so it is not possible to identify {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} matches. Please fill out your profile as completely as possible before using the {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Finder.");
            }

            return($"This {FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabel()} has not opted in to the Matchmaker service.");
        }
Esempio n. 11
0
 public void UpdateModel(ProjectFirmaModels.Models.Organization organization)
 {
     organization.MatchmakerCash                          = MatchmakerCash;
     organization.MatchmakerCashDescription               = MatchmakerCashDescription;
     organization.MatchmakerInKindServices                = MatchmakerInKindServices;
     organization.MatchmakerInKindServicesDescription     = MatchmakerInKindServicesDescription;
     organization.MatchmakerCommercialServices            = MatchmakerCommercialServices;
     organization.MatchmakerCommercialServicesDescription = MatchmakerCommercialServicesDescription;
     organization.MatchmakerConstraints                   = MatchmakerConstraints;
     organization.MatchmakerAdditionalInformation         = MatchmakerAdditionalInformation;
 }
Esempio n. 12
0
 public void UpdateModel(ProjectFirmaModels.Models.Organization organization)
 {
     using (var disposableTempFile = DisposableTempFile.MakeDisposableTempFileEndingIn(".gdb.zip"))
     {
         var gdbFile = disposableTempFile.FileInfo;
         FileResourceData.SaveAs(gdbFile.FullName);
         HttpRequestStorage.DatabaseEntities.AllOrganizationBoundaryStagings.RemoveRange(organization.OrganizationBoundaryStagings.ToList());
         organization.OrganizationBoundaryStagings.Clear();
         OrganizationModelExtensions.CreateOrganizationBoundaryStagingStagingListFromGdb(gdbFile, FileResourceData.FileName, organization);
     }
 }
Esempio n. 13
0
 public EditViewModel(ProjectFirmaModels.Models.Organization organization)
 {
     OrganizationID         = organization.OrganizationID;
     OrganizationName       = organization.OrganizationName;
     OrganizationShortName  = organization.OrganizationShortName;
     OrganizationTypeID     = organization.OrganizationTypeID;
     PrimaryContactPersonID = organization.PrimaryContactPerson?.PersonID;
     OrganizationUrl        = organization.OrganizationUrl;
     IsActive = organization.IsActive;
     KeystoneOrganizationGuid = organization.KeystoneOrganizationGuid;
 }
Esempio n. 14
0
 public EditProfileSupplementalInformationViewModel(ProjectFirmaModels.Models.Organization organization)
 {
     OrganizationID                          = organization.OrganizationID;
     MatchmakerCashDescription               = organization.MatchmakerCashDescription;
     MatchmakerCash                          = organization.MatchmakerCash ?? false;
     MatchmakerInKindServicesDescription     = organization.MatchmakerInKindServicesDescription;
     MatchmakerInKindServices                = organization.MatchmakerInKindServices ?? false;
     MatchmakerCommercialServicesDescription = organization.MatchmakerCommercialServicesDescription;
     MatchmakerCommercialServices            = organization.MatchmakerCommercialServices ?? false;
     MatchmakerConstraints                   = organization.MatchmakerConstraints;
     MatchmakerAdditionalInformation         = organization.MatchmakerAdditionalInformation;
 }
 public MatchmakerOrganizationClassificationsViewModel(ProjectFirmaModels.Models.Organization organization, List <ProjectFirmaModels.Models.ClassificationSystem> allClassificationSystems)
 {
     ClassificationSystemListboxes = new List <SitkaLeftRightListbox>();
     foreach (var classificationSystem in allClassificationSystems)
     {
         var allSelectListItems      = classificationSystem.Classifications.OrderBy(x => x.ClassificationSortOrder).ToList();
         var selectedClassifications = organization.MatchmakerOrganizationClassifications.Select(x => x.Classification).ToList();
         var selectListItems         = allSelectListItems.ToSelectList(x => Convert.ToString(x.ClassificationID), x => x.DisplayName,
                                                                       selectedClassifications.Select(y => Convert.ToString(y.ClassificationID)).ToList()).ToList();
         var sitkaLeftRightListbox = new SitkaLeftRightListbox($"ClassificationSystemID_{classificationSystem.ClassificationSystemID}", selectListItems);
         ClassificationSystemListboxes.Add(sitkaLeftRightListbox);
     }
 }
Esempio n. 16
0
        public EditBoundaryViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Organization organization) : base(currentFirmaSession)
        {
            PageTitle = "Edit Organization Boundary";

            Organization    = organization;
            EditBoundaryUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditBoundary(organization));

            ApproveGisUploadUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.ApproveUploadGis(organization));

            OrganizationDetailUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.Detail(organization, null));
        }
Esempio n. 17
0
        private static Person CreateNewFirmaPerson(KeystoneService.KeystoneUserClaims keystoneUser, Guid?organizationGuid)
        {
            Organization organization;

            if (organizationGuid.HasValue)
            {
                organization =
                    HttpRequestStorage.DatabaseEntities.Organizations.GetOrganizationByKeystoneOrganizationGuid(organizationGuid
                                                                                                                .Value);

                if (organization == null)
                {
                    var keystoneClient = new KeystoneDataClient();


                    var keystoneOrganization = keystoneClient.GetOrganization(organizationGuid.Value);


                    var defaultOrganizationType =
                        HttpRequestStorage.DatabaseEntities.OrganizationTypes.GetDefaultOrganizationType();
                    var firmaOrganization =
                        new Organization(keystoneOrganization.FullName, true, defaultOrganizationType, Organization.UseOrganizationBoundaryForMatchmakerDefault, false)
                    {
                        KeystoneOrganizationGuid = keystoneOrganization.OrganizationGuid,
                        OrganizationShortName    = keystoneOrganization.ShortName,
                        OrganizationUrl          = keystoneOrganization.URL
                    };
                    HttpRequestStorage.DatabaseEntities.AllOrganizations.Add(firmaOrganization);

                    HttpRequestStorage.DatabaseEntities.SaveChanges();

                    organization = firmaOrganization;
                }
            }
            else
            {
                organization = HttpRequestStorage.DatabaseEntities.Organizations.GetUnknownOrganization();
            }


            var firmaPerson = new Person(keystoneUser.UserGuid, keystoneUser.FirstName, keystoneUser.LastName,
                                         keystoneUser.Email, Role.Unassigned, DateTime.Now, true, organization, false,
                                         keystoneUser.LoginName);

            HttpRequestStorage.DatabaseEntities.AllPeople.Add(firmaPerson);
            return(firmaPerson);
        }
Esempio n. 18
0
        public ProjectsIncludingLeadImplementingGridSpec(ProjectFirmaModels.Models.Organization organization, FirmaSession currentFirmaSession, bool showSubmittalStatus)
        {
            Add(FieldDefinitionEnum.Project.ToType().ToGridHeaderString(), a => UrlTemplate.MakeHrefString(a.GetDetailUrl(), a.GetDisplayName()), 350, DhtmlxGridColumnFilterType.Html);

            if (showSubmittalStatus)
            {
                Add("Submittal Status", a => a.ProjectApprovalStatus.ProjectApprovalStatusDisplayName, 110, DhtmlxGridColumnFilterType.SelectFilterStrict);
            }


            if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship())
            {
                Add(FieldDefinitionEnum.ProjectsStewardOrganizationRelationshipToProject.ToType().ToGridHeaderString(), x => x.GetCanStewardProjectsOrganization().GetDisplayNameAsUrl(), 150,
                    DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
            }
            Add(FieldDefinitionEnum.IsPrimaryContactOrganization.ToType().ToGridHeaderString(), x => x.GetPrimaryContactOrganization().GetDisplayNameAsUrl(), 150, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);

            Add(FieldDefinitionEnum.ProjectStage.ToType().ToGridHeaderString(), a => a.ProjectStage.ProjectStageDisplayName, 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionEnum.ProjectOrganizationRelationshipType.ToType().ToGridHeaderStringPlural(FieldDefinitionEnum.ProjectOrganizationRelationshipType.ToType().GetFieldDefinitionLabelPluralized()),
                a => string.Join(", ", a.GetAssociatedOrganizationRelationships().Where(x => x.Organization.OrganizationID == organization.OrganizationID).Select(x => x.OrganizationRelationshipTypeName)), 180, DhtmlxGridColumnFilterType.Text);

            Add(FieldDefinitionEnum.PlanningDesignStartYear.ToType().ToGridHeaderString(), x => x.GetPlanningDesignStartYear(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionEnum.ImplementationStartYear.ToType().ToGridHeaderString(), x => x.GetImplementationStartYear(), 115, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionEnum.CompletionYear.ToType().ToGridHeaderString(), x => x.GetCompletionYear(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add($"# Of Reported {MultiTenantHelpers.GetPerformanceMeasureName()} Records", x => x.PerformanceMeasureActuals.Count, 100);
            Add($"# Of {FieldDefinitionEnum.ReportedExpenditure.ToType().GetFieldDefinitionLabel()} Records", x => x.ProjectFundingSourceExpenditures.Count, 100);
            Add(FieldDefinitionEnum.FundingType.ToType().ToGridHeaderString(), x => x.FundingType?.FundingTypeDisplayName, 300, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionEnum.EstimatedTotalCost.ToType().ToGridHeaderString(), x => x.GetEstimatedTotalRegardlessOfFundingType(), 85, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);

            Add(FieldDefinitionEnum.ProjectedFunding.ToType().ToGridHeaderString(), x => x.GetProjectedFunding(), 100, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);
            Add(FieldDefinitionEnum.NoFundingSourceIdentified.ToType().ToGridHeaderString(), x => x.GetNoFundingSourceIdentifiedAmount(), 85, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);
            foreach (var geospatialAreaType in new List <GeospatialAreaType>())
            {
                Add($"{geospatialAreaType.GeospatialAreaTypeNamePluralized}", a => a.GetProjectGeospatialAreaNamesAsHyperlinks(geospatialAreaType), 350, DhtmlxGridColumnFilterType.Html);
            }
            Add(FieldDefinitionEnum.ProjectDescription.ToType().ToGridHeaderString(), x => x.ProjectDescription, 200);
            if (new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession))
            {
                Add("Tags", x => new HtmlString(!x.ProjectTags.Any() ? string.Empty : string.Join(", ", x.ProjectTags.Select(pt => pt.Tag.GetDisplayNameAsUrl()))), 100, DhtmlxGridColumnFilterType.Html);
            }
            Add("# of Photos", x => x.ProjectImages.Count, 60);
        }
        public ProjectFinderOrganizationViewData(FirmaSession currentFirmaSession,
                                                 ProjectFirmaModels.Models.Organization organization,
                                                 List <PartnerOrganizationMatchMakerScore> projectMatchmakerScoresForOrganization,
                                                 ProjectFinderGridSpec projectFinderGridSpec, ProjectLocationsMapInitJson projectLocationsMapInitJson,
                                                 LayerGeoJson matchMakerAreaOfInterestGeoJson) : base(currentFirmaSession)
        {
            ContainerFluid           = true;
            PageTitle                = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Finder";
            PageSubTitle             = $"({organization.OrganizationName})";
            ProjectFinderGridSpec    = projectFinderGridSpec;
            ProjectFinderGridName    = "projectFinderGrid";
            ProjectFinderGridDataUrl = SitkaRoute <ProjectFinderController> .BuildUrlFromExpression(tc => tc.ProjectFinderGridFullJsonData(organization.OrganizationID));

            Organization = organization;


            LegendFormats = ProjectMapLegendElement.BuildLegendFormatDictionary(MultiTenantHelpers.GetTopLevelTaxonomyTiers(), true);
            ProjectLocationsMapInitJson     = projectLocationsMapInitJson;
            MatchMakerAreaOfInterestGeoJson = matchMakerAreaOfInterestGeoJson;
        }
Esempio n. 20
0
 public ProjectFundingSourceExpendituresForOrganizationGridSpec(ProjectFirmaModels.Models.Organization organization)
 {
     Add(FieldDefinitionEnum.Project.ToType().ToGridHeaderString(),
         a => UrlTemplate.MakeHrefString(a.Project.GetDetailUrl(), a.Project.GetDisplayName()),
         250,
         DhtmlxGridColumnFilterType.Html);
     if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship())
     {
         Add(FieldDefinitionEnum.ProjectsStewardOrganizationRelationshipToProject.ToType().ToGridHeaderString(), x => x.Project.GetCanStewardProjectsOrganization().GetDisplayNameAsUrl(), 150,
             DhtmlxGridColumnFilterType.Html);
     }
     Add(FieldDefinitionEnum.IsPrimaryContactOrganization.ToType().ToGridHeaderString(), x => x.Project.GetPrimaryContactOrganization().GetDisplayNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html);
     Add(FieldDefinitionEnum.ProjectStage.ToType().ToGridHeaderString(), x => x.Project.ProjectStage.ProjectStageDisplayName, 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionEnum.OrganizationType.ToType().ToGridHeaderString(), x => x.FundingSource.Organization.OrganizationType?.GetOrganizationTypeHtmlStringWithColor(), 80, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
     Add(FieldDefinitionEnum.FundingSource.ToType().ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.FundingSource.GetDetailUrl(), x.FundingSource.GetDisplayName()), 120);
     Add(FieldDefinitionEnum.Organization.ToType().ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.FundingSource.Organization.GetDetailUrl(), x.FundingSource.Organization.GetDisplayName()), 120);
     Add($"Provided by {FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabel()}", x => (x.FundingSource.Organization == organization).ToYesOrEmpty(), 100, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
     Add($"Received from other {FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabel()}", x => (x.FundingSource.Organization != organization).ToYesOrEmpty(), 100, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
     Add(FieldDefinitionEnum.ReportingYear.ToType().ToGridHeaderString(), x => x.CalendarYear, 80, DhtmlxGridColumnFormatType.Date, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add("Amount", x => x.ExpenditureAmount, 80, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);
 }
Esempio n. 21
0
        public void UpdateModel(ProjectFirmaModels.Models.Organization organization, FirmaSession currentFirmaSession, DatabaseEntities databaseEntities)
        {
            organization.OrganizationName      = OrganizationName;
            organization.OrganizationShortName = OrganizationShortName;
            organization.OrganizationTypeID    = OrganizationTypeID.Value;
            organization.IsActive = IsActive;
            organization.PrimaryContactPersonID = PrimaryContactPersonID;
            organization.OrganizationUrl        = OrganizationUrl;
            if (LogoFileResourceData != null)
            {
                var oldLogoFileResourceInfo = organization.LogoFileResourceInfo;
                organization.LogoFileResourceInfo = FileResourceModelExtensions.CreateNewFromHttpPostedFileAndSave(LogoFileResourceData, currentFirmaSession);
                oldLogoFileResourceInfo?.FileResourceData.Delete(databaseEntities);
                oldLogoFileResourceInfo?.Delete(databaseEntities);
            }

            var isSitkaAdmin = new SitkaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);

            if (isSitkaAdmin)
            {
                organization.KeystoneOrganizationGuid = KeystoneOrganizationGuid;
            }
        }
Esempio n. 22
0
        public MatchmakerOrganizationLocationDetailViewData(ProjectFirmaModels.Models.Organization organization,
                                                            MapInitJson mapInitJson,
                                                            LayerGeoJson organizationBoundaryLayerGeoJson,
                                                            //string uploadGisFileUrl,
                                                            string mapFormID,
                                                            string saveFeatureCollectionUrl,
                                                            int annotationMaxLength,
                                                            LayerGeoJson editableLayerGeoJson
                                                            /*,bool hasProjectLocationPoint*/)
        {
            Organization = organization;
            MapInitJson  = mapInitJson;
            OrganizationBoundaryLayerGeoJson = organizationBoundaryLayerGeoJson;
            //UploadGisFileUrl = uploadGisFileUrl;
            MapFormID = mapFormID;
            SaveFeatureCollectionUrl = saveFeatureCollectionUrl;
            AnnotationMaxLength      = annotationMaxLength;
            //HasProjectLocationPoint = hasProjectLocationPoint;

            SimplePointMarkerImg    = "https://api.tiles.mapbox.com/v3/marker/pin-s-marker+838383.png";
            OrganizationHasBoundary = Organization.OrganizationBoundary != null;
            EditableLayerGeoJson    = editableLayerGeoJson;
        }
Esempio n. 23
0
 public void UpdateModel(ProjectFirmaModels.Models.Organization organization, FirmaSession currentFirmaSession)
 {
     organization.PrimaryContactPersonID = PrimaryContactPersonID;
 }
Esempio n. 24
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public Person(Guid personGuid, string firstName, string lastName, string email, Role role, DateTime createDate, bool isActive, Organization organization, bool receiveSupportEmails, string loginName) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.PersonID       = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.PersonGuid     = personGuid;
     this.FirstName      = firstName;
     this.LastName       = lastName;
     this.Email          = email;
     this.RoleID         = role.RoleID;
     this.CreateDate     = createDate;
     this.IsActive       = isActive;
     this.OrganizationID = organization.OrganizationID;
     this.Organization   = organization;
     organization.People.Add(this);
     this.ReceiveSupportEmails = receiveSupportEmails;
     this.LoginName            = loginName;
 }
Esempio n. 25
0
        public OrganizationDetailViewData(FirmaSession currentFirmaSession,
                                          ProjectFirmaModels.Models.Organization organization,
                                          MapInitJson mapInitJson,
                                          LayerGeoJson projectLocationsLayerGeoJson,
                                          bool hasSpatialData,
                                          List <ProjectFirmaModels.Models.PerformanceMeasure> performanceMeasures,
                                          ViewGoogleChartViewData expendituresDirectlyFromOrganizationViewGoogleChartViewData,
                                          ViewGoogleChartViewData expendituresReceivedFromOtherOrganizationsViewGoogleChartViewData,
                                          List <MatchmakerTaxonomyTier> topLevelMatchmakerTaxonomyTier,
                                          int maximumTaxonomyLeaves,
                                          OrganizationDetailTab activeTab, MapInitJson matchMakerAreaOfInterestInitJson,
                                          List <IGrouping <ProjectFirmaModels.Models.ClassificationSystem, MatchmakerOrganizationClassification> >
                                          matchmakerClassificationsGroupedByClassificationSystem,
                                          List <ProjectFirmaModels.Models.ClassificationSystem> allClassificationSystems) : base(currentFirmaSession)
        {
            Organization = organization;
            PageTitle    = organization.GetDisplayName();
            EntityName   = $"{FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabel()}";
            UserHasOrganizationManagePermissions = new OrganizationManageFeature().HasPermissionByFirmaSession(currentFirmaSession);
            UserHasOrganizationManagePrimaryContactPermissions = new OrganizationPrimaryContactManageFeature().HasPermissionByFirmaSession(currentFirmaSession);

            EditOrganizationUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.Edit(organization));

            EditBoundaryUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditBoundary(organization));

            DeleteOrganizationBoundaryUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(
                    c => c.DeleteOrganizationBoundary(organization));

            EditOrganizationPrimaryContactUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditPrimaryContact(organization));

            ProjectsIncludingLeadImplementingGridSpec =
                new ProjectsIncludingLeadImplementingGridSpec(organization, currentFirmaSession, false)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} associated with {organization.GetDisplayName()}",
                SaveFiltersInCookie = true
            };

            ProjectOrganizationsGridName    = "projectOrganizationsFromOrganizationGrid";
            ProjectOrganizationsGridDataUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(
                    tc => tc.ProjectsIncludingLeadImplementingGridJsonData(organization));

            ProjectStewardOrLeadImplementorFieldDefinitionName = MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship()
                ? FieldDefinitionEnum.ProjectsStewardOrganizationRelationshipToProject.ToType().GetFieldDefinitionLabel()
                : "Lead Implementer";

            ProjectFundingSourceExpendituresForOrganizationGridSpec =
                new ProjectFundingSourceExpendituresForOrganizationGridSpec(organization)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} {FieldDefinitionEnum.ReportedExpenditure.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} {FieldDefinitionEnum.ReportedExpenditure.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };

            ProjectFundingSourceExpendituresForOrganizationGridName    = "projectCalendarYearExpendituresForOrganizationGrid";
            ProjectFundingSourceExpendituresForOrganizationGridDataUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(
                    tc => tc.ProjectFundingSourceExpendituresForOrganizationGridJsonData(organization));

            ManageFundingSourcesUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(c => c.Index());

            IndexUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.Index());

            MapInitJson = mapInitJson;
            ProjectLocationsLayerGeoJson = projectLocationsLayerGeoJson;
            HasSpatialData = hasSpatialData;
            ExpendituresDirectlyFromOrganizationViewGoogleChartViewData       = expendituresDirectlyFromOrganizationViewGoogleChartViewData;
            ExpendituresReceivedFromOtherOrganizationsViewGoogleChartViewData = expendituresReceivedFromOtherOrganizationsViewGoogleChartViewData;

            PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => organization.GetPerformanceMeasureChartViewData(x, currentFirmaSession)).ToList();

            NewFundingSourceUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(c => c.New());

            CanCreateNewFundingSource = new FundingSourceCreateFeature().HasPermissionByFirmaSession(currentFirmaSession) &&
                                        (currentFirmaSession.Person.RoleID != ProjectFirmaModels.Models.Role.ProjectSteward.RoleID || // If person is project steward, they can only create funding sources for their organization
                                         currentFirmaSession.Person.OrganizationID == organization.OrganizationID);
            ShowProposals        = currentFirmaSession.CanViewProposals();
            ProposalsPanelHeader = MultiTenantHelpers.ShowProposalsToThePublic()
                ? FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized()
                : $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized()} (Not Visible to the Public)";

            ProposalsGridSpec =
                new ProjectsIncludingLeadImplementingGridSpec(organization, currentFirmaSession, true)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized()} associated with {organization.GetDisplayName()}",
                SaveFiltersInCookie = true
            };

            ProposalsGridName    = "proposalsGrid";
            ProposalsGridDataUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(
                    tc => tc.ProposalsGridJsonData(organization));

            ShowPendingProjects = currentFirmaSession.Person.CanViewPendingProjects();

            // If they have no permissions, just say "yes" or "no" if GUID set.
            // If they have manage permissions, show the GUID, otherwise "None".
            bool   hasKeystoneOrganizationGuid = (organization.KeystoneOrganizationGuid != null);
            string hasKeystoneOrganizationGuidBooleanAsString = hasKeystoneOrganizationGuid.ToYesNo();
            string organizationKeystoneGuidAsStringOrNone     = hasKeystoneOrganizationGuid ? organization.KeystoneOrganizationGuid.ToString() : "None";

            OrganizationKeystoneGuidDisplayString = UserHasOrganizationManagePermissions ? organizationKeystoneGuidAsStringOrNone : hasKeystoneOrganizationGuidBooleanAsString;

            PendingProjectsGridSpec =
                new ProjectsIncludingLeadImplementingGridSpec(organization, currentFirmaSession, true)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} associated with {organization.GetDisplayName()}",
                SaveFiltersInCookie = true
            };

            PendingProjectsGridName    = "pendingProjectsGrid";
            PendingProjectsGridDataUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(
                    tc => tc.PendingProjectsGridJsonData(organization));

            TenantHasCanStewardProjectsOrganizationRelationship = MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship();
            var allAssociatedProjects = Organization.GetAllAssociatedProjects();

            NumberOfStewardedProjects       = allAssociatedProjects.Count(x => x.IsActiveProject() && x.GetCanStewardProjectsOrganization() == Organization);
            NumberOfLeadImplementedProjects = allAssociatedProjects.Count(x => x.IsActiveProject() && x.GetPrimaryContactOrganization() == Organization);
            NumberOfProjectsContributedTo   = allAssociatedProjects.ToList().GetActiveProjects().Count;
            DescriptionViewData             = new ViewPageContentViewData(organization, currentFirmaSession);

            UserHasViewEditProfilePermission = new OrganizationProfileViewEditFeature().HasPermission(currentFirmaSession, organization).HasPermission;

            bool matchmakerEnabledForTenant           = MultiTenantHelpers.GetTenantAttributeFromCache().EnableMatchmaker;
            bool matchmakerOptedInForThisOrganization = Organization.MatchmakerOptIn.HasValue && Organization.MatchmakerOptIn.Value;

            ShowMatchmakerProfileTab        = matchmakerEnabledForTenant;
            ShowMatchmakerProfileTabDetails = matchmakerEnabledForTenant && (UserHasViewEditProfilePermission || matchmakerOptedInForThisOrganization);

            FieldDefinitionForProject  = FieldDefinitionEnum.Project.ToType();
            EditProfileMatchmakerOptIn = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditProfileMatchmakerOptIn(organization));

            EditProfileSupplementalInformationUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditProfileSupplementalInformation(organization));

            EditProfileTaxonomyUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditProfileTaxonomy(organization));

            EditAreaOfInterestUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditMatchMakerAreaOfInterest(organization));

            EditAreaOfInterestDialogFormID = OrganizationController.GenerateEditOrganizationMatchMakerAreaOfInterestFormID(organization);
            HasAreaOfInterest         = (Organization.UseOrganizationBoundaryForMatchmaker && Organization.OrganizationBoundary != null) || (!Organization.UseOrganizationBoundaryForMatchmaker && Organization.MatchMakerAreaOfInterestLocations.Any());
            AreaOfInterestMapInitJson = matchMakerAreaOfInterestInitJson;

            OrganizationMatchmakerKeywordsViewData = new OrganizationMatchmakerKeywordsViewData(organization);
            EditMatchmakerKeywordsUrl = SitkaRoute <KeywordController> .BuildUrlFromExpression(c => c.EditMatchMakerKeywordsModal(organization));

            EditMatchmakerKeywordDialogFormID = OrganizationMatchmakerKeywordsViewData.EditMatchmakerKeywordDialogFormID;

            TopLevelMatchmakerTaxonomyTier = topLevelMatchmakerTaxonomyTier;
            TaxonomyTrunkDisplayName       = FieldDefinitionEnum.TaxonomyTrunk.ToType().GetFieldDefinitionLabel();
            TaxonomyBranchDisplayName      = FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabel();
            TaxonomyLeafDisplayName        = FieldDefinitionEnum.TaxonomyLeaf.ToType().GetFieldDefinitionLabel();
            TaxonomyLevel         = MultiTenantHelpers.GetTaxonomyLevel();
            MaximumTaxonomyLeaves = maximumTaxonomyLeaves;
            ActiveTab             = activeTab;

            EditOrgClassificationsUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditMatchMakerClassifications(organization));

            MatchmakerClassificationsGroupedByClassificationSystem = matchmakerClassificationsGroupedByClassificationSystem;
            AllClassificationSystems = allClassificationSystems;

            EditOrgPerformanceMeasuresUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditMatchMakerPerformanceMeasures(organization));

            ProjectFinderPageUrl = SitkaRoute <ProjectFinderController> .BuildUrlFromExpression(c => c.Organization(organization));

            MatchmakerProfileCompletionDictionary = organization.GetMatchmakerOrganizationProfileCompletionDictionary();

            MatchmakerProfileIncomplete           = !MatchmakerProfileCompletionDictionary.Values.Any(x => x);
            MatchmakerProjectFinderButtonDisabled = !organization.MatchmakerOptIn.HasValue || !organization.MatchmakerOptIn.Value || MatchmakerProfileIncomplete;
            ShouldShowBackgroundTab = DescriptionViewData.HasPageContent || new OrganizationBackgroundEditFeature().HasPermission(currentFirmaSession, organization).HasPermission;
            MatchmakerProjectFinderButtonContent = GetMatchmakerProjectFinderButtonContent(organization, MatchmakerProfileCompletionDictionary);

            ShowFundingSources = Organization.FundingSources.Any() || new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);
        }
Esempio n. 26
0
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static Person CreateNewBlank(Role role, Organization organization)
 {
     return(new Person(default(Guid), default(string), default(string), default(string), role, default(DateTime), default(bool), organization, default(bool), default(string)));
 }
Esempio n. 27
0
 public ProjectOrganizationForDiff(ProjectFirmaModels.Models.Organization organization, OrganizationRelationshipType organizationRelationshipType, string displayCssClassDeletedElement)
 {
     Organization = organization;
     OrganizationRelationshipType = organizationRelationshipType;
     DisplayCssClass = displayCssClassDeletedElement;
 }
 public EditProfileTaxonomyViewModel(ProjectFirmaModels.Models.Organization organization, List <string> taxonomyCompoundKeys)
 {
     OrganizationID       = organization.OrganizationID;
     TaxonomyCompoundKeys = taxonomyCompoundKeys;
 }
        public void UpdateModel(ProjectFirmaModels.Models.Organization organization,
                                ICollection <MatchmakerOrganizationTaxonomyTrunk> allMatchMakerOrganizationTaxonomyTrunks,
                                ICollection <MatchmakerOrganizationTaxonomyBranch> allMatchMakerOrganizationTaxonomyBranches,
                                ICollection <MatchmakerOrganizationTaxonomyLeaf> allMatchMakerOrganizationTaxonomyLeafs
                                )
        {
            // determine which taxonomy level each key in TaxonomyCompoundKeys is
            var updatedTaxonomyTrunkIDs  = new List <int>();
            var updatedTaxonomyBranchIDs = new List <int>();
            var updatedTaxonomyLeafIDs   = new List <int>();

            if (TaxonomyCompoundKeys == null)
            {
                TaxonomyCompoundKeys = new List <string>();
            }
            foreach (var compoundKey in TaxonomyCompoundKeys)
            {
                var levelAndID = TaxonomyTierHelpers.GetTaxonomyLevelAndIDFromComboTreeNodeKey(compoundKey);
                switch (levelAndID.Item1)
                {
                case TaxonomyLevelEnum.Trunk:
                    updatedTaxonomyTrunkIDs.Add(levelAndID.Item2);
                    break;

                case TaxonomyLevelEnum.Branch:
                    updatedTaxonomyBranchIDs.Add(levelAndID.Item2);
                    break;

                case TaxonomyLevelEnum.Leaf:
                    updatedTaxonomyLeafIDs.Add(levelAndID.Item2);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            if (MultiTenantHelpers.IsTaxonomyLevelTrunk())
            {
                // merge trunk
                var taxonomyTrunksUpdated = updatedTaxonomyTrunkIDs.Select(x => new MatchmakerOrganizationTaxonomyTrunk(organization.OrganizationID, x, true)).ToList();
                organization.MatchmakerOrganizationTaxonomyTrunks.Merge(taxonomyTrunksUpdated,
                                                                        allMatchMakerOrganizationTaxonomyTrunks,
                                                                        (x, y) => x.OrganizationID == y.OrganizationID && x.TaxonomyTrunkID == y.TaxonomyTrunkID,
                                                                        HttpRequestStorage.DatabaseEntities);
            }

            if (MultiTenantHelpers.IsTaxonomyLevelBranch() || MultiTenantHelpers.IsTaxonomyLevelTrunk())
            {
                // merge branch
                var taxonomyBranchesUpdated = updatedTaxonomyBranchIDs.Select(x => new MatchmakerOrganizationTaxonomyBranch(organization.OrganizationID, x, true)).ToList();
                organization.MatchmakerOrganizationTaxonomyBranches.Merge(taxonomyBranchesUpdated,
                                                                          allMatchMakerOrganizationTaxonomyBranches,
                                                                          (x, y) => x.OrganizationID == y.OrganizationID && x.TaxonomyBranchID == y.TaxonomyBranchID,
                                                                          HttpRequestStorage.DatabaseEntities);
            }

            // merge leaf
            var taxonomyLeafsUpdated = updatedTaxonomyLeafIDs.Select(x => new MatchmakerOrganizationTaxonomyLeaf(organization.OrganizationID, x, true)).ToList();

            organization.MatchmakerOrganizationTaxonomyLeafs.Merge(taxonomyLeafsUpdated,
                                                                   allMatchMakerOrganizationTaxonomyLeafs,
                                                                   (x, y) => x.OrganizationID == y.OrganizationID && x.TaxonomyLeafID == y.TaxonomyLeafID,
                                                                   HttpRequestStorage.DatabaseEntities);
        }
Esempio n. 30
0
        private string MakeOrganizationNameWithKeystoneGuidWarning(ProjectFirmaModels.Models.Organization organization)
        {
            string noGuidWarning = organization.KeystoneOrganizationGuid == null ? " [No Keystone Organization GUID]" : string.Empty;

            return($"{organization.OrganizationName}{noGuidWarning}");
        }