Example #1
0
        public IActionResult Index()
        {   //Po utworzeniu userów
            //var user = User.Identity.Name;
            //var modelData = _modelService.GetAll().Where(x => x.UserId == user);
            //Przed utworzeniem userow
            var modelData = _modelService.GetAll();

            return(View(modelData));
        }
Example #2
0
        public HtmlToPdfDocument getPdf()
        {
            var incidents = _incidentService.GetAll();

            var globalSettings = new GlobalSettings
            {
                ColorMode   = ColorMode.Color,
                Orientation = Orientation.Portrait,
                PaperSize   = PaperKind.A4,
                Margins     = new MarginSettings {
                    Top = 10
                },
                DocumentTitle = "PDF Report",
            };

            var objectSettings = new ObjectSettings
            {
                PagesCount     = true,
                HtmlContent    = TemplateGenerator.GetHTMLString(incidents),
                WebSettings    = { DefaultEncoding = "utf-8", UserStyleSheet = Path.Combine(Directory.GetCurrentDirectory(), "assets", "styles.css") },
                HeaderSettings = { FontName = "Arial", FontSize = 25, Right = "Raport Watchman, " + DateTime.Now.ToString("dd.MM.yyyy"), Line = true },
                FooterSettings = { FontName = "Arial", FontSize = 25, Line = true, Center = "WATCHMAN" }
            };

            var pdf = new HtmlToPdfDocument()
            {
                GlobalSettings = globalSettings,
                Objects        = { objectSettings }
            };

            return(pdf);
        }
Example #3
0
        private async Task <bool> RefreshDashboard()
        {
            try
            {
                IsItemSelected   = false;
                SelectedIncident = null;

                var res = await _incidentService.GetAll();

                if (!Equals(res, null))
                {
                    _deviceService.BeginInvokeOnMainThread(() =>
                    {
                        Incidents     = new ObservableCollection <Incident>(res);
                        IncidentCount = res.Count;
                    });
                }
                return(true);
            }
            catch (Exception ex)
            {
                await _pageDialogService.DisplayAlertAsync("Error", ex.Message, "OK");

                return(false);
            }
        }
        public IActionResult Get()
        {
            try
            {
                //to return all events
                var allEvents = _eventService
                                .GetAll()
                                .ToApiModels();

                // to return all incidents
                var allIncidents = _incidentService
                                   .GetAll()
                                   .ToApiModels();

                foreach (var incident in allIncidents)
                {
                    var theevent = allEvents.Where(e => e.id == incident.IncidentEventId).FirstOrDefault();
                    incident.IncidentEvent = theevent;
                }
                return(Ok(allIncidents));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("GetIncidents", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Example #5
0
 public IActionResult Get()
 {
     try
     {
         // to return all incidents
         var allIncidents = _incidentService
                            .GetAll()
                            .ToApiModels();
         return(Ok(allIncidents));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("GetIncidents", ex.Message);
         return(BadRequest(ModelState));
     }
 }
 public List <Incident> Get()
 {
     return(_incidentService.GetAll());
 }
Example #7
0
 public List <IncidentVM> GetAll()
 {
     return(_mapper.Map <List <IncidentVM> >(_incidentService.GetAll()));
 }