public ActionResult OCRService() { ServiceController sc = new ServiceController("2saOCR"); try { if (sc.Status == ServiceControllerStatus.Running) { ViewData["serviceStatus"] = "Us³uga OCR jest uruchomiona."; ViewData["statusClass"] = "ocrRunning"; } else { ViewData["serviceStatus"] = "Us³uga OCR nie jest uruchomiona."; ViewData["statusClass"] = "ocrStopped"; } } catch (Exception) { ViewData["serviceStatus"] = "Nie uda³o siê odnaleŸæ us³ugi OCR"; ViewData["statusClass"] = "ocrError"; } pOCRGetConfigurationResult r = TempData["entity"] as pOCRGetConfigurationResult; return(View(r ?? _repository.GetOCRConfiguration())); }
public ActionResult OCRService(pOCRGetConfigurationResult ocrSettings, bool ocrEnabled) { TimeSpan sh; if (ocrSettings.OCRStartHour.Length != 5 || ocrSettings.OCRStartHour.IndexOf(':') != 2 || !TimeSpan.TryParse(ocrSettings.OCRStartHour, out sh)) { ModelState.AddModelError("OCRStartHour", "godzina musi byæ w formacie gg:mm !"); TempData["entity"] = ocrSettings; } if (ocrSettings.OCREndHour.Length != 5 || ocrSettings.OCREndHour.IndexOf(':') != 2 || !TimeSpan.TryParse(ocrSettings.OCREndHour, out sh)) { ModelState.AddModelError("OCREndHour", "godzina musi byæ w formacie gg:mm !"); TempData["entity"] = ocrSettings; } if (ModelState.IsValid) { _repository.SaveOCRConfiguration(ocrSettings.OCRStartHour, ocrSettings.OCREndHour, ocrEnabled); return(RedirectToAction("OCRService")); } return(View(ocrSettings)); }