예제 #1
0
        public ConfirmPage()
        {
            this.InitializeComponent();

            viewModel   = (Application.Current as App).BizLogic.GetViewModel <ConfirmViewModel>();
            DataContext = viewModel;
        }
예제 #2
0
        public async Task <IActionResult> Confirm(ConfirmViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var user = await _cognitoUserManager.FindByEmailAsync(model.Email);

            if (user == null)
            {
                ModelState.AddModelError("UserNotFound", "User doesn't exist.");

                return(View(model));
            }

            var result = await _cognitoUserManager.ConfirmSignUpAsync(user, model.Code, false);

            if (result.Succeeded)
            {
                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }

            foreach (var error in result.Errors)
            {
                ModelState.AddModelError(error.Code, error.Description);
            }

            return(View(model));
        }
예제 #3
0
        public async Task <IActionResult> Confirm(ConfirmViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByEmailAsync(model.Email);

                if (user == null)
                {
                    ModelState.AddModelError("NotFound", "A user with provided e-mail was not found");
                    return(View(model));
                }

                var cognitoRef = (CognitoUserManager <CognitoUser>)_userManager;

                var result = await cognitoRef.ConfirmSignUpAsync(user, model.Code, true);

                if (result.Succeeded)
                {
                    return(RedirectToAction("Index", "Home"));
                }

                foreach (var item in result.Errors)
                {
                    ModelState.AddModelError(item.Code, item.Description);
                }
            }

            return(View(model));
        }
예제 #4
0
        public async Task <IActionResult> Confirm([FromBody] ConfirmViewModel vm,
                                                  CancellationToken cancellationToken)
        {
            SecurityToken token;

            JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
            var claims =
                new JwtSecurityTokenHandler().ValidateToken(vm.JwtTokenString, this._tokenValidationParameters,
                                                            out token);

            if (!claims.HasClaim("register", "yes"))
            {
                return(this.BadRequest());
            }

            var user = await this._users.FindByIdAsync(claims.GetSubjectId(), cancellationToken);

            user.Email         = claims.Claims.First(c => c.Type == JwtRegisteredClaimNames.Email).Value;
            user.EmailVerified = true;
            user.UserName      = claims.Claims.First(c => c.Type == JwtRegisteredClaimNames.UniqueName).Value;

            if (await this._users.CreateAsync(user, nameof(AccountController) + nameof(this.Confirm), cancellationToken) != IdentityResult.Success)
            {
                return(this.ServerError(new Exception("Create user failed")));
            }

            return(this.Ok());
        }
예제 #5
0
        public async Task <IActionResult> Reset([FromBody] ResetPwdViewModel viewModel)
        {
            if (CurrentUser.Id == viewModel.Id)
            {
                var loader = new Loader <User>()
                {
                    Id = CurrentUser.Id
                };
                await DataHandler.Execute(loader);

                if (loader.Result != null && loader.Result.EncryptedPwd == EncryptHelper.Encrypt(viewModel.Current))
                {
                    loader.Result.EncryptedPwd = EncryptHelper.Encrypt(viewModel.Replacement);

                    var persist = new Persist <User> {
                        Model = loader.Result
                    };
                    await DataHandler.Execute(persist);

                    if (persist.Confirm.Success)
                    {
                        await DataHandler.Commit();
                    }

                    return(Ok(ConfirmViewModel.CreateFromConfirm(persist.Confirm)));
                }

                return(Ok(ConfirmViewModel.CreateFailure("Password not correct")));
            }

            return(Unauthorized());
        }
예제 #6
0
        public void Execute(object parameter)
        {
            var vm = new ConfirmViewModel()
            {
                Caption = "Clear Entries?",
                Message = "Are you sure you want to clear all" +
                          " the listed entries?\n" +
                          "\nThis action cannot be undone."
            };

            var window = new ConfirmWindow
            {
                DataContext = vm,
            };
            window.ShowDialog();
            var result = vm.Result;

            if (result == ConfirmResult.Affirmative)
            {
                LocalDataService.Backup(_viewModel.Entries);
                _viewModel.Entries = new ObservableCollection<EntryViewModel>();
                LocalDataService.Save(_viewModel.Entries);
                _viewModel.Refresh();
            }
        }
