Horoscopo
Enviado por evanescence8943 • 17 de Abril de 2013 • 728 Palabras (3 Páginas) • 356 Visitas
clase: validacion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Windows.Forms;
/// <summary>
/// </summary>
public class Validar
{
private string cedula_Id;
public Validar(string num_ced)
{
//constructor
this.cedula_Id = num_ced;
}
public Boolean proceso_verificacion()
{
int result, Dec;
Boolean ver;
int incremento_par=0, incremento_imp=0;
for (int i = 0; i <= 8; i++)
{
if (i % 2 == 1)
{
incremento_par = incremento_par + Convert.ToInt16(this.cedula_Id.Substring(i, 1));
}
else
{
int valor = Convert.ToInt16(this.cedula_Id.Substring(i, 1)) * 2;
if (valor > 9)
valor = valor - 9;
incremento_imp = incremento_imp + valor;
}
}
result = incremento_imp + incremento_par;
Dec = ((result / 10) + 1) * 10;
if (Convert.ToInt16(this.cedula_Id.Substring(9, 1)) == (Dec - result))
ver= true;
else
ver = false;
return ver;
}
...