public HttpResponseMessage Put(FormDataCollection form) { Identificacion identificacion = new Identificacion(); identificacion.Numero1 = form.Get("Numero"); identificacion.Tipo1 = form.Get("Tipo"); string[] respuesta = new string[2]; respuesta[0] = identificacion.Insert_Identificacion(); respuesta[1] = form.Get("Numero"); HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta); return(response); }
public HttpResponseMessage Delete(FormDataCollection form) { Persona persona = new Persona(); Identificacion identificacion = new Identificacion(); identificacion.Numero1 = form.Get("IdentificacionPersona"); persona.IdentificacionNumero1 = identificacion; string[] respuesta = new string[2]; respuesta[0] = persona.Delete_Persona(); respuesta[1] = form.Get("IdentificacionPersona"); HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta); return(response); }
public bool crearIdentificacion(Identificacion identificacion) { using (var db = new MapeoIdentificacion()) { int resultado = db.identificacion.Where(x => x.Id == identificacion.Id).Count(); if (resultado == 0) { db.identificacion.Add(identificacion); db.SaveChanges(); return(true); } else { return(false); } } }
public bool ValidarIdentificacion(int?personaId, int tipoIdentificacion, string identificacion, out string mensaje) { //Creacion de Persona var existeIdentificacion = _repositoryPersona.GetQuery(p => p.Identificacion.Equals(identificacion) && (!personaId.HasValue || personaId != p.Id)).Any(); if (existeIdentificacion) { mensaje = "Ya existe una persona registrada con la identificación: " + identificacion; return(false); } var tipoDocumento = _iCatalogoService.GetItem(tipoIdentificacion); switch (tipoDocumento.Codigo) { case ConstantesCatalogos.ITM_TIPO_DOC_CED: var esValida = Identificacion.CedulaEsValida(identificacion); if (!esValida) { mensaje = "La identificación " + identificacion + " de tipo Cédula no es Valida."; return(false); } break; case ConstantesCatalogos.ITM_TIPO_DOC_RUC: esValida = Identificacion.RucEsValido(identificacion); if (!esValida) { mensaje = "La identificación " + identificacion + " de tipo Ruc no es Valida."; return(false); } break; case ConstantesCatalogos.ITM_TIPO_DOC_PAS: esValida = Identificacion.PasaporteEsValido(identificacion); if (!esValida) { mensaje = "La identificación " + identificacion + " de tipo Pasaporte no es Valida."; return(false); } break; } mensaje = null; return(true); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (IdTipoIdentificacion == 1) { var cad = Identificacion.ToString(); var total = 0; var longitud = cad.Length; var longcheck = longitud - 1; if (cad != "" && longitud == 10) { for (int i = 0; i < longcheck; i++) { if (i % 2 == 0) { var aux = int.Parse(cad.Substring(i, 1)) * 2; if (aux > 9) { aux -= 9; } total += aux; } else { total += int.Parse(cad.Substring(i, 1)); // parseInt o concatenará en lugar de sumar } } total = total % 10; total = 10 - total; if (int.Parse(cad.Substring(longitud - 1, 1)) != total) { yield return (new ValidationResult(errorMessage: "La cédula no es válida", memberNames: new[] { "Identificacion" })); } } } }
public HttpResponseMessage Put(FormDataCollection form) { Persona persona = new Persona(); persona.Nombre1 = form.Get("NombrePersona"); Identificacion identificacion = new Identificacion(); identificacion.Numero1 = form.Get("IdentificacionPersona"); persona.IdentificacionNumero1 = identificacion; persona.NombreComercial1 = form.Get("NombreComercial"); Ubicacion ubicacionid = new Ubicacion(); ubicacionid.ID1 = Convert.ToInt32(form.Get("UbicacionPersona")); persona.UbicacionID1 = ubicacionid; TelefonoFax telefono = new TelefonoFax(); telefono.NumTelefono1 = Convert.ToInt32(form.Get("TelefonoPersona")); persona.TelefonoNumero1 = telefono; TelefonoFax fax = new TelefonoFax(); fax.NumTelefono1 = Convert.ToInt32(form.Get("FaxPersona")); persona.FaxNumero1 = fax; persona.CorreoElectronico1 = form.Get("CorreoPersona"); string[] respuesta = new string[2]; respuesta[0] = persona.Insert_Persona(); respuesta[1] = form.Get("IdentificacionPersona"); HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta); return(response); }
public ActionResult Delete(short id) { try { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IIdentificacionApiConsumer.SetAuthHeader(_tokenManager.Token); Identificacion varIdentificacion = null; if (id.ToString() != "0") { string where = ""; } var result = _IIdentificacionApiConsumer.Delete(id, null, null).Resource; return(Json(result, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public HttpResponseMessage Post(FormDataCollection form) { Factura factura = new Factura(); factura.CodigoActividad1 = form.Get("CodActividad"); factura.Clave1 = form.Get("Clave"); factura.NumeroConsecutivo1 = form.Get("NumConsecutivo"); factura.FechaEmision1 = Convert.ToDateTime(form.Get("FechaEmision")); Identificacion idemisor = new Identificacion(); idemisor.Numero1 = form.Get("Emisor"); Persona emisor = new Persona(); emisor.IdentificacionNumero1 = idemisor; factura.EmisorPersona1 = emisor; Identificacion idreceptor = new Identificacion(); idreceptor.Numero1 = form.Get("Receptor"); Persona receptor = new Persona(); receptor.IdentificacionNumero1 = idreceptor; factura.ReceptorPersona1 = receptor; factura.CondicionVenta1 = form.Get("CondVenta"); factura.PlazoCredito1 = form.Get("PlazoCredito"); factura.MedioPago1 = form.Get("MedioPago"); string[] respuesta = new string[2]; respuesta[0] = factura.Update_Factura(); respuesta[1] = form.Get("Clave"); HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta); return(response); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (DateTime.Now < FechaNacimiento.AddYears(16).Date) { yield return (new ValidationResult(errorMessage: "La persona debe tener más de 16 años", memberNames: new[] { "FechaNacimiento" })); } if (IdTipoIdentificacion == 1) { var cad = Identificacion.ToString(); var longitud = cad.Length; var longcheck = longitud - 1; if (cad != "" && longitud != 10) { yield return (new ValidationResult(errorMessage: "La cédula no es válida", memberNames: new[] { "Identificacion" })); } } }
public void TarjetaDeIdentidadDebeSerNumerica() { Assert.AreEqual("TI 79879078", Identificacion.Crear("TI", "79879078").ToString()); }
/// <summary> /// Returns true if Convenio instances are equal /// </summary> /// <param name="other">Instance of Convenio to be compared</param> /// <returns>Boolean</returns> public bool Equals(Convenio other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( NombreProveedor == other.NombreProveedor || NombreProveedor != null && NombreProveedor.Equals(other.NombreProveedor) ) && ( Identificacion == other.Identificacion || Identificacion != null && Identificacion.Equals(other.Identificacion) ) && ( TipoConvenio == other.TipoConvenio || TipoConvenio != null && TipoConvenio.Equals(other.TipoConvenio) ) && ( FechaVigencia == other.FechaVigencia || FechaVigencia != null && FechaVigencia.Equals(other.FechaVigencia) ) && ( Correo == other.Correo || Correo != null && Correo.Equals(other.Correo) ) /*&& * ( * Pais == other.Pais || * Pais != null && * Pais.Equals(other.Pais) * ) */&& ( Ciudad == other.Ciudad || Ciudad != null && Ciudad.Equals(other.Ciudad) ) && ( Endpoint == other.Endpoint || Endpoint != null && Endpoint.Equals(other.Endpoint) ) && ( TemplateEntrada == other.TemplateEntrada || TemplateEntrada != null && TemplateEntrada.Equals(other.TemplateEntrada) ) && ( TemplateSalida == other.TemplateSalida || TemplateSalida != null && TemplateSalida.Equals(other.TemplateSalida) ) && ( EstadoConvenio == other.EstadoConvenio || EstadoConvenio != null && EstadoConvenio.Equals(other.EstadoConvenio) )); }
public static Persona CrearDesdeSolicitud(SolcitudCreacionPersona solicitud) { return(new Persona(Identificacion.Crear(solicitud.Tipo, solicitud.Numero), solicitud.Nombres, solicitud.Apellidos, solicitud.FechaNacimiento)); }
public override string ToString() { return(Identificacion.ToString() + " - " + Nombre + " - " + Direccion + "-" + Telefono.ToString()); }
public void LanzaErrorSiPasaporteTieneMasDe5Numeros() { var ex = Assert.ThrowsException <FormatException>(() => Identificacion.Crear("PA", "KK798790")); Assert.AreEqual(Pasaporte.ErrorElPasaporteDebeEmpezarPorDosLetrasYTerminarConCincoNumeros, ex.Message); }
public void LanzaErrorSiTarjetaDeIdentidadNoEsNumerica() { var ex = Assert.ThrowsException <FormatException>(() => Identificacion.Crear("TI", "781207-01125")); Assert.AreEqual(TarjetaDeIdentidad.ErrorTarjetaDeIdentidadDebeSerNumerica, ex.Message); }
public void LanzaErrorSiCedulaNoEsNumerica() { var ex = Assert.ThrowsException <FormatException>(() => Identificacion.Crear("CC", "A-123456")); Assert.AreEqual(CedulaCiudadania.ErrorCedulaCiudadaniaDebeSerNumerica, ex.Message); }
public void PasaporteDebeEmpeazarPorDosLetrasYTerminarCon5Numeros() { Assert.AreEqual("PA KK79879", Identificacion.Crear("PA", "KK79879").ToString()); }
public static Persona CrearDesdePersistencia(PersonaPersistencia personaPersistencia) { return(new Persona(Identificacion.Crear(personaPersistencia.Tipo, personaPersistencia.NumeroIdentificacion), personaPersistencia.Nombres, personaPersistencia.Apellidos, personaPersistencia.FechaNacimiento)); }
public void CedulaDeCiudadaniaDebeSerNumerica() { Assert.AreEqual("CC 79879078", Identificacion.Crear("CC", "79879078").ToString()); }
public bool EstaIdentificadoCon(Identificacion identificacion) { return(_identificacion.Equals(identificacion)); }
public void EliminarPersona(Identificacion identificacion) { var personaAEliminar = ObtenerPersona(identificacion); _directorio.Remove(personaAEliminar); }