示例#1
0
		void BindNewPromoters()
		{
			if (true)
			{
				Query q = new Query();
				q.QueryCondition = new And(
					(ContainerPage.Url[0].Equals("all") ? new Q(Promoter.Columns.ClientSector, Promoter.ClientSectorEnum.Promoter) : new Q(true)),
					Promoter.EnabledQ,
					new Q(Promoter.Columns.SalesStatus, Promoter.SalesStatusEnum.New),
					SalesUsrQ,
					new Q(Promoter.Columns.SalesCallCount, 0),
					new Or(
						new Q(Promoter.Columns.SalesHold, false),
						new Q(Promoter.Columns.SalesHold, QueryOperator.IsNull, null)
					)
				);

				q.OrderBy = new OrderBy(Promoter.Columns.DateTimeSignUp, OrderBy.OrderDirection.Ascending);

				PromoterSet ps = new PromoterSet(q);

				NewPromoterDataGrid.AllowPaging = (ps.Count > NewPromoterDataGrid.PageSize);
				NewPromoterDataGrid.DataSource = ps;
				NewPromoterDataGrid.DataBind();

			}
		}
示例#2
0
		void BindCallBacks()
		{
			if (true)
			{
				Query q = new Query();
				q.QueryCondition = new And(
					(ContainerPage.Url[0].Equals("all") ? new Q(Promoter.Columns.ClientSector, Promoter.ClientSectorEnum.Promoter) : new Q(true)),
					Promoter.EnabledQ,
					new Q(Promoter.Columns.SalesStatus, Promoter.SalesStatusEnum.New),
					SalesUsrQ,
					new Or(
						new Q(Promoter.Columns.SalesHold, false),
						new Q(Promoter.Columns.SalesHold, QueryOperator.IsNull, null)
					),
					new Q(Promoter.Columns.SalesNextCall, QueryOperator.LessThan, DateTime.Today.AddDays(1)),
					new Q(Promoter.Columns.SalesCallCount, QueryOperator.NotEqualTo, 0)
				);

				q.OrderBy = Promoter.NewIdleOrder;

				PromoterSet ps = new PromoterSet(q);

				CallBacksDataGrid.AllowPaging = (ps.Count > CallBacksDataGrid.PageSize);
				CallBacksDataGrid.DataSource = ps;
				CallBacksDataGrid.DataBind();
			}
		}
示例#3
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;
				}
			}
			

		}
示例#4
0
		void ArticlesDataGrid_Bind()
		{
			Query q = new Query();
			if (Usr.Current.IsAdmin)
				q.QueryCondition = new Or(new Q(Article.Columns.OwnerUsrK, Usr.Current.K), new Q(Article.Columns.Status, Article.StatusEnum.Edit), new Q(Article.Columns.Status, Article.StatusEnum.Enabled));
			else if (Usr.Current.IsSuper)
				q.QueryCondition = new Or(new Q(Article.Columns.OwnerUsrK, Usr.Current.K), new Q(Article.Columns.Status, Article.StatusEnum.Edit));
			else
				q.QueryCondition = new Q(Article.Columns.OwnerUsrK, Usr.Current.K);

			q.OrderBy = new OrderBy(Article.Columns.AddedDateTime, OrderBy.OrderDirection.Descending);

			ArticleSet ars = new ArticleSet(q);

			if (ars.Count == 0)
			{
				NoArticlesDataGridPanel.Visible = true;
				ArticlesDataGridPanel.Visible = false;

			}
			else
			{
				ArticlesDataGrid.Columns[3].Visible = Usr.Current.IsSuper;
				NoArticlesDataGridPanel.Visible = false;
				ArticlesDataGridPanel.Visible = true;
				ArticlesDataGrid.AllowPaging = (ars.Count > ArticlesDataGrid.PageSize);
				ArticlesDataGrid.DataSource = ars;
				ArticlesDataGrid.DataBind();
			}
		}
        private void GetResults()
        {
            Query searchCardTransferQuery = new Query();

            List<Q> QueryConditionList = new List<Q>();

            searchCardTransferQuery.OrderBy = new OrderBy("dateadd(day, 0, datediff(day, 0, [Transfer].[DateTimeComplete]))");
            searchCardTransferQuery.GroupBy = new GroupBy("dateadd(day, 0, datediff(day, 0, [Transfer].[DateTimeComplete]))");
            searchCardTransferQuery.ExtraSelectElements.Add("SumAmount", "SUM([Transfer].[Amount])");
            searchCardTransferQuery.ExtraSelectElements.Add("CountTransfers", "COUNT([Transfer].[K])");
            searchCardTransferQuery.ExtraSelectElements.Add("Date", "dateadd(day, 0, datediff(day, 0, [Transfer].[DateTimeComplete]))");
            searchCardTransferQuery.Columns = new ColumnSet();

            QueryConditionList.Add(new Q(Bobs.Transfer.Columns.Method, Bobs.Transfer.Methods.Card));
            QueryConditionList.Add(new Q(Bobs.Transfer.Columns.Status, Bobs.Transfer.StatusEnum.Success));

            if (this.FromDateCal.Date != DateTime.MinValue)
                QueryConditionList.Add(new Q(Bobs.Transfer.Columns.DateTimeComplete, QueryOperator.GreaterThanOrEqualTo, this.FromDateCal.Date));
            if (this.ToDateCal.Date != DateTime.MinValue)
                QueryConditionList.Add(new Q(Bobs.Transfer.Columns.DateTimeComplete, QueryOperator.LessThan, this.ToDateCal.Date.AddDays(1)));

            searchCardTransferQuery.QueryCondition = new And(QueryConditionList.ToArray());

            TransferSet searchCardTransfers = new TransferSet(searchCardTransferQuery);

            this.CardnetAccountGridView.DataSource = searchCardTransfers;
            this.CardnetAccountGridView.DataBind();
            
            SumAmounts(searchCardTransfers);
        }
