Exemplo n.º 1
0
        private LocalReport LoadReport(string reportName)
        {
            Report.Daten.Firma tempFirma = new Report.Daten.Firma() { Name = Firma.Name, Strasse = Firma.Strasse, PLZ = Firma.PLZ, Ort = Firma.Ort, Beschreibung = Firma.Beschreibung };
            Report.Daten.Objekt tempObjekt = new Report.Daten.Objekt()
            {
                Stundenverrechnungssatz = Objekt.Stundenverrechnungssatz,
                Name = Objekt.Name,
                Beschreibung = Objekt.Beschreibung,
                GesamtPreisJahr = Objekt.GesamtPreisJahr,
                AverageHoursDaily = Objekt.Stunden
            };

            var tempList = Objekt.Leistungen.ToList();
            tempList.Sort(new Comparer.LeistungObservableObjectComparer());

            List<Report.Daten.Leistung> tempLeistungen = new List<Report.Daten.Leistung>();
            foreach (var item in tempList)
            {
                tempLeistungen.Add(new Report.Daten.Leistung()
                {
                    Etage = item.Etage.Name,
                    Bezeichnung = item.Bezeichnung.Name,
                    Art = item.Art.Name,
                    Methode = item.Methode.Name,
                    Maenge = item.Maenge.Name,
                    Anzahl = item.Anzahl,
                    RichtLeistung = item.RichtLeistungMitFaktor,
                    Haeufigkeit = item.Haeufigkeit != null ? item.Haeufigkeit.ReportName : "",
                    HaeufigkeitFaktor = item.Haeufigkeit != null ? item.Haeufigkeit.Faktor : 0m,
                    AnzahlMonatlich = item.AnzahlMonatlich,
                    ZeitTaeglich = item.ZeitTaeglich,
                    ZeitMonatlich = item.ZeitMonatlich,
                    Preis = item.Preis
                });
            }

            LocalReport report = new LocalReport();
            Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();

            reportDataSource1.Name = "Firma"; //Name of the report dataset in our .RDLC file
            reportDataSource1.Value = new Report.Daten.Firma[1] { tempFirma };
            report.DataSources.Add(reportDataSource1);

            Microsoft.Reporting.WinForms.ReportDataSource reportDataSource2 = new Microsoft.Reporting.WinForms.ReportDataSource();

            reportDataSource2.Name = "Objekt"; //Name of the report dataset in our .RDLC file
            reportDataSource2.Value = new Report.Daten.Objekt[1] { tempObjekt };
            report.DataSources.Add(reportDataSource2);

            Microsoft.Reporting.WinForms.ReportDataSource reportDataSource3 = new Microsoft.Reporting.WinForms.ReportDataSource();

            reportDataSource3.Name = "Leistung"; //Name of the report dataset in our .RDLC file
            reportDataSource3.Value = tempLeistungen;
            report.DataSources.Add(reportDataSource3);

            report.ReportEmbeddedResource = reportName; //"CleanEstimate.Report.EtageHaeufigkeit.rdlc";

            return report;
        }
Exemplo n.º 2
0
        private LocalReport LoadPrintObjectOverview(string reportName)
        {
            Report.Daten.Firma tempFirma = new Report.Daten.Firma() { Name = Firma.Name, Strasse = Firma.Strasse, PLZ = Firma.PLZ, Ort = Firma.Ort, Beschreibung = Firma.Beschreibung };
            IEnumerable<Report.Daten.Objekt> tempObjekts = Firma.Objekte.OrderBy(x => x.Name).ThenBy(x => x.Beschreibung).ThenBy(x => x.GesamtPreisJahr).Select(x => new Report.Daten.Objekt()
            {
                Stundenverrechnungssatz = x.Stundenverrechnungssatz,
                Name = x.Name,
                Beschreibung = x.Beschreibung,
                GesamtPreisJahr = x.GesamtPreisJahr,
                AverageHoursDaily = x.Stunden
            });

            LocalReport report = new LocalReport();
            Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();

            reportDataSource1.Name = "Firma"; //Name of the report dataset in our .RDLC file
            reportDataSource1.Value = new Report.Daten.Firma[1] { tempFirma };
            report.DataSources.Add(reportDataSource1);

            Microsoft.Reporting.WinForms.ReportDataSource reportDataSource2 = new Microsoft.Reporting.WinForms.ReportDataSource();

            reportDataSource2.Name = "Objekt"; //Name of the report dataset in our .RDLC file
            reportDataSource2.Value = tempObjekts.ToArray();
            report.DataSources.Add(reportDataSource2);

            report.ReportEmbeddedResource = reportName;

            return report;
        }