using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PowerAccounting.Models;
using System.IO;
using System.Collections;
using Microsoft.Reporting.NETCore;
using System.Reflection;


using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
//using Microsoft.Reporting.Map.WebForms.BingMaps;

namespace PowerAccounting.Service
{
    public class ServiceReport : IServiceReport
    {
        List<string> op = new List<string>();
        //...
        private readonly IWebHostEnvironment _webHostEnvironment;
        private static List<Stream> m_streams;
        private static int m_currentPageIndex = 0;
        private System.ComponentModel.Container components;
        private Font printFont;
        private StreamReader streamToPrint;

        public ServiceReport()
        {
            op.Add("");
            op.Add("");
            op.Add("");
            op.Add("");
        }

        public byte[] CreateReportFile(List<Class2> myList,string MyPath,string Param5)
        {
       
            LocalReport report = new LocalReport();
            report.ReportPath = MyPath;
            // using var rs = Assembly.GetExecutingAssembly().GetManifestResourceStream("PowerAccounting.Report.Report.rdlc");
            //  report.LoadReportDefinition(rs);
            report.DataSources.Add(new ReportDataSource("DataSet1", myList));
            report.SetParameters(new[] { new ReportParameter("ReportParameter1", op[0]), new ReportParameter("ReportParameter2",op[1] ), new ReportParameter("ReportParameter3", op[2]), new ReportParameter("ReportParameter4", op[3]), new ReportParameter("ReportParameter5", Param5) });

            byte[] pdf = report.Render("PDF");
            return pdf;
        }

        public byte[] CreateReportFileTow(List<vmProductDetails> _objData, string MyPath, string Param5)
        {
            LocalReport report = new LocalReport();
            report.ReportPath = MyPath;
            // using var rs = Assembly.GetExecutingAssembly().GetManifestResourceStream("PowerAccounting.Report.Report.rdlc");
            //  report.LoadReportDefinition(rs);
            report.DataSources.Add(new ReportDataSource("DataSetBarcode", _objData));
           // report.SetParameters(new[] { new ReportParameter("ReportParameter1", op[0]), new ReportParameter("ReportParameter2", op[1]), new ReportParameter("ReportParameter3", op[2]), new ReportParameter("ReportParameter4", op[3]), new ReportParameter("ReportParameter5", Param5) });
            byte[] pdf = report.Render("PDF");
            return pdf;
        }


    }
}
