Exemplo n.º 1
0
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
			Query q = new Query();
			q.QueryCondition = Usr.LoggedInQ;
			q.NoLock = true;
			q.ReturnCountOnly = true;
			UsrSet us = new UsrSet(q);
			UsersOnline5MinLabel.Text = (us.Count == 1 ? "is " : "are ") + us.Count.ToString("#,##0") + " user" + (us.Count == 1 ? "" : "s");

			Query q30min = new Query();
			q30min.QueryCondition = Usr.LoggedIn30MinQ;
			q30min.NoLock = true;
			q30min.ReturnCountOnly = true;
			UsrSet us30min = new UsrSet(q30min);
			UsersOnline30MinLabel.Text = us30min.Count.ToString("#,##0");

			Bobs.Global gMaxUsers = new Bobs.Global(Bobs.Global.Records.MaxUsers5Min);
			MaxUsersOnline5MinLabel.Text = gMaxUsers.ValueInt.ToString("#,##0");
			MaxUsersOnline5MinDateLabel.Text = Cambro.Misc.Utility.FriendlyDate(gMaxUsers.ValueDateTime, true, false);
			Bobs.Global gMaxUsers30Min = new Bobs.Global(Bobs.Global.Records.MaxUsers30Min);
			MaxUsersOnline30MinLabel.Text = gMaxUsers30Min.ValueInt.ToString("#,##0");

			Page.DataBind();
		}
Exemplo n.º 2
0
		protected void BindOnlineBox()
		{
			if (Prefs.Current["ShowOnline"].Exists && Prefs.Current["ShowOnline"] == 1)
			{
				//Show box
				OnlineHiddenPanel.Visible = false;
				OnlinePanel.Visible = true;
			}
			else
			{
				//show link
				Query q = new Query();
				q.CacheDuration = TimeSpan.FromMinutes(10);
				q.QueryCondition = Usr.LoggedInChatQ;
				q.ReturnCountOnly = true;
				UsrSet us = new UsrSet(q);
				if (us.Count <= 1)
				{
					this.Visible = false;
				}
				else
				{
					Bobs.Global.SetMaxUsers(us.Count);
					OnlineHiddenLabel.Text = us.Count.ToString() + " user" + (us.Count == 1 ? "" : "s") + " online";
					OnlineHiddenPanel.Visible = true;
					OnlinePanel.Visible = false;
				}
			}
			

		}
Exemplo n.º 3
0
		protected void LoginButton_Click(object sender, EventArgs e)
		{
			if (LoginEmailTextBox.Text.Trim().Length < 5)
			{
				LoginCustomValidator.ErrorMessage = "Invalid email address";
				LoginCustomValidator.IsValid = false;
			}
			else if (LoginPasswordTextBox.Text.Trim().Length < 4)
			{
				LoginCustomValidator.ErrorMessage = "Email and password do not match our records";
				LoginCustomValidator.IsValid = false;
			}
			else if (Page.IsValid)
			{
				// Validate email and password
				UsrSet us = new UsrSet(new Query(new Or(new Q(Usr.Columns.NickName, LoginEmailTextBox.Text.Trim()),
														new Q(Usr.Columns.Email, LoginEmailTextBox.Text.Trim()))));
				if (us.Count == 1 && us[0].CheckPassword(LoginPasswordTextBox.Text.Trim()))
				{
				//	us[0].LogInAsThisUser(true);
					Proceed();
				}
				else
				{
					// invalidate
					LoginCustomValidator.ErrorMessage = "Email and password do not match our records";
					LoginCustomValidator.IsValid = false;
				}
			}
		}
Exemplo n.º 4
0
		public static Hashtable CheckEmail(string email)
		{
			UsrSet us = new UsrSet(new Query(new Q(Usr.Columns.Email, email), true));

			Hashtable ret = new Hashtable();

			ret["Found"] = us.Count > 0;

			return ret;
		}
Exemplo n.º 5
0
		protected void Page_Load(object sender, EventArgs e)
		{
			Query q = new Query();
			q.QueryCondition=new Q(Usr.Columns.CampTickets, QueryOperator.GreaterThan, 0);
			q.OrderBy = new OrderBy(Usr.Columns.NickName);
			UsrSet us = new UsrSet(q);
			foreach (Usr u in us)
			{
				Response.Write(u.NickName + " - " + u.CampTickets + "<br>");
			}
		}
Exemplo n.º 6
0
		private void Page_Load(object sender, System.EventArgs e)
		{
			ContainerPage.SetPageTitle("Contact us");
			//Usr john = new Usr(1);
			//Usr tim = new Usr(2);
			//Usr dave = new Usr(4);
			//JohnPic.Src = john.AnyPicPath;
			//john.MakeRolloverNoPic(JohnPic);
			//DavePic.Src = dave.AnyPicPath;
			//dave.MakeRolloverNoPic(DavePic);
			//TimPic.Src = tim.AnyPicPath;
			//tim.MakeRolloverNoPic(TimPic);

			//JohnLink.HRef = john.Url();
			//JohnLink.InnerText = john.NickName;
			//TimLink.HRef = tim.Url();
			//TimLink.InnerText = tim.NickName;
			//DaveLink.HRef = dave.Url();
			//DaveLink.InnerText = dave.NickName;

			Query qSuper = new Query();
			qSuper.NoLock = true;
			qSuper.QueryCondition = new And(
				new Q(Usr.Columns.AdminLevel, Usr.AdminLevels.Super),
				new Q(Usr.Columns.IsAdmin, false)
			);
			qSuper.OrderBy = new OrderBy(Usr.Columns.DateTimeLastPageRequest, OrderBy.OrderDirection.Descending);
			qSuper.Columns = Usr.LinkColumns;
			UsrSet usSuper = new UsrSet(qSuper);
			SuperAdminDataList.DataSource = usSuper;
			SuperAdminDataList.ItemTemplate = this.LoadTemplate("/Templates/Usrs/Default.ascx");
			SuperAdminDataList.DataBind();

			Query qSenior = new Query();
			qSenior.NoLock = true;
			qSenior.QueryCondition = new Q(Usr.Columns.AdminLevel, Usr.AdminLevels.Senior);
			qSenior.OrderBy = new OrderBy(Usr.Columns.DateTimeLastPageRequest, OrderBy.OrderDirection.Descending);
			qSenior.Columns = Usr.LinkColumns;
			UsrSet usSenior = new UsrSet(qSenior);
			SeniorAdminDataList.DataSource = usSenior;
			SeniorAdminDataList.ItemTemplate = this.LoadTemplate("/Templates/Usrs/Default.ascx");
			SeniorAdminDataList.DataBind();

			Query qJunior = new Query();
			qJunior.NoLock = true;
			qJunior.QueryCondition = new Q(Usr.Columns.AdminLevel, Usr.AdminLevels.Junior);
			qJunior.OrderBy = new OrderBy(Usr.Columns.DateTimeLastPageRequest, OrderBy.OrderDirection.Descending);
			qJunior.Columns = Usr.LinkColumns;
			UsrSet usJunior = new UsrSet(qJunior);
			JuniorAdminDataList.DataSource = usJunior;
			JuniorAdminDataList.ItemTemplate = this.LoadTemplate("/Templates/Usrs/Default.ascx");
			JuniorAdminDataList.DataBind();
		}
