Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
 public RawPrintingHTTPServer()
 {
     config       = ServerConfig.load();
     _url        += ":" + config.port;
     _permissions = new PermissionsHandler(this);
     _home        = new HomeHandler(this);
     _printers    = new PrintersHandler();
 }
Ejemplo n.º 3
0
 public RawPrintingHTTPServer()
 {
     config       = ServerConfig.load();
     _permissions = new PermissionsHandler(this);
     _home        = new HomeHandler(this);
     _printers    = new PrintersHandler(this);
     _settings    = new SettingsHandler(this);
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public static int countProduct()
 {
     return(HomeHandler.countProduct());
 }
Ejemplo n.º 6
0
 public static List <DetailProduct> FetchDataRandom()
 {
     return(HomeHandler.FetchDataRandom());
 }
Ejemplo n.º 7
0
        public static MsUser FetchDataForHome(String ID)
        {
            MsUser user = HomeHandler.FetchDataForHome(ID);

            return(user);
        }
Ejemplo n.º 8
0
 public static Product checkProductId(int id)
 {
     return(HomeHandler.checkProductId(id));
 }
Ejemplo n.º 9
0
 public static ProductType GetProductTypeController(int id)
 {
     return(HomeHandler.GetProductTypeHandler(id));
 }
Ejemplo n.º 10
0
 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);
 }