Esempio n. 1
0
        public static BaseResponse Process(Request request)
        {
            BaseResponse response = null;
            var          config   = new ConfigReader(HostingEnvironment.MapPath("~/App_Data/ServerConfig.xml")).Read();
            var          handlers = HandlerFactory.Find(request);

            try
            {
                foreach (var handler in handlers)
                {
                    DataResponse dataResponse;
                    if (handler.Process(request, config, out dataResponse))
                    {
                        response = dataResponse;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                var errorResponse = Utils.CreateResponse <ErrorResponse>();
                errorResponse.Message = ex.Message;
                errorResponse.Detail  = ex.ToString();
                response = errorResponse;
            }
            return(response);
        }
Esempio n. 2
0
        public Response Accept(Request id)
        {
            Response response = null;
            var      config   = new ConfigReader(HostingEnvironment.MapPath("~/App_Data/ServerConfig.xml")).Read();
            var      handlers = HandlerFactory.Find(id);

            foreach (var handler in handlers)
            {
                if (handler.Process(id, config, out response))
                {
                    break;
                }
            }
            return(response);
        }