Exemplo n.º 7
0
		private void Page_Load(object sender, System.EventArgs e)
		{
			ContainerPage.SetPageTitle("Pro spotters");
			Query q = new Query();
			q.NoLock = true;
			q.QueryCondition = new Q(Usr.Columns.IsProSpotter, true);
			q.OrderBy = new OrderBy(Usr.Columns.SpottingsTotal, OrderBy.OrderDirection.Descending);
			UsrSet us = new UsrSet(q);
			ProSpottersDataList.DataSource = us;
			ProSpottersDataList.ItemTemplate = this.LoadTemplate("/Templates/Usrs/ProSpotter.ascx");
			ProSpottersDataList.DataBind();
		}
		protected void Page_Load(object sender, EventArgs e)
		{
			Query q = new Query();
			q.TopRecords = 100;
			q.TableElement = new Join.Series(Usr.Columns.K, PromoterUsr.Columns.UsrK, PromoterUsr.Columns.PromoterK, Promoter.Columns.K);
			q.OrderBy = new OrderBy(OrderBy.OrderDirection.Random);

			UsrSet us = new UsrSet(q);
			foreach (Usr u in us)
			{
				Ph.Controls.Add(new LiteralControl(u.JoinedPromoterUsr.Promoter.GetUpcomingEvents(false).Count.ToString() + " <a href=\"" + u.LoginAndTransferShort(u.JoinedPromoterUsr.Promoter.Url()) + "\" target=\"_blank\">" + u.JoinedPromoterUsr.Promoter.UrlName + " - " + u.NickName + "</a><br>"));
			}
		}
Exemplo n.º 9
0
		static void UnsubscribeEmail(string Email, ref int count)
		{
			UsrSet us = new UsrSet(new Query(new Q(Usr.Columns.Email, Email)));
			if (us.Count > 0 && !us[0].EmailHold)
			{
				us[0].EmailHold = true;
				us[0].Update();
				Console.WriteLine("  Unsubscribed: " + Email);
				count++;
			}
			else
			{
				Console.WriteLine("  Skipped: " + Email);
			}
		}
Exemplo n.º 10
0
		static void UnverifyEmail(string Email, ref int count)
		{
			UsrSet us = new UsrSet(new Query(new Q(Usr.Columns.Email, Email)));
			if (us.Count > 0 && us[0].IsEmailVerified)
			{
				us[0].IsEmailVerified = false;
				us[0].Update();
				Console.WriteLine("  Unverified: " + Email);
				count++;
			}
			else
			{
				Console.WriteLine("  Skipped: " + Email);
			}
		}
Exemplo n.º 11
0
		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Vars.DevEnv)
			{
				Query q = new Query();
				q.QueryCondition = new Or(
					new Q(Usr.Columns.CardStatus, Usr.CardStatusEnum.New),
					new Q(Usr.Columns.CardStatus, Usr.CardStatusEnum.PrintingWelcomePack),
					new Q(Usr.Columns.CardStatus, Usr.CardStatusEnum.NeedCards),
					new Q(Usr.Columns.CardStatus, Usr.CardStatusEnum.PrintingRefill)
				);
				q.ReturnCountOnly = true;
				UsrSet us = new UsrSet(q);
				TitleLabel.Text = us.Count.ToString("#,##0") + " item" + (us.Count == 1 ? "" : "s");
			}
		}
Exemplo n.º 12
0
		protected void Page_Load(object sender, EventArgs e)
		{
			Q sexQ =
				Usr.Current == null ? new Q(true) :
				Usr.Current.IsMale ? new Q(Usr.Columns.IsMale, false) :
				new Q(Usr.Columns.IsMale, true);

			Query q = new Query();
			q.DataTableElement = new TableElement(TablesEnum.Usr);
			q.TableElement = Event.UsrAttendedJoin;
			q.QueryCondition = new And(
				sexQ,
				new Q(Usr.Columns.IsSkeleton, false),
				new Q(Usr.Columns.ExDirectory, false),
				new Q(Usr.Columns.PhotosMeCount, QueryOperator.GreaterThan, 0),
				new Q(Usr.Columns.Pic, QueryOperator.NotEqualTo, Guid.Empty),
				Event.FutureEventsQueryCondition,
				new Q(Event.Columns.DateTime, QueryOperator.LessThan, DateTime.Today.AddDays(7)));
			q.Distinct = true;
			q.DistinctColumn = Usr.Columns.K;
			q.OrderBy = new OrderBy(Usr.Columns.K);
			q.CacheDuration = new TimeSpan(1, 0, 0);
			q.Columns = new ColumnSet(Usr.Columns.IsMale, Usr.Columns.K, Usr.Columns.Pic, Usr.Columns.FacebookUID);
			UsrSet ueas = new UsrSet(q);

			if (ueas.Count >= 6)
			{
				Random r = new Random();
				int start = r.Next(ueas.Count);
				OutBoxHolder.InnerHtml += "<p>";
				for (int i = 0; i < 6; i++)
				{
					int j = start + i;
					if (j >= ueas.Count)
						j = start + i - ueas.Count;

					Usr u = ueas[j];

					string s = "<a href=\"/pages/out/" + (u.IsMale ? "boys" : "girls") + "/worldwide/" + u.K.ToString() + "\" class=\"NoStyle\"><img src=\"" + u.PicPath + "\" width=\"100\" height=\"100\" /></a>";
					OutBoxHolder.InnerHtml += s;
				}
				OutBoxHolder.InnerHtml += "</p>";
			}
			else
				this.Visible = false;

		}
Exemplo n.º 13
0
		private void Page_Load(object sender, System.EventArgs e)
		{
			Query q = new Query();
			q.Columns = new ColumnSet(
				Usr.Columns.K,
				Usr.Columns.SpottingsMonth,
				Usr.Columns.SpottingsMonthRank,
				Usr.LinkColumns
			);
			q.QueryCondition = new And(new Q(Usr.Columns.IsAdmin, false), new Q(Usr.Columns.K, QueryOperator.NotEqualTo, 2770));
			q.OrderBy = new OrderBy(new OrderBy(Usr.Columns.SpottingsMonth, OrderBy.OrderDirection.Descending), new OrderBy(Usr.Columns.K, OrderBy.OrderDirection.Ascending));
			q.TopRecords = 10;
			UsrSet us = new UsrSet(q);

			SpotterRankRepeater.ItemTemplate = this.LoadTemplate("/Templates/Usrs/SpotterRank.ascx");
			SpotterRankRepeater.DataSource = us;
			SpotterRankRepeater.DataBind();
		}
