Ejemplo n.º 1
0
        public async Task <IActionResult> CheckBalance()
        {
            System.Security.Claims.ClaimsPrincipal currentUser = User;
            var UserId = _userManager.GetUserId(currentUser);
            // Reference logged in User
            ApplicationUser LoggedInUser = await _userManager.FindByIdAsync(UserId);

            var walletAddress = (
                from w in _context.Wallets
                where w.Username == LoggedInUser.UserName
                select w.publicAddress).FirstOrDefault();

            if (walletAddress != null)
            {
                var walletBalance = (
                    from w in _context.Wallets
                    where w.Username == LoggedInUser.UserName
                    select w.Balance).FirstOrDefault();

                _notyf.Information($"Your wallet balance is: {walletBalance}");
            }
            else
            {
                _notyf.Warning("No wallet balance recorded!", 10);
            }

            var wallet = (from w in _context.Wallets
                          where w.Username == LoggedInUser.UserName
                          select w).FirstOrDefault();

            ViewBag.walletAddress = walletAddress;
            return(View("Wallet", wallet));
        }
Ejemplo n.º 2
0
        private Block Mine(Block newBlock, int difficulty)
        {
            var leadingZeros = new string('0', difficulty);

            while (newBlock.Hash == null || newBlock.Hash.Substring(0, difficulty) != leadingZeros)
            {
                newBlock.Nonce++;
                newBlock.Hash = CalculateHash(
                    newBlock.TimeStamp,
                    newBlock.PreviousHash,
                    newBlock.Transactions,
                    newBlock.Nonce);
            }

            _notyf.Information("Mining process completed.");
            return(newBlock);
        }
Ejemplo n.º 3
0
 public IActionResult Index()
 {
     _notyf.Success("Success Notification");
     _notyf.Error("Some Error Message");
     _notyf.Information("Information Notification - closes in 4 seconds.", 4);
     _notyf.Custom("Custom Notification <br><b><i>closes in 5 seconds.</i></b></p>", 5, "indigo", "fa fa-gear");
     return(View());
 }
        public async Task <IActionResult> Logout()
        {
            await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);

            HttpContext.Session.Remove("Token");
            _notyf.Information("Đăng xuất thành công");
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 5
0
        public IActionResult Index()
        {
            var total   = 0;
            var session = HttpContext.Session.GetString(SystemConstants.CartSession);
            List <CartItemViewModel> currentCart = new List <CartItemViewModel>();

            if (session != null)
            {
                currentCart = JsonConvert.DeserializeObject <List <CartItemViewModel> >(session);
                foreach (var countQuantity in currentCart)
                {
                    total += countQuantity.Quantity;
                }
                _notyf.Information($"Có {total} trong giỏ hàng");
            }

            return(View(currentCart));
        }
Ejemplo n.º 6
0
 public IActionResult Index()
 {
     _notyf.Success("Success Notification");
     _notyf.Success("Success Notification that closes in 10 Seconds.", 3);
     _notyf.Error("Some Error Message");
     _notyf.Warning("Some Error Message");
     _notyf.Information("Information Notification - closes in 4 seconds.", 4);
     _notyf.Custom("Custom Notification - closes in 5 seconds.", 5, "whitesmoke", "fa fa-gear");
     _notyf.Custom("Custom Notification - closes in 5 seconds.", 10, "#B600FF", "fa fa-home");
     return(View());
 }
        public IActionResult Index(Klant klant)
        {
            _notyf.Information("Kies hier een contract en onderneem een actie.");
            List <Contract> contracten = klant.GetContracten();

            if (contracten == null)
            {
                return(NotFound());
            }
            return(View(contracten));
        }
