Ejemplo n.º 1
0
        public async Task ConfirmAsync(ConfirmUser command)
        {
            var user = await _dbContext.Users
                       .FirstOrDefaultAsync(x =>
                                            x.Id == command.Id &&
                                            x.Status == UserStatusType.Pending);

            if (user == null)
            {
                throw new DataException($"User with Id {command.Id} not found.");
            }

            user.Confirm();

            var userIdForEvent = command.UserId == Guid.Empty
                ? user.Id
                : command.UserId;

            _dbContext.Events.Add(new Event(command.SiteId,
                                            userIdForEvent,
                                            EventType.Confirmed,
                                            typeof(User),
                                            command.Id));

            await _dbContext.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        protected override string GetBody()
        {
            ConfirmUser template = new ConfirmUser(this.NewUser, this.Url);
            string      body     = template.TransformText();

            return(body);
        }
Ejemplo n.º 3
0
 public int getaddGoods(string itemNum, string itemName, string itemDescription, string hashCode)
 {
     if (!ConfirmUser.testUser(hashCode))
     {
         return(-1);
     }
     else
     {
         return(goods.addGoods(itemNum, itemName, itemDescription));
     }
 }
Ejemplo n.º 4
0
 public int getaddStockChange(int goodsId, int wareHouseId, int number, String hashCode)
 {
     if (!ConfirmUser.testUser(hashCode))
     {
         return(-1);
     }
     else
     {
         return(stock.addStock(goodsId, wareHouseId, number));
     }
 }
Ejemplo n.º 5
0
 public int getaddWareHouse(string wareHouseName, string wareHouseDescription, string hashCode)
 {
     if (!ConfirmUser.testUser(hashCode))
     {
         return(-1);
     }
     else
     {
         return(ware.addWareHouse(wareHouseName, wareHouseDescription));
     }
 }
        public IActionResult UpdatePasswordInfo(IndexView user, int id)
        {
            ConfirmUser confirm_new = user.NewUser;

            confirm_new.password = user.NewUser.password;

            if (confirm_new.password == confirm_new.confirm_password)
            {
                PasswordHasher <User> hasher = new PasswordHasher <User>();
                string hashed = hasher.HashPassword(confirm_new, confirm_new.password);

                User update_user_password = _context.users.SingleOrDefault(u => u.user_id == id);
                update_user_password.password = hashed;
                _context.SaveChanges();
                return(RedirectToAction("Admin", "Dashboard"));
            }
            IndexView model = new IndexView();

            model.User         = new User();
            model.User.user_id = user.NewUser.user_id;
            _context.SaveChanges();
            return(View("ShowUserInfo", model));
        }
Ejemplo n.º 7
0
        public void confUserMethod()
        {
            ConfirmUser _ConfirmUser = new ConfirmUser();



            _ConfirmUser.DataContext = new ConfirmUserViewModel();



            try

            {
                _ConfirmUser.ShowDialog();
                Users.Clear();
                ListOfUsers = con.GetUsers();
                Users       = OneTimeUsers;
                foreach (var a in ListOfUsers)
                {
                    OneTimeUsers.Add(a.userFIO);
                }
            }
            catch { }
        }
Ejemplo n.º 8
0
 public void Run(User user, ConfirmUser command)
 {
     user.Confirm();
 }