Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.User.Identity.IsAuthenticated == true)
            {
                try
                {
                    if (!this.IsPostBack)
                    {
                        BIZReserva.ReservaUpdateFinalizado(DateTime.Today, DateTime.Today.Hour.ToString().PadLeft(2, '0'));

                        ddlZona.DataSource = BIZZona.SelectAll();
                        ddlZona.DataBind();
                        string    query = @"SELECT E.[descripcion], E.[calle], E.[altura], E.[datosAdicionales], B.[descripcion], E.[latitud] ,E.[longitud], TE.[idTipoEstadia]  FROM [Estacionamiento] E, [Plaza] P, [Barrio] B, [TipoEstadia] TE, [Tarifa] T where E.[idEstacionamiento] = P.[idEstacionamiento] AND B.[idBarrio] = E.[idBarrio] AND P.[disponible] = 1 AND P.[pago] = 0 and P.idTarifa = T.idTarifa and T.idTipoEstadia = TE.idTipoEstadia";
                        DataTable dt    = this.GetData(query);

                        int?     idTipoEstadia = !string.IsNullOrEmpty(ddlTipoAlquiler.SelectedValue) ? int.Parse(ddlTipoAlquiler.SelectedValue) : (int?)null;
                        int?     idZona        = int.Parse(ddlZona.SelectedValue);
                        DateTime?fechaDesde    = !string.IsNullOrEmpty(txtFechaDesde.Text) ? Convert.ToDateTime(txtFechaDesde.Text) : (DateTime?)null;
                        DateTime?fechaHasta    = !string.IsNullOrEmpty(txtFechaHasta.Text) ? Convert.ToDateTime(txtFechaHasta.Text) : (DateTime?)null;


                        dt = BIZPlaza.SelectAll(idTipoEstadia, idZona, fechaDesde, fechaHasta).Tables[0];
                        Session["PlazasFiltradas"] = dt;
                        rptMarkers.DataSource      = dt;
                        rptMarkers.DataBind();

                        if (dt.Rows.Count == 0)
                        {
                            /*lblErrorMapa.Text = "No se encuentran plazas disponibles";
                             * lblErrorMapa.Visible = true;*/
                            ((SiteMaster)this.Master).ShowMessage("<strong>No se encuentran plazas disponibles</strong>", SiteMaster.WarningType.Warning);
                        }
                    }
                }
                catch (Exception)
                {
                    rptMarkers.DataSource = null;
                    lblErrorMapa.Visible  = true;
                }
            }
            else
            {
                Response.Redirect("~/Account/Login.aspx");
            }
        }
Пример #2
0
        private void Filtrar()
        {
            ((SiteMaster)this.Master).HiddenMessage();
            int?     idTipoEstadia = !string.IsNullOrEmpty(ddlTipoAlquiler.SelectedValue) ? int.Parse(ddlTipoAlquiler.SelectedValue) : (int?)null;
            int?     idZona        = int.Parse(ddlZona.SelectedValue);
            DateTime?fechaDesde;
            DateTime?fechaHasta;

            if (idTipoEstadia == 1)
            {
                fechaDesde = !string.IsNullOrEmpty(txtFechaDesde.Text) ? Convert.ToDateTime(txtFechaDesde.Text) : (DateTime?)null;
                fechaHasta = !string.IsNullOrEmpty(txtFechaHasta.Text) ? Convert.ToDateTime(txtFechaHasta.Text) : (DateTime?)null;
            }
            else
            {
                fechaDesde = !string.IsNullOrEmpty(txtFecha.Text) ? Convert.ToDateTime(txtFecha.Text) : (DateTime?)null;
                fechaHasta = !string.IsNullOrEmpty(txtFecha.Text) ? Convert.ToDateTime(txtFecha.Text) : (DateTime?)null;
            }
            if (FechasValidas())
            {
                DataTable dt = BIZPlaza.SelectAll(idTipoEstadia, idZona, fechaDesde, fechaHasta).Tables[0];
                Session["PlazasFiltradas"] = dt;
                rptMarkers.DataSource      = dt;
                rptMarkers.DataBind();

                if (dt.Rows.Count == 0)
                {
                    /*lblErrorMapa.Text = "No se encuentran plazas disponibles";
                     * lblErrorMapa.Visible = true;*/
                    ((SiteMaster)this.Master).ShowMessage("<strong>No se encuentran plazas disponibles</strong>", SiteMaster.WarningType.Warning);
                }
            }
            else
            {
                ((SiteMaster)this.Master).ShowMessage("<strong>Verifique las fechas ingresadas</strong>", SiteMaster.WarningType.Warning);
            }
        }