当前位置: 首页>>代码示例>>C#>>正文


C# Usr.CanGroupMemberAdmin方法代码示例

本文整理汇总了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;
			}
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:74,代码来源:Group.cs

示例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))
				{
//.........这里部分代码省略.........
开发者ID:davelondon,项目名称:dontstayin,代码行数:101,代码来源:Group.cs


注:本文中的Bobs.Usr.CanGroupMemberAdmin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。