コード例 #1
0
ファイル: Usr.cs プロジェクト: davelondon/dontstayin
		public void UpdateIsPromoter()
		{
			Query q = new Query();
			q.QueryCondition = new Q(PromoterUsr.Columns.UsrK, this.K);
			q.TopRecords = 1;
			PromoterUsrSet pus = new PromoterUsrSet(q);
			if (this.IsPromoter != (pus.Count > 0))
			{
				this.IsPromoter = (pus.Count > 0);
				this.Update();
			}

			Query qActive = new Query();
			qActive.QueryCondition = new And(
				new Q(PromoterUsr.Columns.UsrK, this.K),
				new Q(Promoter.Columns.Status, Promoter.StatusEnum.Active)
			);
			qActive.TopRecords = 1;
			qActive.TableElement = new Join(PromoterUsr.Columns.PromoterK, Promoter.Columns.K);
			PromoterUsrSet pusActive = new PromoterUsrSet(qActive);
			bool isActivePromoter = pusActive.Count > 0;

			Group g = new Group(3684); //DontStayIn Promoters group
			GroupUsr gu = this.GetGroupUsr(g.K);
			if (isActivePromoter)
				this.AddToPromotersGroup(gu, g);
			else if (!isActivePromoter && gu != null)
				g.ChangeUsr(true, this.K, false, false, false, false, GroupUsr.StatusEnum.Member, DateTime.Now, true);

		}
コード例 #2
0
		public void VerifyUserPermissions()
		{
			Usr.KickUserIfNotLoggedIn();

			if (!(Usr.Current.IsAdmin || (Usr.Current.IsPromoter && CurrentEvent.IsPromoter(Usr.Current))))
			{
				bool match = false;
				PromoterUsrSet pus = new PromoterUsrSet(new Query(new Q(PromoterUsr.Columns.UsrK, Usr.Current.K)));
				foreach (PromoterUsr pu in pus)
				{
					try
					{
						new TicketPromoterEvent(pu.PromoterK, CurrentEvent.K);
						match = true;
						break;
					}
					catch { }
				}
				if (!match)
					throw new Exception("You cannot view this ticket run doorlist! It does not belong to your promoter account.");
			}
		}