Exemplo n.º 14
0
		public void SplitOutEmailContacts(List<Contact> contacts, int currentUsrK, out int numberAlreadyBuddiesOrBuddyRequests, out List<Usr> memberContacts, out List<Contact> nonMemberContacts)
		{
			numberAlreadyBuddiesOrBuddyRequests = 0;

			if (contacts.Count > 0)
			{
				Query q = new Query();
				//q.Columns = new ColumnSet(Usr.Columns.K, Usr.Columns.NickName, Usr.Columns.Email);
				q.TableElement = new Join(Usr.Columns.K, Buddy.Columns.BuddyUsrK, QueryJoinType.Left, new Q(Buddy.Columns.UsrK, currentUsrK));
				q.QueryCondition = new And(
					new Q(Usr.Columns.Email, contacts.ConvertAll(c => c.Email).ToArray()),
					new Q(Usr.Columns.IsSkeleton, false)
					);
				q.ExtraSelectElements.Add("BuddyRequested", "case when [Buddy].[BuddyUsrK] IS NOT NULL and coalesce([Buddy].[FullBuddy], 0) = 0 then cast(1 as bit) else cast(0 as bit) end");
				q.ExtraSelectElements.Add("IsAlreadyBuddy", "case when coalesce([Buddy].[FullBuddy], 0) = 1 then cast(1 as bit) else cast(0 as bit) end");
				q.OrderBy = new OrderBy("case when [Buddy].[FullBuddy] = 1 then 0 when [Buddy].[FullBuddy] = 0 then 1 else 2 end ASC, [Usr].[Email]");
				memberContacts = new UsrSet(q).ToList();

				List<int> alreadyBuddyOrRequestedBuddyKs = new List<int>(contacts.Count);
				foreach (Usr u in memberContacts)
				{
					if ((bool)u.ExtraSelectElements["IsAlreadyBuddy"] || (bool)u.ExtraSelectElements["BuddyRequested"])
					{
						alreadyBuddyOrRequestedBuddyKs.Add(u.K);
					}
					contacts.RemoveAll(c => c.Email == u.Email);
				}

				memberContacts.RemoveAll(u => u.K == currentUsrK);

				numberAlreadyBuddiesOrBuddyRequests = alreadyBuddyOrRequestedBuddyKs.Count;
				foreach (int k in alreadyBuddyOrRequestedBuddyKs)
				{
					memberContacts.RemoveAll(u => u.K == k);
				}
			}
			else
			{
				memberContacts = new List<Usr>();
			}

			nonMemberContacts = contacts;
		}
Exemplo n.º 15
0
		void Bind()
		{
			Query q = new Query();
			q.NoLock = true;
			q.QueryCondition = new Q(Usr.Columns.AdminLevel, Usr.AdminLevels.Super);
			q.OrderBy = new OrderBy(Usr.Columns.NickName);
			q.Columns = new ColumnSet(Usr.LinkColumns, Usr.Columns.DateTimeLastPageRequest, Usr.Columns.IsLoggedOn, Usr.Columns.FirstName, Usr.Columns.LastName, Usr.Columns.IsSkeleton);
			UsrSet us = new UsrSet(q);
			ModeratorsDataGrid.DataSource = us;
			ModeratorsDataGrid.DataBind();

			if (ContainerPage.Url["usrk"].IsInt)
			{
				int UsrK = ContainerPage.Url["usrk"];
				if (ContainerPage.Url["type"] == 1)
				{
					Query tsq = new Query();
					tsq.QueryCondition = new And(
						new Q(Thread.Columns.NewsStatus, Thread.NewsStatusEnum.Recommended),
						new Q(Thread.Columns.NewsModeratorUsrK, UsrK));
					tsq.TopRecords = 10;
					tsq.NoLock = true;
					ThreadSet ts = new ThreadSet(tsq);
					if (ts.Count == 0)
						ItemsPanel.Visible = false;
					else
					{
						ItemsRepeater.DataSource = ts;
						ItemsRepeater.ItemTemplate = this.LoadTemplate("/Templates/Threads/NewsAdmin.ascx");
						ItemsRepeater.DataBind();
					}
				}
				else
				{
					ItemsPanel.Visible = false;
				}
			}
			else
			{
				ItemsPanel.Visible = false;
			}
		}
Exemplo n.º 16
0
		private void Page_Load(object sender, System.EventArgs e)
		{
			if (Usr.Current != null && Usr.Current.HasBuddiesFull)
			{
				Query q = new Query();
				q.TableElement = Usr.BuddyJoin;
				q.QueryCondition = Usr.Current.BuddiesFullQ;
				q.OrderBy = new OrderBy(Usr.Columns.NickName);
				q.NoLock = true;
				q.Columns = new ColumnSet(Usr.Columns.K, Usr.Columns.NickName);
				UsrSet usBuddys = new UsrSet(q);
				UsrPhotoBuddyDropDown.DataSource = usBuddys;
				UsrPhotoBuddyDropDown.DataTextField = "NickName";
				UsrPhotoBuddyDropDown.DataValueField = "K";
				UsrPhotoBuddyDropDown.DataBind();
				UsrPhotoBuddyDropDown.Items.Insert(0, new ListItem("Select buddy", "-1"));
			}
			else
			{
				this.Visible = false;
			}
		}
Exemplo n.º 17
0
		protected void MarkSent(object o, EventArgs e)
		{
			Query q = new Query();
			q.NoLock = true;
			q.QueryCondition = new Or(
				new Q(Usr.Columns.CardStatus, Usr.CardStatusEnum.PrintingWelcomePack),
				new Q(Usr.Columns.CardStatus, Usr.CardStatusEnum.PrintingRefill));
			UsrSet us = new UsrSet(q);
			foreach (Usr u in us)
			{
				if (u.CardStatus.Equals(Usr.CardStatusEnum.PrintingWelcomePack))
				{
					u.CardStatus = Usr.CardStatusEnum.WelcomePackInPost;
				}
				else
				{
					u.CardStatus = Usr.CardStatusEnum.CardsInPost;
				}
				u.TotalCardsSent += 360;
				u.Update();
			}
			DoneLabel.Visible = true;
		}
Exemplo n.º 18
0
		public void CountUsrs_NoConditions()
		{
			new Delete(TablesEnum.Usr, new Q(true)).Run();
			int usrsToCreate = 15;
			usrsToCreate.Times(() =>
			{
				Usr u = new Usr()
				{
					Email = Guid.NewGuid().ToString(),
					IsSkeleton = false,
					IsEmailVerified = true,
					SendFlyers = true
				};
				u.Update();
			});

			Query q = new Query();
			q.QueryCondition = new And(new Q(Usr.Columns.IsSkeleton, false), new Q(Usr.Columns.SendFlyers, true));
			q.ReturnCountOnly = true;

			int totalUsrs = new UsrSet(q).Count;
			Assert.AreEqual(usrsToCreate, totalUsrs);
			Assert.AreEqual(totalUsrs, Flyer.CountUsrs(new List<int>(), new List<int>(), false));
		}
