Esempio n. 1
0
        public void InsertInventoryUser(InventoryUserColumnModel model)
        {
            try
            {
                using (this.unitOfWork)
                {
                    InventoryUser item = new InventoryUser()
                    {
                        Username   = model.Username,
                        Password   = model.Password,
                        Firstname  = model.Firstname,
                        Lastname   = model.Lastname,
                        IsAdmin    = model.IsAdmin,
                        IsApprover = model.IsApprover,
                        IsVisitor  = model.IsVisitor,
                        IsDeleted  = model.IsDeleted
                    };

                    this.unitOfWork.Context.AddToInventoryUser(item);
                    string action = string.Format("Added new User - {0}", item.Username);
                    this.actionLogController.AddToLog(action, UserInfo.UserId);
                    this.unitOfWork.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> OnPostAsync(string returnUrl = null)
        {
            returnUrl = returnUrl ?? Url.Content("~/");
            if (ModelState.IsValid)
            {
                var user = new InventoryUser {
                    UserName = Input.UserName
                };
                var result = await _userManager.CreateAsync(user, Input.Password);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User created a new account with password.");

                    await _signInManager.SignInAsync(user, isPersistent : false);

                    return(LocalRedirect(returnUrl));
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
            }

            // If we got this far, something failed, redisplay form
            return(Page());
        }
Esempio n. 3
0
 private void Start()
 {
     InventoryUser[] players = FindObjectsOfType <InventoryUser>();
     if (players.Length > 1)
     {
         Debug.LogWarning("Multiple Players Foudn!");
     }
     player         = FindObjectsOfType <InventoryUser>()[0];
     dialogueSource = FindObjectOfType <DialogueSystem>();
 }
Esempio n. 4
0
    void Awake()
    {
        charController = GetComponent <CharController> ();
        // TODO: make component HeadingTransform and put it on child object. Here call GetComponentInChildren <HeadingTransform> ();
        headingTransform          = transform.GetChild(0);
        inventoryUser             = GetComponentInChildren <InventoryUser> ();
        collisionTracker          = GetComponent <CollisionContactsTracker> ();
        collisionDamageDispatcher = GetComponent <CollisionDamageDispatcher> ();
        soundPlayer = GetComponentInChildren <SoundPlayer> ();

        contactsLayerMask = PhysicsHelper.GetLayerCollisionMask(gameObject.layer);
    }
Esempio n. 5
0
        public async Task <IActionResult> OnPostAsync(string returnUrl = null)
        {
            returnUrl      = returnUrl ?? Url.Content("~/");
            ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
            if (ModelState.IsValid)
            {
                var user = new InventoryUser {
                    UserName = Input.Email, Email = Input.Email
                };
                var result = await _userManager.CreateAsync(user, Input.Password);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User created a new account with password.");

                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
                    var callbackUrl = Url.Page(
                        "/Account/ConfirmEmail",
                        pageHandler: null,
                        values: new { area = "Identity", userId = user.Id, code = code },
                        protocol: Request.Scheme);

                    await _emailSender.SendEmailAsync(Input.Email, "Confirm your email",
                                                      $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");

                    if (_userManager.Options.SignIn.RequireConfirmedAccount)
                    {
                        return(RedirectToPage("RegisterConfirmation", new { email = Input.Email }));
                    }
                    else
                    {
                        await _signInManager.SignInAsync(user, isPersistent : false);

                        return(LocalRedirect(returnUrl));
                    }
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
            }

            // If we got this far, something failed, redisplay form
            return(Page());
        }
Esempio n. 6
0
 public void LoadUserDetails()
 {
     if (UserId != 0)
     {
         InventoryUser u = this.inventoryUserController.FetchInventoryUserById(UserId);
         IdTextbox.Text             = u.Id.ToString();
         UsernameTextbox.Text       = u.Username;
         FirstnameTextbox.Text      = u.Firstname;
         LastnameTextbox.Text       = u.Lastname;
         IsAdminCheckbox.Checked    = u.IsAdmin.HasValue ? u.IsAdmin.Value : false;
         IsApproverCheckbox.Checked = u.IsApprover.HasValue ? u.IsApprover.Value : false;
         IsVisitorCheckbox.Checked  = u.IsVisitor.HasValue ? u.IsVisitor.Value : false;
     }
     else
     {
         ClearForm();
     }
 }
Esempio n. 7
0
 void Awake()
 {
     animator      = GetComponentInChildren <Animator> ();
     inventoryUser = GetComponentInChildren <InventoryUser> ();
     soundPlayer   = GetComponentInChildren <SoundPlayer> ();
 }
Esempio n. 8
0
 public virtual void SetUser(InventoryUser user)
 {
     _user = user;
 }