Created
November 12, 2014 16:52
-
-
Save dutchand/2b9816262d8b2da6a2b1 to your computer and use it in GitHub Desktop.
ID Validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Modulos.Validacion | |
{ | |
public class ValidacionClase | |
{ | |
public static function ValidarCarnet(ci:String):Boolean | |
{ | |
var bandera:Boolean = false; | |
if(ci.length == 11) | |
{ | |
var dia:int = Number(ci.substr(4,2)); | |
var mes:int = Number(ci.substr(2,2)); | |
var year:int = Number(ci.substr(0,2)); | |
if(mes >= 1 && mes <= 12) | |
{ | |
if(mes == 2){ | |
if( ( dia >=1 && dia <=28 || dia == 29) && year % 4 == 0 ) | |
bandera = true; | |
} | |
else if(mes == 4 || mes == 6 || mes == 9 || mes == 11) | |
{ | |
if(dia >= 1 && dia <= 30) | |
bandera = true; | |
} | |
else if(mes == 1 || mes == 3 || mes == 5 || mes == 7 || mes == 8 || mes == 10 || mes == 12 ) | |
{ | |
if(dia >= 1 && dia <= 31) | |
bandera = true; | |
} | |
} | |
} | |
return bandera; | |
} | |
// Funcion para mostrar el icono de advertencia | |
public static function IconoAlertaAdvertencia():Class | |
{ | |
[Embed(source="icons/Advertencia.png")] | |
var Advertencia:Class; | |
return Advertencia; | |
} | |
// Funcion para mostrar el icono de error | |
public static function IconoAlertaError():Class | |
{ | |
[Embed(source="icons/Error.png")] | |
var Error:Class; | |
return Error; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment