Exemplo n.º 1
0
        private void DeleteBaseStationFromAccount(RESTRequestStatus response, String sessionid, BaseStation baseStation, string devicetoken)
        {
            SilentNotification notification = null;

            List <string> devicesTokens;

            if (DataLayer.DeleteBaseStation(response, baseStation))
            {
                if (DataLayer.GetBaseStationsWithSessionId(response, sessionid))
                {
                    response.statuscode = RESTRequestStatusCode.success;
                    response.status     = RESTRequestStatusCode.success.ToString( );

                    notification = new SilentNotification(baseStation);

                    notification.NotificationType = Constants.delete;

                    DataLayer.GetDeviceTokensForAccount(baseStation.AccountNo, out devicesTokens);

                    devicesTokens.Remove(devicetoken);

                    if (devicesTokens.Count > 0)
                    {
                        Task.Factory.StartNew(() => { NotificationController.PushNotification(notification, devicesTokens); });
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void AssociateBaseStationWithAccount(RESTRequestStatus response, String sessionid, BaseStation baseStation, String devicetoken)
        {
            SilentNotification notification = null;
            Int64         accountNo         = 0;
            List <string> devicesTokens;


            if (DataLayer.AssociateBaseStationWithAccount(response, sessionid, baseStation))
            {
                if (DataLayer.GetBaseStationsWithSessionId(response, sessionid))
                {
                    accountNo = DataLayer.GetAccountNoUsingSessionId(sessionid);

                    response.statuscode = RESTRequestStatusCode.success;
                    response.status     = RESTRequestStatusCode.success.ToString( );

                    notification = new SilentNotification(baseStation);

                    notification.NotificationType = Constants.add;

                    DataLayer.GetDeviceTokensForAccount(accountNo, out devicesTokens);

                    if (devicesTokens == null)
                    {
                        return;
                    }

                    devicesTokens.Remove(devicetoken);

                    if (devicesTokens.Count > 0)
                    {
                        Task.Factory.StartNew(() => { NotificationController.PushNotification(notification, devicesTokens); });
                    }
                }
            }
        }