示例#6
0
		public void SetState()
		{
			Query q = new Query();
			q.OrderBy = MusicType.OrderBy;
			MusicTypeSet mts = new MusicTypeSet(q);
			foreach (MusicType mt in mts)
			{
					CheckBox cb = (CheckBox)Cambro.Web.Helpers.SearchControl(Tree, "ItemCb" + mt.K);
					cb.Checked = false;
				if (mt.Children.Count > 0)
				{
					HtmlGenericControl children = (HtmlGenericControl)Cambro.Web.Helpers.SearchControl(Tree, "Children" + mt.K);
					children.Style["display"] = null;
					Label lab = (Label)Cambro.Web.Helpers.SearchControl(Tree, "LabCb" + mt.K);
					lab.Style["display"] = "none";
				}
			}
			if (initialMusicTypes != null)
			{
				foreach (MusicType mt in initialMusicTypes)
				{
					CheckBox cb = (CheckBox)Cambro.Web.Helpers.SearchControl(Tree, "ItemCb" + mt.K);
					cb.Checked = true;
					if (mt.Children.Count > 0)
					{
						HtmlGenericControl children = (HtmlGenericControl)Cambro.Web.Helpers.SearchControl(Tree, "Children" + mt.K);
						children.Style["display"] = "none";
						Label lab = (Label)Cambro.Web.Helpers.SearchControl(Tree, "LabCb" + mt.K);
						lab.Style["display"] = null;
					}
				}
			}
		}
示例#7
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();
		}
示例#8
0
		public void DaveIgnore(object o, System.EventArgs e)
		{
			Usr Dave = new Usr(4);
			Cambro.Web.Helpers.WriteAlertHeader();

			Cambro.Web.Helpers.WriteAlert("Selecting...", 1);
			Query q = new Query();
			if (Vars.DevEnv)
				q.TopRecords = 50;
			PromoterSet bs = new PromoterSet(q);
			for (int count = 0; count < bs.Count; count++)
			{
				Promoter p = bs[count];

				// Do work here!
				try
				{
					Thread t = new Thread(p.QuestionsThreadK);

					ThreadUsr tu = t.GetThreadUsr(Dave);
					tu.ChangeStatus(ThreadUsr.StatusEnum.Ignore, DateTime.Now, true, true);
					if (count % 100 == 0)
						Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count + " - " + p.UrlName, 2);
				}
				catch
				{
					Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count + " - EXCEPTION! " + p.UrlName, 3);
				}

				bs.Kill(count);

			}
			Cambro.Web.Helpers.WriteAlert("Done!", 4);
			Cambro.Web.Helpers.WriteAlertFooter("/admin/promoterpm");
		}
示例#9
0
		private void PanelInvite_Load(object sender, System.EventArgs e)
		{
			if (Mode.Equals(Modes.None))
			{
				ContainerPage.SetPageTitle(String.Format("Invite {0} to a group...", ThisUsr.NickName));
				InviteUsrAnchor.HRef = ThisUsr.Url();
				InviteUsrAnchor.InnerText = ThisUsr.NickName;
				ThisUsr.MakeRollover(InviteUsrAnchor);
				Header.InnerText = String.Format("Invite {0} to a group...", ThisUsr.NickName);

				if (!Page.IsPostBack)
				{
					Query q = new Query();
					q.Columns = new ColumnSet(Group.Columns.Name, Group.Columns.K);
					q.QueryCondition = Usr.Current.GroupMemberQ;
					q.TableElement = Group.UsrMemberJoin;
					q.OrderBy = new OrderBy(Group.Columns.Name);
					GroupSet gs = new GroupSet(q);
					if (gs.Count == 0)
					{
						ChangePanel(PanelNoGroups);
					}
					else
					{
						GroupDropDown.DataSource = gs;
						GroupDropDown.DataTextField = "Name";
						GroupDropDown.DataValueField = "K";
						GroupDropDown.DataBind();
					}
				}
			}
		}
		void BindExpired()
		{
			List<Q> queryConditionList = new List<Q>();
			queryConditionList.Add(Promoter.EnabledQ);
			queryConditionList.Add(new Or(new Q(Promoter.Columns.SalesHold, false),
										  new Q(Promoter.Columns.SalesHold, QueryOperator.IsNull, null)));
			queryConditionList.Add(new Q(Promoter.Columns.SalesStatusExpires, QueryOperator.LessThan, DateTime.Now));
			queryConditionList.Add(new Or(new Q(Promoter.Columns.SalesNextCall, QueryOperator.LessThan, DateTime.Now), 
										  new Q(Promoter.Columns.SalesNextCall, QueryOperator.IsNull, null)));
			queryConditionList.Add(new Q(Promoter.Columns.SalesUsrK, Usr.Current.K));
			
			if(this.SectorFilterDropDownList.SelectedValue != "")
				queryConditionList.Add(new Q(Promoter.Columns.ClientSector, Convert.ToInt32(SectorFilterDropDownList.SelectedValue)));
			if(this.SalesEstimateFilterDropDownList.SelectedValue != "")
				queryConditionList.Add(new Q(Promoter.Columns.SalesEstimate, Convert.ToInt32(SalesEstimateFilterDropDownList.SelectedValue)));

			Query q = new Query(new And(queryConditionList.ToArray()));

			q.OrderBy = new OrderBy(
				new OrderBy(Promoter.Columns.SalesNextCall, OrderBy.OrderDirection.Descending),
				new OrderBy(Promoter.Columns.SalesEstimate, OrderBy.OrderDirection.Descending),
				new OrderBy(Promoter.Columns.DateTimeSignUp, OrderBy.OrderDirection.Descending));
			PromoterSet ps = new PromoterSet(q);

			ExpiredDataGrid.AllowPaging = (ps.Count > ExpiredDataGrid.PageSize);
			ExpiredDataGrid.DataSource = ps;
			ExpiredDataGrid.DataBind();
		}