예제 #7
0
        public override async Task <IActionResult> Post([FromBody] MeetingViewModel viewModel)
        {
            var model = await Parse(viewModel);

            if (AuthoriseWrite(model))
            {
                model.Participants = viewModel.Attendees.Select(f => f.Id).ToList();

                var attendCheck = new AttendCheck()
                {
                    CurrentUser  = CurrentUser,
                    DataHandler  = DataHandler,
                    LogicHandler = LogicHandler,
                    Meeting      = model
                };
                await LogicHandler.Execute(attendCheck);

                if (attendCheck.Result)
                {
                    await DataHandler.Commit();

                    return(Ok(ConfirmViewModel.CreateSuccess(attendCheck.Meeting)));
                }
                else
                {
                    return(Ok(ConfirmViewModel.CreateFailure("Failed to save Meeting")));
                }
            }

            return(Unauthorized());
        }
예제 #8
0
        public override async Task <IActionResult> Delete(string id)
        {
            var loader = new Loader <Tenant>()
            {
                Id = CurrentUser.TenantId
            };
            await DataHandler.Execute(loader);

            if (loader.Result == null)
            {
                return(NotFound());
            }

            if (AuthoriseWrite(loader.Result))
            {
                var delete = new TenantDelete()
                {
                    Id = id
                };
                await DataHandler.Execute(delete);

                if (delete.Result)
                {
                    await DataHandler.Commit();

                    return(Ok(ConfirmViewModel.CreateSuccess(id)));
                }

                return(Ok(ConfirmViewModel.CreateFailure("Failed to delete")));
            }

            return(Unauthorized());
        }
예제 #9
0
        public async Task <IHttpActionResult> ConfirmEmail(ConfirmViewModel confirmViewModel)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }
                var result = await _repo.ConfirmEmail(confirmViewModel.UserId, confirmViewModel.Code);

                if (result)
                {
                    return(Ok());
                }
                else
                {
                    ModelState.AddModelError("", "Invalid token");
                    return(BadRequest(ModelState));
                }
            }
            catch (Exception ex)
            {
                var msg = ex.Message;
                ErrorSaver.SaveError(msg);
                return(BadRequest("ConfirmEmail --- " + msg));
            }
        }
