Esempio n. 1
0
 public static Boolean GuardarTranPush(THE_PUSTRAN tran)
 {
     return(MngDatosPushTran.GuardarTranPush(tran));
 }
Esempio n. 2
0
        void t_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                THE_PUSTRAN objTran = new THE_PUSTRAN();
                objTran.DescTran          = "Se ha enviado desde el global asax";
                objTran.FechaCreaEncuesta = DateTime.Now;
                MngNegocioPushTran.GuardarTranPush(objTran);


                List <TDI_Notificaciones> notifica = MngNegocioNotificaciones.ObtieneNotificaciones();


                objTran.DescTran = "Hay " + notifica.Count + " pendientes por enviar";
                MngNegocioPushTran.GuardarTranPush(objTran);



                if (notifica.Count > 0)
                {
                    foreach (TDI_Notificaciones element in notifica)
                    {
                        PushService PushClient = new PushService();

                        PushClient.Events.OnDeviceSubscriptionExpired   += new PushSharp.Common.ChannelEvents.DeviceSubscriptionExpired(Events_OnDeviceSubscriptionExpired);
                        PushClient.Events.OnDeviceSubscriptionIdChanged += new PushSharp.Common.ChannelEvents.DeviceSubscriptionIdChanged(Events_OnDeviceSubscriptionIdChanged);
                        PushClient.Events.OnChannelException            += new PushSharp.Common.ChannelEvents.ChannelExceptionDelegate(Events_OnChannelException);
                        PushClient.Events.OnNotificationSendFailure     += new PushSharp.Common.ChannelEvents.NotificationSendFailureDelegate(Events_OnNotificationSendFailure);
                        PushClient.Events.OnNotificationSent            += new PushSharp.Common.ChannelEvents.NotificationSentDelegate(Events_OnNotificationSent);
                        PushClient.Events.OnChannelCreated   += new PushSharp.Common.ChannelEvents.ChannelCreatedDelegate(Events_OnChannelCreated);
                        PushClient.Events.OnChannelDestroyed += new PushSharp.Common.ChannelEvents.ChannelDestroyedDelegate(Events_OnChannelDestroyed);

                        //PushClient.Events.OnNotificationSent += HandleOnNotificationSent;
                        PushClient.StartGoogleCloudMessagingPushService(
                            new GcmPushChannelSettings("248326017313", "AIzaSyBl8zK7NlLAFc0AkWtuJgsEt3VlXGNARu4", "encuestas.moviles"));

                        //PushClient.StartGoogleCloudMessagingPushService(new GcmPushChannelSettings("248326017313", "AIzaSyBl8zK7NlLAFc0AkWtuJgsEt3VlXGNARu4", "encuestas.moviles"));

                        //        PushClient.QueueNotification(NotificationFactory.AndroidGcm()
                        //.ForDeviceRegistrationId("APA91bFKLIddkts8DxU-qlLdrlOw3fhrIiPiWHIBsNRv8f0HosWF_e45WeFhjLYaEp-CaHnyR5sh9FLXcO1T-U-8-Pgkwy6YoylF9_NusAAbqHqme0F7mviyh1mthrn1hqP_PytyzpxSpir6pK96AIWa-CC8t5humg")
                        //.WithCollapseKey("NONE")
                        //.WithJson("{\"alert\":\"Alert Text!\",\"badge\":\"7\"}"));


                        PushClient.QueueNotification(NotificationFactory.AndroidGcm()
                                                     .ForDeviceRegistrationId(element.TokenDispositivo.ToString())
                                                     .WithCollapseKey("NONE")
                                                     .WithJson("{\"alert\":\"Alert Text!\",\"badge\":\"7\"}"));
                        Console.WriteLine("Waiting for Queue to Finish...");

                        PushClient.StopAllServices(true);
                    }
                }
                else
                {
                    Trace.WriteLine("El PROCESO NO ARROJO NINGUN RESULTADO");
                }
            }
            catch (Exception ms)
            {
                THE_PUSTRAN objTran = new THE_PUSTRAN();
                objTran.DescTran          = "OCURRIO ERROR: " + ms.Message;
                objTran.FechaCreaEncuesta = DateTime.Now;
                MngNegocioPushTran.GuardarTranPush(objTran);
                Console.WriteLine("OCURRIO ERROR: " + ms.Message);
            }
        }
Esempio n. 3
0
 public static Boolean GuardarTranPush(THE_PUSTRAN tran)
 {
     return(NHibernateHelperORACLE.SingleSessionSave <THE_PUSTRAN>(tran));
 }