/// <summary> /// Retrieves the existing cards for the user in the context. /// </summary> /// <returns> /// The list of InternalCard objects corresponding to the user's existing cards. /// </returns> public IEnumerable <InternalCard> RetrieveUserCards() { Context.Log.Verbose("Retrieving list of cards belonging to user {0}", ((User)Context[Key.User]).GlobalId); IEnumerable <InternalCard> result = CardOperations.RetrieveCards(); Context.Log.Verbose("{0} cards were retrieved from the data store.", result.Count()); return(result); }
public Task RemoveCardOperation(CardOperationModel cardOperation) { if (CardOperations.Contains(cardOperation)) { CardOperations.Remove(cardOperation); } return(Task.CompletedTask); }
private void AddCardOperationsToModelCollection(List <CardOperation> operations) { foreach (var op in operations) { var newCardOperationModel = new CardOperationModel(); _mapper.Map <CardOperation, CardOperationModel>(op, newCardOperationModel); CardOperations.Add(newCardOperationModel); } }
private async Task <BankDataSheet> GetCardData(string cardNumber, DateTime startDate, DateTime endDate) { this.sessionId = await this.LoginAndGetSessionId(); CardOperations cardOperations = new CardOperations(this.client, this.sessionId, this.sequence); XDocument document = await cardOperations.GetCardData(cardNumber, startDate, endDate); this.oldDataManager.StoreData(document, cardNumber); return(this.xmlTransformer.TransformXml(document)); }
public async Task LoadData() { var operations = await _dbLogicManager.GetLastOperations(30); var categories = await _dbLogicManager.GetAllCategories(); CardOperations.Clear(); AddCardOperationsToModelCollection(operations); AddCategoriesToModelCollection(categories); }
/// <summary> /// Sends notification to a user upon redemption of a deal. /// </summary> public override void SendNotification() { if (TransactionMetNotificationThreshold()) { IEnumerable <InternalCard> cards = CardOperations.RetrieveCardsByPartnerCardId(); foreach (InternalCard internalCard in cards) { Send(internalCard.GlobalUserId, CommerceServiceConfig.Instance.Environment); } } }
public async Task SaveNewOperation() { var cardOperation = _mapper.Map <CardOperation>(NewCardOperation); var savedOperation = await _dbLogicManager.AddNewOperation(cardOperation); var savedOperationModel = _mapper.Map <CardOperationModel>(savedOperation); CardOperations.Insert(0, savedOperationModel); NewCardOperation.Clean(); IsNewCardOperationBeingAdded = false; }
private void UpdateViewModelAfterImport(List <CardOperation> operations) { CardOperations.Clear(); foreach (var op in operations) { var newCardOperationModel = new CardOperationModel(); _mapper.Map <CardOperation, CardOperationModel>(op, newCardOperationModel); newCardOperationModel.UserDefinedName = op.OriginalName; CardOperations.Add(newCardOperationModel); } DataImported = true; }
/// <summary> /// Retrieves the card with the specified ID. /// </summary> /// <returns> /// * The specified card if it exists. /// * Else returns null. /// </returns> public Card RetrieveCard() { Card result; Context.Log.Verbose("Retrieving specified Card from the data store."); result = CardOperations.RetrieveCard(); if (result != null) { Context.Log.Verbose("Specified Card retrieved from data store."); } else { Context.Log.Verbose("Specified Card does not exist within the data store."); } return(result); }
private async void Reader_CardAdded(SmartCardReader sender, CardAddedEventArgs args) { await SharedState.LogAsync($"BackgroundScanner ({_taskInstance.InstanceId}): CardAdded event fired."); try { TravelCard card = await CardOperations.ReadTravelCardAsync(args.SmartCard); if (card != null) { await SharedState.LogAsync($"BackgroundScanner ({_taskInstance.InstanceId}): Successful read card."); Task updateCardTask = SharedState.SetAsync(SharedState.LastSeenCard, card.RawValues); await SharedState.LogAsync($"BackgroundScanner ({_taskInstance.InstanceId}): LastSeenCard updated."); Task updateTimestampTask = SharedState.SetAsync(SharedState.LastSeenTimestamp, DateTimeOffset.UtcNow); await SharedState.LogAsync($"BackgroundScanner ({_taskInstance.InstanceId}): LastSeenTimestamp updated."); if (await SharedState.GetAsync <bool>(SharedState.IsApplicationInForeground)) { await SharedState.LogAsync($"BackgroundScanner ({_taskInstance.InstanceId}): Application is in the foreground. Changed Progress value."); _taskInstance.Progress = 2; } else { await SharedState.LogAsync($"BackgroundScanner ({_taskInstance.InstanceId}): Application is in the background. Post toast notification."); PostToastNotification(card); } } } catch (Exception ex) { await SharedState.LogAsync($"BackgroundScanner ({_taskInstance.InstanceId}): Failed to read travel card! Exception: {ex}\nStack trace: {ex.StackTrace}"); } }
public async Task RemoveCardOperation(CardOperationModel cardOperation) { await _dbLogicManager.RemoveCardOperationById(cardOperation.Id); CardOperations.Remove(cardOperation); }