예제 #10
0
        public async Task <IActionResult> Confirm(ConfirmViewModel model)
        {
            if (User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByEmailAsync(model.Email);

                if (user is null)
                {
                    ModelState.AddModelError("Not found", "User with given email has not been found");
                    return(View(model));
                }
                var result = await(_userManager as CognitoUserManager <CognitoUser>)
                             .ConfirmSignUpAsync(user, model.Code, true);
                if (result.Succeeded)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                foreach (var item in result.Errors)
                {
                    ModelState.AddModelError(item.Code, item.Description);
                }
            }
            return(View(model));
        }
        public IActionResult Confirm(int OrderID, float TotalPrice, string NameOnCard, string CreditCardNumber, string CreditCardMonth, int CreditCardYear)
        {
            var ccNo = CreditCardNumber.Replace(" ", "");

            if (!Regex.IsMatch(ccNo, "^(?:4[0-9]{12}(?:[0-9]{3})?|[25][1-7][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$"))
            {
                return(Redirect($"/AuthOnly/Pay/{OrderID}?message=Invalid Credit Card Number"));
            }

            if (CreditCardMonth.NotIn("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"))
            {
                return(Redirect($"/AuthOnly/Pay/{OrderID}?message=Invalid Credit Card Month"));
            }

            if (CreditCardYear < DateTime.Now.Year || CreditCardYear > DateTime.Now.Year + 10)
            {
                return(Redirect($"/AuthOnly/Pay/{OrderID}?message=Invalid Credit Card Year"));
            }

            var model = new ConfirmViewModel();

            model.OrderID          = OrderID;
            model.TotalPrice       = TotalPrice;
            model.NameOnCard       = NameOnCard;
            model.CreditCardNumber = CreditCardNumber;
            model.CreditCardMonth  = CreditCardMonth;
            model.CreditCardYear   = CreditCardYear;

            return(View(model));
        }
            public WhenPostingConfirmFixture()
            {
                _apiClient = new Mock <ICommitmentsApiClient>();
                _apiClient.Setup(x => x.CreateChangeOfPartyRequest(It.IsAny <long>(), It.IsAny <CreateChangeOfPartyRequestRequest>(),
                                                                   It.IsAny <CancellationToken>())).Returns(Task.CompletedTask);

                _mapperResult = new CreateChangeOfPartyRequestRequest();

                _modelMapper = new Mock <IModelMapper>();
                _modelMapper.Setup(x => x.Map <CreateChangeOfPartyRequestRequest>(It.IsAny <ConfirmViewModel>()))
                .ReturnsAsync(_mapperResult);

                _viewModel = new ConfirmViewModel
                {
                    ApprenticeshipId                 = 123,
                    ApprenticeshipHashedId           = "DF34WG2",
                    ProviderId                       = 2342,
                    AccountLegalEntityPublicHashedId = "DFF41G",
                    NewStartDate                     = "62020",
                    NewEmployerName                  = "TestEmployerName"
                };

                var tempData = new TempDataDictionary(new DefaultHttpContext(), Mock.Of <ITempDataProvider>());

                _sut = new ApprenticeController(_modelMapper.Object, Mock.Of <ICookieStorageService <IndexRequest> >(), _apiClient.Object);

                _sut.TempData = tempData;
            }
        public async Task <IActionResult> Confirm([FromQuery] string username, [FromQuery] string code)
        {
            var user = await _userManager.FindByNameAsync(username);

            var vm = new ConfirmViewModel();

            vm.Success   = true;
            vm.ClientUrl = _configuration.GetValue <string>("ClientUrl");

            if (user == null)
            {
                vm.Success = false;
                vm.Message = $"Unable to locate user {username} to confirm";

                return(BadRequest(new { errorMessage = $"Unable to locate user {username} to confirm" }));
            }

            var result = await _userManager.ConfirmEmailAsync(user, code);

            if (!result.Succeeded)
            {
                vm.Success = false;
                vm.Message = $"Failed to confirm email";

                return(BadRequest(new { errorMessage = "Failed to confirm email" }));
            }

            return(Accepted());
        }
예제 #14
0
        public ConfirmWindow()
        {
            InitializeComponent();
            ConfirmViewModel viewModel = new ConfirmViewModel();

            DataContext = viewModel;
        }
        public async Task <IActionResult> Confirm(int?id)
        {
            if (id != null)
            {
                Worker worker = await db.Workers.FindAsync(id);

                if (worker != null)
                {
                    string guid = Guid.NewGuid().ToString();
                    HttpContext.Session.SetString("Password", guid);

                    EmailService service = new EmailService();
                    await service.SendEmailAsync(
                        email : worker.Email,
                        subject : "Подтвердите ваш аккаунт",
                        message : $"Пароль: {guid}",
                        configuration : _configuration);

                    ConfirmViewModel model = new ConfirmViewModel()
                    {
                        WorkerId = worker.Id
                    };

                    return(View(model));
                }
            }
            return(NotFound());
        }
예제 #16
0
        public async Task <IActionResult> Delete(string id)
        {
            var query = new Loader <VisibleFile> {
                Id = id
            };
            await DataHandler.Execute(query);

            if (query.Result != null && AuthoriseWrite(query.Result))
            {
                var delete = new FileDelete {
                    CloudHandler = CloudHandler, File = query.Result
                };
                await LogicHandler.Execute(delete);

                if (delete.Result.Success)
                {
                    await DataHandler.Commit();

                    return(Ok(ConfirmViewModel.CreateSuccess(id)));
                }

                return(Ok(ConfirmViewModel.CreateFailure("Failed to delete file")));
            }

            return(Unauthorized());
        }
