using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;

namespace hukpiWinApp.Forms
{
    public partial class ReportViewerAnimalDepotsForm : Form
    {
        List<decimal> modalitiesList = null;

        public ReportViewerAnimalDepotsForm(List<decimal> modalitiesList)
        {
            InitializeComponent();

            this.modalitiesList = modalitiesList;
        }

        private void ReportViewerAnimalDepotsForm_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'hukpiDatabaseDataSet.ReportAnimalDepotsSimpleView' table. You can move, or remove it, as needed.
            this.reportAnimalDepotsSimpleViewTableAdapter.Fill(this.hukpiDatabaseDataSet.ReportAnimalDepotsSimpleView);
            string ReportCaption = "Jelentés az állattartó telepekről";

            string modalities = "";
            if (this.modalitiesList != null)
            {
                modalities = " (Jellegek: " + Utils.implode(", ", Utils.getModalityCodesByIdList(this.modalitiesList)) + " ) ";
                ReportCaption += modalities;
            }


            ReportParameter p = new ReportParameter("Title", ReportCaption);

            this.reportAnimalDepotsSimpleViewTableAdapter.FillByModalities(this.hukpiDatabaseDataSet.ReportAnimalDepotsSimpleView, this.modalitiesList);
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p });
            //this.reportViewer1.RefreshReport();
        }

        public void refreshReport()
        {
            this.reportViewer1.RefreshReport();
            this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
            
        }
    }
}
