Exemplo n.º 1
0
        public static User CreateUserData(User user)
        {
            user = CreateUserResource(user);
            user = CreateUserFactor(user);
            user = AddPlanet(user);

            return user;
        }
Exemplo n.º 2
0
        private void ShowMainForm(User user)
        {
            authorisationForm.Hide();

            var form = new MainScreen(user);
            form.Show();

        }
Exemplo n.º 3
0
        public User CreateUser(UserViewModel userViewModel)
        {
            var salt = Hash.GenerateSalt();

            var newUser = new User()
            {
                Email = userViewModel.Email,
                PasswordHash = Hash.GenerateHash(userViewModel.Password, salt),
                PasswordSalt = salt,
                ResourcesUpdatedAt = DateTime.Now
            };

            newUser = UserFactory.CreateUserFactor(newUser);
            newUser = UserFactory.CreateUserResource(newUser);
            newUser = UserFactory.AddPlanet(newUser);

            return newUser;
        }
Exemplo n.º 4
0
        public static User CreateUserFactor(User user)
        {

            user.UserFactors = new List<UserFactor>();

            var factorRepository = new Repository<Factor>();

            foreach (Factor factor in factorRepository.Get())
            {
                user.UserFactors.Add(
                    new UserFactor()
                    {
                        User = user,
                        Factor = factor,
                        Value = factor.InitialValue
                    });
            }

            return user;
        }
Exemplo n.º 5
0
        public static User CreateUserResource(User user){

            user.UserResources = new List<UserResource>();

            var resorceRepository = new Repository<Resource>();

            foreach (Resource resource in resorceRepository.Get())
            {
                user.UserResources.Add(
                    new UserResource()
                    {
                        User = user,
                        Resource = resource,
                        Amount = resource.InitialValue
                    });
            }

            return user;

        }
Exemplo n.º 6
0
        public static User AddPlanet(User user)
        {
            var repo = new Repository<Planet>();

            var planet = repo.Get().Where(b => b.User == null).First();

            if (user.Planets == null)
            {
                user.Planets = new List<Planet>();
            }

            planet.User = user;
            user.Planets.Add(planet);
      
            return user;
        }
Exemplo n.º 7
0
        public MainScreen(User user)
        {
            this.user = user;

            InitializeComponent();
        }