예제 #17
0
        public async Task <ActionResult> Delete(Guid id, DeleteViewModel model)
        {
            var movementId = await mediator.SendAsync(new GetMovementIdIfExists(id, model.Number.Value));

            bool result = false;

            if (movementId.HasValue)
            {
                result = await mediator.SendAsync(new DeleteMovement(movementId.Value));

                await this.auditService.AddMovementAudit(this.mediator,
                                                         id, model.Number.Value,
                                                         User.GetUserId(),
                                                         MovementAuditType.Deleted);
            }

            var confirmModel = new ConfirmViewModel
            {
                Number         = model.Number,
                Success        = result,
                NotificationId = id
            };

            return(RedirectToAction("Confirm", confirmModel));
        }
예제 #18
0
        public async Task <IActionResult> Confirm_Post(ConfirmViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await userManager.FindByEmailAsync(model.Email).ConfigureAwait(false);

                if (user == null)
                {
                    ModelState.AddModelError("Not Found", "A user with the given email adress was not found");
                    return(View(model));
                }

                var result = await(userManager as CognitoUserManager <CognitoUser>).ConfirmSignUpAsync(user, model.Code, true).ConfigureAwait(false);

                if (result.Succeeded)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    foreach (var item in result.Errors)
                    {
                        ModelState.AddModelError(item.Code, item.Description);
                    }
                    return(View(model));
                }
            }

            return(View(model));
        }
예제 #19
0
        public async Task <IActionResult> Confirm(Guid userId, string token)
        {
            var bytes     = token.AsHex();
            var trueToken = Encoding.UTF8.GetString(bytes);

            var user = await _userManager.FindByIdAsync(userId.ToString());

            if (user is null)
            {
                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }

            var result = await _userManager.ConfirmEmailAsync(user, trueToken);

            if (result.Succeeded)
            {
                var model = new ConfirmViewModel
                {
                    UserName  = user.UserName,
                    UserEmail = user.Email
                };

                return(View(model));
            }

            return(RedirectToAction(nameof(HomeController.Index), "Home"));
        }
        public async Task <IActionResult> Confirm([FromForm] ConfirmViewModel confirmViewModel)
        {
            if (ModelState.IsValid)
            {
                var encryptedUser = modelEncryptionProvider.Encrypt(confirmViewModel);

                var foundUser = await userManager.FindByEmailAsync(encryptedUser.EmailAddress);

                return(await exceptionHandler.TryAsync <User, IActionResult>(foundUser, async(user) =>
                {
                    if (user == null || await userManager.IsEmailConfirmedAsync(user))
                    {
                        throw new UserRegistrationException("User not found or has already been verified");
                    }

                    if (await userManager.CheckPasswordAsync(user, confirmViewModel.Password) == false)
                    {
                        throw new UserRegistrationException("Email address or password invalid");
                    }
                    var token = await userManager.GenerateEmailConfirmationTokenAsync(user);
                    return Ok(Convert.ToBase64String(token.GetBytes(Encoding.UTF8).ToArray()));
                }, async(exception) => {
                    await Task.CompletedTask;
                    ModelState.AddModelError("", exception.Message);
                    return View(confirmViewModel);
                }, type => type.DescribeType <UserRegistrationException>()));
            }

            return(View(confirmViewModel));
        }
예제 #21
0
        public async Task <IActionResult> ConfirmPost(ConfirmViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByEmailAsync(model.Email);

                if (user == null)
                {
                    ModelState.AddModelError("NotFound", "A user with the given email address was not found.");
                    return(View(model));
                }

                var result = await _userManager.ConfirmEmailAsync(user, model.Code);

                if (result.Succeeded)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    foreach (var identityError in result.Errors)
                    {
                        ModelState.AddModelError(identityError.Code, identityError.Description);
                    }
                }
            }

            return(View(model));
        }
