/// <summary> /// �ƶ����ѵ���ѡ�� /// </summary> public string ChangeUserGroup(string userId, string relationshiper, string groupName) { UserGroup userGroup = new UserGroup(); string strGroupId = null; if (groupName == "İ����") { strGroupId = userGroup.GetStrangerGroupId(); } else if(groupName == "�Լ�") { WriteMessage("self"); return null; } else { strGroupId = userGroup.ExistGroupByName(groupName, userId); } if (strGroupId == null || strGroupId == "") // ��������ڸ��飬���ȴ������� { string createGroupId = userGroup.CreateGroup(groupName, userId); if (createGroupId == "") { WriteMessage("��������ʧ�ܣ����Ժ����ԣ�"); return null; } strGroupId = createGroupId; } bool flag = false; GroupRelation groupRelation = new GroupRelation(); if (groupRelation.ExistGroupRelation(userId, relationshiper)) {// ����Ѿ��ӹ��˺��� bool existGroupRelation = groupRelation.ExistGroupRelation(userId, relationshiper, strGroupId); if (existGroupRelation == false) {// �ú��Ѳ��ڸ�����,���ƶ��ú��ѵ������� flag = groupRelation.UpdateGroupRelation(userId, relationshiper, strGroupId); } else { flag = true; } } else {// û�мӹ��˺��ѣ���Ӹú��� flag = groupRelation.InsertGroupRelation(userId, relationshiper, strGroupId); } if (flag) { return strGroupId; } return null; }