private void CardNumber_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            char c = Convert.ToChar(e.Text);

            if (Char.IsControl(c))
            {
                ExpiryDate.Focus();
                return;
            }
            int a = CardNumber.Text.ToCharArray().Where(f => f != ' ').Count();

            if (Char.IsDigit(c) && a <= 15)
            {
                if (a % 4 == 0 && a != 0)
                {
                    CardNumber.Text          += " ";
                    CardNumber.SelectionStart = CardNumber.Text.Length;
                    CardHolderName.Focus();
                    CardNumber.Focus();
                }
                e.Handled = false;
            }
            else
            {
                e.Handled = true;
            }
        }
        private void ExpiryDate_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            char c = Convert.ToChar(e.Text);

            if (Char.IsControl(c))
            {
                CardHolderName.Focus();
                return;
            }
            int a = ExpiryDate.Text.ToCharArray().Where(f => Char.IsDigit(f)).Count();

            if (Char.IsSurrogate(c) || Char.IsDigit(c) && a <= 3)
            {
                if (a % 2 == 0 && a != 0)
                {
                    ExpiryDate.Text          += "/";
                    ExpiryDate.SelectionStart = ExpiryDate.Text.Length;
                    CardHolderName.Focus();
                    ExpiryDate.Focus();
                }
                e.Handled = false;
            }
            else
            {
                e.Handled = true;
            }
        }
Пример #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (id_ != null)
            {
                hash ^= Id.GetHashCode();
            }
            if (MaskedPan.Length != 0)
            {
                hash ^= MaskedPan.GetHashCode();
            }
            if (expirationDate_ != null)
            {
                hash ^= ExpirationDate.GetHashCode();
            }
            if (CardHolderName.Length != 0)
            {
                hash ^= CardHolderName.GetHashCode();
            }
            if (Brand != 0)
            {
                hash ^= Brand.GetHashCode();
            }
            if (IsVirtualCard != false)
            {
                hash ^= IsVirtualCard.GetHashCode();
            }
            if (virtualCardUnusedBalance_ != null)
            {
                hash ^= VirtualCardUnusedBalance.GetHashCode();
            }
            if (virtualCardAvailableOn_ != null)
            {
                hash ^= VirtualCardAvailableOn.GetHashCode();
            }
            if (virtualCardExpiresOn_ != null)
            {
                hash ^= VirtualCardExpiresOn.GetHashCode();
            }
            if (CardType != 0)
            {
                hash ^= CardType.GetHashCode();
            }
            return(hash);
        }