using System; using System.Collections.Generic; using System.Web.Mvc; using BeWoPlanerMobil.Models; using BeWoPlanerMobil.Service; using BeWoPlanerMobil.Util; using BS.Shared; namespace BeWoPlanerMobil.Controllers { public class ReportViewerController : AbstractBaseController { private ReportViewerModel _Model; public ReportViewerModel Model { get { if(!MobileSessionFacade.IsUserLoggedIn()) { RedirectToActionPermanent("Index", "Login"); return null; } if(((ReportViewerModel)Session[ModelSessionConstants.ReportViewerModelKey])?.Employee is null) { _Model = new ReportViewerModel { Employee = MobileSessionFacade.LoggedInEmployee }; Session[ModelSessionConstants.ReportViewerModelKey] = _Model; } else { _Model = (ReportViewerModel)Session[ModelSessionConstants.ReportViewerModelKey]; } return _Model; } } public ActionResult ReportViewer() { var month = DateTime.Today.Month; var year = DateTime.Today.Year; var first = new DateTime(year, month, 1).AddMonths(-1); Model.SelectedYear = Model.SelectedYear ?? first.Year; Model.SelectedMonth = Model.SelectedMonth ?? first.Month; Model.AllEmployees = EmployeeService.GetActiveCompactEmployeesForEmployee(MobileSessionFacade.LoggedInCompactEmployee.EmployeeOid); Model.AllTeams = EmployeeService.GetAllActiveCompactTeamsForEmployee(MobileSessionFacade.LoggedInEmployee.EmployeeOid); Model.ReportTypes = new List { new SelectListItem { Text = "Berichte", Value = "0" }, new SelectListItem { Text = "Mitarbeiterstundenkonto", Value = "1" } }; Model.SelectedReportType = ReportType.Berichte; Model.Queries = QueryService.GetAllQueriesOfType(QueryType.Public); return View(Model); } [Authorize] public ActionResult DocumentViewerPartial() { return PartialView("DocumentWebViewerPartial", Model); } [Authorize] public ActionResult ExportDocumentViewer() { throw new NotImplementedException("Service dafür implementieren!"); } } }