示例#11
0
		private void LoadCurrentEventsWithTickets()
		{
			Query currentEventsWithTicketsQuery = new Query(new And(new Q(Bobs.TicketRun.Columns.PromoterK, CurrentPromoter.K),
																   new Q(Bobs.TicketRun.Columns.EndDateTime, QueryOperator.GreaterThanOrEqualTo, DateTime.Today.AddDays(-5)),
																   new Q(Bobs.TicketRun.Columns.SoldTickets, QueryOperator.GreaterThan, 0)));
			currentEventsWithTicketsQuery.TableElement = Bobs.TicketRun.EventJoin;
			currentEventsWithTicketsQuery.GroupBy = new GroupBy(new GroupBy(Event.Columns.K), new GroupBy(Event.Columns.DateTime), new GroupBy(Event.Columns.Name));
			currentEventsWithTicketsQuery.OrderBy = new OrderBy(Event.Columns.DateTime);
//			currentEventsWithTicketsQuery.ExtraSelectElements.Add("TicketsSold", "SUM([TicketRun].[SoldTickets])");

			currentEventsWithTicketsQuery.Columns = new ColumnSet(Event.Columns.K, Event.Columns.Name);
			EventSet currentEventsWithTickets = new EventSet(currentEventsWithTicketsQuery);

			this.NoTicketsP.Visible = false;
			if (currentEventsWithTickets.Count == 0)
			{
				this.NoTicketsP.Visible = true;
				this.HasTicketsP.Visible = false;
			}
			else if (currentEventsWithTickets.Count == 1)
			{
				// redirect to doorlist popup page
				Response.Redirect(currentEventsWithTickets[0].DoorlistUrl);
			}
			else
			{
				this.EventDropDownList.Items.Clear();
				foreach (Event ticketEvent in currentEventsWithTickets)
				{
					this.EventDropDownList.Items.Add(new ListItem(ticketEvent.Name, ticketEvent.K.ToString()));
				}
			}
		}
		public Dictionary<DateTime, int> GetCountOfLogItemForDates(Log.Items logItemType, List<DateTime> dates)
		{
			return Caching.Instances.Main.GetWithLocalCaching(
				String.Format("GetCountOfLogItemForDates(logItemType={0}, dates={1})", logItemType, string.Join(",", dates.ConvertAll(d => d.ToShortDateString()).ToArray())),
				() =>
				{
					var query = new Query();
					query.Columns = new ColumnSet(Log.Columns.Count, Log.Columns.Date);
					query.QueryCondition = new And(
												new Q(Log.Columns.Item, logItemType),
												   new Or(
													   dates.ConvertAll(date => new Q(Log.Columns.Date, date.Date)).ToArray()
												   )
											   );
					var ls = new LogSet(query);
					var results = new Dictionary<DateTime, int>();
					foreach (Log l in ls)
					{
						results.Add(l.Date, l.Count);
					}
					foreach (DateTime d in dates)
					{
						if (!results.ContainsKey(d.Date))
						{
							results.Add(d.Date, 0);
						}
					}
					return results;
				},
				5.Minutes(),
				1.Days()
			);
		}
		public void TopPlacesPanel_Load(object o, System.EventArgs e)
		{

			Query q = new Query();
			q.QueryCondition = new And(new Q(Place.Columns.CountryK, CurrentCountry.K), new Q(Place.Columns.Enabled, true));
			q.OrderBy = new OrderBy(new OrderBy(Place.Columns.TotalEvents, OrderBy.OrderDirection.Descending), new OrderBy(Place.Columns.Population, OrderBy.OrderDirection.Descending));
			q.TopRecords = 20;
			PlaceSet ps = new PlaceSet(q);
			if (ps.Count == 0)
			{
				TopPlacesPanel.Visible = false;
			}
			else
			{
				TopPlacesDataList.ItemTemplate = this.LoadTemplate("/Templates/Places/CountryTopPlacesList.ascx");
				TopPlacesDataList.DataSource = ps;
				TopPlacesDataList.DataBind();
			}
			if (ps.Count == 20)
			{
				TopPlacesAnchor.HRef = CurrentCountry.UrlApp("places");
				TopPlacesAnchor.InnerText = TopPlacesAnchor.InnerText.Replace("???", CurrentCountry.FriendlyName);
			}
			else
				TopPlacesAnchorPanel.Visible = false;
		}