Exemplo n.º 19
0
		protected void Page_Load(object sender, EventArgs e)
		{
			if (Usr.Current != null)
			{
				#region Home country
				{
					if (Country.Current != null)
					{
						HomeCountryLink.HRef = Country.Current.Url();
						HomeCountryLink.InnerHtml = Country.Current.FriendlyName;
						HomeCountryLabel.Text = Country.Current.FriendlyName;
					}
				}
				#endregion

				#region Favourite groups
				{
					Query q = new Query();
					q.TableElement = new Join(
						new TableElement(TablesEnum.Group),
						new TableElement(TablesEnum.GroupUsr),
						QueryJoinType.Inner,
						new And(
							new Q(Group.Columns.K, GroupUsr.Columns.GroupK, true),
							new Q(GroupUsr.Columns.Favourite, true),
							new Q(GroupUsr.Columns.UsrK, Usr.Current.K),
							new Q(GroupUsr.Columns.Status, GroupUsr.StatusEnum.Member)
						)
					);
					q.Columns = new ColumnSet(Group.Columns.UrlName, Group.Columns.Name);
					q.OrderBy = new OrderBy(Group.Columns.Name);
					GroupSet gs = new GroupSet(q);
					if (gs.Count > 0)
					{
						StringBuilder sb = new StringBuilder();
						foreach (Group g in gs)
						{
							sb.Append(string.Format("{0}<a href=\"{1}\">{2}</a>", sb.Length == 0 ? "" : ", ", g.Url(), g.Name));
						}
						FavouriteGroupsPlaceholder.Controls.Add(new LiteralControl(sb.ToString()));
						FavouriteGroupsHolder.Visible = true;
						NoFavouriteGroupsHolder.Visible = false;
					}
					else
					{
						FavouriteGroupsHolder.Visible = false;
						NoFavouriteGroupsHolder.Visible = true;
					}
				}
				#endregion

				#region Places I visit
				{
					Query q = new Query();
					q.TableElement = new Join(
						new TableElement(TablesEnum.Place),
						new TableElement(TablesEnum.UsrPlaceVisit),
						QueryJoinType.Inner,
						new And(
							new Q(Place.Columns.K, UsrPlaceVisit.Columns.PlaceK, true),
							new Q(UsrPlaceVisit.Columns.UsrK, Usr.Current.K)
						)
					);
					q.Columns = new ColumnSet(Place.Columns.UrlName, Place.Columns.Name, Place.Columns.RegionAbbreviation, Place.Columns.UrlFragment);
					q.OrderBy = new OrderBy(Place.Columns.Name);
					PlaceSet ps = new PlaceSet(q);
					if (ps.Count > 0)
					{
						StringBuilder sb = new StringBuilder();
						foreach (Place p in ps)
						{
							sb.Append(string.Format("{0}<a href=\"{1}\">{2}</a>", sb.Length == 0 ? "" : ", ", p.Url(), p.NamePlain));
						}
						PlacesPlaceholder.Controls.Add(new LiteralControl(sb.ToString()));
					}
					else
					{
						PlacesHolder.Visible = false;
					}
				}
				#endregion

				#region Calendars
				{
					MyCalendarLink.HRef = "/pages/mycalendar#Day" + DateTime.Now.ToString("yyyyMMdd");
					BuddyCalendarLink.HRef = "/pages/mycalendar/type-buddy#Day" + DateTime.Now.ToString("yyyyMMdd");
				}
				#endregion

				#region My comments
				{
					MyCommentsLink.HRef = Usr.Current.UrlApp("chat");
				}
				#endregion

				#region My tickets
				{
					MyTicketsLink.HRef = Usr.Current.UrlApp("mytickets");
				}
				#endregion

				#region Online buddies
				{
					Query q = new Query();
					q.TableElement = Usr.BuddyJoin;
					q.QueryCondition = new And(
						new Q(Buddy.Columns.UsrK, Usr.Current.K),
						Usr.LoggedIn30MinIncludeNonEmailVerifiedQ);
					q.OrderBy = new OrderBy(Usr.Columns.NickName);
					UsrSet us = new UsrSet(q);
					StringBuilder sb = new StringBuilder();
					foreach (Usr u in us)
					{
						sb.Append(sb.Length == 0 ? "" : ", ");
						u.LinkAppend(sb, false);
					}
					OnlineBuddiesPlaceholder.Controls.Add(new LiteralControl(sb.ToString()));
				}
				{
					Query q = new Query();
					q.QueryCondition = Usr.LoggedIn30MinIncludeNonEmailVerifiedQ;
					q.CacheDuration = TimeSpan.FromMinutes(15);
					q.ReturnCountOnly = true;
					UsrSet us = new UsrSet(q);
					NumberOnlineLabel.Text = us.Count.ToString("#,##0");
				}
				#endregion

				#region Favourite photos
				//{
				//    Query q = new Query();
				//    q.TableElement = Photo.UsrFavouritesJoin;
				//    q.OrderBy = new OrderBy(UsrPhotoFavourite.Columns.DateTimeAdded, OrderBy.OrderDirection.Descending);
				//    q.TopRecords = 7;
				//    q.QueryCondition = new Q(UsrPhotoFavourite.Columns.UsrK, Usr.Current.K);
				//    PhotoSet ps = new PhotoSet(q);
				//    StringBuilder sb = new StringBuilder();
				//    foreach (Photo p in ps)
				//    {
				//        sb.Append(string.Format("<a href=\"{0}\"><img src=\"{1}\" border=\"0\" width=\"50\" height=\"50\" class=\"BorderBlack All\" /></a> ", p.Url(), p.IconPath));
				//    }
				//    FavouritePhotosPlaceholder.Controls.Add(new LiteralControl(sb.ToString()));

				//    FavouritePhotosLink.HRef = Usr.Current.UrlApp("favouritephotos");
				//}
				#endregion
			}
			
		}
Exemplo n.º 20
0
		public void Buddies_Click(object o, System.EventArgs e)
		{
			if (Mode.Equals(Modes.Buddies))
			{
				if (Page.IsValid)
				{
					
					Query q = new Query(new Q(Usr.Columns.K, uiMultiBuddyChooser.SelectedUsrKs.ToArray()));
					


					q.Columns = new ColumnSet(Usr.EmailColumns, Usr.LinkColumns, Usr.Columns.AddedByUsrK, Usr.Columns.AddedByGroupK);
					UsrSet us = new UsrSet(q);
					int successCount = 0;
					foreach (Usr u in us)
					{
						try
						{
							GroupUsr gu = CurrentGroup.GetGroupUsr(u);
							Return r = CurrentGroup.Invite(u, gu, Usr.Current, CurrentGroupUsr, BuddiesIntroTextBox.Text, false);

							if (r.Success)
							{
								successCount++;
								BuddiesOutputP.InnerHtml += @"<img src=""/gfx/icon-tick-up.png"" border=""0"" height=""21"" width=""26"" align=""absmiddle"" style=""margin-right:3px;"">";
								BuddiesOutputP.InnerHtml += r.MessageHtml;
							}
							else
							{
								BuddiesOutputP.InnerHtml += @"<img src=""/gfx/icon-cross-up.png"" border=""0"" height=""21"" width=""26"" align=""absmiddle"" style=""margin-right:3px;"">";
								BuddiesOutputP.InnerHtml += r.MessageHtml;
							}

						}
						catch
						{
							BuddiesOutputP.InnerHtml += @"<img src=""/gfx/icon-cross-up.png"" border=""0"" height=""21"" width=""26"" align=""absmiddle"" style=""margin-right:3px;"">Exception";
						}
						BuddiesOutputP.InnerHtml += "<br>";
					}
					if (successCount > 0)
						this.uiMultiBuddyChooser.Clear();

				}
			}
		}
