public void DeleteRoleinfoByRoleid(string roleid)
 {
     try
     {
         var usermaproleinfoManagement=new UsermaproleinfoManagement(Management);
         var rolepermissionManagement=new RolepermissionManagement(Management);
         Management.BeginTransaction();
         rolepermissionManagement.DeleteRolepermissionByRoleidMenuid(new List<string>(){roleid},new List<string>());
         usermaproleinfoManagement.DeleteUsermaproleinfoByUseridRoleid(new List<string>(),new List<string>(){roleid});
         Management.DeleteRoleinfoByRoleid(roleid);
         Management.Commit();
     }
     catch
     {
         Management.Rollback();
         throw;
     }
 }
 public List<Menuitem> RetrieveMenuItemsByUserId(string userId)
 {
     var menuItems = new List<Menuitem>();
     var usermaproleinfoManagement=new UsermaproleinfoManagement(Management);
     var roleInfos = usermaproleinfoManagement.RetrieveUsermaproleinfoByUseridRoleid(new List<string>() {userId},
                                                                                    new List<string>());
     if(roleInfos.Count>0)
     {
         if(WebContext.Current.CurrentUser!=null)
         {
             var roleinfoManagement = new RoleinfoManagement(Management);
             var currentRole = roleinfoManagement.RetrieveRoleinfoByRoleid(roleInfos[0].Roleid);
             WebContext.Current.CurrentUser.Rolename =currentRole == null ? string.Empty : currentRole.Rolename;
         }
         var rolepermissionManagement=new RolepermissionManagement(Management);
         var list = rolepermissionManagement.RetrieveMenuItemsByRoleId(roleInfos[0].Roleid);
         list = (from p in list
                 orderby p.Parentmenuid
                 orderby p.Orderby
                 orderby p.Menuid
                 select p).ToList();
         menuItems.AddRange(list);
     }
     return menuItems;
 }