public ActionResult EditMedicalReportView(int reportId)
        {
            var mReport = _medicalReportService.GetById(reportId);

            var mReportViewModel = Mapper.Map <MedicalReportViewModel>(mReport);

            return(PartialView("_EditMedicalReportModal", mReportViewModel));
        }
Example #2
0
        public ActionResult EditCustomEventView(int customEventId, string color)
        {
            switch (color)
            {
            case CalendarEventColors.CustomEvent:
                var customEvent = _customEventService.GetById(customEventId);

                var customEventModel = Mapper.Map <CustomEventViewModel>(customEvent);

                return(PartialView("EditCustomEventView", customEventModel));

            case CalendarEventColors.MedicalReport:
                var medicalEx = _medicalReportService.GetById(customEventId);

                CalendarEventViewModel medicalExModel = new CalendarEventViewModel
                {
                    Description  = medicalEx.Notes,
                    Title        = "Koniec badań lekarskich",
                    StartDate    = medicalEx.CompletionDate,
                    EndDate      = medicalEx.NextCompletionDate,
                    EmployeeName = medicalEx.Employee.FullName
                };


                return(PartialView("CalendarEventView", medicalExModel));

            case CalendarEventColors.Leave:
            case CalendarEventColors.SickLeave:
                var leave = _leaveService.GetById(customEventId);

                CalendarEventViewModel leaveModel = new CalendarEventViewModel
                {
                    Description  = leave.Notes,
                    Title        = CreateLeaveTitle(leave),
                    StartDate    = leave.DateFrom,
                    EndDate      = leave.DateTo,
                    EmployeeName = leave.Employee.FullName
                };

                return(PartialView("CalendarEventView", leaveModel));

            case CalendarEventColors.OSHTraining:
                var oshTraining = _oshTrainingService.GetById(customEventId);

                CalendarEventViewModel model = new CalendarEventViewModel
                {
                    Description  = oshTraining.Notes,
                    Title        = "Koniec szkolenia BHP",
                    StartDate    = oshTraining.CreatedDate,
                    EndDate      = oshTraining.NextCompletionDate,
                    EmployeeName = oshTraining.Employee.FullName
                };

                return(PartialView("CalendarEventView", model));
            }
            ;

            throw new Exception("Brak widoku do wyświetlenia!");
        }