Ejemplo n.º 1
0
        public void CleanRelation(int deviceId)
        {
            if (_dictionaryByDeviceId.ContainsKey(deviceId))
            {
                if (_dictionaryByDeviceId.ContainsKey(deviceId))
                {
                    Model.Entity.Device device = Get(deviceId);
                    _dictionaryByDeviceId[deviceId].IsGuard = false;
                    lock (device)
                    {
                        DeviceContact.GetInstance().CleanByDeviceId(deviceId);  //删除联系人
                        GeoFence.GetInstence().CleanByDeviceId(deviceId);       //删除电子围栏
                        SchoolGuardian.GetInstance().CleanByDeviceId(deviceId); //删除上学守护
                        DeviceSet.GetInstance().Del(deviceId);                  //删除配置信息

                        //删除绑定号用户
                        User.GetInstance().DelByBindNumber(device.BindNumber);
                        User.GetInstance().DelReal(device.UserId);
                        UserDevice.GetInstance().DelDevice(deviceId); //删除关联信息

                        //清理消息
                        Notification.GetInstance().CleanByDeviceId(deviceId);
                        DeviceException.GetInstance().CleanByDeviceId(deviceId);
                        DeviceSMS.GetInstance().CleanByDeviceId(deviceId);
                        DeviceVoice.GetInstance().CleanByDeviceId(deviceId);
                        DevicePhoto.GetInstance().CleanByDeviceId(deviceId);
                        DeviceState.GetInstance().CleanByDeviceId(deviceId);
                        DeviceFriend.GetInstance().DelDevice(deviceId);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static DeviceFriend GetInstance()
        {
            if (_object == null)
            {
                lock (LockHelper)
                {
                    if (_object == null)
                    {
                        _object = new DeviceFriend();
                    }
                }
            }

            return(_object);
        }