Exemplo n.º 21
0
		protected void Page_Load(object sender, EventArgs e)
		{
			if (!ContainerPage.Url.HasMonthFilter || !ContainerPage.Url["UsrK"].IsInt)
				Response.Redirect("/admin/salescalls/usrk-1/year-" + DateTime.Now.Year + "/month-" + DateTime.Now.Month);

			Query q1 = new Query();
			q1.QueryCondition = new Q(Usr.Columns.IsSalesPerson, true);
			q1.OrderBy = new OrderBy(Usr.Columns.K);
			UsrSet us = new UsrSet(q1);
			foreach (Usr u in us)
			{
				if (CurrentUsr != null && u.K == CurrentUsr.K)
					UsersPh.Controls.Add(new LiteralControl("<b>" + u.NickName + "</b>"));
				else
				{
					if (ContainerPage.Url.HasDayFilter)
					{
						UsersPh.Controls.Add(new LiteralControl("<a href=\"/admin/salescalls/usrk-" + u.K + "/year-" + ContainerPage.Url.DateFilter.Year + "/month-" + ContainerPage.Url.DateFilter.Month + "/day-" + ContainerPage.Url.DateFilter.Day + "\" " + u.Rollover + ">" + u.NickName + "</a>"));
					}
					else
					{
						UsersPh.Controls.Add(new LiteralControl("<a href=\"/admin/salescalls/usrk-" + u.K + "/year-" + ContainerPage.Url.DateFilter.Year + "/month-" + ContainerPage.Url.DateFilter.Month + "\" " + u.Rollover + ">" + u.NickName + "</a>"));
					}
				}
				UsersPh.Controls.Add(new LiteralControl("&nbsp;|&nbsp;"));

			}
			
			Cal.MonthUrlGetter = new Controls.Cal.MonthUrlDelegate(GetMonthUrl);
			Cal.DayUrlGetter = new Controls.Cal.DayUrlDelegate(GetDayUrl);
			Cal.DateTimeColumn = new Column(SalesCall.Columns.DateTimeStart);
			Cal.TableElement = new TableElement(TablesEnum.SalesCall);
			Cal.QueryCondition = new And(new Q(SalesCall.Columns.UsrK, CurrentUsr.K), new Q(SalesCall.Columns.IsCall, true));


			DateTime dtStart = new DateTime(ContainerPage.Url["Year"], ContainerPage.Url["Month"], 1);
			DateTime dtEnd = new DateTime(ContainerPage.Url["Year"], ContainerPage.Url["Month"], 1).AddMonths(1);
			if (ContainerPage.Url["Day"].Exists)
			{
				dtStart = new DateTime(ContainerPage.Url["Year"], ContainerPage.Url["Month"], ContainerPage.Url["Day"]);
				dtEnd = new DateTime(ContainerPage.Url["Year"], ContainerPage.Url["Month"], ContainerPage.Url["Day"]).AddDays(1);
			}

			

			Query q = new Query();
			q.QueryCondition = new And(
				new Q(SalesCall.Columns.UsrK, CurrentUsr.K),
				new Q(SalesCall.Columns.DateTimeStart, QueryOperator.GreaterThanOrEqualTo, dtStart),
				new Q(SalesCall.Columns.DateTimeStart, QueryOperator.LessThan, dtEnd)
			);
			q.OrderBy = new OrderBy(SalesCall.Columns.DateTimeStart);
			SalesCallSet scs = new SalesCallSet(q);

			StringBuilder sb = new StringBuilder();

			foreach (SalesCall sc in scs)
			{
				SalesCallToString(sc, sb);
			}
			SalesCallsPh.Controls.Add(new LiteralControl(sb.ToString()));



		}
Exemplo n.º 22
0
		protected void AddAllNow_Click(object sender, System.EventArgs e)
		{

			Query q = new Query();
			Join j = new Join(
				Usr.BuddyUsrJoin,
				new TableElement(TablesEnum.UsrMusicTypeFavourite),
				QueryJoinType.Left,
				Usr.Columns.K,
				UsrMusicTypeFavourite.Columns.UsrK);
			q.TableElement = new Join(
				j,
				new TableElement(TablesEnum.UsrPlaceVisit),
				QueryJoinType.Left,
				Usr.Columns.K,
				UsrPlaceVisit.Columns.UsrK);

			if (ThreadK > 0)
			{
				q.TableElement = new Join(
					q.TableElement,
					new TableElement(TablesEnum.ThreadUsr),
					QueryJoinType.Left,
					new And(
						new Q(Usr.Columns.K, ThreadUsr.Columns.UsrK, true),
						new Q(ThreadUsr.Columns.ThreadK, ThreadK)
					)
				);

			}
			else if (RestrictionGroupK > 0)
			{
				q.TableElement = new Join(
					q.TableElement,
					new TableElement(TablesEnum.GroupUsr),
					QueryJoinType.Left,
					new And(
						new Q(Usr.Columns.K, GroupUsr.Columns.UsrK, true),
						new Q(GroupUsr.Columns.GroupK, RestrictionGroupK)
					)
				);
			}

			Q placeQ = new Q(true);
			if (!AddAllPlaceDrop.SelectedValue.Equals("0"))
			{
				placeQ = new Or(
					new Q(Usr.Columns.HomePlaceK, int.Parse(AddAllPlaceDrop.SelectedValue)),
					new Q(UsrPlaceVisit.Columns.PlaceK, int.Parse(AddAllPlaceDrop.SelectedValue)));
			}
			int musicTypeK = int.Parse(AddAllMusicDrop.SelectedValue);
			Q musicQ = new Q(true);
			if (musicTypeK > 1)
			{
				ArrayList musicQs = new ArrayList();
				MusicType mt = new MusicType(musicTypeK);
				musicQs.Add(new Q(Usr.Columns.FavouriteMusicTypeK, 1));
				musicQs.Add(new Q(UsrMusicTypeFavourite.Columns.MusicTypeK, 1));
				musicQs.Add(new Q(Usr.Columns.FavouriteMusicTypeK, musicTypeK));
				musicQs.Add(new Q(UsrMusicTypeFavourite.Columns.MusicTypeK, musicTypeK));
				foreach (MusicType mtChild in mt.Children)
				{
					musicQs.Add(new Q(Usr.Columns.FavouriteMusicTypeK, mtChild.K));
					musicQs.Add(new Q(UsrMusicTypeFavourite.Columns.MusicTypeK, mtChild.K));
				}
				musicQ = new Or((Q[])musicQs.ToArray(typeof(Q)));
			}

			Q restrictionQ = new Q(true);
			if (ThreadK > 0)
			{
				restrictionQ = new Q(ThreadUsr.Columns.UsrK, QueryOperator.IsNull, null);
			}
			else if (RestrictionGroupK > 0)
			{
				restrictionQ = RestrictionGroupQ;
			}

			q.QueryCondition = new And(
				new Q(Buddy.Columns.BuddyUsrK, Usr.Current.K),
				new Q(Buddy.Columns.FullBuddy, true),
				new Q(Buddy.Columns.CanBuddyInvite, true),
				restrictionQ,
				musicQ,
				placeQ);
			q.Columns = new ColumnSet(Usr.Columns.NickName, Usr.Columns.K, Usr.Columns.Pic, Usr.Columns.FacebookUID);
			q.Distinct = true;
			q.OrderBy = new OrderBy(Usr.Columns.NickName);
			q.DistinctColumn = Usr.Columns.K;
			UsrSet us = new UsrSet(q);
			int duplicate = 0;
			int done = 0;
			foreach (Usr u in us)
			{
				bool yes = this.AddUsr(u);
				if (yes)
					done++;
				else
					duplicate++;
			}
			string selectedDuplicate = "";
			if (duplicate > 0)
				selectedDuplicate = us.Count.ToString("#,##0") + " " + (us.Count == 1 ? "buddy" : "buddies") + " selected\n" + duplicate.ToString("#,##0") + " of them " + (duplicate == 1 ? "was" : "were") + " already in the list\n";

			AlertMessageAll(selectedDuplicate + done.ToString("#,##0") + " " + (done == 1 ? "buddy" : "buddies") + " added");

			if (done > 0)
			{
				MoreButton.InnerText = "More...";
				ShowMore = false;
				SetVisibility();
			}

			if (AnchorSkip.Length > 0)
				((Spotted.Master.DsiPage)Page).AnchorSkip(AnchorSkip);

		}
