public void Display()
 {
     using (SqlConnection connection = new SqlConnection(con))
     {
         SqlCommand cmd = new SqlCommand("DisplayRole", connection);
         cmd.CommandType = CommandType.StoredProcedure;
         connection.Open();
         RoleGridView.DataSource = cmd.ExecuteReader();
         RoleGridView.DataBind();
     }
 }
Ejemplo n.º 2
0
        protected void RoleGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DeleteRole")
            {
                int        roleId = Convert.ToInt32(e.CommandArgument);
                RoleEntity entity = new RoleEntity()
                {
                    Id = roleId, ApplicationId = Convert.ToInt32(ConfigurationManager.AppSettings["ApplicationId"])
                };
                new FormMapper().DeleteFormsFromRole(entity);
                new UserMapper().DeleteUsersFromRole(entity);
                new RoleMapper().Delete(entity);

                RoleGridView.DataBind();
            }
        }