コード例 #1
0
        //Export
        //Export
        public ActionResult ExportToPDF(DivisionVM division)
        {
            DivisionReport divreport = new DivisionReport();

            byte[] abytes = divreport.PrepareReport(GetDivision());
            return(File(abytes, "application/pdf"));
        }
コード例 #2
0
        public ActionResult ReportPDF()
        {
            var token = HttpContext.Session.GetString("token");

            client.DefaultRequestHeaders.Add("Authorization", token);

            List <Division> divisions     = new List <Division>();
            DivisionReport  divisonReport = new DivisionReport();

            var resTask = client.GetAsync("divisions");

            resTask.Wait();

            var result = resTask.Result;

            if (result.IsSuccessStatusCode)
            {
                var readTask = result.Content.ReadAsAsync <List <Division> >();
                readTask.Wait();
                divisions = readTask.Result;
            }
            else
            {
                divisions = null;
                ModelState.AddModelError(string.Empty, "Server Error try after sometimes.");
            }

            byte[] abytes = divisonReport.PrepareReport(divisions);
            return(File(abytes, "application/pdf"));
        }
コード例 #3
0
        public ActionResult DivisionPdf(Division division)
        {
            DivisionReport divisionReport = new DivisionReport();

            byte[] abytes = divisionReport.PrepareReport(GetDivisions());
            return(File(abytes, "application/pdf"));
        }
コード例 #4
0
        public async Task <ActionResult> PrintReport()
        {
            DivisionReport divisionReport = new DivisionReport();
            var            allData        = await GetAllReport();

            byte[] fileStream    = divisionReport.PrepareReport(allData);
            var    stringContent = Convert.ToBase64String(fileStream);

            return(Ok(stringContent));
        }
        public IActionResult ReportDivision()
        {
            DivisionReport  divisionReport = new DivisionReport();
            List <Division> divisions      = new List <Division>();
            var             token          = HttpContext.Session.GetString("JWToken");

            httpClient.DefaultRequestHeaders.Add("Authorization", token);
            var restTask = httpClient.GetAsync("division");

            restTask.Wait();

            var result = restTask.Result;

            if (result.IsSuccessStatusCode)
            {
                var readTask = result.Content.ReadAsAsync <List <Division> >();
                readTask.Wait();
                divisions = readTask.Result;
            }

            byte[] abyte = divisionReport.PrepareReport(divisions);
            return(File(abyte, "application/pdf"));
        }