Exemplo n.º 23
0
		public void CampDsiEmails(object o, System.EventArgs e)
		{
			Cambro.Web.Helpers.WriteAlertHeader();

			Cambro.Web.Helpers.WriteAlert("Selecting users...", 1);
			Query q = new Query();
			q.TableElement = new JoinLeft(Usr.Columns.K, GroupUsr.Columns.UsrK);
			q.TableElement = new Join(q.TableElement, new TableElement(TablesEnum.UsrEventAttended), QueryJoinType.Left, Usr.Columns.K, UsrEventAttended.Columns.UsrK);
			
			q.QueryCondition = 
				new Or(
				new Q(GroupUsr.Columns.GroupK, 1060),
					new Q(UsrEventAttended.Columns.EventK, 29398),
					new Q(UsrEventAttended.Columns.EventK, 10597)
					);
			q.Distinct = true;
			q.DistinctColumn = Usr.Columns.K;
			UsrSet bs = new UsrSet(q);
			for (int count = 0; count < bs.Count; count++)
			{
				Usr c = bs[count];

				try
				{

					Mailer m = new Mailer();
					m.UsrRecipient = c;
					m.RedirectUrl = "/event-29398";
					m.Subject = "DontStayIn 3rd birthday bash! - Camp DSI 2006!";
					m.Body = @"<p>
<div style=""font-size:33px; font-weight:bold; line-height:33px;"">
<center>DSI IS 3 YEARS OLD!</center>
</div>
</p>
<p>
<div style=""font-size:36px; font-weight:bold;line-height:36px;"">
<center>LETS GO CAMPING!</center>
</div>
</p>
<p>
<center>
Friday 16th June to Sunday 18th June 2006<br>
<a href=""[LOGIN]"">Camp DSI</a> @ <a href=""[LOGIN(/uk/barnstaple/little-roadway-farm-campsite)]"">Little Roadway Farm Campsite</a> in Woolacombe, North Devon
</center>
</p>
<table cellspacing=""10""><tr><td valign=""top"">
<p>
You are receiving this email because you are signed up to Camp DSI!
</p>
<p>
This year we are heading back to the beautiful Woolacombe in Devon to celebrate our third birthday! DSI will be 3 years old! Can you believe it?
</p>
<p> 
If you're not coming, please be so kind as to take your name off the <a href=""[LOGIN]"">event page</a>.
</p>
<p>
For those of you coming, <b>GET READY FOR A WEEKEND TO REMEMBER!</b>
</p>
<p>
This year you can expect a marquee playing music on Friday evening, Saturday daytime and evening and Sunday daytime.  We have lots of activities provided by some of our DSI regulars - currently we have:
</p>
<p>
<b>A dressing up tent, a giant BBQ, a tea tent, a break-dancing tent, a body painting tent, a casino / strip poker tent, a massage tent, a rubber dingy racing contest, a tequila drinking contest and photography lessons!!!</b>
</p>
<p>
If you think you could add anything to the fun, please put your name down on <a href=""[LOGIN(/chat/k-629074)]"">this topic</a> and we will be in contact.
</p>
<p>
Tickets are £20 for the whole weekend. That includes campsite fees etc.  The rest will be used to pay for marquees / sound rigs / all the other bits and bobs. 
</p>
<p>
<b>We've only got 300 tickets, but there are 400 of you signed up... Some of you might be disappointed if you don't buy your tickets early! The only way to get a ticket is to <a href=""[LOGIN]"">buy on the event page</a>. If you don't have a credit card, you can get one of your friends to buy one for you.</b>
</p>
<p>
Everyone who buys a ticket will get a little CAMP DSI icon on their profile!
</p>
<p>
We're really excited about this - it's going to be great to meet you all in the flesh! See you there!
</p>
</td>
<td valign=""top"">
<p>
<a href=""[LOGIN(/photo-503702)]""><img src=""[WEB-ROOT]gfx/camp-dsi-jump.jpg"" width=""100"" height=""133"" border=""0"" style=""border:1px solid #000000;""></a>
</p>
<p>
<a href=""[LOGIN(/photo-474887)]""><img src=""[WEB-ROOT]gfx/camp-dsi-matt.jpg"" width=""100"" height=""94"" border=""0"" style=""border:1px solid #000000;""></a>
</p>
<p>
<a href=""[LOGIN(/photo-476406)]""><img src=""[WEB-ROOT]gfx/camp-dsi-vw.jpg"" width=""100"" height=""133"" border=""0"" style=""border:1px solid #000000;""></a>
</p>
<p>
<a href=""[LOGIN(/photo-475245)]""><img src=""[WEB-ROOT]gfx/camp-dsi-girl.jpg"" width=""100"" height=""127"" border=""0"" style=""border:1px solid #000000;""></a>
</p>
</td></tr></table>
<p style=""margin-bottom:10px;"">
<center><a href=""[LOGIN]"" style=""font-size:20px; font-weight:bold;line-height:20px;"">CLICK HERE TO BUY YOUR TICKETS!</a></center>
</p>
";
					m.Send();
					//Response.Write(c.NickName + "<br>");

					// Do work here!
					//c.Update();

					if (count % 10 == 0)
						Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count, 2);

				}
				catch (Exception ex)
				{
					Cambro.Web.Helpers.WriteAlert("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3);
				}

				bs.Kill(count);

			}
			Cambro.Web.Helpers.WriteAlert("Done!", 3);
			Cambro.Web.Helpers.WriteAlertFooter();
		}
