public EditViewModel(ProjectFirmaModels.Models.TaxonomyBranch taxonomyBranch) { TaxonomyBranchID = taxonomyBranch.TaxonomyBranchID; TaxonomyBranchName = taxonomyBranch.TaxonomyBranchName; TaxonomyBranchDescription = taxonomyBranch.TaxonomyBranchDescriptionHtmlString; TaxonomyTrunkID = taxonomyBranch.TaxonomyTrunkID; ThemeColor = taxonomyBranch.ThemeColor; }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public TaxonomyLeaf(TaxonomyBranch taxonomyBranch, string taxonomyLeafName) : this() { // Mark this as a new object by setting primary key with special value this.TaxonomyLeafID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.TaxonomyBranchID = taxonomyBranch.TaxonomyBranchID; this.TaxonomyBranch = taxonomyBranch; taxonomyBranch.TaxonomyLeafs.Add(this); this.TaxonomyLeafName = taxonomyLeafName; }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public PersonStewardTaxonomyBranch(Person person, TaxonomyBranch taxonomyBranch) : this() { // Mark this as a new object by setting primary key with special value this.PersonStewardTaxonomyBranchID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.PersonID = person.PersonID; this.Person = person; person.PersonStewardTaxonomyBranches.Add(this); this.TaxonomyBranchID = taxonomyBranch.TaxonomyBranchID; this.TaxonomyBranch = taxonomyBranch; taxonomyBranch.PersonStewardTaxonomyBranches.Add(this); }
private ProjectTaxonomyViewData(ProjectFirmaModels.Models.TaxonomyTrunk taxonomyTrunk, ProjectFirmaModels.Models.TaxonomyBranch taxonomyBranch, ProjectFirmaModels.Models.TaxonomyLeaf taxonomyLeaf, ProjectFirmaModels.Models.Project project, TaxonomyLevel taxonomyLevel) { TaxonomyLeaf = taxonomyLeaf; TaxonomyTrunk = taxonomyTrunk; TaxonomyBranch = taxonomyBranch; Project = project; IsProject = Project != null; IsTaxonomyLeaf = TaxonomyLeaf != null && !IsProject; IsTaxonomyBranch = TaxonomyBranch != null && !IsTaxonomyLeaf && !IsProject; IsTaxonomyTrunk = TaxonomyTrunk != null && !IsTaxonomyBranch && !IsTaxonomyLeaf && !IsProject; TaxonomyLevel = taxonomyLevel; }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public MatchmakerOrganizationTaxonomyBranch(Organization organization, TaxonomyBranch taxonomyBranch, bool isActive) : this() { // Mark this as a new object by setting primary key with special value this.MatchmakerOrganizationTaxonomyBranchID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.OrganizationID = organization.OrganizationID; this.Organization = organization; organization.MatchmakerOrganizationTaxonomyBranches.Add(this); this.TaxonomyBranchID = taxonomyBranch.TaxonomyBranchID; this.TaxonomyBranch = taxonomyBranch; taxonomyBranch.MatchmakerOrganizationTaxonomyBranches.Add(this); this.IsActive = isActive; }
public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.TaxonomyBranch taxonomyBranch, ProjectLocationsMapInitJson projectLocationsMapInitJson, ProjectLocationsMapViewData projectLocationsMapViewData, bool canHaveAssociatedPerformanceMeasures, RelatedPerformanceMeasuresViewData relatedPerformanceMeasuresViewData, List <PerformanceMeasureChartViewData> performanceMeasureChartViewDatas, TaxonomyLevel taxonomyLevel, List <ProjectCustomGridConfiguration> projectCustomDefaultGridConfigurations) : base(currentFirmaSession) { TaxonomyBranch = taxonomyBranch; ProjectLocationsMapViewData = projectLocationsMapViewData; ProjectLocationsMapInitJson = projectLocationsMapInitJson; PageTitle = taxonomyBranch.GetDisplayName(); var taxonomyBranchDisplayName = FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabel(); TaxonomyBranchDisplayName = taxonomyBranchDisplayName; TaxonomyBranchDisplayNamePluralized = FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabelPluralized(); TaxonomyLeafDisplayNamePluralized = FieldDefinitionEnum.TaxonomyLeaf.ToType().GetFieldDefinitionLabelPluralized(); EntityName = taxonomyBranchDisplayName; ProjectMapFilteredUrl = ProjectLocationsMapInitJson.ProjectMapCustomization.GetCustomizedUrl(); UserHasTaxonomyBranchManagePermissions = new TaxonomyBranchManageFeature().HasPermissionByFirmaSession(currentFirmaSession); EditTaxonomyBranchUrl = SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(c => c.Edit(taxonomyBranch.TaxonomyBranchID)); IndexUrl = SitkaRoute <ProgramInfoController> .BuildUrlFromExpression(c => c.Taxonomy()); var projectDetails = HttpRequestStorage.DatabaseEntities.vProjectDetails.ToDictionary(x => x.ProjectID); ProjectCustomDefaultGridSpec = new ProjectCustomGridSpec(currentFirmaSession, projectCustomDefaultGridConfigurations, ProjectCustomGridType.Default.ToEnum, projectDetails, currentFirmaSession.Tenant) { ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true }; ProjectCustomDefaultGridName = "taxonomyBranchProjectListGrid"; ProjectCustomDefaultGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.TaxonomyBranchProjectsGridJsonData(taxonomyBranch)); ProjectTaxonomyViewData = new ProjectTaxonomyViewData(taxonomyBranch, taxonomyLevel); CanHaveAssociatedPerformanceMeasures = canHaveAssociatedPerformanceMeasures; RelatedPerformanceMeasuresViewData = relatedPerformanceMeasuresViewData; PerformanceMeasureChartViewDatas = performanceMeasureChartViewDatas; EditChildrenSortOrderUrl = SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(x => x.EditChildrenSortOrder(taxonomyBranch)); }
public void UpdateModel(ProjectFirmaModels.Models.TaxonomyBranch taxonomyBranch, FirmaSession currentFirmaSession) { Check.Ensure(HttpRequestStorage.DatabaseEntities.TaxonomyTrunks.Any(), "No entries in TaxonomyTrunks; is something wrong with db?"); taxonomyBranch.TaxonomyBranchName = TaxonomyBranchName; taxonomyBranch.TaxonomyBranchDescriptionHtmlString = TaxonomyBranchDescription; taxonomyBranch.TaxonomyTrunkID = MultiTenantHelpers.IsTaxonomyLevelTrunk() ? TaxonomyTrunkID : HttpRequestStorage.DatabaseEntities.TaxonomyTrunks.First().TaxonomyTrunkID; // really should only be one taxonomyBranch.ThemeColor = ThemeColor; if (!ModelObjectHelpers.IsRealPrimaryKeyValue(taxonomyBranch.TaxonomyBranchID)) { // for new branches, set the sort order to greater than the current max for this trunk (or null if no branches have a sort order set) var maxSortOrder = HttpRequestStorage.DatabaseEntities.TaxonomyBranches .Where(x => x.TaxonomyTrunkID == taxonomyBranch.TaxonomyTrunkID).Max(x => x.TaxonomyBranchSortOrder); taxonomyBranch.TaxonomyBranchSortOrder = maxSortOrder + 1; } }
public ProjectTaxonomyViewData(ProjectFirmaModels.Models.TaxonomyBranch taxonomyBranch, TaxonomyLevel taxonomyLevel) : this(taxonomyBranch.TaxonomyTrunk, taxonomyBranch, null, null, taxonomyLevel) { }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static PersonStewardTaxonomyBranch CreateNewBlank(Person person, TaxonomyBranch taxonomyBranch) { return(new PersonStewardTaxonomyBranch(person, taxonomyBranch)); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static TaxonomyLeaf CreateNewBlank(TaxonomyBranch taxonomyBranch) { return(new TaxonomyLeaf(taxonomyBranch, default(string))); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static MatchmakerOrganizationTaxonomyBranch CreateNewBlank(Organization organization, TaxonomyBranch taxonomyBranch) { return(new MatchmakerOrganizationTaxonomyBranch(organization, taxonomyBranch, default(bool))); }