public ActionResult GeMadreConsolidada(string id) { ModeloMadre modMadre = new ModeloMadre(); Madre myDataM = modMadre.Buscar(Convert.ToInt64(id)); return(Json(myDataM, JsonRequestBehavior.AllowGet)); }
public void Editar(long Id, Madre madre) { Madre _madre = null; _madre = (from p in context.Madres where p.Id == Id select p).FirstOrDefault(); _madre.IdSesion = SessionManager.getSessionIdentifier(); _madre.FechaUltimaTransaccion = DateTime.Now; _madre.FechaRegistro = DateTime.Now; _madre.EstadoRegistro = TipoEstadoRegistro.VigenteRegistroModificado; _madre.EstadoSincronizacion = TipoEstadoSincronizacion.Pendiente; _madre.Nombres = madre.Nombres; _madre.NombreCompleto = madre.NombreCompleto; _madre.PrimerApellido = madre.PrimerApellido; _madre.SegundoApellido = madre.SegundoApellido; _madre.TercerApellido = madre.TercerApellido; _madre.DocumentoIdentidad = madre.DocumentoIdentidad; _madre.TipoDocumentoIdentidad = madre.TipoDocumentoIdentidad; _madre.FechaNacimiento = madre.FechaNacimiento; _madre.IdDepartamento = madre.IdDepartamento; _madre.IdProvincia = madre.IdProvincia; _madre.IdMunicipio = madre.IdMunicipio; _madre.LocalidadNacimiento = madre.LocalidadNacimiento; _madre.Defuncion = madre.Defuncion; _madre.Observaciones = madre.Observaciones; context.SaveChanges(); }
private void grdMadre_SelectionChanged(object sender, SelectionChangedEventArgs e) { this.Cursor = Cursors.Wait; madre = this.grdMadre.SelectedItem as Madre; if (OpcionDeBusquedaAsignada == 1) { this.grdCorresponsabilidadMadre.ItemsSource = null; this.grdControlMadre.ItemsSource = null; this.grdTutorMadre.ItemsSource = null; this.grdMenor.ItemsSource = null; this.grdCorresponsabilidadMenor.ItemsSource = null; this.grdControlMenor.ItemsSource = null; this.grdTutorMenor.ItemsSource = null; if (madre != null) { this.grdMenor.ItemsSource = modelomenor.ListarHijosDeMadreATravesDeCorresponsabilidadDeMenor(madre.Id); if (this.grdMenor.Items.Count > 0) { this.grdMenor.SelectedIndex = 0; } } } if (madre != null) { this.grdCorresponsabilidadMadre.ItemsSource = modelocorresponsabilidadmadre.ListarCorresponsabilidadesDeMadre(madre.Id); if (this.grdCorresponsabilidadMadre.Items.Count > 0) { this.grdCorresponsabilidadMadre.SelectedIndex = 0; } } this.Cursor = Cursors.Arrow; }
private string ConstruirParametroMadre(Madre madre, Dictionary <string, object> propiedadesObejtoBusqueda) { string cadenaB = ""; foreach (var item in propiedadesObejtoBusqueda) { if (item.Key == "Identificador") { continue; } if ((bool)item.Value) { switch (item.Key) { case "Nombres": cadenaB += madre.Nombres; break; case "PrimerApellido": cadenaB += madre.PrimerApellido; break; case "SegundoApellido": cadenaB += madre.SegundoApellido; break; case "TercerApellido": cadenaB += madre.TercerApellido; break; case "NombreCompleto": cadenaB += madre.NombreCompleto; break; case "DocumentoIdentidad": cadenaB += madre.DocumentoIdentidad; break; case "FechaNacimiento": cadenaB += madre.FechaNacimiento; break; case "LocalidadNacimiento": cadenaB += madre.LocalidadNacimiento; break; } } } return(cadenaB); }
public ActionResult EditMadre(Madre obj) { try { if (ModelState.IsValid) { MadreRepository MadRepo = new MadreRepository(); if (MadRepo.UpdateMadre(obj)) { ViewBag.Message = "Madre modificado"; } else { ViewBag.Message = "Ocurrio un error"; } return(RedirectToAction("GetMadres")); } return(View(obj)); } catch { return(RedirectToAction("GetMadres")); } }
public ActionResult DeleteConfirmed(long id) { Madre madre = db.Madres.Find(id); db.Madres.Remove(madre); db.SaveChanges(); return(RedirectToAction("Index")); }
public void MatrimonioDeSolterosTest() { Padre diego = new Padre("Diego"); Madre lucia = new Madre("Lucia"); diego.Esposa = lucia; Assert.AreEqual(diego, lucia.Esposo, "La madre no está casada con el padre."); Assert.AreEqual(diego.Esposa, lucia, "El padre no está casado con la madre."); }
public List <Madre> BuscarSemejantes(ParametrosBusqueda parBusqueda) { long identificador = Convert.ToInt64(parBusqueda.Identificador); MadreTemporal madreTemp = new MadreTemporal(); madreTemp = Listar().Where(m => m.Id == identificador).FirstOrDefault(); Dictionary <string, object> propiedadesBusqueda = ObtenerElementos(parBusqueda, MemberTypes.Property); List <Madre> madresCandidatas = new List <Madre>(); Madre peorSemejanza = new Madre(); int distanciaCalculada; int peorDistancia = -1; //string strParametrosMadreTemporal = madreTemp.NombreCompleto; string cadenaMadreTemporal = ConstruirParametroMadreTemporal(madreTemp, propiedadesBusqueda); //foreach (Madre ma in madre.Listar()) foreach (Madre ma in db.Madres.ToList()) { distanciaCalculada = Distancia.Levenshtein(cadenaMadreTemporal, ConstruirParametroMadre(ma, propiedadesBusqueda)); if (madresCandidatas.Count < 10) { ma.IdMunicipio = distanciaCalculada; //** madresCandidatas.Add(ma); if (distanciaCalculada > peorDistancia) { peorDistancia = distanciaCalculada; peorSemejanza = ma; } } else { if (distanciaCalculada < peorDistancia) { ma.IdMunicipio = distanciaCalculada; //** madresCandidatas.Remove(peorSemejanza); madresCandidatas.Add(ma); // Peor distancia entre los 10 peorDistancia = -1; foreach (var item in madresCandidatas) { distanciaCalculada = Distancia.Levenshtein(madreTemp.NombreCompleto, item.NombreCompleto); if (distanciaCalculada > peorDistancia) { peorDistancia = distanciaCalculada; peorSemejanza = item; } } } } } return(madresCandidatas.OrderBy(m => m.IdMunicipio).ToList()); }
// Adicionado por Hernán public Madre Buscar(long id = 0) { Madre madre = context.Madres.Find(id); if (madre == null) { return(null); } return(madre); }
// // GET: /RevisionMadres/Details/5 public ActionResult Details(long id = 0) { Madre madre = modRevisionManual.Buscar(id); if (madre == null) { return(HttpNotFound()); } return(View(madre)); }
public Madre Recuperar(long Id) { Madre madre = null; madre = (from m in context.Madres where m.Id == Id select m).FirstOrDefault(); return(madre); }
// // GET: /RevisionMadres/Delete/5 public ActionResult Delete(long id = 0) { Madre madre = db.Madres.Find(id); if (madre == null) { return(HttpNotFound()); } return(View(madre)); }
public ActionResult Editar(int id) { List <Madre> madres = new List <Madre>(); madres.Add(new Madre { Madre_ID = 1, Madre_Nombre = "Roxana", Madre_Apellido = "Condori", Madre_Edad = 35, Madre_Sangre = "A", Madre_Factor = "No", Madre_Entrada = Convert.ToDateTime("2018-11-09"), Madre_Examen_ID = 1 }); madres.Add(new Madre { Madre_ID = 2, Madre_Nombre = "Tammy", Madre_Apellido = "Gutierrez", Madre_Edad = 41, Madre_Sangre = "AB", Madre_Factor = "No", Madre_Entrada = Convert.ToDateTime("2018-11-09"), Madre_Examen_ID = 2 }); madres.Add(new Madre { Madre_ID = 3, Madre_Nombre = "Diana", Madre_Apellido = "Sosa", Madre_Edad = 39, Madre_Sangre = "O+", Madre_Factor = "Si", Madre_Entrada = Convert.ToDateTime("2018-11-09"), Madre_Examen_ID = 3 }); madres.Add(new Madre { Madre_ID = 4, Madre_Nombre = "Roshan", Madre_Apellido = "Palo", Madre_Edad = 38, Madre_Sangre = "O-", Madre_Factor = "No", Madre_Entrada = Convert.ToDateTime("2018-11-09"), Madre_Examen_ID = 4 }); Madre madre = (from p in madres where p.Madre_ID == id select p).FirstOrDefault(); return(View(madre)); }
public void MatrimonioDeSolterosTest() { Madre target = new Madre("Lucía"); Padre expected = new Padre("Diego"); Padre actual; target.Esposo = expected; actual = target.Esposo; Assert.AreEqual(expected, actual, "La madre no está casada con el padre"); Assert.AreEqual(expected.Esposa, target, "El padre no está casado con la madre"); }
public void MadreConstructorTest() { Madre target = new Madre("Lucía"); string expected = "Lucía"; string actual; target.Nombre = expected; actual = target.Nombre; Assert.AreEqual(expected, actual, "El nombre no está correctamente asignado"); Assert.AreEqual(target.Esposo, null, "Cada madre está soltera por defecto"); }
public void MatrimonioMujerCasadaHombreSolteroTest() { Madre isabel = new Madre("Isabel Presysler"); Padre julio = new Padre("Julio Iglesias"); Padre miguel = new Padre("Miguel Boyer"); isabel.Esposo = julio; isabel.Esposo = miguel; Assert.AreEqual(isabel.Esposo, miguel, "Isabel no está casada con Miguel"); Assert.AreEqual(miguel.Esposa, isabel, "Miguel no está casado con Julian"); Assert.IsNull(julio.Esposa, "Julio no está soltero"); }
public void MatrimonioMujerSolteraHombreCasadoTest() { Madre isabel = new Madre("Isabel Pantoja"); Madre maite = new Madre("Maite Zaldivar"); Padre julian = new Padre("Julian Munhoz"); maite.Esposo = julian; isabel.Esposo = julian; Assert.AreEqual(isabel.Esposo, julian, "Julian no está casado con Isabel"); Assert.AreEqual(julian.Esposa, isabel, "Isabel no está casada con Julian"); Assert.IsNull(maite.Esposo, "Maite no está soltera"); }
public void addHijoTest() { Madre isabel = new Madre("Isabel"); Padre paquirri = new Padre("Paquirri"); string nombreHijo = "DJ Kiko"; Hijo kiko = new Hijo(nombreHijo); isabel.addHijo(kiko); Assert.IsTrue(isabel.Hijos.Contains(kiko)); Assert.IsTrue(paquirri.Hijos.Contains(kiko)); }
public void MatrimonioMujerSolteraHombreCasadoTest() { Padre alonso = new Padre("Fernando Alono"); Madre raquel = new Madre("Raquel del Rosario"); Madre dasha = new Madre("Dasha Kapustina"); alonso.Esposa = raquel; alonso.Esposa = dasha; Assert.AreEqual(alonso.Esposa, dasha, "Alonso no está casado con Dasha"); Assert.AreEqual(dasha.Esposo, alonso, "Dasha no está casada con Alonso"); Assert.IsNull(raquel.Esposo, "Raquel no está soltera"); }
// // GET: /RevisionMadres/Edit/5 public ActionResult Edit(long id = 0) { Madre madre = db.Madres.Find(id); if (madre == null) { return(HttpNotFound()); } ViewBag.IdDepartamento = new SelectList(db.Departamentos, "Id", "DescripcionEstadoSincronizacion", madre.IdDepartamento); ViewBag.IdProvincia = new SelectList(db.Provincias, "Id", "DescripcionEstadoSincronizacion", madre.IdProvincia); ViewBag.IdMunicipio = new SelectList(db.Municipios, "Id", "DescripcionEstadoSincronizacion", madre.IdMunicipio); return(View(madre)); }
public ActionResult Edit(Madre madre) { if (ModelState.IsValid) { db.Entry(madre).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdDepartamento = new SelectList(db.Departamentos, "Id", "DescripcionEstadoSincronizacion", madre.IdDepartamento); ViewBag.IdProvincia = new SelectList(db.Provincias, "Id", "DescripcionEstadoSincronizacion", madre.IdProvincia); ViewBag.IdMunicipio = new SelectList(db.Municipios, "Id", "DescripcionEstadoSincronizacion", madre.IdMunicipio); return(View(madre)); }
public void Crear(Madre madre) { madre.Id = IdentifierGenerator.NewId(); madre.IdSesion = SessionManager.getSessionIdentifier(); madre.FechaUltimaTransaccion = DateTime.Now; madre.FechaRegistro = DateTime.Now; madre.EstadoRegistro = TipoEstadoRegistro.VigenteNuevoRegistro; madre.EstadoSincronizacion = TipoEstadoSincronizacion.Pendiente; madre.DescripcionEstadoSincronizacion = ""; context.Madres.Add(madre); context.SaveChanges(); }
public void Eliminar(long Id) { Madre madre = null; madre = (from m in context.Madres where m.Id == Id select m).FirstOrDefault(); madre.IdSesion = SessionManager.getSessionIdentifier(); madre.FechaUltimaTransaccion = DateTime.Now; madre.FechaRegistro = DateTime.Now; madre.EstadoRegistro = TipoEstadoRegistro.BorradoLogico; context.SaveChanges(); }
public void MatrimonioMujerCasadaHombreCasadoTest() { Madre isabel = new Madre("Isabel Pantoja"); Madre maite = new Madre("Maite Zaldivar"); Padre julian = new Padre("Julian Munhoz"); Padre diego = new Padre("Diego Gómez"); julian.Esposa = maite; diego.Esposa = isabel; julian.Esposa = isabel; Assert.AreEqual(isabel.Esposo, julian, "Julian no está casado con Isabel"); Assert.AreEqual(julian.Esposa, isabel, "Isabel no está casada con Julian"); Assert.IsNull(maite.Esposo, "Maite no está soltera"); Assert.IsNull(diego.Esposa, "Julián no está soltera"); }
/* * BOTON QUE BUSCA CARACTERISTICAS EN LA MADRE */ protected void btnCaracteristicaMadre_Click(object sender, EventArgs e) { try { CatalogMadre madre = new CatalogMadre(); List <Madre> lista = new List <Madre>(); //PRIMERO BUSCA POR NOMBRE DE VARIEDAD, SINO POR CARACTERISTICAS if (this.txtMadre.Text.Equals("")) { string tamaño = this.ddlMejoramientoTamaño.SelectedValue; string madurez = this.ddlMejoramientoMadurez.SelectedValue; string forma = this.ddlMejoramientoForma.SelectedValue; string distribucion = this.ddlMejoramientoDistribucion.SelectedValue; string profundidad = this.ddlMejoramientoProfundidad.SelectedValue; string regularidad = this.ddlMejoramientoRegularidad.SelectedValue; string brotacion = this.ddlMejoramientoBrotacion.SelectedValue; string emergencia = this.ddlMejoramientoEmergencia.SelectedValue; string emergencia40 = this.ddlMejoramientoEmergencia40.SelectedValue; string metribuzina = this.ddlMejoramientoMetribuzina.SelectedValue; string verdes = this.ddlMejoramientoTuberculosVerdes.SelectedValue; string tizon_follaje = this.ddlMejoramientoTizonFollaje.SelectedValue; string tizon_tuberculo = this.ddlMejoramientoTizonTuberculo.SelectedValue; string numero = this.ddlMejoramientoNumero.SelectedValue; string fertilidad = this.ddlMejoramientoFertilidad.SelectedValue; string destino = this.ddlMejoramientoDestino.SelectedValue; Madre mama = new Madre(Int32.Parse(tamaño), Int32.Parse(madurez), Int32.Parse(forma), Int32.Parse(distribucion), Int32.Parse(profundidad), Int32.Parse(regularidad), Int32.Parse(brotacion), Int32.Parse(emergencia), Int32.Parse(emergencia40), Int32.Parse(metribuzina), Int32.Parse(verdes), Int32.Parse(tizon_follaje), Int32.Parse(tizon_tuberculo), Int32.Parse(numero), Int32.Parse(fertilidad), Int32.Parse(destino)); lista = madre.GetMadre(mama); } else { RefreshDropDown(); string nombre = this.txtMadre.Text; lista = madre.GetMadreNombre(nombre); } this.gdvCaracteristicaMadre.DataSource = lista; this.gdvCaracteristicaMadre.DataBind(); } catch (Exception ex) { } }
//GET public ActionResult EditMadre(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MadreRepository MadRepo = new MadreRepository(); Madre result = MadRepo.ListarMadres() .Find(Mad => Mad.Madre_Id == id); if (result == null) { return(HttpNotFound()); } return(View(result)); }
private void cmdTitularTutor_Click(object sender, RoutedEventArgs e) { if (registrotitularpago != null) { Button Img = (Button)sender; if (Img.Tag != null) { Int64 Id = (Int64)Img.Tag; if (Id > 0) { if (registrotitularpago.Titular != "SI") { string NombreCompleto = ""; if (registrotitularpago.Tipo == "Madre") { ModeloMadre modelomadre = new ModeloMadre(); Madre __madre = new Madre(); __madre = modelomadre.Recuperar(Id); NombreCompleto = __madre.NombreCompleto; } else { ModeloTutor modelotutor = new ModeloTutor(); Tutor __tutor = new Tutor(); __tutor = modelotutor.Recuperar(Id); NombreCompleto = __tutor.NombreCompleto; } if (MessageBox.Show("¿Desea establecer a " + NombreCompleto + " como titular de pago para esta familia?", "Advertencia", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar(); modelogrupofamiliar.EstablecerTitularDePagoVigenteDeFamilia(IdSeleccionado, registrotitularpago.IdGrupoFamiliar); RecuperarMadresYTutoresALaVez(); } } else { MessageBox.Show("Esta persona ya se halla establecida como titular de pago de esta familia.", "Mensaje", MessageBoxButton.OK, MessageBoxImage.Information); } } } } }
public bool UpdateMadre(Madre obj) { connection(); SqlCommand com = new SqlCommand("ModificarMadre", con); com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("@mad_id", obj.Madre_Id); com.Parameters.AddWithValue("@mad_nom", obj.Madre_Nombre); com.Parameters.AddWithValue("@mad_ape", obj.Madre_Apellido); com.Parameters.AddWithValue("@mad_fecnac", obj.Madre_FecNac); com.Parameters.AddWithValue("@mad_sangre", obj.Madre_Sangre); com.Parameters.AddWithValue("@mad_factor", obj.Madre_Factor); com.Parameters.AddWithValue("@mad_enf", obj.Madre_Enfermedad); com.Parameters.AddWithValue("@mad_examen_id", obj.Madre_Tipo_ID); con.Open(); int i = com.ExecuteNonQuery(); con.Close(); bool result = i >= 1 ? true : false; return(result); }
public ActionResult AddMadre(Madre mad) { try { if (ModelState.IsValid) { MadreRepository MadRepo = new MadreRepository(); if (MadRepo.AddMadre(mad)) { ViewBag.Message = "Madre agregado"; } else { ViewBag.Message = "Ocurrio un error"; } } return(RedirectToAction("GetMadres")); } catch { return(View()); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { CantidadDeControles = 4; ////this.lblDepartamento.Content = ""; ////this.lblEstablecimiento.Content = ""; ModeloMadre modelomadre = new ModeloMadre(); Madre madre = new Madre(); madre = modelomadre.Recuperar(IdSeleccionado); if (madre != null) { this.lblNombresMadre.Content = madre.NombreCompleto; this.lblFechaNacimientoMadre.Content = string.Format("{0:dd/MM/yyyy}", madre.FechaNacimiento); } else { this.lblNombresMadre.Content = ""; this.lblFechaNacimientoMadre.Content = ""; } ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar(); _grupofamiliar = modelogrupofamiliar.RecuperarPorMadreDeFamilia(IdFamilia, IdSeleccionado); if (_grupofamiliar.TitularPagoVigente == true) { this.lblNombreTitular.Content = this.lblNombresMadre.Content; this.lblParentesco.Content = ""; this.lblParentescoTitular.Content = "MADRE GESTANTE"; } else { _grupofamiliar = modelogrupofamiliar.RecuperarTitularHabilitado(IdFamilia); if (_grupofamiliar != null) { ModeloTutor modelotutor = new ModeloTutor(); Tutor tutor = new Tutor(); tutor = modelotutor.Recuperar(_grupofamiliar.IdTutor.Value); this.lblNombreTitular.Content = tutor.NombreCompleto; ModeloTipoParentesco modelotipoparentesco = new ModeloTipoParentesco(); TipoParentesco tipoparentesco = new TipoParentesco(); tipoparentesco = modelotipoparentesco.Recuperar(_grupofamiliar.IdTipoParentesco.Value); this.lblParentescoTitular.Content = tipoparentesco.Descripcion; } else { this.lblNombreTitular.Content = ""; this.lblParentescoTitular.Content = ""; } } ModeloCorresponsabilidadMadre modelocorresponsabilidadmadre = new ModeloCorresponsabilidadMadre(); IdCorresponsabilidadMadre = modelocorresponsabilidadmadre.RecuperarLaUltimaCorresponsabilidadValidaDeMadre(IdSeleccionado); ValoresPorDefecto(); if (IdCorresponsabilidadMadre > 0) { RecuperarCorresponsabilidadMadre(); } else { this.txtCodigoFormulario.IsEnabled = true; this.dtpFechaFUM.IsEnabled = true; this.dtpFechaInscripcion.IsEnabled = true; this.dtpFechaUltimoParto.IsEnabled = true; this.txtNumeroEmbarazo.IsEnabled = true; this.chkARO.IsEnabled = true; this.rdbNueva.IsEnabled = true; this.rdbTransferencia.IsEnabled = true; this.cmdGuardar.IsEnabled = true; } if (TipoAccion == TipoAccion.Detalle) { this.txtCodigoFormulario.IsEnabled = false; this.dtpFechaFUM.IsEnabled = false; this.dtpFechaInscripcion.IsEnabled = false; this.dtpFechaSalida.IsEnabled = false; this.dtpFechaUltimoParto.IsEnabled = false; this.txtNumeroEmbarazo.IsEnabled = false; this.chkARO.IsEnabled = false; this.chkSalida.IsEnabled = false; this.rdbAborto.IsEnabled = false; this.rdbCumplimiento.IsEnabled = false; this.rdbFallecimiento.IsEnabled = false; this.rdbIncumplimiento.IsEnabled = false; this.rdbNueva.IsEnabled = false; this.rdbObitoFetal.IsEnabled = false; this.rdbTransferencia.IsEnabled = false; this.rdbTransferenciaSalida.IsEnabled = false; this.txtAutorizado.IsEnabled = false; this.txtCargo.IsEnabled = false; this.cmdGuardar.IsEnabled = false; } }