/// <summary> /// Dispatches the request to the handler whose pattern most closely matches the request URL. /// </summary> /// <param name="request"></param> /// <param name="response"></param> public void Service(HttpListenerRequest request, HttpListenerResponse response) { if (request.Url.AbsolutePath.Equals("/")) { if (HomeHandler != null) { HomeHandler.Service(request, response); } } IHttpHandler handler = Match(request); if (handler == null) { handler = this.NotFoundHandler; } if (handler != null) { foreach (var mw in this.middleWares) { handler = mw.Middleware(handler); } handler.Service(request, response); } }
public RawPrintingHTTPServer() { config = ServerConfig.load(); _url += ":" + config.port; _permissions = new PermissionsHandler(this); _home = new HomeHandler(this); _printers = new PrintersHandler(); }
public RawPrintingHTTPServer() { config = ServerConfig.load(); _permissions = new PermissionsHandler(this); _home = new HomeHandler(this); _printers = new PrintersHandler(this); _settings = new SettingsHandler(this); }
public static List <Product> generateRandom() { int lastID = HomeHandler.getMax(); int firstID = HomeHandler.getMin(); Random rand = new Random(); int[] arr = new int[5]; int ran = 0; int flag; int j = 0; do { flag = 0; ran = rand.Next(firstID, lastID); bool IsEmpty = HomeHandler.checkProduct(ran); if (IsEmpty == true) { for (int i = 0; i < 5; i++) { if (ran == arr[i]) { flag = -1; break; } else { flag = 1; } } if (flag == 1) { arr[j] = ran; j++; } } } while (j < 5); int a, b, c, d, e; a = arr[0]; b = arr[1]; c = arr[2]; d = arr[3]; e = arr[4]; var pr = HomeHandler.addRandomProduct(a, b, c, d, e); return(pr); }
public static int countProduct() { return(HomeHandler.countProduct()); }
public static List <DetailProduct> FetchDataRandom() { return(HomeHandler.FetchDataRandom()); }
public static MsUser FetchDataForHome(String ID) { MsUser user = HomeHandler.FetchDataForHome(ID); return(user); }
public static Product checkProductId(int id) { return(HomeHandler.checkProductId(id)); }
public static ProductType GetProductTypeController(int id) { return(HomeHandler.GetProductTypeHandler(id)); }
public static List <Product> GetFiveRandomProductController() { return(HomeHandler.GetFiveRandomProductHandler()); }
public ActionResult Incident() { HomeHandler handler = new HomeHandler(new HomeDataAccess()); List<IncidentVM> viewModel = handler.GetIncident(0, 100); return View(viewModel); }