Ejemplo n.º 8
0
        public IActionResult Index(int id)
        {
            Ticket  ticket  = _gebruikerRepository.GetByTicketNr(id);
            Rapport rapport = new Rapport
            {
                RapportNaam  = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                Beschrijving = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ut mi in nisi posuere varius. In pharetra, risus a sagittis pharetra, lacus massa viverra turpis,  ",
                Ticket       = ticket,
                Oplossing    = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ut mi in nisi posuere varius. In pharetra, risus a sagittis pharetra, lacus massa viverra turpis, sit amet rutrum magna augue at neque. Mauris commodo, dui eu varius tempus, elit elit lobortis tellus, ac aliquam mi diam vel ante. Etiam ac tortor vel orci laoreet viverra. Nulla lobortis commodo massa, et porta augue sodales nec. Cras sollicitudin ipsum in ante mattis, id lacinia magna dictum. Donec ut ligula et risus tempus interdum fringilla non nisl. Vestibulum non pellentesque tellus, id sagittis ex. Sed commodo semper turpis et luctus. Donec in ipsum vel nulla finibus venenatis quis ac quam. Integer sit amet dui massa. In ac ipsum consequat neque vehicula malesuada. Vestibulum in nunc risus. Morbi sodales iaculis augue aliquam volutpat. In non egestas tortor. Integer interdum congue lorem quis dictum."
            };

            _notyf.Information($"Raadpleeg hier het rapport van {ticket.Titel}");
            ViewBag.ticketnaam = ticket.Titel;
            return(View(rapport));
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> ConfirmRecruited(long id)
        {
            var learner = _context.Learner.FirstOrDefault(a => a.LearnerId == id);

            if (learner != null && learner.AppliedYn.Equals("Yes"))
            {
                learner.RecruitedYn = Const.TRUE;


                //  await SendConfirmRequitmentMail(learner);

                _context.Update(learner);
                await _context.SaveChangesAsync();
            }
            else
            {
                _notyf.Error("Please make sure you recruit Applied learners", 5);
                // return RedirectToAction("Index","Learners").WithSuccess("Not Recruited","Please make sure you recruit Applied learners");
            }

            _notyf.Information("Learner will now be placed with a company", 5);
            ViewData["JobId"] = new SelectList(_context.Jobs, "JobId", "JobTitle");
            return(RedirectToAction("Index", "Learners").WithSuccess("Recruited", "Learner will now be placed with a company"));
        }
Ejemplo n.º 10
0
        public IActionResult Index(Klant klant, bool ticketstatus, int contractid = 0)
        {
            _notyf.Information("Kies hier een ticket en onderneem een actie.", 3);
            List <Ticket> tickets = new List <Ticket>();

            ViewData["contractenKlant"] = GetContractenAsSelectList(klant, contractid);
            if (contractid != 0)
            {
                tickets = klant.GetAllActiveTicketsByContractId(contractid, ticketstatus);
                ViewBag.ContractNaam = "van " + klant.GetContractById(contractid).ContractTitel;
            }
            else
            {
                tickets = klant.GetAllActiveTickets(ticketstatus);
            }

            if (tickets == null)
            {
                return(NotFound());
            }
            tickets = tickets.OrderByDescending(x => x.LaatstGewijzigd).ToList();
            return(View(tickets));
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> Register(RegisterUserDto input)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    var messages = string.Join("; ", ModelState.Values
                                               .SelectMany(x => x.Errors)
                                               .Select(x => x.ErrorMessage));
                    throw new Exception("Please correct the following errors: " + Environment.NewLine + messages);
                }

                ViewData["Name"] = new SelectList(_roleManager.Roles, "Name", "Name", input.Role);
                input.ActiveYn   = "No";
                if (await _userManager.FindByNameAsync(input.UserName) != null ||
                    await _userManager.FindByEmailAsync(input.Email) != null)
                {
                    _notyf.Error("Username : "******" or Email : " + input.Email + " already exists", 10);
                    _logger.LogError("Username or Email already exists");
                    return(View());
                }

                _logger.LogInformation("--- Register(" + input.Email + ") Start --");

                //Create a User object
                var user = new Users {
                    UserName = input.UserName, Email = input.Email
                };
                user.ActiveYn = Const.FALSE;
                //Create a User on DB
                var result = await _userManager.CreateAsync(user, input.Password);

                /*
                 * _context.User.Update(user);
                 * await _context.SaveChangesAsync();*/
                //Add User to role
                await _userManager.AddToRoleAsync(user, input.Role);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User created a new account with password");
                    _logger.LogInformation("Send an activation email...");
                    await SendActivationMail(user);

                    if (_userManager.Options.SignIn.RequireConfirmedAccount)
                    {
                        return(View("Login"));
                    }

                    await _signInManager.SignInAsync(user, true);

                    if (await _lookUpService.GetPersonDetailsByEmail(input.Email) == null)
                    {
                        _notyf.Information("Your registration was successful", 10);
                        _logger.LogInformation("--- Register(" + input.Email + ") Create Account Start --");
                        return(RedirectToRoute("",
                                               new { controller = "Person", action = "CreateAccount" }));
                    }

                    if (_roleManager.GetRoleNameAsync(new Roles {
                        Name = input.Role
                    }).Result
                        .Equals(Const.ADMINISTRATOR_USER))
                    {
                        _logger.LogInformation("--- Register(" + input.Email + ") Person Index Start --");
                        return(RedirectToRoute("",
                                               new { controller = "Person", action = "Index" }));
                    }

                    _logger.LogInformation("--- Register(" + input.Email + ") Login Start --");
                    return(View("Login"));
                }
            }
            catch (Exception ex)
            {
                _notyf.Error("Something went wrong...");
                return(Json(new { Result = "ERROR", ex.Message }));
            }
            // If we got this far, something failed, redisplay form

            return(RedirectToPage("/Dashboard/Dashboard"));
        }