예제 #1
0
		public static Dictionary<string, string> GetDataItem(Article a)
		{
			return new Dictionary<string, string>()
			{
				{Columns.PicPath.ToString(), a.PicPath},
				{Columns.Title.ToString(), a.Title},
				{Columns.Summary.ToString(), a.Summary},
				{Columns.OwnerUrl.ToString(), a.Owner.Url()},
				{Columns.OwnerNickName.ToString(), a.Owner.NickName},
				{Columns.DiscussionUrl.ToString(), a.UrlDiscussion()},
				{Columns.Comments.ToString(), a.TotalComments.ToString()},
				{Columns.Views.ToString(), a.Views.ToString()},
				{Columns.Url.ToString(), a.Url()},
				{Columns.Date.ToString(), Cambro.Misc.Utility.FriendlyDate(a.EnabledDateTime)},
			};

		}
예제 #2
0
		public void ForumInfo_Load(object o, System.EventArgs e)
		{
			if (!CurrentForumCheck)
				return;

			PanelThreadDescTypeNone.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.None);
			PanelThreadDescTypeEvent.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Event);
			PanelThreadDescTypeVenue.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Venue);
			PanelThreadDescTypePlace.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Place);
			PanelThreadDescTypeCountry.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Country);
			PanelThreadDescTypeArticle.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Article);
			PanelThreadDescTypeBrand.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Brand);
			PanelThreadDescTypeGroup.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Group);
			PanelThreadDescRelatedPanel.Visible = false;
			PanelThreadDescGroupBrandPanel.Visible = false;
			PanelThreadDescBrandPanel.Visible = false;
			FavouriteGroupPanel.Visible = (ThreadParentType.Equals(Model.Entities.ObjectType.Group) && CurrentGroupUsr != null && CurrentGroupUsr.IsMember);

			SetPageTitle("General discussions");

			if (ThreadParentType.Equals(Model.Entities.ObjectType.None))
			{
				ThreadDescWorldwideHomeCountryLink.InnerText = ThreadDescWorldwideHomeCountryLink.InnerText.Replace("???", Country.Current.FriendlyName);
				ThreadDescWorldwideHomeCountryLink.HRef = Country.Current.UrlDiscussion();
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Event))
			{
				Event ev = new Event(ObjectK);
				ThreadDescEventEventLink.InnerText = ev.Name;
				ThreadDescEventEventLink.HRef = ev.Url();

				ThreadDescEventVenueLink.InnerText = ev.Venue.Name;
				ThreadDescEventVenueLink.HRef = ev.Venue.Url();

				ThreadDescEventPlaceLink.InnerText = ev.Venue.Place.Name;
				ThreadDescEventPlaceLink.HRef = ev.Venue.Place.Url();

				ThreadDescEventDateLabel.Text = ev.FriendlyDate(false);

				PanelThreadDescRelatedPanel.Visible = ev.Brands.Count > 0;
				string brandsHtml = "";
				for (int i = 0; i < ev.Brands.Count; i++)
				{
					brandsHtml += (i == 0 ? "" : (i == (ev.Brands.Count - 1) ? " or " : ", ")) + "the <b><a href=\"" + ev.Brands[i].UrlDiscussion() + "\">" + ev.Brands[i].Name + " forum</a></b>";
				}
				PanelThreadDescRelatedPh.Controls.Add(new LiteralControl(brandsHtml));

				SetPageTitle(ev.Name + " discussions");


			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Venue))
			{
				Venue v = new Venue(ObjectK);

				ThreadDescVenueVenueLink.InnerText = v.Name;
				ThreadDescVenueVenueLink.HRef = v.Url();

				ThreadDescVenuePlaceLink.InnerText = v.Place.Name;
				ThreadDescVenuePlaceLink.HRef = v.Place.Url();
				SetPageTitle(v.Name + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Place))
			{
				Place t = new Place(ObjectK);

				ThreadDescPlacePlaceLink.InnerText = t.Name;
				ThreadDescPlacePlaceLink.HRef = t.Url();
				SetPageTitle(t.Name + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Country))
			{
				Country c = new Country(ObjectK);

				ThreadDescCountryLabel.Text = c.FriendlyName;
				ThreadDescCountryLink.HRef = c.Url();
				SetPageTitle(c.FriendlyName + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Article))
			{
				Article a = new Article(ObjectK);
				ThreadDescArticleArticleLink.InnerText = a.Title;
				ThreadDescArticleArticleLink.HRef = a.Url();
				SetPageTitle(a.Title + " discussions");
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Brand))
			{
				Brand b = new Brand(ObjectK);
				ThreadDescBrandBrandLink.InnerText = b.Name;
				ThreadDescBrandBrandLink.HRef = b.Url();
				SetPageTitle(b.Name + " discussions");
				if (b.Group.TotalComments > 0)
				{
					PanelThreadDescBrandPanel.Visible = true;
					PanelThreadDescBrandGroupChatAnchor.InnerText = b.Group.FriendlyName + " group chat";
					PanelThreadDescBrandGroupChatAnchor.HRef = b.Group.UrlDiscussion();
					PanelThreadDescBrandGroupChatCommentsLabel.Text = b.Group.TotalComments.ToString("#,##0") + " comment" + (b.Group.TotalComments == 1 ? "" : "s");
				}
			}
			if (ThreadParentType.Equals(Model.Entities.ObjectType.Group))
			{
				ThreadDescGroupGroupLink.InnerText = CurrentGroup.FriendlyName + " group";
				ThreadDescGroupGroupLink.HRef = CurrentGroup.Url();
				SetPageTitle(CurrentGroup.FriendlyName + " discussions");
				if (CurrentGroup.BrandK > 0)
				{
					PanelThreadDescGroupBrandPanel.Visible = true;
					PanelThreadDescGroupBrandAnchor.HRef = CurrentGroup.Brand.UrlDiscussion();
					PanelThreadDescGroupBrandAnchor.InnerText = CurrentGroup.Brand.Name + " public chat";
					PanelThreadDescGroupBrandCommentsLabel.Text = CurrentGroup.Brand.TotalComments.ToString("#,##0") + " comment" + (CurrentGroup.Brand.TotalComments == 1 ? "" : "s");
				}
			}
		}
