Пример #1
0
 private static void AllocateOrderToPrefferedAgent(int orderId)
 {
     using (OrderDao dao = new OrderDao())
     {
         Order  order = dao.FindById(orderId);
         string latitude = order.ConsumerAddress.Latitude;
         string longitude = order.ConsumerAddress.Longitude;
         Agency preferredAgency = AgencyService.FindPreferredAgency(order, latitude, longitude);
         string appId = order.Consumer.AppID, appToken = order.Consumer.AppToken;
         string message = string.Format(OrdersServices.ORDER_ALLOCATION_TEMPLATE, order.OrdrID);
         PushMessagingService.PushNotification(appId, appToken, message);
         HostingEnvironment.QueueBackgroundWorkItem(t => PostProcessAgencyNotification(order.OrdrID, false));
     }
 }
Пример #2
0
 public static void NotifyAgencies(int ordrID)
 {
     using (OrderDao dao = new OrderDao())
     {
         Order         ord = dao.FindById(ordrID);
         int           userId = ord.ConsID;
         string        latitude = ord.ConsumerAddress.Latitude;
         string        longitude = ord.ConsumerAddress.Longitude;
         List <Agency> agencies = AgencyService.GetProximateAgencies(latitude, longitude);
         string        appId = ord.Consumer.AppID, appToken = ord.Consumer.AppToken;
         foreach (Agency ag in agencies)
         {
             if (!TimeslotService.CheckTimeslotFree(ord.DeliveryDate, latitude, longitude, ord.DeliverySlotID, ag.AgenID))
             {
                 continue;
             }
             string message = string.Format(OrdersServices.ORDER_NOTIFICATION_TEMPLATE, ord.OrdrID);
             PushMessagingService.PushNotification(appId, appToken, message);
         }
         HostingEnvironment.QueueBackgroundWorkItem(t => PostProcessAgencyNotification(ord.OrdrID));
     }
 }