Exemplo n.º 1
0
        protected void gvwDatos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                int inIndice = Convert.ToInt16(e.CommandArgument);
                if (e.CommandName.Equals("Editar"))
                {
                    lblOpcion.Text   = "2";
                    txtCodigo.Text   = ((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text;
                    txtLatitud.Text  = String.IsNullOrEmpty(gvwDatos.Rows[inIndice].Cells[1].Text) ? String.Empty : gvwDatos.Rows[inIndice].Cells[1].Text;
                    txtLongitud.Text = String.IsNullOrEmpty(gvwDatos.Rows[inIndice].Cells[2].Text) ? String.Empty : gvwDatos.Rows[inIndice].Cells[2].Text;
                }
                else if (e.CommandName.Equals("Eliminar"))
                {
                    logica.Models.clsFloraxDepartamento obclsFloraxDepartamento = new logica.Models.clsFloraxDepartamento
                    {
                        lgCodigo   = Convert.ToInt32(((Label)gvwDatos.Rows[inIndice].FindControl("lblCodigo")).Text),
                        stLatitud  = String.Empty,
                        stLongitud = String.Empty
                    };

                    Controllers.FloraxDepartamentoControllers obFloraxDepartamentoControllers = new Controllers.FloraxDepartamentoControllers();

                    ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('MENSAJE!', '" + obFloraxDepartamentoControllers.deleteFloraxDepartamento(obclsFloraxDepartamento) + "!','Success')</Script>");

                    lblOpcion.Text = txtCodigo.Text = txtLatitud.Text = txtLongitud.Text = String.Empty;
                    getFloraxDepartamento();
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Mesaje", "<Script> swal('ERROR!', '" + ex.Message + "!', 'ERROR')</Script>");
            }
        }