Exemplo n.º 1
0
        public ActionResult DeleteAjaxServiceDeskGrid([DataSourceRequest] DataSourceRequest request, ServiceDeskViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var serviceDesk = _serviceDeskService.GetById(model.Id);

                    if (serviceDesk == null)
                    {
                        ModelState.AddModelError(ModelStateErrorNames.ServiceDeskDeleteEntityDoesNotExist,
                                                 WebResources.ServiceDeskCannotFindServiceDeskToBeDeleted);
                    }
                    else if (serviceDesk.ServiceDomains.Any())
                    {
                        ModelState.AddModelError(ModelStateErrorNames.ErrorMessage,
                                                 WebResources.ServiceDesksCannotBeDeletedDueToServiceDomainsExisting);
                    }
                    else
                    {
                        _serviceDeskService.Delete(serviceDesk);
                    }
                }
                catch (Exception ex)
                {
                    _contextManager.ResponseManager.StatusCode = 500;
                    _contextManager.ResponseManager.AppendHeader(ModelStateErrorNames.ErrorMessage, ex.Message);
                }
            }

            return(Json(new[] { model }.ToDataSourceResult(request, ModelState)));
        }
        public void Transform(int serviceDeskId, List <TemplateRow> templateRows)
        {
            var serviceDesk = _serviceDeskService.GetById(serviceDeskId);

            foreach (var templateRow in templateRows)
            {
                TransformServiceDomain(serviceDesk, templateRow);
            }
        }
Exemplo n.º 3
0
        public void ServiceDeskService_GetById_CallsRepositoryGetById()
        {
            #region Arrange

            #endregion

            #region Act

            _serviceDeskService.GetById(1);

            #endregion

            #region Assert

            _mockServiceDeskRepository.Verify(x => x.GetById(It.IsAny <int>()), Times.Once);

            #endregion
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
        }