예제 #22
0
        public async Task <IActionResult> Register(ConfirmViewModel model, string returnUrl = null)
        {
            List <string> _allowedEmailDomains = new List <string> {
                "outlook.com", "hotmail.com", "gmail.com", "yahoo.com"
            };
            var emailDomain = model.Email.Split('@')[1];

            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                if (!_allowedEmailDomains.Contains(emailDomain.ToLower()))
                {
                    ModelState.AddModelError(string.Empty, "Email domain is not allowed it's should be one of these (gmail,yahoo,outlock,hotmail)");
                    return(View());
                }
                var user = new ApplicationUser {
                    FirstName = model.FirstName, LastName = model.LastName, DateOfBirth = model.DateOfBirth, Email = model.Email, UserName = model.Email, EmailConfirmed = true
                };
                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    if (!mBotAppVar.IsItInUse)
                    {
                        mBotAppVar.users.Add(new LoginViewModel()
                        {
                            Email = model.Email, LoggedInTime = DateTime.Now
                        });
                        HttpContext.Session.SetString("User", model.Email);
                        mBotAppVar.CurrentUser = model.Email;
                        mBotAppVar.LoggedInCounter++;
                        mBotAppVar.IsItInUse = true;

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

                        _logger.LogInformation("User created a new account with password.");
                        return(RedirectToAction(nameof(AccountController.UploadProfilePicture), "Account"));
                    }
                    else
                    {
                        mBotAppVar.users.Add(new LoginViewModel()
                        {
                            Email = model.Email, LoggedInTime = DateTime.Now
                        });
                        mBotAppVar.LoggedInCounter++;
                        HttpContext.Session.SetString("User", model.Email);
                        ModelState.AddModelError(string.Empty, "Main user is already logged in. You are added to waiting list instead");

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

                        _logger.LogInformation("User created a new account with password.");
                        return(RedirectToAction(nameof(AccountController.UploadProfilePicture), "Account"));
                    }
                }
                AddErrors(result);
            }

            return(View(model));
        }
        public async Task<ActionResult> Confirm(Guid id, IndexViewModel model)
        {
            var data = await mediator.SendAsync(new GetChangeNumberOfShipmentConfrimationData(id, model.Number.GetValueOrDefault()));
            var confirmModel = new ConfirmViewModel(data);
            confirmModel.NewNumberOfShipments = model.Number.GetValueOrDefault();

            return View(confirmModel);
        }
예제 #24
0
        public async Task <ActionResult> Confirm(Guid id, Guid transactionId)
        {
            var transaction = await mediator.SendAsync(new GetTransactionById(transactionId));

            var model = new ConfirmViewModel(id, transaction);

            return(View(model));
        }
        public async Task<ActionResult> Confirm(Guid id, Guid transactionId)
        {
            var transaction = await mediator.SendAsync(new GetTransactionById(transactionId));

            var model = new ConfirmViewModel(id, transaction);

            return View(model);
        }
        public async Task<ActionResult> Confirm(Guid id, ConfirmViewModel model)
        {
            await mediator.SendAsync(new ChangeUser(model.NotificationId, new Guid(model.NewUser.UserId)));

            TempData[NotificationNumberKey] = model.NotificationNumber;
            TempData[NewUserEmailKey] = model.NewUser.Email;
                        
            return RedirectToAction("Success", new { id });
        }
        public async Task <IActionResult> Confirm(ConfirmViewModel viewModel)
        {
            var apiRequest = await _modelMapper.Map <CreateChangeOfPartyRequestRequest>(viewModel);

            await _commitmentsApiClient.CreateChangeOfPartyRequest(viewModel.ApprenticeshipId, apiRequest);

            TempData[nameof(ConfirmViewModel.NewEmployerName)] = viewModel.NewEmployerName;
            return(RedirectToRoute(RouteNames.ApprenticeSent, new { viewModel.ApprenticeshipHashedId }));
        }
        public async Task <ActionResult> Confirm(Guid id, ConfirmViewModel model)
        {
            await mediator.SendAsync(new ChangeUser(model.NotificationId, new Guid(model.NewUser.UserId)));

            TempData[NotificationNumberKey] = model.NotificationNumber;
            TempData[NewUserEmailKey]       = model.NewUser.Email;

            return(RedirectToAction("Success", new { id }));
        }
        public async Task <ActionResult> Confirm(ConfirmViewModel model)
        {
            var userId = await mediator.SendAsync(new GetUserId(model.EmailAddress));

            await mediator.SendAsync(new ChangeUser(model.NotificationId, userId));

            TempData["ConfirmViewModel"] = model;

            return(RedirectToAction("Success", new { id = model.NotificationId }));
        }
