示例#1
0
		public void UpdatePreMatch()
		{
			try
			{
				UsrDate ud = new UsrDate(this.DateUsrK, this.UsrK);
				if (ud.Status.Equals(StatusEnum.Yes) && this.Status.Equals(StatusEnum.Yes))
				{
					this.PreMatch = true;
					this.Update();
					ud.PreMatch = true;
					ud.Update();
				}
				else
				{
					this.PreMatch = false;
					this.Update();
					ud.PreMatch = false;
					ud.Update();
				}
			}
			catch
			{
				this.PreMatch = false;
				this.Update();
			}
		}
示例#2
0
		public void SendMatchNotification()
		{
			#region Init thread
			Thread t = new Thread();
			t.DateTime = DateTime.Now;
			t.Enabled = true;
			t.ParentObjectK = 0;
			t.ParentObjectType = Model.Entities.ObjectType.None;
			t.Subject = "DSI Date introduction - " + this.Usr.NickName + " and " + this.DateUsr.NickName;
			t.UsrK = this.UsrK;
			t.Private = true;
			t.IsNews = false;
			t.IsSticky = false;
			t.Update();
			t.UpdateAncestorLinks(null);

			ThreadUsr tu = new ThreadUsr();
			tu.DateTime = DateTime.Now;
			tu.InvitingUsrK = this.UsrK;
			tu.UsrK = this.DateUsrK;
			tu.ThreadK = t.K;
			tu.ChangeStatus(ThreadUsr.StatusEnum.NewInvite);
			tu.StatusChangeObjectK = this.UsrK;
			tu.StatusChangeObjectType = Model.Entities.ObjectType.Usr;
			tu.PrivateChatType = ThreadUsr.PrivateChatTypes.Popup;
			tu.Update();

			ThreadUsr tu1 = new ThreadUsr();
			tu1.DateTime = DateTime.Now;
			tu1.InvitingUsrK = this.DateUsrK;
			tu1.UsrK = this.UsrK;
			tu1.ThreadK = t.K;
			tu1.ChangeStatus(ThreadUsr.StatusEnum.NewInvite);
			tu1.PrivateChatType = ThreadUsr.PrivateChatTypes.Popup;
			tu1.StatusChangeObjectK = this.UsrK;
			tu1.StatusChangeObjectType = Model.Entities.ObjectType.Usr;
			tu1.Update();

			Comment c = new Comment();
			c.DateTime = DateTime.Now;
			if (HttpContext.Current != null)
				c.Ip = Utilities.TruncateIp(HttpContext.Current.Request.ServerVariables["REMOTE_HOST"]);
			c.Enabled = true;
			string rel = "";
			if (this.Usr.Relationship1 && this.DateUsr.Relationship1)
				rel += " <b>just friends</b>";
			if (this.Usr.Relationship2 && this.DateUsr.Relationship2)
				rel += (rel.Length > 0 ? " or " : "") + " <b>a bit of a fling</b>";
			if (this.Usr.Relationship3 && this.DateUsr.Relationship3)
				rel += (rel.Length > 0 ? " or " : "") + " <b>love</b>";
			c.Text = "<b>You've both been matched by DSI Date.</b>\n\nYou've selected Yes to each others profiles on the DSI Date page. You're both looking for: " + rel + ".\n\nGet to know each other better in this private conversation.";
			c.ThreadK = t.K;
			c.UsrK = 3526;
			c.DuplicateGuid = Guid.NewGuid();
			c.Update();
			c = new Comment(c.K);

			CommentAlert.Enable(this.Usr, t.K, Model.Entities.ObjectType.Thread);
			CommentAlert.Enable(this.DateUsr, t.K, Model.Entities.ObjectType.Thread);

			t.LastPost = c.DateTime;
			t.LastPostUsrK = c.UsrK;
			t.Update();
			t.UpdateTotalComments(null);
			//t.UpdateTotalParticipants();
			UpdateTotalParticipantsJob job = new UpdateTotalParticipantsJob();
			job.ExecuteSynchronously();

			#endregion

			this.MatchThreadK = t.K;
			this.Update();
			UsrDate udRev = new UsrDate(this.DateUsrK, this.UsrK);
			udRev.MatchThreadK = t.K;
			udRev.Update();

			//Email
			Mailer sm = new Mailer();
			sm.RedirectUrl = t.Url();
			sm.Subject = "DSI Date has matched you to " + this.DateUsr.NickName;
			sm.Body = "<p>DSI Date has matched you to " + this.DateUsr.NickNameSafe + ". We've invited you both to a private conversation, where you can get to know each other better.</p>";
			sm.Body += "<p><a href=\"[LOGIN(" + t.Url() + ")]\">Click here to send " + this.DateUsr.NickNameSafe + " a message</a></p>";
			sm.TemplateType = Mailer.TemplateTypes.AnotherSiteUser;
			sm.UsrRecipient = this.Usr;
			sm.To = this.Usr.Email;
			sm.Send();

			Mailer sm1 = new Mailer();
			sm1.RedirectUrl = t.Url();
			sm1.Subject = "DSI Date has matched you to " + this.Usr.NickName;
			sm1.Body = "<p>DSI Date has matched you to " + this.Usr.NickNameSafe + ". We've invited you both to a private conversation, where you can get to know each other better.</p>";
			sm1.Body += "<p><a href=\"[LOGIN(" + t.Url() + ")]\">Click here to send " + this.Usr.NickNameSafe + " a message</a></p>";
			sm1.TemplateType = Mailer.TemplateTypes.AnotherSiteUser;
			sm1.UsrRecipient = this.DateUsr;
			sm1.To = this.DateUsr.Email;
			sm1.Send();

		}
