/// <summary> /// Copia los valores de base de datos a este objeto en base al ID /// </summary> /// <returns>True si se logro una copia. False de lo contrario</returns> public bool Read() { Datos.BeLifeEntities bbdd = new Datos.BeLifeEntities(); try { Datos.Plan plnn = bbdd.Plan.First(pln => pln.IdPlan == this.IdPlan); CommonBC.Syncronize(plnn, this); return(true); } catch (Exception) { return(false); } }
public bool Read() { Datos.BeLifeEntities BBDD = new Datos.BeLifeEntities(); Datos.Plan plan = BBDD.Plan.First(p => p.IdPlan == IdPlan); try { CommonBC.Syncronize(plan, this); return(true); } catch (Exception) { return(false); } }
public IEnumerable <Contrato> ReadS(string numero, String rut, string poliza) { Datos.BeLifeEntities bbdd = new Datos.BeLifeEntities(); Datos.Plan pl = bbdd.Plan.First(e => e.PolizaActual == poliza); if (rut.Length > 0 && numero.Length > 0 && poliza.Length > 0) { IEnumerable <Contrato> abc = from d in ReadAll() where d.RutCliente == rut && d.Numero == numero.ToString() && d.CodigoPlan == pl.IdPlan.ToString() select d; return(abc); } else if (rut.Length > 0 && numero.Length > 0 && poliza.Length == 0) { IEnumerable <Contrato> ab = from d in ReadAll() where d.RutCliente == rut && d.Numero == numero.ToString() select d; return(ab); } else if (rut.Length > 0 && numero.Length == 0 && poliza.Length > 0) { IEnumerable <Contrato> ac = from d in ReadAll() where d.RutCliente == rut && d.CodigoPlan == pl.IdPlan.ToString() select d; return(ac); } else if (rut.Length > 0 && numero.Length == 0 && poliza.Length == 0) { IEnumerable <Contrato> a = from d in ReadAll() where d.RutCliente == rut select d; return(a); } else if (numero.Length > 0 && poliza.Length > 0) { IEnumerable <Contrato> ac = from d in ReadAll() where d.Numero == numero.ToString() && d.CodigoPlan == pl.IdPlan.ToString() select d; return(ac); } else if (numero.Length > 0 && poliza.Length == 0) { IEnumerable <Contrato> a = from d in ReadAll() where d.Numero == numero.ToString() select d; return(a); } else if (numero.Length == 0 && poliza.Length > 0) { IEnumerable <Contrato> c = from d in ReadAll() where d.CodigoPlan == pl.IdPlan.ToString() select d; return(c); } else { return(ReadAll()); } }