예제 #30
0
        public async Task <ActionResult> Confirm(Guid id, IndexViewModel model)
        {
            var data = await mediator.SendAsync(new GetChangeNumberOfShipmentConfrimationData(id, model.Number.GetValueOrDefault()));

            var confirmModel = new ConfirmViewModel(data);

            confirmModel.NewNumberOfShipments = model.Number.GetValueOrDefault();

            return(View(confirmModel));
        }
예제 #31
0
        public ConfirmViewModel Confirm(int userid, string skuid)
        {
            var confirm = new ConfirmViewModel()
            {
                Address = storeContext.Address.FirstOrDefault(p => p.UserId == userid),
                Skus    = GetBySKUID(skuid.Split(",").Where(p => !string.IsNullOrEmpty(p)).Select(p => int.Parse(p)).ToArray()),
            };

            return(confirm);
        }
예제 #32
0
        public IActionResult Confirm(int id)
        {
            int[] seatIds = (int[])TempData["SeatIds"];
            TempData.Keep("SeatIds");
            List <int> seatNumbers = sqlTheaterData.GetSeatNumbers(seatIds);
            var        model       = new ConfirmViewModel {
                Viewing = sqlTheaterData.GetViewingById(id), SeatNumbers = seatNumbers
            };

            return(View(model));
        }
예제 #33
0
        public ActionResult ConfirmPOST()
        {
            string           newImgData      = Request.Form.Get("newImgData");
            string           originalImgData = Request.Form.Get("originalImgData");
            string           imgID           = Request.Form.Get("imageId");
            string           answerID        = Request.Form.Get("answerId");
            ConfirmViewModel model           = new ConfirmViewModel(newImgData, originalImgData, imgID, answerID);

            TempData["model"] = model;
            return(RedirectToAction("Confirm"));
        }
예제 #34
0
        public async Task <ActionResult> Confirm(ConfirmViewModel model)
        {
            await mediator.SendAsync(new SetNewNumberOfShipments(model.NotificationId, model.OldNumberOfShipments, model.NewNumberOfShipments));

            await this.auditService.AddAuditEntry(this.mediator,
                                                  model.NotificationId,
                                                  User.GetUserId(),
                                                  NotificationAuditType.Updated,
                                                  NotificationAuditScreenType.AmountsAndDates);

            return(RedirectToAction("Index", "Overview"));
        }
예제 #35
0
        public void Execute(object parameter)
        {
            var dlg = new OpenFileDialog()
            {
                Multiselect = false,
                Filter = "ManVan Entry Files|*.manvan",
                InitialDirectory = Environment.GetFolderPath(
                    Environment.SpecialFolder.Desktop),
            };
            var result = dlg.ShowDialog();
            if (result.HasValue && !result.Value)
            {
                return;
            }
            try
            {
                var path = dlg.FileName;
                var file = new FileInfo(path);
                if (!file.Exists)
                    throw new FileNotFoundException("The file does not exist.");
                var str = File.ReadAllText(file.FullName);
                var entries = _viewModel.Entries;
                var xs = new XmlSerializer(entries.GetType());
                var list = (ObservableCollection<EntryViewModel>)xs.Deserialize(new StringReader(str));
                list.ToList().ForEach(x =>
                {
                    if(!_viewModel.EntriesContainsId(x.Id))
                        entries.Add(x);
                });
                _viewModel.Refresh();
            }
            catch (Exception exception)
            {
                var vm = new ConfirmViewModel()
                {
                    Caption = "Unexpected Error",
                    Message = exception.Message,
                    NegativeVisibility = Visibility.Hidden,
                    AffirmativeLabel = "Okay",
                };

                var window = new ConfirmWindow
                {
                    DataContext = vm,
                };
                window.ShowDialog();
            }
        }
예제 #36
0
        public async Task<ActionResult> Confirm(Guid id, ConfirmViewModel model)
        {
            object result;
            if (TempData.TryGetValue(SubmittedMovementListKey, out result))
            {
                var selectedMovements = result as List<ImportCancelMovementData>;

                TempData[SubmittedMovementListKey] = selectedMovements;

                await mediator.SendAsync(new CancelImportMovements(selectedMovements));

                return RedirectToAction("Success");
            }

            return RedirectToAction("Index");
        }