示例#14
0
		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				CountryDrop.Items.Clear();
				CountryDrop.Items.Add(new ListItem("select here...", "0"));
				Query qTop = new Query();
				qTop.Columns = new ColumnSet(Country.Columns.FriendlyName, Country.Columns.K);
				qTop.OrderBy = new OrderBy(Country.Columns.TotalEvents, OrderBy.OrderDirection.Descending);
				qTop.QueryCondition = new Q(Country.Columns.Enabled, true);
				qTop.TopRecords = 10;
				CountrySet csTop = new CountrySet(qTop);
				CountryDrop.Items.Add(new ListItem("", "0"));
				CountryDrop.Items.Add(new ListItem("- POPULAR COUNTRIES -", "0"));
				foreach (Country c in csTop)
					CountryDrop.Items.Add(new ListItem(Cambro.Misc.Utility.Snip(c.FriendlyName, 25), c.K.ToString()));

				Query qAll = new Query();
				qAll.Columns = new ColumnSet(Country.Columns.FriendlyName, Country.Columns.K);
				qAll.OrderBy = new OrderBy(Country.Columns.FriendlyName);
				qAll.QueryCondition = new Q(Country.Columns.Enabled, true);
				CountrySet csAll = new CountrySet(qAll);
				CountryDrop.Items.Add(new ListItem("", "0"));
				CountryDrop.Items.Add(new ListItem("--- ALL COUNTRIES ---", "0"));
				foreach (Country c in csAll)
					CountryDrop.Items.Add(new ListItem(Cambro.Misc.Utility.Snip(c.FriendlyName, 25), c.K.ToString()));
			}
		}