Exemplo n.º 24
0
		public void SendSpotterInvites(object o, System.EventArgs e)
		{
			Cambro.Web.Helpers.WriteAlertHeader();

			Cambro.Web.Helpers.WriteAlert("Selecting spotters...", 1);
			Query q = new Query();
			q.QueryCondition = new And(
				new Q(Usr.Columns.IsSpotter, true),
				new Q(Usr.Columns.AddressCountryK, QueryOperator.NotEqualTo, 224),
				new Q(Usr.Columns.AddressCountryK, QueryOperator.NotEqualTo, 225)
			);
			UsrSet bs = new UsrSet(q);
			for (int count = 0; count < bs.Count; count++)
			{
				Usr c = bs[count];

				try
				{

					Mailer m = new Mailer();
					m.UsrRecipient = c;
					m.Subject = "Calling all DontStayIn Spotters - cards now available!";
					m.RedirectUrl = "/pages/spotters";
					m.Body = @"<p>Calling all spotters!</p>

<p>You recently signed up as a Spotter on DontStayIn, but because you weren't based in the UK we couldn't send you a pack of cards. Spotter cards help people find their photos, and get the word out about DontStayIn!</p>

<p><b>We can now send spotter cards all over the world!</b></p>

<p>Just visit the <a href=""[LOGIN]"">Spotters page</a>, check your address is still correct, and click the 'request more cards' button. We'll send them out straight away.</p>

<p>Please note they will be sent airmail from the UK, so they may take about a week to arrive.</p>
";
					m.Send();

					// Do work here!
					c.Update();

					Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count, 2);

				}
				catch(Exception ex)
				{
					Cambro.Web.Helpers.WriteAlert("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3);
				}

				bs.Kill(count);

			}
			Cambro.Web.Helpers.WriteAlert("Done!", 3);
			Cambro.Web.Helpers.WriteAlertFooter();
		}
Exemplo n.º 25
0
		public void SendSpotterInvitesAll(object o, System.EventArgs e)
		{
			Cambro.Web.Helpers.WriteAlertHeader();

			Cambro.Web.Helpers.WriteAlert("Selecting spotters...", 1);
			Query q = new Query();
			q.QueryCondition = new Q(Usr.Columns.IsSpotter, true);
			UsrSet bs = new UsrSet(q);

			Usr dsiUsr = new Usr(8);
			Bobs.Group spottersGroup = new Bobs.Group(3480);
			Bobs.Group spottersGroupUsa = new Bobs.Group(4537);
			GroupUsr guDsi = spottersGroup.GetGroupUsr(dsiUsr);
			GroupUsr guDsiUsa = spottersGroupUsa.GetGroupUsr(dsiUsr);

			for (int count = 0; count < bs.Count && count<1000; count++)
			{
				Usr c = bs[count];

				try
				{

					GroupUsr guTarget = spottersGroup.GetGroupUsr(c);
					spottersGroup.Invite(c, guTarget, dsiUsr, guDsi, "Chat about being a Spotter and all things Spotting in the DontStayIn Spotters group!", false);

					if (c.AddressCountryK == 225)
					{
						GroupUsr guTargetUsa = spottersGroupUsa.GetGroupUsr(c);
						spottersGroupUsa.Invite(c, guTargetUsa, dsiUsr, guDsiUsa, "Chat about being a USA based DontStayIn Spotter in the USA Spotters group!", false);
					}
					if (count % 100 == 0)
						Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count, 2);

				}
				catch(Exception ex)
				{
					Cambro.Web.Helpers.WriteAlert("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3);
				}

				bs.Kill(count);

			}
			Cambro.Web.Helpers.WriteAlert("Done!", 3);
			Cambro.Web.Helpers.WriteAlertFooter();
		}
Exemplo n.º 26
0
		public void SendGlobalEmail(object o, System.EventArgs e)
		{
			Cambro.Web.Helpers.WriteAlertHeader();

			Cambro.Web.Helpers.WriteAlert("SendGlobalEmail...", 1);
			Query q = new Query();
			if (Vars.DevEnv)
				q.TopRecords = 50;
			q.QueryCondition = new Q(UsrEventAttended.Columns.EventK, 25099);
			q.TableElement = new Join(Usr.Columns.K, UsrEventAttended.Columns.UsrK);
			UsrSet bs = new UsrSet(q);
			Event globalEvent = new Event(25099);
			for (int count = 0; count < bs.Count; count++)
			{
				Usr c = bs[count];

				try
				{
					Mailer m = new Mailer();
					m.Bulk = true;
					m.RedirectUrl = globalEvent.Url();
					m.Subject = "SUBJECT";
					m.Body = "<p>BODY</p>";
					m.UsrRecipient = c;
					m.Send();


					if (count % 10 == 0)
						Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count, 2);

				}
				catch(Exception ex)
				{
					Cambro.Web.Helpers.WriteAlert("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3);
				}

				bs.Kill(count);

			}
			Cambro.Web.Helpers.WriteAlert("Done!", 3);
			Cambro.Web.Helpers.WriteAlertFooter();
		}
Exemplo n.º 27
0
		public void SortIsPromoter(object o, System.EventArgs e)
		{
			Cambro.Web.Helpers.WriteAlertHeader();

			Cambro.Web.Helpers.WriteAlert("Selecting PromoterUsrs...", 1);
			Query q = new Query();
			q.QueryCondition = new Q(Promoter.Columns.Status, Promoter.StatusEnum.Active);
			q.TableElement = new Join(
				new Join(Usr.Columns.K, PromoterUsr.Columns.UsrK),
				Promoter.Columns.K,
				PromoterUsr.Columns.PromoterK);
			UsrSet bs = new UsrSet(q);

			Group g = new Group(3684); //DontStayIn Promoters group

			try
			{

				for (int count = 0; count < bs.Count; count++)
				{
					Usr u = bs[count];

					try
					{
						GroupUsr gu = u.GetGroupUsr(g.K);
						if (gu == null || !(gu.Status.Equals(GroupUsr.StatusEnum.Exited) || gu.Status.Equals(GroupUsr.StatusEnum.Barred)))
						{
							GroupUsr gu1 = g.ChangeUsr(false, u.K, false, false, false, false, Bobs.GroupUsr.StatusEnum.Member, u.DateTimeSignUp, false);
							gu1.Favourite = true;
							gu1.Update();
							CommentAlert.Enable(u, g.K, Model.Entities.ObjectType.Group);
						}


						if (count % 10 == 0)
							Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count + " - " + u.NickName, 2);
					}
					catch (Exception ex)
					{
						Cambro.Web.Helpers.WriteAlert("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3);
					}

					bs.Kill(count);

				}
			}
			finally
			{
				g.UpdateTotalMembers();
			}
			Cambro.Web.Helpers.WriteAlert("Done!", 4);
			Cambro.Web.Helpers.WriteAlertFooter();
			Response.End();
		}
Exemplo n.º 28
0
		public void UpdateSpottings(Transaction transaction)
		{
			if (true)
			{
				Query q = new Query();
				q.TableElement = new Join(UsrPhotoMe.Columns.PhotoK, Photo.Columns.K);
				q.TableElement = new Join(q.TableElement, new TableElement(TablesEnum.Usr), QueryJoinType.Inner, UsrPhotoMe.Columns.UsrK, Usr.Columns.K);
				q.QueryCondition = new And(
					new Q(Usr.Columns.IsEmailVerified, true),
					new Q(Usr.Columns.IsSkeleton, false),
					new Q(Photo.Columns.UsrK, this.K));
				q.ExtraSelectElements.Add("SpottingsTotal", "count(distinct UsrPhotoMe.UsrK)");
				q.Columns = new ColumnSet();
				UsrSet us = new UsrSet(q);
				if (this.SpottingsTotal != (int)us[0].ExtraSelectElements["SpottingsTotal"])
				{
					this.SpottingsTotal = (int)us[0].ExtraSelectElements["SpottingsTotal"];
					this.Update();
				}
			}
		}
