Example #1
0
        private GI.BR.Propiedades.Ubicacion GetUbicacion(GI.BR.Propiedades.Ubicaciones.Barrio barrio, GI.BR.Propiedades.Ubicaciones.Localidad loc, GI.BR.Propiedades.Ubicaciones.Provincia prov, GI.BR.Propiedades.Ubicaciones.Pais pais)
        {
            GI.BR.Propiedades.Ubicacion u = new GI.BR.Propiedades.Ubicacion();

            u.Pais = pais;
            u.Localidad = loc;
            u.Provincia = prov;
            u.Barrio = barrio;

            return u;
        }
        private void bBuscar_Click(object sender, EventArgs e)
        {
            GI.Managers.AdmAlquileres.MngAdmAlquileres mngAdmAlquileres = new GI.Managers.AdmAlquileres.MngAdmAlquileres();

            #region Por Ubicación

            if (tabControlTiposDeBusqueda.SelectedIndex == 0)
            {

                GI.BR.Propiedades.TipoPropiedad TipoProp = null;
                GI.BR.Propiedades.Ubicacion Ubicacion = new GI.BR.Propiedades.Ubicacion();
                GI.BR.Propiedades.Ambiente Ambiente = null;
                GI.BR.Propiedades.EstadoPropiedad Estado = null;
                GI.BR.Valor ValorDesde = null;
                GI.BR.Valor ValorHasta = null;
                if (cbTipoPropiedad.SelectedIndex > 0)
                    TipoProp = (GI.BR.Propiedades.TipoPropiedad)cbTipoPropiedad.SelectedItem;

                if (cbPais.SelectedIndex > 0)
                    Ubicacion.Pais = (GI.BR.Propiedades.Ubicaciones.Pais)cbPais.SelectedItem;
                if (cbProvincia.SelectedIndex > 0)
                    Ubicacion.Provincia = (GI.BR.Propiedades.Ubicaciones.Provincia)cbProvincia.SelectedItem;
                if (cbLocalidad.SelectedIndex > 0)
                    Ubicacion.Localidad = (GI.BR.Propiedades.Ubicaciones.Localidad)cbLocalidad.SelectedItem;
                if (cbBarrio.SelectedIndex > 0)
                    Ubicacion.Barrio = (GI.BR.Propiedades.Ubicaciones.Barrio)cbBarrio.SelectedItem;

                if (cbAmbientes.SelectedIndex > 0)
                    Ambiente = (GI.BR.Propiedades.Ambiente)cbAmbientes.SelectedItem;

                if (cbEstadoPropiedad.SelectedIndex > 0)
                    Estado = (GI.BR.Propiedades.EstadoPropiedad)cbEstadoPropiedad.SelectedItem;

                decimal importeDesde = 0;
                if (decimal.TryParse(textBoxValorDesde.Text, out importeDesde))
                {
                    ValorDesde = new GI.BR.Valor();
                    ValorDesde.Importe = importeDesde;
                    ValorDesde.Moneda = (GI.BR.Monedas.Moneda)cbMonedaReal.SelectedItem;

                }

                decimal importeHasta = 0;
                if (decimal.TryParse(textBoxValorHasta.Text, out importeHasta))
                {
                    ValorHasta = new GI.BR.Valor();
                    ValorHasta.Importe = importeHasta;
                    ValorHasta.Moneda = (GI.BR.Monedas.Moneda)cbMonedaReal.SelectedItem;

                }

                admAlquileres = mngAdmAlquileres.RecuperarAdmAlquileres(TipoProp, Estado, Ambiente, Ubicacion, ValorDesde, ValorHasta ,cBoxRecuperarVencidos.Checked);

            }
            #endregion

            #region Por Dirección
            if (tabControlTiposDeBusqueda.SelectedIndex == 1)
            {
                int numero = 0;
                Int32.TryParse(textBoxNumero.Text, out numero);
                admAlquileres = mngAdmAlquileres.RecuperarAdmAlquileres(textBoxDireccion.Text, numero, cBoxRecuperarVencidos.Checked);
            }
            #endregion

            #region Por Código

            if (tabControlTiposDeBusqueda.SelectedIndex == 2)
            {
                int numero = 0;
                Int32.TryParse(textBoxNumero.Text, out numero);
                admAlquileres = mngAdmAlquileres.RecuperarAdmAlquileresPorCodigoPropiedad(tbCodigo.Text, cBoxRecuperarVencidos.Checked);
            }

            #endregion

            #region Por Inquilino

            if (tabControlTiposDeBusqueda.SelectedIndex == 3)
            {

                admAlquileres = mngAdmAlquileres.RecuperarAdmAlquileresPorInquilinos(tbNombresInquilinos.Text, cBoxRecuperarVencidos.Checked);
            }

            #endregion

            if (this.admAlquileres.Count == 0)
            {
                GI.Framework.General.GIMsgBox.ShowNoSeEncontraronDatos();
                return;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }