public DataTable GetPrintersInfo()
        {
            _printers = new PrintersService(_scope, _options);
            var printerNamesList = _printers.GetPrinters();

            return(CreateExcelFile.ListToDataTable(printerNamesList, "Printers"));
        }
        public DataTable GetLocalAccountsInfo()
        {
            _localAccounts = new LocalAccountService(_scope, _options);
            var localAccountsList = _localAccounts.GetAllLocalAccounts();

            return(CreateExcelFile.ListToDataTable(localAccountsList, "Local Accounts"));
        }
        public DataTable GetServicesInfo()
        {
            _services = new ServicesService(_scope, _options);
            var serviceNamesList = _services.GetAllServices();

            return(CreateExcelFile.ListToDataTable(serviceNamesList, "Services"));
        }
        public async Task <IHttpActionResult> ExportMediaNewsToExcel(MediaSearchModel model)
        {
            var      userId = User.Identity.GetUserId <int>();
            DateTime?fromDate = null, toDate = null;
            string   pathnew = Request.RequestUri.AbsolutePath;

            if ((!String.IsNullOrEmpty(model.startDate)))
            {
                fromDate = DateTime.ParseExact(model.startDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }

            if ((!String.IsNullOrEmpty(model.endDate)))
            {
                toDate = DateTime.ParseExact(model.endDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }

            var taskResult = repository.GeMediaListAll(userId, model.mediaTypeId, model.newsTypeIds, model.channelIds, model.categoryIds, model.sentimentIds, model.relevanceIds, model.createdBy, model.script, fromDate, toDate);
            var excelData  = taskResult.MediaFormList;

            string          baseUrl       = "";
            string          excelFilename = "MediaNews" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + DateTime.Now.Millisecond + ".xls";
            string          SaveLocation  = HttpContext.Current.Request.PhysicalApplicationPath + "Files\\" + excelFilename;
            DataTable       dt            = CreateExcelFile.ListToDataTable(excelData);
            CreateExcelFile file          = new CreateExcelFile();
            string          detail        = file.CreateExcelSheet(dt, SaveLocation, new List <int>(), new List <int>(), new List <string>());

            baseUrl = "Files/" + excelFilename;
            return(Ok(baseUrl));
        }
        public DataTable GetSoftwareInfo()
        {
            _applications = new SoftwareService(_scope, _options);
            var      softwareNamesList = _applications.GetAllSoftware();
            var      dt = CreateExcelFile.ListToDataTable(softwareNamesList, "Software");
            DataView dv = dt.DefaultView;

            dv.Sort = "Name asc";
            return(dv.ToTable());
        }
        public List <DataTable> GetSystemInfo()
        {
            List <DataTable> dtList = new List <DataTable>();
            DataTable        dtTemp = new DataTable();

            _sysInfo = new SystemInfoService(_scope, _options);
            var sysInfo = _sysInfo.GetSystemInfo().FirstOrDefault();

            dtList.Add(ExtensionMethods.ConvertToDataTable(sysInfo, "System Info"));
            dtList[0].Columns.Remove("Disks");
            dtList[0].Columns.Remove("Drives");
            dtList[0].Columns.Remove("CompSystem");
            dtList.Add(CreateExcelFile.ListToDataTable(sysInfo.Disks, "Disks"));
            dtList.Add(CreateExcelFile.ListToDataTable(sysInfo.CompSystem, "Computer System"));

            return(dtList);
        }
Exemple #7
0
        private void btnExportToExcel_Click(object sender, RoutedEventArgs e)
        {
            List <Customer> customerList = rp.DisplayListOfPurchesOfCustomers();

            lvAddress.Items.Clear();
            foreach (Customer c in customerList)
            {
                lvAddress.Items.Add(c);
            }
            var reducedList = customerList.Select(c => new { CompanyName = c.CompanyName, NumberOfBuys = c.SalesRepId }).ToList();

            var            datatable      = CreateExcelFile.ListToDataTable(reducedList);
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "Excel file (*.xls)|*.xlsx";
            if (saveFileDialog.ShowDialog() == true)
            {
                CreateExcelFile.CreateExcelDocument(datatable, saveFileDialog.FileName);
                MessageBox.Show("All Information exported!", "Successfully", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
        public DataTable GetDrivesInfo()
        {
            var sysInfo = _sysInfo.GetSystemInfo().FirstOrDefault();

            return(CreateExcelFile.ListToDataTable(sysInfo.Drives, "Drives"));
        }