示例#1
0
        private void cargarZonas()
        {
            try
            {
                CultureInfo us = new CultureInfo("es-ES");
                gvZona.DataSource = BIZZona.SelectAll();
                gvZona.DataBind();
                divHora.Visible = false;
                //Attribute to show the Plus Minus Button.
                if (gvZona.HeaderRow != null && gvZona.HeaderRow.Cells.Count > 0)
                {
                    gvZona.HeaderRow.Cells[0].Attributes["data-class"] = "expand";

                    //Attribute to hide column in Phone.
                    gvZona.HeaderRow.Cells[1].Attributes["data-hide"] = "phone";

                    //Adds THEAD and TBODY to GridView.
                    gvZona.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
            }
            catch (Exception)
            {
                Response.Redirect("ErrorPage.aspx");
            }
        }
示例#2
0
        protected void gvZona_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Delete")
                {
                    LinkButton lnkView = (LinkButton)e.CommandSource;

                    string dealId = hiddenRow.Value;
                    int    idZona = int.Parse(dealId);
                    BIZZona.Delete(idZona);
                    //Response.Redirect("~/Zona.aspx?delete=true", true);
                    //cargarZonas();

                    //System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "BootstrapDialog.alert('Registro eliminado correctamente.');", true);
                    //data.


                    Response.Redirect("~/Zona.aspx?delete=true", true);
                }
            }
            catch (SqlException)
            {
                Response.Redirect("~/Zona.aspx?delete=false");
                //System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "BootstrapDialog.alert('No se pudo eliminar el registro. Error: " + ex.Message + "');", true);
            }
            catch (Exception ex)
            {
            }
        }
示例#3
0
 protected void gvUsuario_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         int idZona = (int)gvUsuario.DataKeys[e.RowIndex].Value;
         BIZZona.Delete(idZona);
         cargarZonas();
     }
     catch (Exception)
     {
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "pepe", "alert('No se pudo eliminar la zona');", true);
     }
 }
        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");
            }
        }
示例#5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             DataTableZona              = BIZZona.SelectAll().Tables[0];
             ddlDespacho.DataSource     = DataTableZona;
             ddlDespacho.DataValueField = "idZona";
             ddlDespacho.DataTextField  = "direccion";
             ddlDespacho.DataBind();
             ddlDespacho.Items.Insert(0, new ListItem(String.Empty, String.Empty));
             ddlDespacho.SelectedIndex = 0;
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
示例#6
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            try
            {
                lblMensaje.Text = string.Empty;
                decimal precio;
                if (!decimal.TryParse(txtPrecio.Text, out precio) || precio <= 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "pepe", "mostrar();", true);
                    lblMensaje.Text    = "Ingrese un precio válido.";
                    lblMensaje.Visible = true;
                    return;
                }

                if (txtIdZona.Text == string.Empty)
                {
                    BIZZona.Insert(txtDescripcion.Text, txtDireccion.Text, precio);
                }
                else
                {
                    BIZZona.Update(Convert.ToInt32(txtIdZona.Text), txtDescripcion.Text, txtDireccion.Text, precio);
                }
                txtIdZona.Text      = string.Empty;
                txtDescripcion.Text = string.Empty;
                txtDireccion.Text   = string.Empty;
                txtPrecio.Text      = string.Empty;

                txtIdZona.Visible = true;
                lblIdZona.Visible = true;

                pnlTab2.Visible = false;
                pnlTab1.Visible = true;
                //divPrecio.Visible = false;
                lblMensaje.Text = string.Empty;
                cargarZonas();
            }
            catch (Exception)
            {
                Response.Redirect("~/ErrorPage.aspx");
            }
        }