예제 #3
0
		public static void CreateArticlePublish(Usr u, Article a)
		{
			Query q = new Query();
			q.QueryCondition = new And(
				new Q(FacebookPost.Columns.DateTime, QueryOperator.GreaterThan, System.DateTime.Now.AddDays(-1)),
				new Q(FacebookPost.Columns.FacebookUid, u.Facebook.Uid),
				new Q(FacebookPost.Columns.Type, TypeEnum.ArticlePublish));
			FacebookPostSet fps = new FacebookPostSet(q);
			if (fps.Count < 15)
			{
				Query q1 = new Query();
				q1.QueryCondition = new And(
					new Q(FacebookPost.Columns.FacebookUid, u.Facebook.Uid),
					new Q(FacebookPost.Columns.DataInt, a.K),
					new Q(FacebookPost.Columns.Type, TypeEnum.ArticlePublish));
				FacebookPostSet fps1 = new FacebookPostSet(q1);
				if (fps1.Count == 0)
				{

					FacebookPost fp = new FacebookPost();
					fp.Hits = 0;
					fp.FacebookUid = u.Facebook.Uid;
					fp.DateTime = System.DateTime.Now;
					fp.Type = TypeEnum.ArticlePublish;
					fp.Content = "ArticleK=" + a.K.ToString();
					fp.DataInt = a.K;
					fp.UsrK = u.K;
					fp.Update();

					//send facebook message
					//http://developers.facebook.com/docs/reference/api/post
					Dictionary<string, object> par = new Dictionary<string, object>();
					if (a.HasPic)
					{
						par["picture"] = a.PicPath;
					}
					par["link"] = "http://" + Vars.DomainName + a.Url() + "?fbpk=" + fp.K.ToString();
					par["name"] = a.Title.TruncateWithDots(50);
					par["caption"] = "Don't Stay In";

					par["description"] = a.Summary.TruncateWithDots(990);
					u.Facebook.PutWallPost("", par);
				}
			}
		}