Exemple #1
0
 public IHttpActionResult GetPassengerRoutes(PassFilterModel model)
 {
     try
     {
         int ff;
         if (User != null && int.TryParse(User.Identity.GetUserId(), out ff))
         {
             var res = _routemanager.GetPassengerRoutes(ff, model);
             return(Json(_responseProvider.GenerateRouteResponse(res)));
         }
         else
         {
             return
                 (ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Unauthorized,
                                                              "You are unauthorized to see Info!")));
         }
     }
     catch (Exception e)
     {
         if (e.InnerException != null)
         {
             _logmanager.Log(Tag, "GetPassengerRoutes", e.Message + "-" + e.InnerException.Message);
         }
         else
         {
             _logmanager.Log(Tag, "GetPassengerRoutes", e.Message);
         }
     }
     return(Json(_responseProvider.GenerateUnknownErrorResponse()));
 }
Exemple #2
0
 public IHttpActionResult GetTripInfo(TripRequest model)
 {
     try
     {
         var res = _routemanager.GetTripInfo(int.Parse(User.Identity.GetUserId()), model.TripId);
         return(Json(_responseProvider.GenerateRouteResponse(res, "TripInfo")));
     }
     catch (Exception e)
     {
         _logmanager.Log(Tag, "SendUserTripLocation", e.Message);
     }
     return(Json(_responseProvider.GenerateUnknownErrorResponse()));
 }
Exemple #3
0
 public IHttpActionResult GetAllClusters()
 {
     try
     {
         var list = _adminmanager.GetAllClusters();
         return(Json(_responseProvider.GenerateRouteResponse(list, "clusters")));
     }
     catch (Exception e)
     {
         _logmanager.Log(Tag, "GetAllRoutes", e.Message);
     }
     return(Json(_responseProvider.GenerateUnknownErrorResponse()));
 }
Exemple #4
0
 public IHttpActionResult GetGoogleApi(Gtoken model)
 {
     try
     {
         var token = _taxiMeterManager.GetGoogleApi(model.Token);
         return(Json(_responseProvider.GenerateRouteResponse(token, "GoogleApi")));
     }
     catch (Exception e)
     {
         _logmanager.Log(Tag, "GetGoogleApi", e.Message);
     }
     return(null);
 }
Exemple #5
0
        public IHttpActionResult GetUserRoutes()
        {
            try
            {
                var list = _routemanager.GetUserRoutes(int.Parse(User.Identity.GetUserId()));
                //پیغام اطلاعات خودرو

                /*var drivings = list.Where(x => x.IsDrive).ToList();
                 * if (drivings.Count>0)
                 * {
                 *  if (drivings.Any(x => x.CarString == ""))
                 *  {
                 *      _responseProvider.SetBusinessMessage(new MessageResponse() { Type = ResponseTypes.Info,Message = getResource.getMessage("FillCarInfo") });
                 *  }
                 * }*/
                return(Json(_responseProvider.GenerateRouteResponse(list)));
            }
            catch (Exception e)
            {
                _logmanager.Log(Tag, "GetUserRoutes", e.Message);
            }
            return(Json(_responseProvider.GenerateUnknownErrorResponse()));
        }
Exemple #6
0
 public IHttpActionResult GetMainStations()
 {
     try
     {
         var res = _routemanager.GetMainStations();
         return(Json(_responseProvider.GenerateRouteResponse(res)));
     }
     catch (Exception e)
     {
         _logmanager.Log(Tag, "GetMainStations", e.Message);
     }
     return(Json(_responseProvider.GenerateUnknownErrorResponse()));
 }
 public IHttpActionResult SetUserRoute(SubStationModel model)
 {
     try
     {
         int ff;
         if (User != null && int.TryParse(User.Identity.GetUserId(), out ff))
         {
             var  res         = _routemanager.SetUserRoute(ff, model.StRouteId, model.StationId);
             bool isSubmitted = res > 0;
             return(Json(_responseProvider.GenerateRouteResponse(new { IsSubmited = isSubmitted, DriverRouteId = res }, "SetUserRoute")));
         }
         else
         {
             return
                 (ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Unauthorized,
                                                              "You are unauthorized to see Info!")));
         }
     }
     catch (Exception e)
     {
         _logmanager.Log(Tag, "SetUserRoute", e.Message);
     }
     return(Json(_responseProvider.GenerateUnknownErrorResponse()));
 }