public void CalculateLastLogonIfLogsNotNull()
        {
            var dtOld = DateTime.Now.AddHours(-1);
            var logs  = new AuthorizationLogEntity {
                AFTime  = dtOld,
                CITime  = dtOld,
                AOLTime = dtOld,
                IOLTime = dtOld
            };
            var info = new ADUserInformation {
                Logs = logs
            };
            var value = DateTime.Now;

            info.CalculateLastLogon(value);
            Assert.That(info.LastLogOnDate, Is.EqualTo(value));

            info.Logs.AFTime = DateTime.Now.AddHours(1);

            info.CalculateLastLogon(value);
            Assert.That(info.LastLogOnDate, Is.EqualTo(null));

            info.Logs.AFTime   = null;
            info.Logs.AOLTime  = null;
            info.Logs.IOLTime  = null;
            info.LastLogOnDate = null;

            info.CalculateLastLogon(value);
            Assert.That(info.LastLogOnDate, Is.EqualTo(value));
        }
        public void App_time()
        {
            var log = new AuthorizationLogEntity {
                AFTime = new DateTime(2015, 1, 15)
            };

            Assert.AreEqual(new DateTime(2015, 1, 15), log.AppTime);
            log = new AuthorizationLogEntity {
                AFTime    = new DateTime(2015, 1, 15),
                AFNetTime = new DateTime(2015, 1, 16)
            };
            Assert.AreEqual(new DateTime(2015, 1, 16), log.AppTime);
        }
Пример #3
0
        public virtual void Setup(ISession session)
        {
            var updateLogin = String.IsNullOrEmpty(Login);

            if (updateLogin)
            {
                Login = GetTempLogin();
            }

            Enabled = true;
            if (Logs == null)
            {
                Logs = new AuthorizationLogEntity(this);
            }
            if (UserUpdateInfo == null)
            {
                UserUpdateInfo = new UserUpdateInfo(this);
            }

            var defaults = session.Query <DefaultValues>().First();

            TargetVersion = defaults.AnalitFVersion;
            UserUpdateInfo.AFAppVersion = defaults.AnalitFVersion;
            session.Save(this);
            if (updateLogin)
            {
                Login = Id.ToString();
            }
            if (String.IsNullOrEmpty(Name))
            {
                Name = Login;
            }
            session.Save(this);

            if (Client != null)
            {
                AddPrices(session, Client);
            }
        }
Пример #4
0
 public User(Service service)
     : this()
 {
     RootService = service;
     if (service is Client)
     {
         Client = (Client)RootService;
         if (Client.Payers.Count == 1)
         {
             Payer = Client.Payers.First();
         }
         WorkRegionMask  = Client.MaskRegion;
         OrderRegionMask = Client.Settings.OrderRegionMask;
     }
     else if (service is Supplier)
     {
         WorkRegionMask = ulong.MaxValue;
         Payer          = ((Supplier)service).Payer;
     }
     UserUpdateInfo = new UserUpdateInfo(this);
     Logs           = new AuthorizationLogEntity(this);
     Accounting     = new UserAccount(this);
     Registration   = new RegistrationInfo(SecurityContext.Administrator);
 }