Пример #1
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);
            }
        }
Пример #2
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);
 }