예제 #1
0
        public void NotificarSobreInmueble(Interesado interesado, decimal cotizacion)
        {
            if (!interesado.Disponible)
            {
                return;
            }

            if (cotizacion == 0)
            {
                cotizacion = GetDolar();
            }

            try
            {
                List <Inmueble> inmuebles = InmuebleDAO.GetInmueblesParaInteresado(interesado, cotizacion);
                if (inmuebles.Count > 0)
                {
                    EmailHelper.SendInmueblesInEmail(inmuebles, interesado);
                }
            }
            catch (Exception ex)
            {
                EmailHelper.EnviarNotificacion(ex);
            }
        }
예제 #2
0
 public Inmueble[] GetInmueblesParaInteresado(Interesado interesado, decimal cotizacion)
 {
     try
     {
         return(InmuebleDAO.GetInmueblesParaInteresado(interesado, cotizacion).ToArray());
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #3
0
 public void GuardarInteresado(Interesado interesado)
 {
     try
     {
         InteresadoDAO.CrearInteresado(interesado);
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #4
0
        public void Test3(int interesadoId)
        {
            List <Interesado> interesados = new List <InmobiliariaService.Interesado>();

            interesados = InteresadoDAO.GetInteresados();
            Interesado interesado = interesados.Find(XmlAttribute => XmlAttribute.Id == interesadoId);

            decimal cotizacion = GetDolar();

            GetInmueblesParaInteresado(interesado, cotizacion);
        }
예제 #5
0
 public bool EliminarInteresado(Interesado interesado)
 {
     try
     {
         return(DAOBase.DeleteEntity(interesado));
     }
     catch (Exception ex)
     {
         EmailHelper.EnviarNotificacion(ex);
         throw ex;
     }
 }
예제 #6
0
 public void TestNotificarSobreInmueble()
 {
     try
     {
         //Este metodo es para probar el envio de los inmuebles
         List <Interesado> interesados = InteresadoDAO.GetInteresados();
         Interesado        interesado  = interesados.Find(x => x.Nombre == " Lorena");
         NotificarSobreInmueble(interesado, GetDolar());
     }
     catch (Exception ex)
     {
     }
 }
예제 #7
0
 internal static void CrearInteresado(Interesado interesado)
 {
     try
     {
         if (interesado.Id == null || interesado.Id == 0)
         {
             interesado.Id = GetNextId(interesado);
             DAOBase.CreateEntity(interesado);
         }
         else
         {
             DAOBase.UpdateEntity(interesado);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #8
0
        private static List <Interesado> LlenarInteresados(Interesado vendedor, DataTable dt)
        {
            try
            {
                List <Interesado> dtos = new List <Interesado>();

                foreach (DataRow dr in dt.Rows)
                {
                    Interesado aux = new Interesado();
                    PoblarObjetoDesdeDataRow(aux, dr);

                    dtos.Add(aux);
                }

                return(dtos);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public static void SendInmueblesInEmail(List <Inmueble> inmuebles, Interesado interesado)
        {
            try
            {
                string cabecera = string.Empty;
                string nombre   = "N/A";
                if (!string.IsNullOrEmpty(interesado.Nombre))
                {
                    nombre = interesado.Nombre;
                }
                if (!string.IsNullOrEmpty(interesado.Apellido))
                {
                    nombre += " " + interesado.Apellido;
                }

                cabecera += string.Format("Se han encontrado los siguientes Inmuebles con el Interesado  <b> {0} </b>:<br><br>", nombre) + Environment.NewLine;

                string cuerpo = string.Empty;

                NumberFormatInfo nfi = new NumberFormatInfo();
                nfi.NumberDecimalSeparator = ",";
                nfi.NumberGroupSeparator   = ".";

                foreach (Inmueble inmueble in inmuebles.Where(x => x.Disponible))
                {
                    string provincia    = "N/A";
                    string calle        = "N/A";
                    string numero       = "N/A";
                    string piso         = "N/A";
                    string departamento = "N/A";
                    string dormitorio   = "N/A";
                    string baño         = "N/A";
                    string comedor      = "N/A";
                    string supCubierta  = "0";
                    string valor        = "0";
                    string referencia   = "N/A";
                    string contacto     = "N/A";

                    if (!string.IsNullOrEmpty(inmueble.Provincia))
                    {
                        provincia = inmueble.Provincia;
                    }
                    if (!string.IsNullOrEmpty(inmueble.Calle))
                    {
                        calle = inmueble.Calle;
                    }
                    if (!string.IsNullOrEmpty(inmueble.Numero))
                    {
                        numero = inmueble.Numero;
                    }
                    if (!string.IsNullOrEmpty(inmueble.Piso))
                    {
                        piso = inmueble.Piso;
                    }
                    if (!string.IsNullOrEmpty(inmueble.Departamento))
                    {
                        departamento = inmueble.Departamento;
                    }
                    //if (!string.IsNullOrEmpty(inmueble.Baños))
                    //    baño = inmueble.Baños;
                    //if (!string.IsNullOrEmpty(inmueble.Dormitorios))
                    //    dormitorio = inmueble.Dormitorios;
                    //if (!string.IsNullOrEmpty(inmueble.Comedor))
                    //    comedor = inmueble.Comedor;
                    if (!string.IsNullOrEmpty(inmueble.SupCubierta))
                    {
                        supCubierta = inmueble.SupCubierta;
                    }
                    if (inmueble.Precio != null)
                    {
                        valor = ((decimal)inmueble.Precio).ToString("#,##0");
                    }
                    if (!string.IsNullOrEmpty(inmueble.Referencia))
                    {
                        referencia = inmueble.Referencia;
                    }
                    if (!string.IsNullOrEmpty(inmueble.Contacto))
                    {
                        contacto = inmueble.Contacto;
                    }


                    cuerpo += string.Format("- {0}, ubicado en <b> {1} </b>, en la calle <b> {2} N° {3} </b> piso {4} departamento {5}.<br>",
                                            ((eTipoInmueble)inmueble.Tipo).ToString(), provincia, calle, numero, piso, departamento) + Environment.NewLine;
                    cuerpo += string.Format("El mismo está constituido por {0} dormitorio/s, {1} baño/s y {2} comedor/es. Cuenta con una superficie cubierta de {3} Mts.<br>", dormitorio, baño, comedor, supCubierta);
                    cuerpo += string.Format("Su valor de {0} es de <b> {1} {2} </b>.<br>", ((eTipoOperacion)inmueble.Operacion).ToString(), ((eMoneda)inmueble.Moneda).ToString(), valor.ToString(CultureInfo.CreateSpecificCulture("es-Ar"))) + Environment.NewLine;
                    cuerpo += string.Format("El contacto del mismo es <b> {0} </b> puede ser ubicado al {1}.<br><br>", contacto, referencia) + Environment.NewLine;
                }

                EnviarNotificacion(cabecera + cuerpo);
            }
            catch (Exception)
            {
                throw;
            }
        }
        internal static List <Inmueble> GetInmueblesParaInteresado(Interesado interesado, decimal cotizacion)
        {
            try
            {
                decimal montoDesdePesos = (decimal)interesado.MontoDesde;
                decimal montoHastaPesos = (decimal)interesado.MontoHasta;

                if (interesado.TipoDeMoneda == (int)eMoneda.Dolar)
                {
                    montoDesdePesos *= cotizacion;
                    montoHastaPesos *= cotizacion;
                }

                List <Inmueble> aux = GetInmuebles();

                aux.RemoveAll(x => !x.Disponible);

                if (interesado.Localidad != eLocalidad.Sin_Especificar.ToString())
                {
                    aux.RemoveAll(x => x.Localidad != interesado.Localidad);
                }

                if (interesado.TipoDeInmueble != (int)eTipoInmueble.Sin_Especificar)
                {
                    aux.RemoveAll(x => x.Tipo != interesado.TipoDeInmueble);
                    //aux = aux.Where(x => x.Tipo == (int)tipoInmueble).ToList();
                }

                if (interesado.TipoDeOperacion != (int)eTipoOperacion.Sin_Especificar)
                {
                    aux.RemoveAll(x => x.Operacion != (int)interesado.TipoDeOperacion);
                    //aux = aux.Where(x => x.Operacion == (int)tipoOperacion).ToList();
                }

                if (interesado.Ambientes != (int)eAmbientes.Sin_Especificar)
                {
                    aux.RemoveAll(x => x.Ambientes != (int)interesado.Ambientes);
                }


                if (interesado.MontoDesde != null && interesado.MontoDesde != 0)
                {
                    //aux.RemoveAll(x => x.Precio < interesado.MontoDesde);


                    aux.RemoveAll(x => ((x.Moneda == (int)eMoneda.Dolar) && ((x.Precio * cotizacion) < montoDesdePesos)) ||
                                  ((x.Moneda == (int)eMoneda.Peso) && (x.Precio < montoDesdePesos)));
                }

                if (interesado.MontoHasta != null && interesado.MontoHasta != 0)
                {
                    //aux.RemoveAll(x => x.Precio > interesado.MontoHasta.Value);

                    aux.RemoveAll(x => ((x.Moneda == (int)eMoneda.Dolar) && ((x.Precio * cotizacion) > montoHastaPesos)) ||
                                  ((x.Moneda == (int)eMoneda.Peso) && (x.Precio > montoHastaPesos)));
                }

                return(aux);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #11
0
 public void Test(Inmueble inmueble, Interesado interesado, eTipoInmueble tipoInmueble,
                  eTipoOperacion tipoOperacion, eMoneda moneda, Vendedor vendedor, eAmbientes ambientes, eCochera cochera,
                  eUbicacion ubicacion, eEstado estado, eLocalidad localidad)
 {
 }