示例#15
0
		public void Template(object o, System.EventArgs e)
		{
			Cambro.Web.Helpers.WriteAlertHeader();

			Cambro.Web.Helpers.WriteAlert("Selecting xxx...", 1);
			Query q = new Query();
			//q.QueryCondition=???
			CommentSet bs = new CommentSet(q);
			for (int count = 0; count < bs.Count; count++)
			{
				Comment c = bs[count];

				try
				{
					// 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();
		}
示例#16
0
		UsrEventAttendedSet get(bool forceAllCountries)
		{
			Q sexQ = 
				SexTypeFromUrl == SexType.Boys ? new Q(Usr.Columns.IsMale, true) : 
				SexTypeFromUrl == SexType.Girls ? new Q(Usr.Columns.IsMale, false) : 
				new Q(true);

			Q countryQ = new Q(true);

			if (!forceAllCountries && LocationTypeFromUrl == LocationType.Country)
				countryQ = new Q(Place.Columns.CountryK, CountryFromUrl.K);


			Query q = new Query();
			q.TableElement = new Join(new Join(Event.UsrAttendedJoin, Venue.Columns.K, Event.Columns.VenueK), Place.Columns.K, Venue.Columns.PlaceK);
			q.QueryCondition = new And(
				new Q(Usr.Columns.IsSkeleton, false),
				new Q(Usr.Columns.ExDirectory, false),
				new Q(Usr.Columns.PhotosMeCount, QueryOperator.GreaterThan, 0),
				sexQ,
				countryQ,
				Event.FutureEventsQueryCondition,
				new Q(Event.Columns.DateTime, QueryOperator.LessThan, DateTime.Today.AddDays(7)));
			q.OrderBy = new OrderBy(Usr.Columns.K);
			q.Columns = new ColumnSet(UsrEventAttended.Columns.UsrK);
			q.CacheDuration = new TimeSpan(1, 0, 0);
			return new UsrEventAttendedSet(q);
		}
示例#17
0
		internal List<KeyValuePair<ILinkable, int>> GetTags(int numberOfItems)
		{
			Random r = new Random();
			return Caching.Instances.Main.GetWithLocalCaching(new NamespacedCacheKey(CacheKeyPrefix.TagCloudData, new CacheKey(CacheKeyPrefix.TagCloudVersion), r.Next(10).ToString(), numberOfItems.ToString()),
				() =>
				{
					List<int> tagKs = GetTagKs(numberOfItems);
			


					Query getTags = new Query(new And(new Q(new Column(Tag.Columns.K), tagKs.ToArray())));
					getTags.TableElement = new Join(new TableElement(Bobs.TablesEnum.TagPhoto), Tag.Columns.K, TagPhoto.Columns.TagK);
					getTags.Columns = new ColumnSet(Tag.Columns.TagText, Tag.Columns.ShowInTagCloud, Tag.Columns.K, Tag.Columns.Blocked, Tag.Columns.BlockedByUsrK, Tag.Columns.BlockedDateTime);
					getTags.ExtraSelectElements.Add("Frequency", "CAST(CEILING(LOG(COUNT(" + new Column(TagPhoto.Columns.TagK).InternalSqlName + "))+1) AS INT)");
					getTags.GroupBy = new GroupBy(new GroupBy(Tag.Columns.K), new GroupBy(Tag.Columns.TagText), new GroupBy(Tag.Columns.Blocked), new GroupBy(Tag.Columns.BlockedByUsrK), new GroupBy(Tag.Columns.BlockedDateTime), new GroupBy(Tag.Columns.ShowInTagCloud));
					getTags.OrderBy = new OrderBy(Tag.Columns.TagText, OrderBy.OrderDirection.Ascending);

					List<Tag> tags = new TagSet(getTags).ToList();
					return tags.ToList().ConvertAll(t => new KeyValuePair<ILinkable, int>(t, (int)t.ExtraSelectElements["Frequency"]));
				},
				new TimeSpan(0, 0, 30),
				new TimeSpan(1, 0, 0)
			);


		}
		void BindPromoters()
		{
			Query q = new Query();
			q.QueryCondition = new And(
				Promoter.EnabledQ,
				new Or(
					new Q(Promoter.Columns.SalesHold, false),
					new Q(Promoter.Columns.SalesHold, QueryOperator.IsNull, null)
				),
				new Or(
					new Q(Promoter.Columns.SalesNextCall, QueryOperator.LessThan, DateTime.Today.AddDays(1)),
					new Q(Promoter.Columns.SalesNextCall, QueryOperator.IsNull, null)
				),
				new Q(Promoter.Columns.LetterStatus, Promoter.LetterStatusEnum.Posted),
				new StringQueryCondition("(SELECT COUNT(*) FROM [SalesCall] WHERE [SalesCall].[PromoterK]=[Promoter].[K] AND [SalesCall].[IsCall]=1)=0")
			);

			q.OrderBy = new OrderBy(
				new OrderBy(Promoter.Columns.FutureEvents, OrderBy.OrderDirection.Descending),
				new OrderBy(Promoter.Columns.SalesNextCall, OrderBy.OrderDirection.Ascending),
				new OrderBy(Promoter.Columns.DateTimeSignUp, OrderBy.OrderDirection.Ascending));
			PromoterSet ps = new PromoterSet(q);

			PromoterDataGrid.AllowPaging = (ps.Count > PromoterDataGrid.PageSize);
			PromoterDataGrid.DataSource = ps;
			PromoterDataGrid.DataBind();

		}
示例#19
0
		static void ProcessGalleriesThatHaveFinishedUploading()
		{
			Query q = new Query();

			q.QueryCondition = new And(
				new Q(Gallery.Columns.RunFinishedUploadingTask, false),
				new Q(Gallery.Columns.LastLiveDateTime, QueryOperator.LessThan, DateTime.Now.AddMinutes(-20)),
				new Q(Gallery.Columns.LivePhotos, QueryOperator.GreaterThan, 0));

			GallerySet gs = new GallerySet(q);
			
			foreach (Gallery g in gs)
			{
				g.RunFinishedUploadingTask = true;
				g.Update();
				if (g.Owner.FacebookConnected && g.Owner.FacebookStoryUploadPhoto)
				{
					try
					{
						FacebookPost.CreatePhotoUpload(g.Owner, g);
					}
					catch { }
				}
			}
		}
示例#20
0
		protected void Page_Load(object sender, EventArgs e)
		{
			{
				StringBuilder sbDjs = new StringBuilder();

				Query q1 = new Query();
				q1.OrderBy = new OrderBy(OrderBy.OrderDirection.Random);
				MixmagGreatestDjSet djs = new MixmagGreatestDjSet(q1);

				HtmlRenderer h = new HtmlRenderer();
				h.RenderFlashTagsRaw = true;

				foreach (MixmagGreatestDj dj in djs)
				{
					sbDjs.Append("<h2 style=\"margin-top: 35px; margin-bottom: -5px;\">" + dj.Name + "</h2>");
					sbDjs.Append("<div style=\"height: 100px; clear:both; margin-bottom: 20px;\">");
					{
						sbDjs.Append("<div style=\"height: 100px; width: 100px; float: left; margin-right: 10px;\"><a href=\"/" + dj.UrlName + "\"><img src=\"" + dj.ImageUrl + "\" width=\"100\" height=\"100\" /></a></div>");
						//sbDjs.Append("<div style=\"height: 100px; width: 150px; float: right; margin-left: 10px; \">" + h.GetFlash("djvid" + dj.K.ToString(), 100, 150, false, "load", "http://www.youtube.com/v/" + dj.YoutubeId + "&rel=1") + "</div>");
						sbDjs.Append("<p>" + dj.Description + "<br /><a href=\"/" + dj.UrlName + "\"><b>Vote for " + dj.Name + "</b></a></p>");
					}
					sbDjs.Append("</div>");
					//sbDjs.Append("<div style=\"clear: both;\"></div>");
				}
				DjsPh.Controls.Add(new LiteralControl(sbDjs.ToString()));
			}


		}
示例#21
0
		void gen(PlaceHolder Stats, Log.Items item)
		{
			Query q = new Query();
			q.ExtraSelectElements.Add("Count", "SUM([Log].[Count])");
			q.ExtraSelectElements.Add("Day", "DATENAME(DW,[Log].[Date])");
			q.QueryCondition = new Q(Log.Columns.Item, item);
			q.GroupBy = new GroupBy("DATENAME(DW,[Log].[Date])");
			q.Columns = new ColumnSet();
			LogSet ls = new LogSet(q);
			Dictionary<DayOfWeek, double> weight = new Dictionary<DayOfWeek, double>();
			int total = 0;
			foreach (Log l in ls)
			{
				total += (int)l.ExtraSelectElements["Count"];
			}
			foreach (Log l in ls)
			{
				double fraction = (double)(int)l.ExtraSelectElements["Count"] / (double)total;
				switch ((string)l.ExtraSelectElements["Day"])
				{
					case "Monday": weight[DayOfWeek.Monday] = fraction; break;
					case "Tuesday": weight[DayOfWeek.Tuesday] = fraction; break;
					case "Wednesday": weight[DayOfWeek.Wednesday] = fraction; break;
					case "Thursday": weight[DayOfWeek.Thursday] = fraction; break;
					case "Friday": weight[DayOfWeek.Friday] = fraction; break;
					case "Saturday": weight[DayOfWeek.Saturday] = fraction; break;
					case "Sunday": weight[DayOfWeek.Sunday] = fraction; break;
					default: break;
				}
			}
			Stats.Controls.Add(new LiteralControl("<table><tr><td>Month</td><td>Year</td><td>Weight</td><td>Actual pages</td><td>Weighted pages</td></tr>"));
			for (DateTime dtMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(-12); dtMonth <= new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); dtMonth = dtMonth.AddMonths(1))
			{
				try
				{
					double monthWeight = 0.0;
					for (DateTime dtDay = dtMonth; dtDay < dtMonth.AddMonths(1) && dtDay < DateTime.Today; dtDay = dtDay.AddDays(1))
					{
						monthWeight += weight[dtDay.DayOfWeek];
					}
					Query qMonth = new Query();
					qMonth.ExtraSelectElements.Add("Count", "SUM([Log].[Count])");
					qMonth.QueryCondition = new And(
						new Q(Log.Columns.Item, item),
						new Q(Log.Columns.Date, QueryOperator.GreaterThanOrEqualTo, dtMonth),
						new Q(Log.Columns.Date, QueryOperator.LessThan, dtMonth.AddMonths(1)),
						new Q(Log.Columns.Date, QueryOperator.LessThan, DateTime.Today));
					qMonth.Columns = new ColumnSet();
					LogSet lsMonth = new LogSet(qMonth);
					int actualPages = (int)lsMonth[0].ExtraSelectElements["Count"];
					double pagesPerWeek = (double)actualPages / monthWeight;
					double pagesPerMonth = pagesPerWeek * 4.345238095;

					Stats.Controls.Add(new LiteralControl("<tr><td>" + dtMonth.ToString("MMM") + "</td><td>" + dtMonth.Year + "</td><td>" + monthWeight.ToString("0.00") + "</td><td>" + actualPages.ToString("0") + "</td><td>" + pagesPerMonth.ToString("0") + "</td></tr>"));
					//				Stats.Controls.Add(new LiteralControl( + " " +  + " is " +  + " weeks. " +  + " pages per week.<br>"));
				}
				catch { }
			}
			Stats.Controls.Add(new LiteralControl("</table>"));
		}
		private void LoadPromotersWithTicketRunsAndUnknownVatStatus()
		{
			Query q = new Query();

			if (this.VatStatusDropDownList.SelectedValue != "")
			{
				if (this.VatStatusDropDownList.SelectedValue == "0")
				{
					q.QueryCondition = new Or(new Q(Promoter.Columns.VatStatus, Promoter.VatStatusEnum.Unknown),
											  new Q(Promoter.Columns.VatStatus, QueryOperator.IsNull, null));
				}
				else
				{
					q.QueryCondition = new Q(Promoter.Columns.VatStatus, Convert.ToInt32(VatStatusDropDownList.SelectedValue));
				}
			}
			q.TableElement = new Join(Promoter.Columns.K, TicketRun.Columns.PromoterK);
			q.Distinct = true;
			q.DistinctColumn = Promoter.Columns.K;
			q.OrderBy = new OrderBy(Promoter.Columns.Name);

			PromoterSet promoters = new PromoterSet(q);

			UnknownPromoterVatStatusGridView.DataSource = promoters;
			UnknownPromoterVatStatusGridView.DataBind();
		}
示例#23
0
		protected void Page_Load(object sender, EventArgs e)
		{
			Query q = new Query();
			q.ReturnCountOnly = true;
			MixmagGreatestVoteSet vs = new MixmagGreatestVoteSet(q);

			Response.Write(vs.Count);
		}
        private BankExportSet GetBatchOfUncompletedBankExports()
        {
            Query uncompletedBankExportsQuery = new Query(new Or(new Q(BankExport.Columns.Status, BankExport.Statuses.Added),
                                                                 new Q(BankExport.Columns.Status, BankExport.Statuses.AwaitingConfirmation),
                                                                 new Q(BankExport.Columns.Status, BankExport.Statuses.Failed)));
            BankExportSet uncompletedBankExports = new BankExportSet(uncompletedBankExportsQuery);

            return uncompletedBankExports;
        }
		protected void Page_Load(object sender, EventArgs e)
		{
			Query q = new Query();
			SalesCampaignSet scs = new SalesCampaignSet(q);
			CampaignsDataGrid.DataSource = scs;
			CampaignsDataGrid.DataBind();


		}
示例#26
0
		public void Report_Click(object o, System.EventArgs e)
		{
			if (Usr.Current.AbuseReportsOverturned > 10 && Usr.Current.AbuseReportsOverturnedFraction > 0.5)
			{
				DonePanel.Visible = true;
				ReportPanel.Visible = false;
				ReportP.InnerHtml = "You have " + Usr.Current.AbuseReportsOverturned + " abuse reports that have been overturned by our moderators. You can't report any more photos! <a href=\"" + CurrentPhoto.Url() + "\">Click here to go back to the photo</a>";
				return;
			}

			if (Usr.Current.AbuseReportsPending > 10)
			{
				DonePanel.Visible = true;
				ReportPanel.Visible = false;
				ReportP.InnerHtml = "You have " + Usr.Current.AbuseReportsPending + " abuse reports that are being investigated by our moderators. You can't report any more photos until these have been resolved. <a href=\"" + CurrentPhoto.Url() + "\">Click here to go back to the photo</a>";
				return;
			}

			Query q = new Query();
			q.QueryCondition = new And(
				new Q(Abuse.Columns.ReportUsrK, Usr.Current.K),
				new Q(Abuse.Columns.ObjectType, Model.Entities.ObjectType.Photo),
				new Q(Abuse.Columns.ObjectK, CurrentPhoto.K)
			);
			AbuseSet abs = new AbuseSet(q);
			if (abs.Count > 0)
			{
				DonePanel.Visible = true;
				ReportPanel.Visible = false;
				ReportP.InnerHtml = "You have already reported this photo. Please wait for a response from our moderators. <a href=\"" + CurrentPhoto.Url() + "\">Click here to go back to the photo</a>";
				return;
			}

			Abuse a = new Abuse();
			a.ReportUsrK = Usr.Current.K;
			a.AbuseUsrK = CurrentPhoto.UsrK;
			a.ObjectType = Model.Entities.ObjectType.Photo;
			a.ObjectK = CurrentPhoto.K;
			if (CurrentPhoto.EventK > 0)
				a.ObjectString = "Photo in " + CurrentPhoto.Event.FriendlyName;
			else if (CurrentPhoto.ArticleK > 0)
				a.ObjectString = "Photo in " + CurrentPhoto.Article.FriendlyName;
			a.ReportDescription = Cambro.Web.Helpers.CleanHtml(ReportMessageTextBox.Text);
			a.ReportDateTime = DateTime.Now;
			a.Status = Abuse.StatusEnum.New;
			a.Update();

			Usr.Current.UpdateAbuseTrackers();
			CurrentPhoto.Usr.UpdateAbuseTrackers();
			Bobs.Global.UpdatePhotoAbuseReports();

			DonePanel.Visible = true;
			ReportPanel.Visible = false;
			ReportP.InnerHtml = "Thanks for reporting this. Our moderators will investigate, and you will receive an email when it's resolved. <a href=\"" + CurrentPhoto.Url() + "\">Click here to go back to the photo</a>";


		}
示例#27
0
		protected void Page_Load(object sender, EventArgs e)
		{
			for (DateTime d = new DateTime(2006, 07, 31); d < new DateTime(2006, 10, 01); d = d.AddDays(7))
			{
				Table t = new Table();
				t.BorderWidth = new Unit(1);
				t.BorderColor = System.Drawing.Color.Black;
				t.Style.Add("margin-bottom", "5px");

				Output("Week " + d.ToString("ddd dd-MM") + " to " + d.AddDays(6).ToString("ddd dd-MM"), "", t);
				

				if (true)
				{

					Output("New group members", Log.GetSum(Log.Items.CaptionGroupJoin, d, d.AddDays(7)).ToString("#,##0"), t);

				}

				if (true)
				{
					Query q = new Query();
					q.Columns = new ColumnSet();
					q.ReturnCountOnly = true;
					if (Vars.CaptionIsBrand)
					{
						q.QueryCondition = new And(
							new Q(Photo.Columns.ParentDateTime, QueryOperator.GreaterThanOrEqualTo, d),
							new Q(Photo.Columns.ParentDateTime, QueryOperator.LessThan, d.AddDays(7)),
							new Q(EventBrand.Columns.BrandK, Vars.CaptionBrandK));
						q.TableElement = new Join.Series(Photo.Columns.GalleryK, Gallery.Columns.K, Gallery.Columns.EventK, Event.Columns.K, EventBrand.Columns.EventK);
					}
					else
					{
						q.QueryCondition = new And(
							new Q(Photo.Columns.ParentDateTime, QueryOperator.GreaterThanOrEqualTo, d),
							new Q(Photo.Columns.ParentDateTime, QueryOperator.LessThan, d.AddDays(7)),
							new Q(GroupEvent.Columns.GroupK, Vars.CompetitionGroupK));
						q.TableElement = new Join.Series(Photo.Columns.GalleryK, Gallery.Columns.K, Gallery.Columns.EventK, Event.Columns.K, GroupEvent.Columns.EventK);
					}
					PhotoSet ps = new PhotoSet(q);
					

					Output("Photos uploaded", ps.Count.ToString("#,##0"), t);

				}

				//Output("Competition entries", Log.GetSum(Log.Items.CaptionsAdded, d, d.AddDays(7)).ToString("#,##0"), t);
				//Output("Banner impressions", BannerStat.GetHits(3913, d, d.AddDays(7)).ToString("#,##0"), t);
				//Output("Banner clicks", BannerStat.GetClicks(3913, d, d.AddDays(7)).ToString("#,##0"), t);


				MainDiv.Controls.Add(t);

			}
		}
示例#28
0
		void BindMisc()
		{
			Query q = new Query();
			q.NoLock = true;
			q.QueryCondition = new Q(Bobs.Misc.Columns.NeedsAuth, true);
			q.OrderBy = new OrderBy(Bobs.Misc.Columns.DateTime, OrderBy.OrderDirection.Descending);
			MiscSet ms = new MiscSet(q);
			MiscDataGrid.DataSource = ms;
			MiscDataGrid.DataBind();
		}
示例#29
0
		protected void bind(DateTime d)
		{
			Query q = new Query();
			q.NoLock = false;
			q.QueryCondition = new Q(Log.Columns.Date, d.Date);
			q.OrderBy = new OrderBy(Log.Columns.Item);
			LogSet ls = new LogSet(q);
			Times.DataSource = ls;
			Times.DataBind();
		}
		protected void Page_Load(object sender, EventArgs e)
		{

			Query q = new Query();
			q.ExtraSelectElements.Add("Sum", "SUM([Invoice].[Price])");
			q.ExtraSelectElements.Add("Day", "DATENAME(DW,[Invoice].[CreatedDateTime])");
			q.QueryCondition = new And(
								   new Q(Invoice.Columns.Type, Invoice.Types.Invoice), 
								   new Q(Invoice.Columns.Price, QueryOperator.LessThan, 1000.0));
			q.GroupBy = new GroupBy("DATENAME(DW,[Invoice].[CreatedDateTime])");
			q.Columns = new ColumnSet();
			InvoiceSet ins = new InvoiceSet(q);
			Dictionary<DayOfWeek, decimal> weight = new Dictionary<DayOfWeek, decimal>();
			decimal total = 0.0m;
			foreach (Invoice i in ins)
			{
				total += (decimal)i.ExtraSelectElements["Sum"];
			}
			foreach (Invoice i in ins)
			{
				decimal fraction = (decimal)i.ExtraSelectElements["Sum"] / total;
				switch ((string)i.ExtraSelectElements["Day"])
				{
					case "Monday": weight[DayOfWeek.Monday] = fraction; break;
					case "Tuesday": weight[DayOfWeek.Tuesday] = fraction; break;
					case "Wednesday": weight[DayOfWeek.Wednesday] = fraction; break;
					case "Thursday": weight[DayOfWeek.Thursday] = fraction; break;
					case "Friday": weight[DayOfWeek.Friday] = fraction; break;
					case "Saturday": weight[DayOfWeek.Saturday] = fraction; break;
					case "Sunday": weight[DayOfWeek.Sunday] = fraction; break;
					default: break;
				}
			}
			Stats.Controls.Add(new LiteralControl("<table><tr><td>Month</td><td>Year</td><td>Weight</td><td>Actual revenue</td><td>Weighted revenue</td></tr>"));
			for (DateTime dtMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(-12); dtMonth <= new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); dtMonth = dtMonth.AddMonths(1))
			{
				try
				{
					decimal monthWeight = 0.0m;
					for (DateTime dtDay = dtMonth; dtDay < dtMonth.AddMonths(1) && dtDay < DateTime.Today; dtDay = dtDay.AddDays(1))
					{
						monthWeight += weight[dtDay.DayOfWeek];
					}
					Query qMonth = new Query();
					qMonth.ExtraSelectElements.Add("Count", "SUM([Invoice].[Price])");
					qMonth.QueryCondition = new And(
						new Q(Invoice.Columns.BuyerType, BuyerType),
						new Q(Invoice.Columns.CreatedDateTime, QueryOperator.GreaterThanOrEqualTo, dtMonth),
						new Q(Invoice.Columns.CreatedDateTime, QueryOperator.LessThan, dtMonth.AddMonths(1)),
						new Q(Invoice.Columns.CreatedDateTime, QueryOperator.LessThan, DateTime.Today));
					qMonth.Columns = new ColumnSet();
					InvoiceSet isMonth = new InvoiceSet(qMonth);
					decimal actualRevenue = (decimal)isMonth[0].ExtraSelectElements["Count"];
					decimal revenuePerWeek = actualRevenue / monthWeight;
					decimal revenuePerMonth = revenuePerWeek * 4.345238095m;