Exemplo n.º 1
0
        public static PracticeActivation Create(DeviceInfo deviceInfo, bool activate = true)
        {
            PracticeActivation activation = null;

            activation = new PracticeActivation(deviceInfo.PracticeId, deviceInfo.Serial, deviceInfo.Model);

            if (activate)
            {
                activation.Activate();
            }

            return(activation);
        }
Exemplo n.º 2
0
        public PracticeActivation ActivateDevice(DeviceInfo deviceInfo, DeviceLocationInfo deviceLocationInfo = null)
        {
            if (IsDeviceActivated(deviceInfo.Serial))
            {
                return(Activations.FirstOrDefault(x => x.IsActive()));
            }

            if (IsDeviceExpired(deviceInfo.Serial))
            {
                var expiredDevice = Activations.FirstOrDefault(x => x.IsExpired());
                expiredDevice.Renew(deviceInfo, deviceLocationInfo);

                return(expiredDevice);
            }

            return(PracticeActivation.Create(Id, deviceInfo, deviceLocationInfo));
        }
Exemplo n.º 3
0
        public static PracticeActivation Create(Guid practiceId, DeviceInfo deviceInfo, DeviceLocationInfo deviceLocationInfo = null, bool activate = true)
        {
            PracticeActivation activation = null;

            if (null != deviceLocationInfo)
            {
                activation = new PracticeActivation(practiceId,
                                                    deviceInfo.Serial, deviceInfo.Model, deviceInfo.Code,
                                                    deviceLocationInfo.IPAddress, deviceLocationInfo.Lng, deviceLocationInfo.Lat);
            }
            else
            {
                activation = new PracticeActivation(practiceId, deviceInfo.Serial, deviceInfo.Model, deviceInfo.Code);
            }

            if (activate)
            {
                activation.Activate();
            }

            return(activation);
        }
Exemplo n.º 4
0
 public void AddActivation(PracticeActivation activation)
 {
     activation.PracticeId = Id;
     Activations.Add(activation);
 }