Beispiel #1
0
        public CreditCardItemViewModel(SecureItem item, System.Windows.Media.Brush defaultColor, ImageSource defaultIcon) : base(item, defaultColor, defaultIcon)
        {
            IsDefaultImage = false;
            type           = SecurityItemsDefaultProperties.SecurityItemType_DigitalWallet;
            subType        = SecurityItemsDefaultProperties.SecurityItemSubType_DW_CreditCard;
            InitializeCollections();



            NameOnCard = item.Data.nameOnCard;
            CardNumber = item.Data.cardNumber;

            if (item.Data.expires != null)
            {
                DateTime expires = new DateTime();
                if (DateTime.TryParse(item.Data.expires, out expires))
                {
                    ExpiresMonth = expires.ToUniversalTime().Month.ToString();
                    ExpiresYear  = expires.ToUniversalTime().Year.ToString();
                }
            }
            if (item.Data.cardType != null)
            {
                SelectedCreditCard = CreditCards.FirstOrDefault(x => x.Type == item.Data.cardType);
            }


            IssuingBank  = item.Data.issuingBank;
            SecurityCode = item.Data.security_code;
            PIN          = item.Data.pin;
            IssueDate    = item.Data.issueDate;
        }
Beispiel #2
0
        public CreditCardItemViewModel(SecureItemSearchResult item, System.Windows.Media.Brush defaultColor, ImageSource defaultIcon) : base(item, defaultColor, defaultIcon)
        {
            IsDefaultImage = false;
            type           = SecurityItemsDefaultProperties.SecurityItemType_DigitalWallet;
            subType        = SecurityItemsDefaultProperties.SecurityItemSubType_DW_CreditCard;
            InitializeCollections();

            SelectedCreditCard = CreditCards.FirstOrDefault(x => x.Type == item.CreditCardType);
        }
        /// <summary>
        /// Remove um cartão de crédito da carteira
        /// </summary>
        /// <param name="number">Número do cartão</param>
        public void RemoveCreditCard(long number)
        {
            if (CreditCards.FirstOrDefault(a => a.Number == number) == null)
            {
                throw new InvalidOperationException("Cartão de crédito não encontrado");
            }

            var card = CreditCards.First(a => a.Number == number);

            _creditCards.Remove(card);
        }
Beispiel #4
0
 public CreditCard GetCreditCard(int?creditCardId) =>
 CreditCards.FirstOrDefault(i => i.CreditCardId.Equals(creditCardId));