package cn.updev.Users.Group.GroupMemberRule;

import cn.updev.Users.Group.GroupInfo.GroupMemberInfoFactory;
import cn.updev.Users.Static.EnumeRule.GroupRule;
import cn.updev.Users.Static.UserOrGroupDAO.UserOrGroupDelete;
import cn.updev.Users.Static.UserOrGroupDAO.UserOrGroupQuery;
import cn.updev.Users.Static.UserOrGroupInterface.IGroupUser;
import cn.updev.Users.User.GroupUser;

/**
 * Created by blf2 on 15-10-8.
 */
public class RootRule {
    public boolean dismissGroup(Integer userId,Integer groupId){
        IGroupUser iGroupUser = new UserOrGroupQuery().queryGroupUser(userId,groupId);
        if(iGroupUser != null && iGroupUser.getGroupMemberRule() == GroupRule.Creater){
            return new UserOrGroupDelete().deleteGroupInfoById(groupId);
        }
        return false;
    }
    public boolean appointAdmin(Integer groupId,Integer userId){
     //   return new GroupMemberInfoFactory().changeGroupMemberInfo(new GroupUser(userId,groupId,2));
        return true;
    }
}

@@ -273,24 +273,87 @@
 GroupQuery;%0A
+import cn.updev.Users.Static.UserOrGroupDAO.UserOrGroupUpdate;%0A
 import cn.up
@@ -402,16 +402,16 @@
 upUser;%0A
-
 import c
@@ -907,24 +907,42 @@
 pId,Integer 
+createrId,Integer 
 userId)%7B%0A   
@@ -947,55 +947,675 @@
     
-//
    
-return new GroupMemberInfoFactory().chan
+IGroupUser iGroupUser = new UserOrGroupQuery().queryGroupUser(createrId,groupId);%0A        if(iGroupUser != null && iGroupUser.getGroupMemberRule() == GroupRule.Creater)%7B%0A            IGroupUser iGroupUser1 = new UserOrGroupQuery().queryGroupUser(userId,groupId);%0A            iGroupUser1.setGroupMemberRule(GroupRule.Admin);%0A            return new UserOrGroupUpdate().updateGroupUser((GroupUser)iGroupUser1);%0A        %7D%0A        return false;%0A    %7D%0A    public boolean cancelAdmin(Integer groupId,Integer createrId,Integer userId)%7B%0A        IGroupUser iGroupUser = new UserOrGroupQuery().queryGroupUser(createrId,groupId);%0A        if(iGroupUser != null && iGroupUser.
 ge
+t
 Grou
@@ -1625,65 +1625,303 @@
 mber
-Info(new GroupUser(userId,groupId,2));%0A        return tru
+Rule() == GroupRule.Creater)%7B%0A            IGroupUser iGroupUser1 = new UserOrGroupQuery().queryGroupUser(userId,groupId);%0A            iGroupUser1.setGroupMemberRule(GroupRule.User);%0A            return new UserOrGroupUpdate().updateGroupUser((GroupUser)iGroupUser1);%0A        %7D%0A        return fals
 e;%0A 

update Rule of User