public void Insert(Guid UserId, Guid RoleId)
        {
            AspnetUsersInRole item = new AspnetUsersInRole();

            item.UserId = UserId;

            item.RoleId = RoleId;


            item.Save(UserName);
        }
        public void Update(Guid UserId, Guid RoleId)
        {
            AspnetUsersInRole item = new AspnetUsersInRole();

            item.MarkOld();
            item.IsLoaded = true;

            item.UserId = UserId;

            item.RoleId = RoleId;

            item.Save(UserName);
        }
Пример #3
0
        public static void SaveAspnetRoleMap(Guid varUserId, Guid[] itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM [aspnet_UsersInRoles] WHERE [aspnet_UsersInRoles].[UserId] = @UserId", AspnetUser.Schema.Provider.Name);

            cmdDel.AddParameter("@UserId", varUserId, DbType.Guid);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (Guid item in itemList)
            {
                AspnetUsersInRole varAspnetUsersInRole = new AspnetUsersInRole();
                varAspnetUsersInRole.SetColumnValue("UserId", varUserId);
                varAspnetUsersInRole.SetColumnValue("RoleId", item);
                varAspnetUsersInRole.Save();
            }
        }
Пример #4
0
        public static void SaveAspnetUserMap(Guid varRoleId, System.Web.UI.WebControls.ListItemCollection itemList)
        {
            QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
            //delete out the existing
            QueryCommand cmdDel = new QueryCommand("DELETE FROM [aspnet_UsersInRoles] WHERE [aspnet_UsersInRoles].[RoleId] = @RoleId", AspnetRole.Schema.Provider.Name);

            cmdDel.AddParameter("@RoleId", varRoleId, DbType.Guid);
            coll.Add(cmdDel);
            DataService.ExecuteTransaction(coll);
            foreach (System.Web.UI.WebControls.ListItem l in itemList)
            {
                if (l.Selected)
                {
                    AspnetUsersInRole varAspnetUsersInRole = new AspnetUsersInRole();
                    varAspnetUsersInRole.SetColumnValue("RoleId", varRoleId);
                    varAspnetUsersInRole.SetColumnValue("UserId", l.Value);
                    varAspnetUsersInRole.Save();
                }
            }
        }
 public bool Destroy(object UserId)
 {
     return(AspnetUsersInRole.Destroy(UserId) == 1);
 }
 public bool Delete(object UserId)
 {
     return(AspnetUsersInRole.Delete(UserId) == 1);
 }