public async Task <ActionResult> BeforeEdit(BeforeEdit card, string operation) { AspNetUser user = await Utility.Util.getUser(HttpContext.User); Customer cust = await db.Customers.FindAsync(user.Id.ToString()); string card10Digits = card.cardID.Substring(0, 12); string card4Digits = card.cardID.Substring(12, 4); CreditCard foundCard = await db.CreditCards.FindAsync(card.id); if (foundCard != null) { Boolean match = false; if (Utility.Encryption.ValidateString(card10Digits, foundCard.creditCardID)) { match = true; } if (match) { return(RedirectToAction(operation, foundCard)); } } ModelState.AddModelError("", "Wrong credit card number/cvv"); return(View(card)); }
// GET: CreditCards/BeforeEdit/ public ActionResult BeforeEdit(int id, string card4Digits, string operation) { ViewBag.LastDigits = card4Digits; ViewBag.operation = operation; var model = new BeforeEdit { id = id, lastDigits = card4Digits }; return(View(model)); }
/// <summary> /// Places the currently selected node into edit mode. /// </summary> public async Task BeginEdit() { if (AllowEdit && SelectedNode != null) { // commit any other edits RootNode.Walk((x) => { x.CommitEdit(); return(true); }); // notify and allow cancel var args = new TreeNodeBeforeEditEventArgs <TItem>(SelectedNode); await BeforeEdit.InvokeAsync(args).ConfigureAwait(true); if (!args.Cancel) { SelectedNode.BeginEdit(); StateHasChanged(); } } }
/// <summary> /// Begins editing of the given item. /// </summary> public async Task BeginEditAsync() { if (AllowEdit && !IsEditing && SelectionMode != TableSelectionMode.None && Selection.Count == 1 && KeyField != null) { // find item to edit var item = ItemsToDisplay.Find(x => KeyField(x).ToString() == Selection[0]); if (item != null) { // notify and allow for cancel EditItem = item; _tableBeforeEditArgs = new TableBeforeEditEventArgs <TItem>(EditItem); await InvokeAsync(async() => await BeforeEdit.InvokeAsync(_tableBeforeEditArgs).ConfigureAwait(true)).ConfigureAwait(true); if (!_tableBeforeEditArgs.Cancel) { _editValues.Clear(); IsEditing = true; BeginEditEvent.Set(); await InvokeAsync(StateHasChanged).ConfigureAwait(true); } } } }
public void BeginEdit() { if (stateFocusedItem == null || stateEditItem != null) { return; } if (stateFocusedItem.BoundsText.Width <= 0 || stateFocusedItem.BoundsText.Height <= 0) { return; } CancelEventArgs args = new CancelEventArgs(); BeforeEdit?.Invoke(stateFocusedItem, args); if (args.Cancel) { return; } stateEditItem = stateFocusedItem; if (EnsureVisible(stateEditItem)) { Update(); } labelEdit.Text = stateEditItem.Text; labelEdit.Bounds = new Rectangle(stateEditItem.BoundsText.X, stateEditItem.BoundsText.Y + 1, stateEditItem.BoundsText.Width, stateEditItem.BoundsText.Height - 2); labelEdit.Font = itemFont; labelEdit.TextAlign = HorizontalAlignment.Left; labelEdit.Visible = true; labelEdit.Focus(); }