credit card validation in csharp

Code Example - credit card validation in csharp

                
                        public bool IsValidCard()
{
    if (txtCardNumber.Text.StartsWith("1298") ||
        txtCardNumber.Text.StartsWith("1267") ||
        txtCardNumber.Text.StartsWith("4512") ||
        txtCardNumber.Text.StartsWith("4567") ||
        txtCardNumber.Text.StartsWith("8901") ||
        txtCardNumber.Text.StartsWith("8933"))
    {
        if (Regex.Replace(txtCardNumber.Text, @"\s+", "").Length == 16)
        {
            return true;
        }
    }
    return false;
}//end IsValidCard()

public bool IsValidSecurityCode()
{
    bool isValid = Regex.Match(txtSecurityCode.Text, @"^\d{3}%%%~COMPRESS~PRE~0~%%%quot;).Success;
    return isValid;
}//end IsValidSecurityCode()

public bool IsValidExpiration()
{
    string[] date = Regex.Split(txtExpiration.Text, "/");
    string[] currentDate = Regex.Split(DateTime.Now.ToString("MM/yyyy"), "/");
    int compareYears = string.Compare(date[1], currentDate[1]);
    int compareMonths = string.Compare(date[0], currentDate[0]);

    //if expiration date is in MM/YYYY format
    if (Regex.Match(txtExpiration.Text, @"^\d{2}/\d{4}%%%~COMPRESS~PRE~0~%%%quot;).Success)
    {
        //if month is "01-12" and year starts with "20"
        if (Regex.Match(date[0], @"^[0][1-9]|[1][0-2]%%%~COMPRESS~PRE~0~%%%quot;).Success)
        {
            //if expiration date is after current date
            if ((compareYears == 1) || (compareYears == 0 && (compareMonths == 1)))
            {
                return true;
            }
        }
    }
    return false;
}//end IsValidExpiration