public void GetAllSystemProcess()
        {
            CPServiceClient webClient = new CPServiceClient();
            List <ControlPanel.Core.Entities.SystemProcess> systemProcesses = webClient.GetAllSystemProcess();
            DateTime?lastUpdateDate = null;

            if (systemProcesses != null && systemProcesses.Count > 0)
            {
                systemProcesses = systemProcesses.OrderBy(x => x.DisplayOrder).ToList();
                foreach (ControlPanel.Core.Entities.SystemProcess systemProcess in systemProcesses)
                {
                    systemProcess.SystemProcessThreadList = webClient.GetSystemProcessThreadsByProcessID(systemProcess.SystemProcessId);
                    if (systemProcess.SystemProcessThreadList != null)
                    {
                        systemProcess.SystemProcessThreadList = systemProcess.SystemProcessThreadList.OrderBy(x => x.DisplayOrder.Length).ThenBy(x => x.DisplayOrder).ToList();
                        var currentMax = systemProcess.SystemProcessThreadList.Select(x => x.LastUpdateDate).Max();
                        foreach (var dt in systemProcess.SystemProcessThreadList)
                        {
                            if (dt.LastSuccessfullyExecuted != null)
                            {
                                dt.LastExecutedSeconds = (DateTime.UtcNow - dt.LastSuccessfullyExecuted.Value.ToUniversalTime()).ToString(@"hh\:mm\:ss");
                            }
                        }
                        if (!lastUpdateDate.HasValue || currentMax > lastUpdateDate)
                        {
                            lastUpdateDate = currentMax;
                        }
                    }
                }

                jsondata = new JavaScriptSerializer().Serialize(systemProcesses);

                if (lastUpdateDate.HasValue)
                {
                    lastupdatedate = lastUpdateDate.Value.ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
                }
            }

            //jsondata = new JavaScriptSerializer().Serialize(systemProcesses);

            //lastupdatedate = lastUpdateDate.Value.ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
        }
        public void GetAllSystemProcess()
        {
            CPServiceClient webClient = new CPServiceClient();
            List<ControlPanel.Core.Entities.SystemProcess> systemProcesses = webClient.GetAllSystemProcess();
            DateTime? lastUpdateDate = null;
            if (systemProcesses != null && systemProcesses.Count > 0)
            {
                systemProcesses = systemProcesses.OrderBy(x => x.DisplayOrder).ToList();
                foreach (ControlPanel.Core.Entities.SystemProcess systemProcess in systemProcesses)
                {
                    systemProcess.SystemProcessThreadList = webClient.GetSystemProcessThreadsByProcessID(systemProcess.SystemProcessId);
                    if (systemProcess.SystemProcessThreadList != null)
                    {
                        systemProcess.SystemProcessThreadList = systemProcess.SystemProcessThreadList.OrderBy(x => x.DisplayOrder.Length).ThenBy(x => x.DisplayOrder).ToList();
                        var currentMax = systemProcess.SystemProcessThreadList.Select(x => x.LastUpdateDate).Max();
                        foreach (var dt in systemProcess.SystemProcessThreadList)
                        {
                            if (dt.LastSuccessfullyExecuted != null)
                                dt.LastExecutedSeconds = (DateTime.UtcNow - dt.LastSuccessfullyExecuted.Value.ToUniversalTime()).ToString(@"hh\:mm\:ss");
                        }
                        if (!lastUpdateDate.HasValue || currentMax > lastUpdateDate)
                            lastUpdateDate = currentMax;
                    }
                }

                jsondata = new JavaScriptSerializer().Serialize(systemProcesses);

                if (lastUpdateDate.HasValue)
                lastupdatedate = lastUpdateDate.Value.ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            }

            //jsondata = new JavaScriptSerializer().Serialize(systemProcesses);

            //lastupdatedate = lastUpdateDate.Value.ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
        }