private void HandleStopTrip(MQBatchRequest batchRequest)
        {
            Trip currTrip = CacheImplementor.GetTrip(batchRequest.MessageData.ToString());

            foreach (KeyValuePair <int, TripPerson> kv in currTrip.PassengarInfo)
            {
                LoginResponse lr = CacheImplementor.GetUserInfo(kv.Value.ID.ToString());
                if (lr != null && !String.IsNullOrEmpty(lr.FirebaseID))
                {
                    PushCommunication.SendNotification(lr.FirebaseID, "TRIP STARTED",
                                                       String.Format("Your trip had been started and Driver: {0} Number: {1] is assigned",
                                                                     currTrip.DriverData.DriverName, currTrip.DriverData.DriverPhoneNumber));
                }
            }
        }
Exemple #2
0
        public override void OnAuthorization(System.Web.Http.Controllers.HttpActionContext actionContext)
        {
            if (actionContext.Request.Headers.Authorization == null)
            {
                actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized);
            }
            else
            {
                string authenticationString = actionContext.Request.Headers.Authorization.Parameter;
                string token = Encoding.UTF8.GetString(Convert.FromBase64String(authenticationString));

                LoginResponse lr = CacheImplementor.GetUserInfo(token);
                if (lr == null)
                {
                    actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized);
                }
                else
                {
                    HttpContext.Current.User = new EzMovePrinicpal(new EzMoveIdentity(lr));
                }
            }
        }