本文整理汇总了C#中UserGroup.CreateGroup方法的典型用法代码示例。如果您正苦于以下问题:C# UserGroup.CreateGroup方法的具体用法?C# UserGroup.CreateGroup怎么用?C# UserGroup.CreateGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserGroup
的用法示例。
在下文中一共展示了UserGroup.CreateGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddGroup
/// <summary>
/// ��ӷ���
/// </summary>
public void AddGroup()
{
string groups = Request.Params["groups"];
string userId = Request.Params["userId"];
groups = groups.Replace("��",",");
string[] groupNames = groups.Split(',');
UserGroup userGroup = new UserGroup();
string groupIds = "";
string changedGroupNames = "";
for(int i=0;i<groupNames.Length;i++){
string groupName = groupNames[i];
string tempGroupName = groupName;
string strGroupId = null;
if (groupName == "����")
{
//strGroupId = userGroup.GetStrangerGroupId();
WriteMessage("�������������Ϊ��İ���ˡ����飡");
return;
}
else if (groupName == "�Լ�")
{
WriteMessage("�������������Ϊ���Լ������飡");
return;
}
else
{
strGroupId = userGroup.ExistGroupByName(tempGroupName, userId);
while (strGroupId != null && strGroupId != "")
{ // ������ڸ��飬���������һ�����ּ�1��û�����֣�������Ϊ1
tempGroupName += "(1)";
strGroupId = userGroup.ExistGroupByName(tempGroupName, userId);
}
}
// ��������
string createGroupId = userGroup.CreateGroup(tempGroupName, userId);
if (createGroupId == "")
{
WriteMessage("��������ʧ�ܣ����Ժ����ԣ�");
return;
}
changedGroupNames += i + ":" + tempGroupName + ",";
groupIds += createGroupId + ",";
}
WriteMessage(groupIds.TrimEnd(',') + "��" + changedGroupNames.TrimEnd(','));
}
示例2: ChangeUserGroup
/// <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;
}