Example #1
0
        public ActionResult Read([DataSourceRequest] DataSourceRequest request)
        {
            DataSourceResult drivers;

            try
            {
                drivers = GetDataSourceResults.GetDrivers(request);
            }
            catch (Exception e)
            {
                drivers = new DataSourceResult()
                {
                    Errors = "Drivers_Read error: " + ServerError.GetErrorFromException(e).ExceptionMsg
                };
            }
            return(Json(drivers, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public ActionResult View_Read([DataSourceRequest] DataSourceRequest request, string viewName)
        {
            DataSourceResult result = null;

            try
            {
                switch (viewName)
                {
                case "Drivers":
                    result = GetDataSourceResults.GetDrivers(request);
                    break;

                case "Trucks":
                    result = GetDataSourceResults.GetTrucks(request);
                    break;

                case "Trailers":
                    result = GetDataSourceResults.GetTrailers(request);
                    break;

                case "Warehouses":
                    result = GetDataSourceResults.GetWarehouses(request);
                    break;
                }
            }

            catch (Exception e)
            {
                result = new DataSourceResult()
                {
                    Errors = viewName + " read error: " + ServerError.GetErrorFromException(e).ExceptionMsg
                };
            }

            var rtnObj = Json(result, JsonRequestBehavior.AllowGet);

            return(rtnObj);
        }