Ejemplo n.º 1
0
        public FileStreamResult DownloadExcelReport(StrassenabschnittGridCommand command)
        {
            var data = strassenabschnittService.GetAllStrassenabschnittImportModels(command.StrassennameFilter);
            var doc  = new XlsxDoc(14);

            for (var j = 1; j < (data.Count + 2); j++)
            {
                var i = 0;
                if (j == 1)
                {
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Strassenname;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.BezeichnungVon;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.BezeichnungBis;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.StrassenabschnittImportModel_ExternalId;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.StrassenabschnittImportModel_Abschnittsnummer;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Strasseneigentuemer;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Ortsbezeichnung;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Belastungskategorie;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Belag;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.BreiteFahrbahn;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Laenge;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Trottoir;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.BreiteTrottoirLinks;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.BreiteTrottoirRechts;
                }
                else
                {
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].Strassenname;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].BezeichnungVon;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].BezeichnungBis;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].ExternalId;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].Abschnittsnummer;
                    doc.worksheet.Row(j).Cell(++i).Value = localizationService.GetLocalizedEnum(data[j - 2].Strasseneigentuemer);
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].Ortsbezeichnung;
                    doc.worksheet.Row(j).Cell(++i).Value = localizationService.GetLocalizedBelastungskategorieTyp(data[j - 2].BelastungskategorieTyp);
                    doc.worksheet.Row(j).Cell(++i).Value = localizationService.GetLocalizedEnum(data[j - 2].Belag);
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].BreiteFahrbahn;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].Laenge;
                    doc.worksheet.Row(j).Cell(++i).Value = localizationService.GetLocalizedEnum(data[j - 2].Trottoir);
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].BreiteTrottoirLinks;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].BreiteTrottoirRechts;
                }
            }
            var fileSteam = doc.Save();

            fileSteam.Seek(0, SeekOrigin.Begin);
            var file = File(fileSteam, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

            file.FileDownloadName = TextLocalization.Strassenabschnitte + ".xlsx";
            return(file);
        }
Ejemplo n.º 2
0
        protected Stream CreateTemplateFor <TModel>(string[] prop)
        {
            var xlsxDoc = new XlsxDoc(prop.Length);
            var cells   = xlsxDoc.HeaderRow.Cells;

            for (int index = 0; index < prop.Length; index++)
            {
                cells[index].Value = LocalizationService.GetLocalizedModelPropertyText <TModel>(prop[index]);
            }

            Stream stream = xlsxDoc.Save();

            stream.Seek(0, 0);
            return(stream);
        }
Ejemplo n.º 3
0
        public FileStreamResult DownloadExcelReport()
        {
            var data = zustandsabschnittService.GetAllZustandsabschnittModels();
            var doc  = new XlsxDoc(20);

            for (var j = 1; j < (data.Count + 2); j++)
            {
                var i = 0;
                if (j == 1)
                {
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Strassenname;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_StrassennameBezeichnungVon;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_StrassennameBezeichnungBis;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_ExternalId;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_Abschnittsnummer;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.BezeichnungVon;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.BezeichnungBis;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Laenge;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Zustandsindex;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_ZustandsindexTrottoirLinks;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_ZustandsindexTrottoirRechts;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Aufnahmedatum;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Aufnahmeteam;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Wetter;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.Bemerkung;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_MassnahmenvorschlagFahrbahnId;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_DringlichkeitFahrbahn;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_MassnahmenvorschlagTrottoirLinksId;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_DringlichkeitTrottoirLinks;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_MassnahmenvorschlagTrottoirRechtsId;
                    doc.worksheet.Row(j).Cell(++i).Value = ModelLocalization.ZustandsabschnittImportModel_DringlichkeitTrottoirRechts;
                }
                else
                {
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].Strassenname;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].StrassennameBezeichnungVon;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].StrassennameBezeichnungBis;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].ExternalId;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].Abschnittsnummer;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].BezeichnungVon;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].BezeichnungBis;
                    doc.worksheet.Row(j).Cell(++i).Value = decimal.Round((decimal)data[j - 2].Laenge, 1, MidpointRounding.AwayFromZero);
                    doc.worksheet.Row(j).Cell(++i).Value = decimal.Round(data[j - 2].Zustandsindex, 1, MidpointRounding.AwayFromZero);
                    doc.worksheet.Row(j).Cell(++i).Value = localizationService.GetLocalizedEnum(data[j - 2].ZustandsindexTrottoirLinks);
                    doc.worksheet.Row(j).Cell(++i).Value = localizationService.GetLocalizedEnum(data[j - 2].ZustandsindexTrottoirRechts);
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].Aufnahmedatum;
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].Aufnahmeteam;
                    doc.worksheet.Row(j).Cell(++i).Value = localizationService.GetLocalizedEnum(data[j - 2].Wetter);
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].Bemerkung;
                    doc.worksheet.Row(j).Cell(++i).Value = localizationService.GetLocalizedMassnahmenvorschlagTyp(data[j - 2].MassnahmenvorschlagKatalogTypFahrbahn);
                    doc.worksheet.Row(j).Cell(++i).Value = localizationService.GetLocalizedEnum(data[j - 2].DringlichkeitFahrbahn);
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].MassnahmenvorschlagKatalogTypTrottoirLinks;
                    doc.worksheet.Row(j).Cell(++i).Value = localizationService.GetLocalizedEnum(data[j - 2].DringlichkeitTrottoirLinks);
                    doc.worksheet.Row(j).Cell(++i).Value = data[j - 2].MassnahmenvorschlagKatalogTypTrottoirRechts;
                    doc.worksheet.Row(j).Cell(++i).Value = localizationService.GetLocalizedEnum(data[j - 2].DringlichkeitTrottoirRechts);
                }
            }
            var fileSteam = doc.Save();

            fileSteam.Seek(0, SeekOrigin.Begin);
            var file = File(fileSteam, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

            file.FileDownloadName = TextLocalization.Zustandsabschnitte + ".xlsx";
            return(file);
        }