protected void btnAgregarRol_Click(object sender, EventArgs e)
        {
            Cls_Roles_Personas_BLL objBLL = new Cls_Roles_Personas_BLL();
            Cls_Roles_Personas_DAL objDAL = new Cls_Roles_Personas_DAL();

            bool existRecord = false;

            for (int i = 0; i < gdvRoles.Rows.Count; i++)
            {
                String Rol = gdvRoles.Rows[i].Cells[2].Text;

                if (cmbRoles.SelectedItem.Text == Rol)
                {
                    existRecord = true;
                    break;
                }
            }

            if (!existRecord)
            {
                objDAL.sCedula = txtCedula.Value.ToString().Trim();
                objDAL.iRol    = Convert.ToInt16(cmbRoles.SelectedValue.ToString().Trim());

                objBLL.Insertar(ref objDAL);

                CargarRoles(objDAL.sCedula);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowPopup", "alert('El rol ya existe para el usuario');", true);
            }
        }
        private void CargarRoles(string sCedula)
        {
            Cls_Roles_Personas_BLL objBLL = new Cls_Roles_Personas_BLL();
            Cls_Roles_Personas_DAL objDAL = new Cls_Roles_Personas_DAL();

            objDAL.sFiltro = sCedula;

            gdvRoles.DataSource = null;
            gdvRoles.DataBind();

            objBLL.Filtrar(ref objDAL);
            if (objDAL.sError == string.Empty)
            {
                gdvRoles.SelectedIndex = -1;
                gdvRoles.DataSource    = objDAL.dtTabla;
                gdvRoles.DataBind();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowPopup", "alert('Se presento un problema a la hora de cargar el los roles');", true);
            }
        }
        protected void gdvRoles_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Borrar")
            {
                int         index        = Convert.ToInt32(e.CommandArgument);
                GridViewRow row          = gdvRoles.Rows[index];
                String      idRolPersona = gdvRoles.Rows[index].Cells[1].Text;

                Cls_Roles_Personas_BLL objBLL = new Cls_Roles_Personas_BLL();
                Cls_Roles_Personas_DAL objDAL = new Cls_Roles_Personas_DAL();

                objDAL.iRolPersona = Convert.ToInt32(idRolPersona.Trim());
                objBLL.Eliminar(ref objDAL);

                if (!string.IsNullOrEmpty(objDAL.sError))
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowPopup", "alert('Se presento un problema a la hora de eliminar el registro');", true);
                }
                else
                {
                    CargarRoles(txtCedula.Value.ToString().Trim());
                }
            }
        }