private static void ProcessComponentServiceActivity( bool opProcs, ServiceComponent component, List <List <DotMatrixListItem> > dotMatrix, ChartDataListItem chartData) { var activities = new ChartDataListItem { Id = component.Resolver?.Id ?? component.Id, Title = NoneSpecified, Type = DecompositionType.Activity.ToString(), CenteredTitle = string.Empty, Units = new List <ChartDataListItem>() }; // Add Service Activity activities.Id = component.Id; if (!string.IsNullOrEmpty(component.ServiceActivities)) { activities.Title = component.ServiceActivities; } else if (component.ComponentLevel == (int)ServiceComponentLevel.Level2 && !string.IsNullOrEmpty(component.ParentServiceComponent.ServiceActivities)) { activities.Title = component.ParentServiceComponent.ServiceActivities; } chartData.Units.Add(activities); if (opProcs) { ProcessOpProcs(component, dotMatrix, activities); } }
public static void ProcessResolverServiceActivities(this List <ServiceOrganisationListItem> resolvers, bool addResolver, bool addServiceActivity, string sdoType, ChartDataListItem chart) { var currentServiceDeliveryUnit = string.Empty; var currentResolverGroup = string.Empty; foreach (var resolver in resolvers) { if (addResolver) { if (!resolver.ServiceDeliveryUnitTypeName.SafeEquals(currentServiceDeliveryUnit) || !resolver.ResolverGroupTypeName.SafeEquals(currentResolverGroup)) { var sdu = resolver.ServiceDeliveryUnitTypeName; var rg = resolver.ResolverGroupTypeName; // Add Resolver var resolverChartListItem = new ChartDataListItem { Id = resolver.Resolver.Id, Title = resolver.ServiceDeliveryOrganisationTypeName, TitleTwo = sdu, TitleThree = rg, Type = DecompositionType.Resolver.ToString(), CenteredTitle = string.Empty, Units = new List <ChartDataListItem>() }; if (addServiceActivity) { var serviceActivities = resolvers.Where( r => r.ServiceDeliveryUnitTypeName == sdu && r.ResolverGroupTypeName == rg && r.ServiceActivities != NoneSpecified) .Aggregate(string.Empty, (current, activity) => current + $"{activity.ServiceActivities}\r\n"); AddResolverServiceActivity(resolver.Resolver.Id, string.IsNullOrEmpty(serviceActivities) ? NoneSpecified : serviceActivities, resolverChartListItem); } currentServiceDeliveryUnit = resolver.ServiceDeliveryUnitTypeName; currentResolverGroup = resolver.ResolverGroupTypeName; chart.Units.Add(resolverChartListItem); } } else if (addServiceActivity) { AddResolverServiceActivity(resolver.Resolver.Id, resolver.ServiceActivities, chart); } } }
public static void ProcessServiceFunctions(this ChartDataListItem chartData, bool svcComponents, bool resolverGroups, bool svcActivities, bool opProcs, string customerName, ServiceDomain deskDomain, List <List <DotMatrixListItem> > dotMatrix) { if (deskDomain.ServiceFunctions == null) { return; } foreach (var domainFunction in deskDomain.ServiceFunctions.OrderBy(x => x.DiagramOrder).ThenBy(x => x.FunctionType.FunctionName)) { var function = new ChartDataListItem { Id = domainFunction.Id, Title = domainFunction.AlternativeName ?? domainFunction.FunctionType.FunctionName, Type = DecompositionType.Function.ToString(), CenteredTitle = string.Empty, Units = new List <ChartDataListItem>(), }; if (svcComponents) { function.ProcessServiceComponents(resolverGroups, svcActivities, opProcs, customerName, domainFunction, dotMatrix); } else if (resolverGroups) { if (domainFunction.ServiceComponents != null) { foreach (var component in domainFunction.ServiceComponents.Where(x => x.ComponentLevel == 1)) { function.ProcessResolvers(svcActivities, opProcs, customerName, component, dotMatrix); } } } else if (svcActivities) { if (domainFunction.ServiceComponents != null) { foreach (var component in domainFunction.ServiceComponents.Where(x => x.ComponentLevel == 1)) { function.ProcessServiceActivities(opProcs, component, dotMatrix); } } } chartData.Units.Add(function); } }
private static ChartDataListItem GetDeepest(ChartDataListItem chartDataListItem) { while (true) { if (chartDataListItem.Units == null || chartDataListItem.Units.Count == 0) { return(chartDataListItem); } chartDataListItem = chartDataListItem.Units.First(); } }
private static void AddResolverServiceActivity(int id, string serviceActivitoes, ChartDataListItem chartData) { var svcActivities = new ChartDataListItem { Id = id, Title = serviceActivitoes, Type = DecompositionType.Activity.ToString(), CenteredTitle = string.Empty, Units = new List <ChartDataListItem>() }; chartData.Units.Add(svcActivities); }
private static ChartDataListItem AddDummyChildComponent(int id) { var childComponentListItem = new ChartDataListItem { Id = id, Title = string.Empty, CenteredTitle = string.Empty, Type = DecompositionType.LineForDummyChildComponent.ToString(), Units = new List <ChartDataListItem>() }; return(childComponentListItem); }
private static void AddResolverComponentNoChildrenComponent(bool svcActivities, ServiceComponent component, ChartDataListItem chartData) { // Create A Dummy Child Component var childComponentListItem = AddDummyChildComponent(component.Id); if (svcActivities) { AddServiceActivity(component, childComponentListItem); } chartData.Units.Add(childComponentListItem); }
private static void ProcessComponentResolver(bool svcActivities, bool opProcs, string customerName, ServiceComponent component, List <List <DotMatrixListItem> > dotMatrix, ChartDataListItem chartData) { var resolver = new ChartDataListItem { Id = component.Id, Title = ToBeConfirmed, TitleTwo = string.Empty, TitleThree = string.Empty, Type = DecompositionType.Resolver.ToString(), CenteredTitle = string.Empty, Units = new List <ChartDataListItem>() }; if (component.Resolver != null) { var serviceDeliveryOrganisation = component.Resolver.ServiceDeliveryOrganisationType.ServiceDeliveryOrganisationTypeName.SafeEquals(ServiceDeliveryOrganisationNames.Fujitsu) ? component.Resolver.ServiceDeliveryOrganisationType.ServiceDeliveryOrganisationTypeName : component.Resolver.ServiceDeliveryOrganisationType.ServiceDeliveryOrganisationTypeName.SafeEquals(ServiceDeliveryOrganisationNames.Customer) ? customerName : $"{customerName} Third Party"; // Add Resolver Group resolver = new ChartDataListItem { Id = component.Id, Title = serviceDeliveryOrganisation, TitleTwo = !string.IsNullOrEmpty(component.Resolver.ServiceDeliveryUnitType?.ServiceDeliveryUnitTypeName) ? component.Resolver.ServiceDeliveryUnitType.ServiceDeliveryUnitTypeName : ToBeConfirmed, TitleThree = !string.IsNullOrEmpty(component.Resolver.ResolverGroupType?.ResolverGroupTypeName) ? component.Resolver.ResolverGroupType.ResolverGroupTypeName : ToBeConfirmed, Type = DecompositionType.Resolver.ToString(), CenteredTitle = string.Empty, Units = new List <ChartDataListItem>() }; } if (svcActivities) { resolver.ProcessServiceActivities(opProcs, component, dotMatrix); } else if (opProcs) { ProcessOpProcs(component, dotMatrix, resolver); } chartData.Units.Add(resolver); }
private static ChartDataListItem AddServiceComponent(ServiceComponent component) { // Add Child Component var componentListItem = new ChartDataListItem { Id = component.Id, Title = component.ComponentName, Type = DecompositionType.Component.ToString(), CenteredTitle = string.Empty, Units = new List <ChartDataListItem>() }; return(componentListItem); }
private static void AddComponentWithChildren(bool svcActivities, string organisationType, ChartDataListItem chartData, ServiceComponent component) { foreach ( var childComponent in component.ChildServiceComponents.Where(c => c.Resolver != null && c.Resolver.ServiceDeliveryOrganisationType .ServiceDeliveryOrganisationTypeName == organisationType).OrderBy(c => c.DiagramOrder).ThenBy(c => c.ComponentName)) { var childComponentListItem = AddServiceComponent(childComponent); if (svcActivities) { AddServiceActivity(childComponent, childComponentListItem); } chartData.Units.Add(childComponentListItem); } }
public List <ChartDataListItem> Generate(int serviceDeskId, bool svcDomains = false, bool svcFunctions = false, bool svcComponents = false, bool resolvers = false, bool svcActivities = false, bool opProcs = false, string[] domainsSelected = null) { if (serviceDeskId == 0) { throw new ArgumentNullException(nameof(serviceDeskId)); } var diagram = new List <ChartDataListItem>(); var serviceDeskChart = new ChartDataListItem(); var serviceDesk = _serviceDeskService.GetById(serviceDeskId); if (serviceDesk != null) { var customerName = serviceDesk.Customer.CustomerName; serviceDeskChart.CreateServiceDeskWithInputs(serviceDesk); var serviceDeliveryOrganisation = new ChartDataListItem { Id = 0, CenteredTitle = "Fujitsu", Title = string.Empty, Type = DecompositionType.ServiceDeliveryOrganisation.ToString(), Units = new List <ChartDataListItem>(), }; var serviceDomains = serviceDesk.ServiceDomains.ToList(); if (serviceDomains.Any()) { serviceDeliveryOrganisation.ProcessServiceDomains(false, false, false, false, false, customerName, serviceDomains, null); } serviceDeskChart.Units.Add(serviceDeliveryOrganisation); diagram.Add(serviceDeskChart); } return(diagram); }
public static void CreateServiceDeskWithInputs(this ChartDataListItem serviceDeskChart, ServiceDesk serviceDesk) { if (serviceDesk.DeskInputTypes != null && serviceDesk.DeskInputTypes.Any()) { // Add Service Desk Inputs foreach (var deskInput in serviceDesk.DeskInputTypes.OrderBy(o => o.InputTypeRefData.InputTypeNumber)) { var deskInputName = new ChartDataListItem { Id = deskInput.Id, CenteredTitle = deskInput.InputTypeRefData.InputTypeName, Title = string.Empty, Type = DecompositionType.InputTypeName.ToString(), Units = new List <ChartDataListItem>() }; var deskInputNumber = new ChartDataListItem { Id = deskInput.Id, CenteredTitle = deskInput.InputTypeRefData.InputTypeNumber.ToString(), Title = string.Empty, Type = DecompositionType.InputTypeNumber.ToString(), Units = new List <ChartDataListItem>() }; var emptyForLayout = new ChartDataListItem { Id = 0, CenteredTitle = string.Empty, Type = DecompositionType.EmptyForLayout.ToString() }; serviceDeskChart.Inputs.Add(deskInputName); deskInputName.Units.Add(deskInputNumber); deskInputNumber.Units.Add(emptyForLayout); } serviceDeskChart.Width = serviceDeskChart.Inputs.Count * Diagram.ShapeWidth; } serviceDeskChart.CenteredTitle = serviceDesk.DeskName; serviceDeskChart.Type = DecompositionType.Desk.ToString(); }
public static void ProcessResolvers(this ChartDataListItem chartData, bool svcActivities, bool opProcs, string customerName, ServiceComponent component, List <List <DotMatrixListItem> > dotMatrix) { if (component.ChildServiceComponents != null && component.ChildServiceComponents.Any()) { foreach (var childComponent in component.ChildServiceComponents) { ProcessComponentResolver(svcActivities, opProcs, customerName, childComponent, dotMatrix, chartData); } } else { ProcessComponentResolver(svcActivities, opProcs, customerName, component, dotMatrix, chartData); } }
private static void AddServiceActivity(ServiceComponent component, ChartDataListItem chartData) { // Add Service Activity if (component.Resolver != null) { if (!string.IsNullOrEmpty(component.ServiceActivities)) { AddResolverServiceActivity(component.Id, component.ServiceActivities, chartData); return; } if (component.ComponentLevel == (int)ServiceComponentLevel.Level2 && !string.IsNullOrEmpty(component.ParentServiceComponent.ServiceActivities)) { AddResolverServiceActivity(component.Id, component.ParentServiceComponent.ServiceActivities, chartData); return; } } AddResolverServiceActivity(component.Id, NoneSpecified, chartData); }
public static void ProcessServiceActivities(this ChartDataListItem chartData, bool opProcs, ServiceComponent component, List <List <DotMatrixListItem> > dotMatrix) { if (component.ChildServiceComponents != null && component.ChildServiceComponents.Any()) { foreach (var childComponent in component.ChildServiceComponents) { // Process Child Component Service Activity ProcessComponentServiceActivity(opProcs, childComponent, dotMatrix, chartData); } } else { // Process Parent Component Service Activity ProcessComponentServiceActivity(opProcs, component, dotMatrix, chartData); } }
private static ChartDataListItem AddResolver(int id, string sdo, string customerName, string sdu, string rg) { var serviceDeliveryOrganisation = sdo.SafeEquals(ServiceDeliveryOrganisationNames.Fujitsu) ? sdo : sdo.SafeEquals(ServiceDeliveryOrganisationNames.Customer) ? customerName : $"{customerName} Third Party"; var resolverChartListItem = new ChartDataListItem { Id = id, Title = serviceDeliveryOrganisation, TitleTwo = sdu, TitleThree = rg, Type = DecompositionType.Resolver.ToString(), CenteredTitle = string.Empty, Units = new List <ChartDataListItem>() }; return(resolverChartListItem); }
private static void ProcessOpProcs(ServiceComponent component, List <List <DotMatrixListItem> > dotMatrix, ChartDataListItem chartData) { // Add Service Activity if (component.Resolver != null) { // Get the data for this resolver group. var componentDotMatrix = dotMatrix .FirstOrDefault(x => x.Any(y => y.Name == DotMatrixNames.ResolverId && (int)y.Value == component.Resolver.Id)); var last = chartData; if (componentDotMatrix != null) { var opProcs = componentDotMatrix .Where(x => x.Name.StartsWith(DotMatrixNames.OpIdPrefix)) .ToList(); foreach (var opProc in opProcs) { var opProcChartData = new ChartDataListItem { Title = opProc.DisplayName, Type = (bool)opProc.Value ? DecompositionTypeNames.ResolverGroupOperationalProcessSelected : DecompositionTypeNames.ResolverGroupOperationalProcess, Units = new List <ChartDataListItem>(), CenteredTitle = string.Empty, }; last.Units.Add(opProcChartData); last = opProcChartData; } } } }
private static void AddResolverChildComponents(bool svcActivities, string organisationType, string sdu, string rg, ServiceComponent component, ChartDataListItem parentComponentListItem) { foreach (var childComponent in component.ChildServiceComponents.Where(c => c.Resolver != null && c.Resolver.ServiceDeliveryOrganisationType.ServiceDeliveryOrganisationTypeName == organisationType && (sdu == NoneSpecified && c.Resolver.ServiceDeliveryUnitType == null || c.Resolver.ServiceDeliveryUnitType != null && sdu.SafeEquals(c.Resolver.ServiceDeliveryUnitType.ServiceDeliveryUnitTypeName)) && (rg == NoneSpecified && c.Resolver.ResolverGroupType == null || c.Resolver.ResolverGroupType != null && rg.SafeEquals(c.Resolver.ResolverGroupType.ResolverGroupTypeName))).OrderBy(c => c.DiagramOrder).ThenBy(c => c.ComponentName)) { var childComponentListItem = AddServiceComponent(childComponent); if (svcActivities) { AddServiceActivity(childComponent, childComponentListItem); } parentComponentListItem.Units.Add(childComponentListItem); } }
public static void ProcessServiceComponents(this ChartDataListItem chartData, bool resolvers, bool svcActivities, bool opProcs, string customerName, ServiceFunction domainFunction, List <List <DotMatrixListItem> > dotMatrix) { if (domainFunction.ServiceComponents == null) { return; } foreach (var parentComponent in domainFunction.ServiceComponents.Where(x => x.ComponentLevel == 1).OrderBy(x => x.DiagramOrder).ThenBy(x => x.ComponentName).ToList()) { var parentComponentListItem = new ChartDataListItem { Id = parentComponent.Id, Title = parentComponent.ComponentName, Type = DecompositionType.Component.ToString(), CenteredTitle = string.Empty, Units = new List <ChartDataListItem>() }; if (parentComponent.ChildServiceComponents != null && parentComponent.ChildServiceComponents.Count > 0) { foreach (var childComponent in parentComponent.ChildServiceComponents.OrderBy(x => x.DiagramOrder).ThenBy(x => x.ComponentName)) { // Add Child Component var childComponentListItem = new ChartDataListItem { Id = childComponent.Id, Title = childComponent.ComponentName, Type = DecompositionType.Component.ToString(), CenteredTitle = string.Empty, Units = new List <ChartDataListItem>() }; if (resolvers) { childComponentListItem.ProcessResolvers(svcActivities, opProcs, customerName, childComponent, dotMatrix); } else if (svcActivities) { childComponentListItem.ProcessServiceActivities(opProcs, childComponent, dotMatrix); } parentComponentListItem.Units.Add(childComponentListItem); } } else if (resolvers || svcActivities) { // Create A Dummy Child Component var childComponentListItem = new ChartDataListItem { Id = 0, Title = string.Empty, CenteredTitle = string.Empty, Type = DecompositionType.LineForDummyChildComponent.ToString(), Units = new List <ChartDataListItem>() }; if (resolvers) { childComponentListItem.ProcessResolvers(svcActivities, opProcs, customerName, parentComponent, dotMatrix); } else { childComponentListItem.ProcessServiceActivities(opProcs, parentComponent, dotMatrix); } if (childComponentListItem.Units.Any()) { parentComponentListItem.Units.Add(childComponentListItem); } } chartData.Units.Add(parentComponentListItem); } }
public static void ProcessResolverServiceComponents(this List <ServiceOrganisationListItem> resolvers, bool svcActivities, string organisationType, ChartDataListItem chartData) { // Components and/or Activities // List of Level One Components being resolved var levelOneComponents = resolvers.Where(r => r.ServiceComponent.ComponentLevel == 1) .Select(c => c.ServiceComponent).ToList(); // List of the Level Two Parent Components being resolved var levelTwoParentComponents = resolvers.Where( r => r.ServiceComponent.ComponentLevel == 2) .Select(c => c.ServiceComponent.ParentServiceComponent).ToList(); // Union of both Level One Components and Level Two Parent Components var allLevelOneComponents = levelOneComponents.Union(levelTwoParentComponents).OrderBy(r => r.DiagramOrder).ThenBy(r => r.ComponentName); // Distinct list of components var distinctServiceComponents = allLevelOneComponents.GroupBy(c => c.Id).Select(c => c.First()); foreach (var component in distinctServiceComponents) { // Add the Parent Component var parentComponentListItem = AddServiceComponent(component); if (component.ChildServiceComponents == null || !component.ChildServiceComponents.Any()) { AddResolverComponentNoChildrenComponent(svcActivities, component, parentComponentListItem); } else { AddComponentWithChildren(svcActivities, organisationType, parentComponentListItem, component); } chartData.Units.Add(parentComponentListItem); } }
public List <ChartDataListItem> Generate(int serviceDeskId, bool svcDomains = false, bool svcFunctions = false, bool svcComponents = false, bool resolvers = false, bool svcActivities = false, bool opProcs = false, string[] domainsSelected = null) { if (serviceDeskId == 0) { throw new ArgumentNullException(nameof(serviceDeskId)); } var diagram = new List <ChartDataListItem>(); var serviceDeskChart = new ChartDataListItem(); var serviceDesk = _serviceDeskService.GetById(serviceDeskId); if (serviceDesk != null) { serviceDeskChart.CreateServiceDeskWithInputs(serviceDesk); var serviceDomains = serviceDesk.ServiceDomains.ToList(); if (serviceDomains.Any()) { var serviceOrganisationListItems = _serviceComponentService.GetServiceOrganisationResolversByDesk(serviceDeskId, _serviceOrganisationDiagramtype); if (serviceOrganisationListItems.Any()) { if (resolvers) { // Resolvers and/or Service Components and/or Service Activities serviceOrganisationListItems.ProcessResolvers(svcComponents, svcActivities, _serviceOrganisationDiagramtype, serviceDesk.Customer.CustomerName, serviceDeskChart); } else if (svcComponents) { // Service Components and/or Service Activities serviceOrganisationListItems.ProcessResolverServiceComponents(svcActivities, _serviceOrganisationDiagramtype, serviceDeskChart); } else if (svcActivities) { // Service Activities only serviceOrganisationListItems.ProcessResolverServiceActivities(false, true, _serviceOrganisationDiagramtype, serviceDeskChart); } } } if (!serviceDeskChart.Units.Any()) { // Add Empty Unit var chartDataListItem = new ChartDataListItem { Id = 0, Title = string.Empty, CenteredTitle = string.Empty, Type = DecompositionType.EmptyForLayout.ToString(), Units = new List <ChartDataListItem>(), }; serviceDeskChart.Units.Add(chartDataListItem); } diagram.Add(serviceDeskChart); } return(diagram); }
public List <ChartDataListItem> Generate(int serviceDeskId, bool svcDomains = false, bool svcFunctions = false, bool svcComponents = false, bool resolvers = false, bool svcActivities = false, bool opProcs = false, string[] domainsSelected = null) { if (serviceDeskId == 0) { throw new ArgumentNullException(nameof(serviceDeskId)); } var diagram = new List <ChartDataListItem>(); var serviceDesk = _serviceDeskService.GetById(serviceDeskId); if (serviceDesk != null) { var dotMatrixData = _resolverService.GetDotMatrix(serviceDesk.CustomerId, true, serviceDeskId); if (dotMatrixData == null || dotMatrixData.Count <= 0) { throw new ApplicationException($"No Process Dot Matrix diagram data could be found for Service Desk Id [{serviceDeskId}]"); } // Construct the first row which holds the operational process names. The first block will be empty as it is above the resolver group namnes. var opProcsRow = new ChartDataListItem { Title = string.Empty, CenteredTitle = string.Empty, Type = DecompositionTypeNames.EmptyForLayout, Units = new List <ChartDataListItem>() }; var opProcesses = dotMatrixData[0] .Where(x => x.Name.StartsWith(DotMatrixNames.OpIdPrefix)) .ToList(); foreach (var opProc in opProcesses) { var deepestOpProcChartData = GetDeepest(opProcsRow); var opProcChartData = new ChartDataListItem { Title = string.Empty, CenteredTitle = opProc.DisplayName, Type = DecompositionTypeNames.OperationalProcess, Units = new List <ChartDataListItem>() }; deepestOpProcChartData.Units.Add(opProcChartData); } diagram.Add(opProcsRow); // Construct the data foreach (var dotMatrix in dotMatrixData) { // Get the resolver group item. var resolverNameItem = dotMatrix.Single(x => x.Name == DotMatrixNames.ResolverName).Value.ToString(); var serviceComponentNameItem = dotMatrix.Single(x => x.Name == DotMatrixNames.ComponentName).Value.ToString(); var resolverNameChartData = new ChartDataListItem { Title = $"{resolverNameItem}", TitleTwo = serviceComponentNameItem.Length < 100 ? $"[{serviceComponentNameItem}]" : $"[{serviceComponentNameItem.Substring(0, 94)} ...]", CenteredTitle = string.Empty, Type = DecompositionTypeNames.Resolver, Units = new List <ChartDataListItem>() }; diagram.Add(resolverNameChartData); // Loop round the values for the Op Procs. var opProcResolvers = dotMatrix .Where(x => x.Name.StartsWith(DotMatrixNames.OpIdPrefix)) .ToList(); foreach (var opProcResolver in opProcResolvers) { var resolverGroupOpProcChartData = (bool)opProcResolver.Value ? new ChartDataListItem { Title = string.Empty, CenteredTitle = string.Empty, Type = DecompositionTypeNames.ResolverGroupOperationalProcessSelected, Units = new List <ChartDataListItem>() } : new ChartDataListItem { Title = string.Empty, CenteredTitle = string.Empty, Type = DecompositionTypeNames.ResolverGroupOperationalProcess, Units = new List <ChartDataListItem>() }; var deepestGroupOpProcChartData = GetDeepest(resolverNameChartData); deepestGroupOpProcChartData.Units.Add(resolverGroupOpProcChartData); } } diagram.Reverse(); } return(diagram); }
public static void ProcessResolvers(this List <ServiceOrganisationListItem> resolvers, bool svcComponents, bool svcActivities, string organisationType, string customerName, ChartDataListItem chartData) { if (!svcComponents && !svcActivities) { // Resolvers only ProcessResolverServiceActivities(resolvers, true, false, ServiceDeliveryOrganisationNames.Fujitsu, chartData); } if (svcComponents) { // Resolvers, Components and/or Activities var currentServiceDeliveryUnit = string.Empty; var currentResolverGroup = string.Empty; foreach (var resolver in resolvers) { if (!resolver.ServiceDeliveryUnitTypeName.SafeEquals(currentServiceDeliveryUnit) || !resolver.ResolverGroupTypeName.SafeEquals(currentResolverGroup)) { var sdu = resolver.ServiceDeliveryUnitTypeName; var rg = resolver.ResolverGroupTypeName; // Add Resolver var resolverChartListItem = AddResolver(resolver.Resolver.Id, organisationType, customerName, sdu, rg); currentServiceDeliveryUnit = resolver.ServiceDeliveryUnitTypeName; currentResolverGroup = resolver.ResolverGroupTypeName; // List of Level One Components being resolved var levelOneComponents = resolvers.Where(r => r.ServiceDeliveryUnitTypeName == sdu && r.ResolverGroupTypeName == rg && r.ServiceComponent.ComponentLevel == 1) .Select(c => c.ServiceComponent).ToList(); // List of the Level Two Parent Components being resolved //TODO: r.ServiceComponent.ParentServiceComponent != null is a bug where the root cause needs to be identified var levelTwoParentComponents = resolvers.Where(r => r.ServiceDeliveryUnitTypeName == sdu && r.ResolverGroupTypeName == rg && r.ServiceComponent.ComponentLevel == 2 && r.ServiceComponent.ParentServiceComponent != null) .Select(c => c.ServiceComponent.ParentServiceComponent).ToList(); // Union of both Level One Components and Level Two Parent Components var allLevelOneComponents = levelOneComponents.Union(levelTwoParentComponents).OrderBy(c => c.DiagramOrder).ThenBy(c => c.ComponentName); // Distinct list of components var distinctServiceComponents = allLevelOneComponents.GroupBy(c => c.Id).Select(c => c.First()); foreach (var component in distinctServiceComponents) { // Add the Parent Component var parentComponentListItem = AddServiceComponent(component); if (component.ChildServiceComponents == null || !component.ChildServiceComponents.Any()) { AddResolverComponentNoChildrenComponent(svcActivities, component, parentComponentListItem); } else { AddResolverChildComponents(svcActivities, organisationType, sdu, rg, component, parentComponentListItem); } resolverChartListItem.Units.Add(parentComponentListItem); } chartData.Units.Add(resolverChartListItem); } } } else if (svcActivities) { // Resolvers and Activities ProcessResolverServiceActivities(resolvers, true, true, ServiceDeliveryOrganisationNames.Fujitsu, chartData); } }
public List <ChartDataListItem> Generate(int serviceDeskId, bool svcDomains = false, bool svcFunctions = false, bool svcComponents = false, bool resolvers = false, bool svcActivities = false, bool opProcs = false, string[] domainsSelected = null) { if (serviceDeskId == 0) { throw new ArgumentNullException(nameof(serviceDeskId)); } var diagram = new List <ChartDataListItem>(); var serviceDeskChart = new ChartDataListItem(); var serviceDesk = _serviceDeskService.GetById(serviceDeskId); if (serviceDesk != null) { var customerName = serviceDesk.Customer.CustomerName; serviceDeskChart.CreateServiceDeskWithInputs(serviceDesk); var serviceDomains = serviceDesk.ServiceDomains.ToList(); if (domainsSelected != null) { if (!domainsSelected.Contains("0")) { // Only render the selected Service Domains var selectedDomains = domainsSelected.ToList(); serviceDomains = serviceDomains.Where(x => selectedDomains.Contains(x.Id.ToString())).ToList(); } } if (serviceDomains.Any()) { var dotMatrix = _resolverService.GetDotMatrix(serviceDesk.CustomerId, true); if (svcDomains || domainsSelected != null && domainsSelected.Any()) { serviceDeskChart.ProcessServiceDomains(svcFunctions, svcComponents, resolvers, svcActivities, opProcs, customerName, serviceDomains, dotMatrix); } else if (svcFunctions) { foreach (var deskDomain in serviceDomains) { serviceDeskChart.ProcessServiceFunctions(svcComponents, resolvers, svcActivities, opProcs, customerName, deskDomain, dotMatrix); } } else if (svcComponents) { foreach (var domainFunction in serviceDomains.Where(deskDomain => deskDomain.ServiceFunctions != null).SelectMany(deskDomain => deskDomain.ServiceFunctions)) { serviceDeskChart.ProcessServiceComponents(resolvers, svcActivities, opProcs, customerName, domainFunction, dotMatrix); } } else if (resolvers) { foreach (var component in from deskDomain in serviceDomains where deskDomain.ServiceFunctions != null from domainFunction in deskDomain.ServiceFunctions where domainFunction.ServiceComponents != null from component in domainFunction.ServiceComponents.Where(x => x.ComponentLevel == 1) select component) { serviceDeskChart.ProcessResolvers(svcActivities, opProcs, customerName, component, dotMatrix); } } else if (svcActivities) { foreach (var component in from deskDomain in serviceDomains where deskDomain.ServiceFunctions != null from domainFunction in deskDomain.ServiceFunctions where domainFunction.ServiceComponents != null from component in domainFunction.ServiceComponents.Where(x => x.ComponentLevel == 1) select component) { serviceDeskChart.ProcessServiceActivities(opProcs, component, dotMatrix); } } } if (!serviceDeskChart.Units.Any()) { // Add Empty Unit var chartDataListItem = new ChartDataListItem { Id = 0, Title = string.Empty, CenteredTitle = string.Empty, Type = DecompositionType.EmptyForLayout.ToString(), Units = new List <ChartDataListItem>(), }; serviceDeskChart.Units.Add(chartDataListItem); } diagram.Add(serviceDeskChart); } return(diagram); }
public List <ChartDataListItem> Generate(int serviceDeskId, bool svcDomains = false, bool svcFunctions = false, bool svcComponents = false, bool resolvers = false, bool svcActivities = false, bool opProcs = false, string[] domainsSelected = null) { if (serviceDeskId == 0) { throw new ArgumentNullException(nameof(serviceDeskId)); } var diagram = new List <ChartDataListItem>(); var serviceDeskChart = new ChartDataListItem(); var serviceDesk = _serviceDeskService.GetById(serviceDeskId); if (serviceDesk != null) { serviceDeskChart.CreateServiceDeskWithInputs(serviceDesk); // Resolvers if (serviceDesk.Resolvers != null) { var serviceDeskResolvers = serviceDesk.Resolvers.ToList(); if (serviceDeskResolvers.Any()) { // Customer Owned Resolver Groups var customerServices = serviceDeskResolvers.Where(x => x.ServiceDeliveryOrganisationType.Id == 2 && x.ServiceDeliveryUnitType != null).ToList(); if (customerServices.Any()) { var customerOwned = new ChartDataListItem { Id = 0, CenteredTitle = serviceDesk.Customer.CustomerName + " Owned Resolver Groups", Title = string.Empty, Type = DecompositionType.ServiceDeliveryOrganisation.ToString(), Units = new List <ChartDataListItem>(), }; var distinctSdus = customerServices.Select(x => x.ServiceDeliveryUnitType.ServiceDeliveryUnitTypeName) .Distinct(); foreach (var sduName in distinctSdus) { var sdu = new ChartDataListItem { Id = 0, CenteredTitle = sduName, Title = string.Empty, Type = DecompositionType.ServiceDeliveryUnit.ToString(), Units = new List <ChartDataListItem>(), }; var servicesNotes = string.Join("\r\n", customerServices.Where( x => x.ServiceDeliveryUnitType.ServiceDeliveryUnitTypeName == sduName) .Select(x => x.ServiceDeliveryUnitNotes) .ToArray()); if (!string.IsNullOrEmpty(servicesNotes)) { var services = new ChartDataListItem { Id = 0, Title = servicesNotes, CenteredTitle = string.Empty, Type = DecompositionType.CustomerServices.ToString(), Units = new List <ChartDataListItem>(), }; sdu.Units.Add(services); } customerOwned.Units.Add(sdu); } serviceDeskChart.Units.Add(customerOwned); } // Customer Third Party Resolver Groups var customerThirdPartyServices = serviceDeskResolvers.Where(x => x.ServiceDeliveryOrganisationType.Id == 3 && x.ServiceDeliveryUnitType != null).ToList(); if (customerThirdPartyServices.Any()) { var customerThirdParty = new ChartDataListItem { Id = 0, CenteredTitle = serviceDesk.Customer.CustomerName + " 3rd Party Resolver Groups", Title = string.Empty, Type = DecompositionType.ServiceDeliveryOrganisation.ToString(), Units = new List <ChartDataListItem>(), }; var distinctSdus = customerThirdPartyServices.Select( x => x.ServiceDeliveryUnitType.ServiceDeliveryUnitTypeName) .Distinct(); foreach (var sduName in distinctSdus) { var sdu = new ChartDataListItem { Id = 0, CenteredTitle = sduName, Title = string.Empty, Type = DecompositionType.ServiceDeliveryUnit.ToString(), Units = new List <ChartDataListItem>(), }; var servicesNotes = string.Join("\r\n", customerThirdPartyServices.Where( x => x.ServiceDeliveryUnitType.ServiceDeliveryUnitTypeName == sduName) .Select(x => x.ServiceDeliveryUnitNotes) .ToArray()); if (!string.IsNullOrEmpty(servicesNotes)) { var services = new ChartDataListItem { Id = 0, Title = string.IsNullOrEmpty(servicesNotes) ? string.Empty : servicesNotes, CenteredTitle = string.Empty, Type = DecompositionType.CustomerServices.ToString(), Units = new List <ChartDataListItem>(), }; sdu.Units.Add(services); } customerThirdParty.Units.Add(sdu); } serviceDeskChart.Units.Add(customerThirdParty); } } } if (!serviceDeskChart.Units.Any()) { // Add Empty Unit var chartDataListItem = new ChartDataListItem { Id = 0, Title = string.Empty, CenteredTitle = string.Empty, Type = DecompositionType.EmptyForLayout.ToString(), Units = new List <ChartDataListItem>(), }; serviceDeskChart.Units.Add(chartDataListItem); } diagram.Add(serviceDeskChart); } return(diagram); }