using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using QuintoCaminoV2.Data_objects;

namespace QuintoCaminoV2.Admin
{
    public partial class AdminUsuarios : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            geUsuarios();
        }

        protected void grdUsers_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int index = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName.Equals("detail"))
            {

                int ID = Convert.ToInt32(grdUsers.DataKeys[index].Value.ToString());
                string Usuario = grdUsers.Rows[index].Cells[1].Text;
                Response.Redirect("UsuarioDetalle.aspx?idUsuario=" + ID + "&vchUsuario=" + Usuario);

            }

            if (e.CommandName.Equals("detail"))
            {

                int ID = Convert.ToInt32(grdUsers.DataKeys[index].Value.ToString());
                string Usuario = grdUsers.Rows[index].Cells[1].Text;
                Response.Redirect("UsuarioDetalle.aspx?idUsuario=" + ID + "&vchUsuario=" + Usuario);

            }
        }

        protected void grdUsers_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {

        }

        protected void grdUsers_RowDataBound(object sender, GridViewRowEventArgs e)
        {

        }

        public void geUsuarios()
        {
            DataLayer oDataLayer = new DataLayer();
            Data_objects.Charlas oCharlas = new Data_objects.Charlas();
            grdUsers.DataSource = oDataLayer.get_AllUsers();
            grdUsers.DataBind();

        }
    }
}