예제 #37
0
        public void Execute(object parameter)
        {
            var dlg = new SaveFileDialog()
            {
                DefaultExt = "manvan",
                Filter = "ManVan Entry Files|*.manvan",
                RestoreDirectory = true,
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                FileName = "manvan_" + DateTime.Now.ToString("yyyy-MM-dd"),
            };
            var result = dlg.ShowDialog();
            if (result.HasValue && !result.Value)
            {
                return;
            }
            try
            {
                var entries = _viewModel.Entries;

                var xs = new XmlSerializer(entries.GetType());

                var path = dlg.FileName;

                using (TextWriter writer = new StreamWriter(path))
                {
                    xs.Serialize(writer, entries);
                }
            }
            catch (Exception exception)
            {
                var vm = new ConfirmViewModel()
                {
                    Caption = "Unexpected Error",
                    Message = exception.Message,
                    NegativeVisibility = Visibility.Hidden,
                    AffirmativeLabel = "Okay",
                };

                var window = new ConfirmWindow
                {
                    DataContext = vm,
                };
                window.ShowDialog();
            }
        }
예제 #38
0
        public async Task<ActionResult> Delete(Guid id, DeleteViewModel model)
        {
            var movementId = await mediator.SendAsync(new GetImportMovementIdIfExists(id, model.Number.Value));
            bool result = false;

            if (movementId.HasValue)
            {
                result = await mediator.SendAsync(new DeleteMovement(movementId.Value));
            }

            var confirmModel = new ConfirmViewModel
            {
                Number = model.Number,
                Success = result,
                NotificationId = id
            };

            return RedirectToAction("Confirm", confirmModel);
        }
예제 #39
0
        private void Cancel_OnClick(object sender, RoutedEventArgs e)
        {
            var vm = new ConfirmViewModel()
            {
                NegativeLabel = "No",
                AffirmativeLabel = "Yes",
                Caption = "Cancel New Entry?",
                Message = "Are you sure you want to cancel this new entry?"
            };

            var window = new ConfirmWindow
            {
                DataContext = vm,
            };

            window.ShowDialog();
            if (vm.Result == ConfirmResult.Negative) return;
            DialogResult = false;
            Close();
        }
예제 #40
0
        public ActionResult Confirm(Guid id)
        {
            object result;
            if (TempData.TryGetValue(SubmittedMovementListKey, out result))
            {
                var selectedMovements = result as List<ImportCancelMovementData>;

                var model = new ConfirmViewModel
                {
                    NotificationId = id,
                    SelectedMovements = selectedMovements
                };

                TempData[SubmittedMovementListKey] = selectedMovements;

                return View(model);
            }

            return RedirectToAction("Index");
        }
예제 #41
0
        private void Delete_OnClick(object sender, RoutedEventArgs e)
        {
            var vm = new ConfirmViewModel()
            {
                NegativeLabel = "No",
                AffirmativeLabel = "Yes",
                Caption = "Delete Entry?",
                Message = "Are you sure you want to delete this entry?\n" +
                          "This action cannot be undone."
            };

            var window = new ConfirmWindow
            {
                DataContext = vm,
            };

            window.ShowDialog();

            if (vm.Result == ConfirmResult.Negative) return;
            DialogResult = false;
            Close();
        }
        public async Task<ActionResult> Confirm(ConfirmViewModel model)
        {
            await mediator.SendAsync(new DeleteTransaction(model.TransactionId));

            return RedirectToAction("Index", "AccountManagement");
        }
        public ActionResult Confirm(ConfirmViewModel model)
        {
            mediator.SendAsync(new SetNewNumberOfShipments(model.NotificationId, model.OldNumberOfShipments, model.NewNumberOfShipments));

            return RedirectToAction("Index", "Overview");
        }
예제 #44
0
 public ActionResult Confirm(ConfirmViewModel model)
 {
     return View(model);
 }