| 1 | using System;
|
|---|
| 2 | using System.Collections.Generic;
|
|---|
| 3 | using System.Windows.Forms;
|
|---|
| 4 | using Microsoft.Reporting.WinForms;
|
|---|
| 5 |
|
|---|
| 6 | namespace Baza_Reklam
|
|---|
| 7 | {
|
|---|
| 8 | public partial class LetterViewer : Form
|
|---|
| 9 | {
|
|---|
| 10 | private short nrAMT;
|
|---|
| 11 | private short nrGS1;
|
|---|
| 12 | private short nrGS2;
|
|---|
| 13 |
|
|---|
| 14 | public LetterViewer(int custId, short nrAMT, short nrGS1, short nrGS2, DateTime dataWysylki)
|
|---|
| 15 | {
|
|---|
| 16 | InitializeComponent();
|
|---|
| 17 |
|
|---|
| 18 | this.nrAMT = nrAMT;
|
|---|
| 19 | this.nrGS1 = nrGS1;
|
|---|
| 20 | this.nrGS2 = nrGS2;
|
|---|
| 21 |
|
|---|
| 22 | KLIENCITableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
|
|---|
| 23 | ListaReklamDoWydaniaNrTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
|
|---|
| 24 |
|
|---|
| 25 | KLIENCITableAdapter.FillByCustomerId(REKLAMADataSet.KLIENCI, custId);
|
|---|
| 26 | ListaReklamDoWydaniaNrTableAdapter.ClearBeforeFill = false;
|
|---|
| 27 | ListaReklamDoWydaniaNrTableAdapter.FillByCustomerId(REKLAMADataSet.ListaReklamDoWydaniaNr, custId, "AMT",
|
|---|
| 28 | nrAMT);
|
|---|
| 29 | ListaReklamDoWydaniaNrTableAdapter.FillByCustomerId(REKLAMADataSet.ListaReklamDoWydaniaNr, custId, "GS",
|
|---|
| 30 | nrGS1);
|
|---|
| 31 | ListaReklamDoWydaniaNrTableAdapter.FillByCustomerId(REKLAMADataSet.ListaReklamDoWydaniaNr, custId, "GS",
|
|---|
| 32 | nrGS2);
|
|---|
| 33 |
|
|---|
| 34 | List<ReportParameter> paramList = new List<ReportParameter>();
|
|---|
| 35 |
|
|---|
| 36 | paramList.Add(new ReportParameter("nrAMT", nrAMT.ToString()));
|
|---|
| 37 | paramList.Add(new ReportParameter("nrGS1", nrGS1.ToString()));
|
|---|
| 38 | paramList.Add(new ReportParameter("nrGS2", nrGS2.ToString()));
|
|---|
| 39 | paramList.Add(new ReportParameter("data_wysylki", dataWysylki.ToShortDateString()));
|
|---|
| 40 | reportViewer1.LocalReport.SetParameters(paramList);
|
|---|
| 41 |
|
|---|
| 42 | reportViewer1.LocalReport.SubreportProcessing += SubreportProcessing;
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | public LetterViewer(List<int> custId, short nrAMT, short nrGS1, short nrGS2, DateTime dataWysylki)
|
|---|
| 46 | {
|
|---|
| 47 | InitializeComponent();
|
|---|
| 48 |
|
|---|
| 49 | this.nrAMT = nrAMT;
|
|---|
| 50 | this.nrGS1 = nrGS1;
|
|---|
| 51 | this.nrGS2 = nrGS2;
|
|---|
| 52 |
|
|---|
| 53 | KLIENCITableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
|
|---|
| 54 | ListaReklamDoWydaniaNrTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
|
|---|
| 55 |
|
|---|
| 56 | KLIENCITableAdapter.ClearBeforeFill = false;
|
|---|
| 57 | ListaReklamDoWydaniaNrTableAdapter.ClearBeforeFill = false;
|
|---|
| 58 |
|
|---|
| 59 | foreach (int i in custId)
|
|---|
| 60 | {
|
|---|
| 61 | KLIENCITableAdapter.FillByCustomerId(REKLAMADataSet.KLIENCI, i);
|
|---|
| 62 | ListaReklamDoWydaniaNrTableAdapter.FillByCustomerId(REKLAMADataSet.ListaReklamDoWydaniaNr, i, "AMT",
|
|---|
| 63 | nrAMT);
|
|---|
| 64 | ListaReklamDoWydaniaNrTableAdapter.FillByCustomerId(REKLAMADataSet.ListaReklamDoWydaniaNr, i, "GS",
|
|---|
| 65 | nrGS1);
|
|---|
| 66 | ListaReklamDoWydaniaNrTableAdapter.FillByCustomerId(REKLAMADataSet.ListaReklamDoWydaniaNr, i, "GS",
|
|---|
| 67 | nrGS2);
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | List<ReportParameter> paramList = new List<ReportParameter>();
|
|---|
| 71 |
|
|---|
| 72 | paramList.Add(new ReportParameter("nrAMT", nrAMT.ToString()));
|
|---|
| 73 | paramList.Add(new ReportParameter("nrGS1", nrGS1.ToString()));
|
|---|
| 74 | paramList.Add(new ReportParameter("nrGS2", nrGS2.ToString()));
|
|---|
| 75 | paramList.Add(new ReportParameter("data_wysylki", dataWysylki.ToShortDateString()));
|
|---|
| 76 | reportViewer1.LocalReport.SetParameters(paramList);
|
|---|
| 77 | reportViewer1.LocalReport.SubreportProcessing += SubreportProcessing;
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | private void LetterViewer_Load(object sender, EventArgs e)
|
|---|
| 81 | {
|
|---|
| 82 | reportViewer1.RefreshReport();
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | private void SubreportProcessing(object sender, SubreportProcessingEventArgs e)
|
|---|
| 86 | {
|
|---|
| 87 | e.DataSources.Add(new ReportDataSource("REKLAMADataSet_ListaReklamDoWydaniaNr",
|
|---|
| 88 | REKLAMADataSet.ListaReklamDoWydaniaNr));
|
|---|
| 89 | }
|
|---|
| 90 | }
|
|---|
| 91 | } |
|---|