Beispiel #1
0
        private DataTableResponse FetchServerCheckGridData(EnvironmentCheckService svc, EnvironmentCheckViewModel viewModel)
        {
            var grid = svc.ServerDetails(viewModel.GridConditions, viewModel.ServerFilterConditions, viewModel.ServerFilterOperands);

            var aaDataRel = grid.Data.Select(d => new String[] {
                d.ServerName, d.OSName, d.OSVersion, d.LogicalProcessors.ToString(), d.Hyperthreaded.ToString(),
            }).ToArray();

            var data = new FilterResult()
            {
                Data = aaDataRel, TotalRecordCount = grid.Count
            };

            var dtResponse = new DataTableResponse()
            {
                sEcho = string.IsNullOrEmpty(viewModel.GridConditions.sEcho)
                                        ? "1"
                                        : viewModel.GridConditions.sEcho,
                aaData          = data.Data,
                recordsTotal    = data.Data.Count(),
                recordsFiltered = data.TotalRecordCount
            };

            return(dtResponse);
        }
Beispiel #2
0
        private string FetchFileServerData(EnvironmentCheckService svc, EnvironmentCheckViewModel viewModel)
        {
            var grid = svc.ServerDetails(viewModel.GridConditions, viewModel.ServerFilterConditions, viewModel.ServerFilterOperands);

            var aaDataRel = grid.Data.Select(d => new String[] {
                d.ServerName, d.OSName, d.OSVersion, d.LogicalProcessors.ToString(), d.Hyperthreaded.ToString(),
            }).ToArray();

            var filterResult = new FilterResult()
            {
                Data = aaDataRel, TotalRecordCount = grid.Count
            };

            using (var sw = new System.IO.StringWriter())
            {
                var heaaderArr = new string[]
                {
                    "Server Name", "Operating System Name", "Operating System Version", "Logical Processors", "Hyperthreaded",
                };
                sw.WriteLine(string.Join(",", heaaderArr));
                foreach (var row in filterResult.Data)
                {
                    sw.WriteCsvSafeLine(row);
                }
                return(sw.ToString());
            }
        }