示例#3
0
		public void Bind()
		{
			RadioMaybe.Checked = false;
			RadioYes.Checked = false;
			RadioNo.Checked = false;
			RadioWrongSex.Checked = false;

			Pic.Src = ThisUsr.PicPath;
			NicknameH1.InnerHtml = ThisUsr.NickNameSafe;
			NicknameLabel.Text = ThisUsr.NickName;
			NicknameLabel1.Text = ThisUsr.NickName;

			Query commentCountQ = new Query();
			commentCountQ.TableElement = Comment.ThreadJoin;
			commentCountQ.QueryCondition = new And(new Q(Comment.Columns.UsrK, UsrK), new Q(Thread.Columns.Private, false));
			commentCountQ.ReturnCountOnly = true;
			CommentSet cs = new CommentSet(commentCountQ);
			UsrCommentsLabel.Text = cs.Count.ToString() + " comment" + (cs.Count == 1 ? "" : "s");

			int photosMeCount = ThisUsr.PhotosMeCount;
			if (photosMeCount == 0)
				UsrSpottedLabel.Text = "I've not been spotted yet";
			else if (photosMeCount == 1)
				UsrSpottedLabel.Text = "I've been spotted once";
			else
				UsrSpottedLabel.Text = "I've been spotted " + photosMeCount + " times";

			UsrMusicTypesLabel.Text = "";
			for (int i = 0; i < ThisUsr.MusicTypesFavourite.Count; i++)
			{
				UsrMusicTypesLabel.Text += (i == 0 ? "" : (i == ThisUsr.MusicTypesFavourite.Count - 1 ? " and " : ", ")) + ThisUsr.MusicTypesFavourite[i].GenericName;
			}

			UsrPlaceVisitLabel.Text = "";
			PlaceSet ps = ThisUsr.PlacesVisit(Place.NameColumns, 0);
			for (int i = 0; i < ps.Count; i++)
			{
				UsrPlaceVisitLabel.Text += (i == 0 ? "" : (i == ps.Count - 1 ? " and " : ", ")) + ps[i].Name;
			}

			if (ThisUsr.PersonalStatement.Length > 0)
			{
				string html = ThisUsr.PersonalStatement;
				if (html.IndexOf("<p>") == -1)
				{
					html = html.Replace("\n", "<br>");
					html = "<p>" + html + "</p>";
				}
				PersonalStatementLabel.Text = html;
			}
			else
			{
				PersonalStatementPanel.Visible = false;
				PersonalStatementLabel.Text = "";
			}

			PhotosIFrame.Attributes["src"] = "/popup/datephotolist/usrk-" + ThisUsr.K.ToString();

			if (Usr.Current.DateSexFemale && Usr.Current.DateSexMale)
				RadioWrongSex.Visible = false;
			else
			{
				RadioWrongSex.Text = RadioWrongSex.Text.Replace("?", Usr.Current.DateSexMale ? "boy" : "girl");
				RadioWrongSex.Attributes["onclick"] = "document.getElementById('WrongSexP').style.display=''";
			}

			try
			{
				UsrDate ud = new UsrDate(Usr.Current.K, ThisUsr.K);
				if (ud.Status.Equals(UsrDate.StatusEnum.Maybe))
					RadioMaybe.Checked = true;
				else if (ud.Status.Equals(UsrDate.StatusEnum.Yes))
					RadioYes.Checked = true;
				else if (ud.Status.Equals(UsrDate.StatusEnum.No))
					RadioNo.Checked = true;
			}
			catch { }

			Query q = new Query();
			q.OrderBy = new OrderBy(new OrderBy(Photo.Columns.WeightedSexyRating, OrderBy.OrderDirection.Descending), new OrderBy(Photo.Columns.WeightedCoolRating, OrderBy.OrderDirection.Descending));
			q.TableElement = Photo.UsrMeJoin;
			q.QueryCondition = new Q(Usr.Columns.K, UsrK);
			q.TopRecords = 1;
			PhotoSet psMe = new PhotoSet(q);
			if (psMe.Count == 1)
			{
				PhotosPanel.Visible = true;
				WebImg.Src = psMe[0].WebPath;
			}
			else
				PhotosPanel.Visible = false;
		}