Exemplo n.º 29
0
		public bool SendWelcomeEmail(Usr invitingUsr, Group invitingGroup, string inviteMessage)
		{
			if (this.EmailHold)
				return false;

			Mailer sm = new Mailer();
			sm.UsrRecipient = this;
			if (invitingGroup == null)
			{
				if (invitingUsr == null)
				{
					sm.Subject = "We've created you a Don't Stay In account!";
					sm.Body = @"
<p>
Don't Stay In is <i>the</i> place to plan your clubbing calendar. Our 
team of spotters are busy taking photos of clubbers at the hottest 
parties in your area and throughout the world. 
</p>
<p>
If you've had your photo taken, you can look through our galleries 
to find it. You can chat live with other clubbers and catch up with 
the latest gossip.
</p>
<p align=""center"" style=""margin:10px 0px 8px 0px;"">
<a href=""[LOGIN]"" style=""font-size:18px;font-weight:bold;"">Click here 
to go to DontStayIn</a>
</p>
";
				}
				else
				{
					sm.Subject = invitingUsr.NickName + " has invited you to DontStayIn!";
					sm.Body = "<p><b>" + invitingUsr.NickName + @" has invited you to DontStayIn!</b></p>
<p>
DontStayIn is <i>the</i> place to plan your clubbing calendar. Our 
team of spotters are busy taking photos of clubbers at the hottest 
parties in your area and throughout the world. 
</p>
<p>
If you've had your photo taken, you can look through our galleries 
to find it. You can chat live with other clubbers and catch up with 
the latest gossip.
</p>
<p align=""center"" style=""margin:10px 0px 8px 0px;"">
<a href=""[LOGIN]"" style=""font-size:18px;font-weight:bold;"">Click here 
to go to DontStayIn</a>
</p>
";
				}
			}
			else
			{
				GroupUsr invitingGroupUsr = invitingGroup.GetGroupUsr(invitingUsr);
				sm.RedirectUrl = invitingGroup.Url();
				sm.Subject = invitingUsr.NickName + @" has invited you to " + (invitingGroupUsr != null && invitingGroupUsr.Moderator ? invitingUsr.HisString(false) : "a") + @" DontStayIn group: " + invitingGroup.FriendlyName;
				string pic = @"<table cellspacing=""0"" cellpadding=""0"" border=""0"" style=""margin:10px 5px 5px 1px;""><tr><td valign=""top"">";
				string picEnd = "</td></tr></table>";
				if (invitingUsr.HasPic)
				{
					pic = @"<table cellspacing=""0"" cellpadding=""0"" border=""0"" style=""margin:10px 5px 5px 1px;""><tr><td valign=""top"" style=""padding:0px 10px 0px 0px;"">";
					pic += "<a href=\"[LOGIN]\"><img src=\"" + invitingUsr.PicPath + "\" class=\"BorderBlack All\" width=\"100\" height=\"100\" vspace=\"3\" border=\"0\"></a></td><td valign=\"top\">";
					picEnd = "</td></tr></table>";
				}
				string members = "";
				if (invitingGroup.TotalMembers > 5)
				{
					Query q = new Query();
					q.TableElement = Usr.GroupJoin;
					q.QueryCondition = new And(new Q(Group.Columns.K, invitingGroup.K), new Q(Usr.Columns.Pic, QueryOperator.NotEqualTo, Guid.Empty));
					q.TopRecords = 5;
					q.OrderBy = new OrderBy(OrderBy.OrderDirection.Random);
					q.Columns = Usr.LinkColumns;
					UsrSet us = new UsrSet(q);
					if (us.Count == 5)
					{
						members = @"<p><b>" + invitingGroup.FriendlyName + @"</b> has " + invitingGroup.TotalMembers.ToString("#,##0") + @" members. Here's a few of them:</p>";
						members += @"<table cellspacing=""4"" cellpadding=""4"" border=""0"" width=""100%""><tr>";
						foreach (Usr uPic in us)
						{
							members += "<td width=\"20%\" valign=\"top\"><center><a href=\"[LOGIN(" + uPic.Url() + ")]\"><img src=\"" + uPic.PicPath + "\" width=\"75\" height=\"75\" style=\"margin:0px 0px 5px 0px;\" class=\"BorderBlack All\"><br>" + Cambro.Misc.Utility.Snip(uPic.NickName, 12) + "</a></center></td>";
						}
						members += @"</tr></table>";
					}
				}
				sm.Body = @"
" + pic + @"
<i style=""font-size:18px;""><b>""</b>" + Cambro.Web.Helpers.Strip(inviteMessage, true, true, false, true).Replace("\n", "<br>") + @"<b>""</b></i>
" + picEnd + @"
<p>" + invitingUsr.LinkEmail() + @" (" + invitingUsr.FirstName + @") has invited you to " +
	 (invitingGroupUsr != null && invitingGroupUsr.Moderator ? invitingUsr.HisString(false) : "a") + @" DontStayIn group!
You can use this to keep in contact with your friends. Here's a quick description 
of <b>" + invitingGroup.FriendlyName + @"</b>:</p>
<p>
<i>" + invitingGroup.Description + @"</i>
</p>
" + members + @"
";
			}

			sm.Send();
			return true;
		}
Exemplo n.º 30
0
		public static Usr GetOrCreateSkeletonUser(Usr invitingUsr, string email, string nickName, Group invitingGroup, string inviteMessage, bool invitedViaContactImporter, bool sendWelcomeEmailEvenIfSkeletonUsrAlreadyExists)
		{
			UsrSet us = new UsrSet(new Query(new Q(Usr.Columns.Email, email)));
			if (us.Count > 0)
			{
				if (us[0].NickName.Length == 0 && nickName.Length > 0)
				{
					//Duplicate nick check
					Query qNick = new Query();
					qNick.QueryCondition = new Q(Usr.Columns.NickName, Usr.GetCompliantNickName(nickName));
					qNick.NoLock = true;
					qNick.ReturnCountOnly = true;
					UsrSet usNick = new UsrSet(qNick);
					if (usNick.Count == 0)
					{
						us[0].NickName = Usr.GetCompliantNickName(nickName);
						if (invitedViaContactImporter)
						{
							us[0].InvitedViaContactImporter = true;
						}
						us[0].Update();
					}
				}
				if (sendWelcomeEmailEvenIfSkeletonUsrAlreadyExists)
				{
					us[0].SendWelcomeEmail(invitingUsr, invitingGroup, inviteMessage);
				}
				return us[0];
			}
			else
				return CreateSkeletonUserAndSendWelcomeEmail(invitingUsr, email, nickName, invitingGroup, inviteMessage, invitedViaContactImporter);
		}