示例#1
0
        private static void SetMainConfigurations()
        {
            Languages = LanguageMapper.ConvertToBusinessLogicEntitiesCollection(LanguageAdapter.GetAll()).ToList();

            UserMapper.Update(Languages);

            DalUser dalUser;
            var     dalUsers   = UserAdapter.GetAll($"login='******'");
            var     enumerable = dalUsers.ToList();

            if (enumerable.Count() == 0)
            {
                throw new ArgumentException(Properties.strings.userNotExist);
            }

            if (enumerable.ElementAt(0).Password == ConfigurationManager.User().Password)
            {
                dalUser = enumerable.ElementAt(0);
            }
            else
            {
                throw new ArgumentException(Properties.strings.wrongPassword);
            }
            User = UserMapper.ConvertToBusinessLogicEntity(dalUser);
            User.SetDetails(UserDetailsMapper.ConvertToBusinessLogicEntity(UserDetailsAdapter.GetById(dalUser.DetailsId)));

            Language = Languages.Where(l => l.Id == User.Language.Id).First();
        }