本文整理汇总了C#中Bobs.Usr.CanGroupMemberAdmin方法的典型用法代码示例。如果您正苦于以下问题:C# Usr.CanGroupMemberAdmin方法的具体用法?C# Usr.CanGroupMemberAdmin怎么用?C# Usr.CanGroupMemberAdmin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bobs.Usr
的用法示例。
在下文中一共展示了Usr.CanGroupMemberAdmin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reject
public Return Reject(Usr TargetUsr, GroupUsr TargetGroupUsr, Usr PerformingUsr, GroupUsr PerformingGroupUsr)
{
Return r = new Return();
if (this.Restriction.Equals(Group.RestrictionEnum.Custom))
{
r.Success=false;
r.MessageHtml="Can't accept into a custom group!";
return r;
}
if (!PerformingUsr.IsAdmin && (PerformingGroupUsr==null || !PerformingGroupUsr.IsMember))
{
r.Success=false;
r.MessageHtml="You must be a member of this group to reject someone!";
return r;
}
if (TargetGroupUsr==null)
{
r.Success=false;
r.MessageHtml="Can't reject - user hasn't requested membership!";
return r;
}
else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.Request))
{
// This person has requested membership
// if the current user is a moderator, we must enable the request.
if (this.Restriction.Equals(Group.RestrictionEnum.Moderator))
{
if (PerformingUsr.CanGroupMemberAdmin(PerformingGroupUsr))
{
RejectPrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr);
r.Success=true;
return r;
}
else
{
r.Success=false;
r.MessageHtml="You don't have permission to reject.";
return r;
}
}
else
{
RejectPrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr);
r.Success=true;
return r;
}
}
else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.Recommend))
{
// A previous membership request was denied
// if the current user is a moderator, we must enable them straight away.
if (PerformingUsr.CanGroupMemberAdmin(PerformingGroupUsr))
{
RejectPrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr);
r.Success=true;
return r;
}
else
{
r.Success=false;
r.MessageHtml="You don't have permission to reject.";
return r;
}
}
else
{
r.Success=false;
r.MessageHtml="Can't reject - wrong status.";
return r;
}
}
示例2: Invite
public Return Invite(Usr TargetUsr, GroupUsr TargetGroupUsr, Usr PerformingUsr, GroupUsr PerformingGroupUsr,
string InviteMessage, bool InviteByEmail)
{
Return r = new Return();
string targetUsr = "";
if (InviteByEmail && TargetUsr.NickName.Length==0)
targetUsr = TargetUsr.Email;
else
targetUsr = TargetUsr.Link();
if (this.Restriction.Equals(Group.RestrictionEnum.Custom))
{
r.Success=false;
r.MessageHtml="The "+this.FriendlyName+" group is a special group - the membership "+
"is automatically controlled. You can't invite people to this group.";
return r;
}
if (!PerformingUsr.IsAdmin && (PerformingGroupUsr==null || !PerformingGroupUsr.IsMember))
{
r.Success=false;
r.MessageHtml="You're not a member of the "+this.FriendlyName+" group!";
return r;
}
if (TargetGroupUsr==null)
{
if (this.Restriction.Equals(Group.RestrictionEnum.Moderator))
{
//nothing now
//if the current user is a moderator, we add an invite request.
//If the current user isn't a mod, we add a recommend.
if (PerformingUsr.CanGroupMemberAdmin(PerformingGroupUsr))
{
InvitePrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr, InviteMessage);
r.Success=true;
r.MessageHtml="You have invited "+targetUsr+" to the "+
this.FriendlyName+" group. They will be sent a message shortly.";
}
else
{
RecommendPrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr, InviteMessage);
r.Success=true;
r.MessageHtml="Since "+this.FriendlyName+" is a restricted group, only "+
"moderators may send invites. "+targetUsr+" has been recommended "+
"as a possible member. A moderator will decide whether to send the invite.";
}
}
else
{
InvitePrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr, InviteMessage);
r.Success=true;
r.MessageHtml="You have invited "+targetUsr+" to the "+this.FriendlyName+" group. "+
"They will be sent a message shortly.";
}
}
else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.Member))
{
// This person is a member of the group
r.Success=false;
r.MessageHtml=targetUsr+" is already a member of the "+this.FriendlyName+" group.";
}
else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.Request))
{
// This person has requested membership
// if the current user is a moderator, we must enable the request.
// If the current user isn't a mod, we must show an error.
if (this.Restriction.Equals(Group.RestrictionEnum.Moderator))
{
if (PerformingUsr.CanGroupMemberAdmin(PerformingGroupUsr))
{
JoinPrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr);
r.Success=true;
r.MessageHtml=targetUsr+" had already requested to join the "+
this.FriendlyName+" group, so we've instantly made them a member.";
}
else
{
r.Success=false;
r.MessageHtml=targetUsr+" has already requested to be a member "+
"of this group. The group moderators will deal with the request and either accept or "+
"deny the request.";
}
}
else
{
JoinPrivate(TargetUsr, TargetGroupUsr, PerformingUsr, PerformingGroupUsr);
r.Success=true;
r.MessageHtml=targetUsr+" had already requested to join the "+
this.FriendlyName+" group, so we've instantly made them a member.";
}
}
else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.RequestRejected))
{
// A previous membership request was denied
// if the current user is a moderator, we must enable them straight away.
// If the current user isn't a mod, we must show an error.
if (PerformingUsr.CanGroupMemberAdmin(PerformingGroupUsr))
{
//.........这里部分代码省略.........