Пример #1
0
 public UserServices(UserManager pUserManager)
 {
     _userManager = pUserManager;
     _tellerManager = new TellerManager();
     roleServices = ServicesProvider.GetInstance().GetRoleServices();
     branchServices = ServicesProvider.GetInstance().GetBranchService();
 }
Пример #2
0
 public UserServices(User pUser, string pTestDb)
 {
     _userManager = new UserManager(pTestDb);
     _tellerManager = new TellerManager(pTestDb);
     roleServices = ServicesProvider.GetInstance().GetRoleServices();
     branchServices = ServicesProvider.GetInstance().GetBranchService();
 }
Пример #3
0
        private void LoadUsers()
        {
            if (_users != null)
            {
                return;
            }
            LoadSubordinateRel();
            LoadBranchRel();
            _users = _userManager.SelectAll();
            RoleServices  rs = ServicesProvider.GetInstance().GetRoleServices();
            BranchService bs = ServicesProvider.GetInstance().GetBranchService();

            rs = rs ?? new RoleServices(_user);
            foreach (User user in _users)
            {
                user.UserRole = rs.Find(user);

                if (_subordinateRel.ContainsKey(user.Id))
                {
                    List <int> subIds = _subordinateRel[user.Id];
                    foreach (int id in subIds)
                    {
                        user.AddSubordinate(Find(id));
                    }
                }

                if (_branchRel.ContainsKey(user.Id))
                {
                    List <int> ids = _branchRel[user.Id];
                    foreach (int id in ids)
                    {
                        user.AddBranch(bs.FindById(id));
                    }
                }
            }
        }