Esempio n. 1
0
        protected void gvwDatos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try {
                int inIndice = Convert.ToInt32(e.CommandArgument);


                if (e.CommandName.Equals("Editar"))
                {
                    lblOpcion.Text = "2";

                    txtCodigo.Text          = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text;
                    txtNombreDeLaPista.Text = gvwDatos.Rows[inIndice].Cells[1].Text;
                    txtGeneroDeLaPista.Text = gvwDatos.Rows[inIndice].Cells[2].Text;
                    txtDemo.Text            = gvwDatos.Rows[inIndice].Cells[3].Text;
                    txtDescripcion.Text     = gvwDatos.Rows[inIndice].Cells[4].Text;
                }
                else if (e.CommandName.Equals("Eliminar"))
                {
                    lblOpcion.Text = "3";
                    Logica.Models.clsPistas obclsPistas = new Logica.Models.clsPistas {
                        inCodigo = Convert.ToInt32(((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text)
                    };

                    Controllers.SubirPistaController obsubirPistaController = new Controllers.SubirPistaController();


                    ;
                    ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> swal('Mensaje','" + obsubirPistaController.deletePistasController(obclsPistas) + "','success')</script>");
                }
            }
            catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script>alert('" + ex.Message + "')</script>"); }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //try
            //  {
            if (!IsPostBack)
            {
                Controllers.SubirPistaController obsubirPistaController = new Controllers.SubirPistaController();
                //DataSet dsConsulta = obsubirPistaController.getConsultarPistasController();

                getPistasXML();
                //if (dsConsulta.Tables[0].Rows.Count > 0)
                //  gvwDatos.DataSource = dsConsulta;
                //else
                // gvwDatos.DataSource = null;

                //gvwDatos.DataBind();
            }
            // }
            //catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script>alert('" + ex.Message + "')</script>"); }
        }
Esempio n. 3
0
        public void getPistasXML()
        {
            try
            {
                Controllers.SubirPistaController obsubirPistaController = new Controllers.SubirPistaController();
                var lstclsPistas = obsubirPistaController.getPistasXMLController();


                if (lstclsPistas != null)
                {
                    gvwDatos.DataSource = lstclsPistas;
                }
                else
                {
                    gvwDatos.DataSource = null;
                }
                gvwDatos.DataBind();
            }
            catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script>alert('" + ex.Message + "')</script>"); }
        }
Esempio n. 4
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try {
                string stMensaje = string.Empty;

                if (string.IsNullOrEmpty(txtCodigo.Text))
                {
                    stMensaje += "Ingrese Codigo,";
                }

                if (!string.IsNullOrEmpty(stMensaje))
                {
                    throw new Exception(stMensaje.TrimEnd(','));
                }

                Logica.Models.clsPistas obclsPistas = new Logica.Models.clsPistas {
                    inCodigo      = Convert.ToInt32(txtCodigo.Text),
                    stNombre      = txtNombreDeLaPista.Text,
                    stGenero      = txtGeneroDeLaPista.Text,
                    stDemo        = txtDemo.Text,
                    stObservacion = txtDescripcion.Text,
                };

                Controllers.SubirPistaController obsubirPistaController = new Controllers.SubirPistaController();
                if (string.IsNullOrEmpty(lblOpcion.Text))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> swal('Mensaje','" + obsubirPistaController.addPistasController(obclsPistas) + "','success')</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> swal('Mensaje','" + obsubirPistaController.updatePistasController(obclsPistas) + "','success')</script>");
                }
                lblOpcion.Text = txtCodigo.Text = txtNombreDeLaPista.Text = txtGeneroDeLaPista.Text = txtDescripcion.Text = txtDemo.Text;

                getPistas();
                //ClientScript.RegisterStartupScript(this.GetType(), "Mensaje!", "<script>alert('" + obsubirPistaController.setAdministrarPistasController(obclsPistas,Convert.ToInt32(lblOpcion.Text)) + "')</script>");
            } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script> swal('Error','" + ex.Message + "','error')</script>"); }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    Controllers.SubirPistaController obsubirPistaController = new Controllers.SubirPistaController();
                    DataSet dsConsulta = obsubirPistaController.getConsultarPistasController();


                    if (dsConsulta.Tables[0].Rows.Count > 0)
                    {
                    }
                    else
                    {
                        throw new Exception
                              {
                              }
                    };
                }
            }
            catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "<script>swal('¡Error!', '" + ex.Message + "', 'error')</script>"); }
        }