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(); }
private void Page_Load(object sender, System.EventArgs e) { AdminPanel.Visible = (Usr.Current != null && Usr.Current.IsAdmin); #region Sales People SalesPanel.Visible = (Usr.Current != null && (Usr.Current.IsSalesPerson || Usr.Current.IsSuperAdmin)); if (SalesPanel.Visible) { List<UsrDataHolder> salesUsrList = new List<UsrDataHolder>(); if (ViewState["SalesUsrList"] == null) { UsrSet salesUsrs = Usr.GetCurrentSalesUsrsNameAndK(new int[] {(int)Usr.SalesTeams.PromoterSalesTeam, (int)Usr.SalesTeams.SmallBusinessSalesTeam}); foreach (Usr salesUsr in salesUsrs) salesUsrList.Add(new UsrDataHolder(salesUsr)); ViewState["SalesUsrList"] = salesUsrList; } else { salesUsrList = (List<UsrDataHolder>)ViewState["SalesUsrList"]; } GenerateSalesTodayTable(salesUsrList); GenerateSalesMonthTable(salesUsrList); //LastWeekDivHeader.InnerHtml = "<a href=\"\" onclick=\"document.getElementById('" + TeamBonusLastWeekDiv.ClientID + "').style.display='';return false;\">Last week</a>"; //LastWeekDivHeader.Attributes["style"] = "cursor:pointer"; TeamBonusLastWeekDiv.Controls.Clear(); TeamBonusThisWeekDiv.Controls.Clear(); try { GenerateTeamBonusTargetWeek(Time.Today.AddDays(-7), TeamBonusLastWeekDiv, salesUsrList); GenerateTeamBonusTargetWeek(Time.Today, TeamBonusThisWeekDiv, salesUsrList); } catch { } } #endregion #region IsSuper if (Usr.Current != null && Usr.Current.IsSuper) { Query vq = new Query(); vq.NoLock = true; vq.QueryCondition = new Q(Venue.Columns.IsNew, true); vq.ReturnCountOnly = true; VenueSet vs = new VenueSet(vq); if (vs.Count != 0) { if (Usr.Current.AdminLevel.Equals(Usr.AdminLevels.Super)) { SuperAdmin.Controls.Add(new LiteralControl("<p>You have to moderate:</p>")); SuperAdmin.Controls.Add(new LiteralControl("<p>" + Usr.Current.NewVenuesToModerateHtml + " new venues</p>")); SuperAdmin.Controls.Add(new LiteralControl("<p>Total to moderate:</p>")); } SuperAdmin.Controls.Add(new LiteralControl("<p>" + vs.Count.ToString() + " new venue(s)</p><p><a href=\"/pages/venues/moderate\">Moderate now!</a></p>")); } Query qMisc = new Query(); qMisc.QueryCondition = new Q(Bobs.Misc.Columns.NeedsAuth, true); qMisc.ReturnCountOnly = true; qMisc.NoLock = true; MiscSet ms = new MiscSet(qMisc); if (ms.Count > 0) SuperAdmin.Controls.Add(new LiteralControl("<p><a href=\"/pages/bannercheck/mode-list\">Check new banners</a></p>")); } else SuperPanel.Visible = false; #endregion #region IsSenior if (Usr.Current != null && Usr.Current.IsSenior) { //GallerySet gs = new GallerySet(new Q(Gallery.Columns.TotalPhotos,QueryOperator.NotEqualTo,Gallery.Columns.LivePhotos,true)); //if (gs.Count>0) SeniorPanel.Visible = true; if (ContainerPage.Url.HasPhotoObjectFilter) { SeniorAdmin.Controls.Add(new LiteralControl("<p><a href=\"" + ContainerPage.Url.ObjectFilterPhoto.Gallery.UrlApp("edit") + "\">Edit gallery</a></p>")); } if (ContainerPage.Url.HasGalleryObjectFilter) { SeniorAdmin.Controls.Add(new LiteralControl("<p><a href=\"" + ContainerPage.Url.ObjectFilterGallery.UrlApp("edit") + "\">Edit gallery</a></p>")); } } else SeniorPanel.Visible = false; #endregion if (Usr.Current != null && Usr.Current.IsAdmin && ((Spotted.Master.DsiPage)Page).Url.HasPromoterObjectFilter) { Promoter CurrentPromoter = ((Spotted.Master.DsiPage)Page).Url.ObjectFilterPromoter; AdminPanelContents.Controls.Add(new LiteralControl("<p><b>PromoterK: " + CurrentPromoter.K + "</b></p>")); AdminPanelContents.Controls.Add(new LiteralControl("<p><a href=\"http://old.dontstayin.com/login-" + Usr.Current.K + "- "+ Usr.Current.LoginString +"/admin/promoter?ID=" + CurrentPromoter.K + "\">Edit this promoter (admin)</a></p>")); AdminPanelContents.Controls.Add(new LiteralControl("<p><a href=\"" + CurrentPromoter.UrlApp("edit") + "\">Edit this promoter (public)</a></p>")); AdminPanelContents.Controls.Add(new LiteralControl("<p>Promoter:<br>")); AdminPanelContents.Controls.Add(new LiteralControl(" - <a href=\"/chat/k-" + CurrentPromoter.QuestionsThreadK + "\">Questions</a><br>")); AdminPanelContents.Controls.Add(new LiteralControl(" - <a href=\"" + CurrentPromoter.UrlApp("banners") + "\">Banners</a><br>")); AdminPanelContents.Controls.Add(new LiteralControl(" - <a href=\"" + CurrentPromoter.UrlApp("files") + "\">Files</a><br>")); AdminPanelContents.Controls.Add(new LiteralControl(" - <a href=\"" + CurrentPromoter.UrlApp("events") + "\">Events</a><br>")); AdminPanelContents.Controls.Add(new LiteralControl(" - <a href=\"" + CurrentPromoter.UrlApp("guestlists") + "\">Guestlists</a><br>")); AdminPanelContents.Controls.Add(new LiteralControl(" - <a href=\"" + CurrentPromoter.UrlApp("competitions") + "\">Competitions</a>")); AdminPanelContents.Controls.Add(new LiteralControl("</p>")); if (CurrentPromoter.AllBrands.Count > 0) AdminPanelContents.Controls.Add(new LiteralControl("<p>Brands:<br>")); foreach (Brand b in CurrentPromoter.AllBrands) AdminPanelContents.Controls.Add(new LiteralControl(" - <a href=\"" + b.Url() + "\">" + b.Name + "</a>" + (b.PromoterStatus.Equals(Brand.PromoterStatusEnum.Unconfirmed) ? " <font color=0000ff><b>unconfirmed</b></font>" : "") + "<br>")); if (CurrentPromoter.AllBrands.Count > 0) AdminPanelContents.Controls.Add(new LiteralControl("</p>")); if (CurrentPromoter.AllVenues.Count > 0) AdminPanelContents.Controls.Add(new LiteralControl("<p>Venues:<br>")); foreach (Venue v in CurrentPromoter.AllVenues) AdminPanelContents.Controls.Add(new LiteralControl(" - <a href=\"" + v.Url() + "\">" + v.Name + " in " + v.Place.Name + "</a>" + (v.PromoterStatus.Equals(Venue.PromoterStatusEnum.Unconfirmed) ? " <font color=0000ff><b>unconfirmed</b></font>" : "") + "<br>")); if (CurrentPromoter.AllVenues.Count > 0) AdminPanelContents.Controls.Add(new LiteralControl("</p>")); AdminPanelContents.Controls.Add(new LiteralControl("<p>Users:<br>")); foreach (Usr u in CurrentPromoter.AdminUsrs) AdminPanelContents.Controls.Add(new LiteralControl(" - <a href=\"" + u.Url() + "\">" + u.NickNameSafe + "</a>" + (CurrentPromoter.PrimaryUsrK == u.K ? " (PRIMARY)" : "") + "<br>")); AdminPanelContents.Controls.Add(new LiteralControl("</p>")); } //if (Usr.Current != null && Usr.Current.IsJunior) //{ // if (ContainerPage.Url.HasUsrObjectFilter) // { // uiModerateTagsAnchor.Text = "Moderate this user's tags"; // uiModerateTagsAnchor.NavigateUrl = "/pages/moderateusrtags/usr-" + ContainerPage.Url.ObjectFilterUsr.K; // } // else if (ContainerPage.Url.HasPhotoObjectFilter) // { // uiModerateTagsAnchor.Text = "Moderate this photo's tags"; // uiModerateTagsAnchor.NavigateUrl = "/pages/moderatephototags/photo-" + ContainerPage.Url.ObjectFilterPhoto.K; // Photo photo = ContainerPage.Url.ObjectFilterPhoto; // if (photo.ThreadK > 0) // { // uiAdministrateChatAnchor.Text = "Administrate this photo's thread"; // uiAdministrateChatAnchor.NavigateUrl = "/pages/chatadmin/k-" + photo.ThreadK; // uiAdministrateChatAnchor.Style["display"] = ""; // } // else // { // uiAdministrateChatAnchor.Style["display"] = "none"; // } // } // else if (ContainerPage.Url["photo"].Exists) // { // uiModerateTagsAnchor.Text = "Moderate this photo's tags"; // uiModerateTagsAnchor.NavigateUrl = "/pages/moderatephototags/photo-" + ContainerPage.Url["photo"].ValueInt; // Photo photo= new Photo(ContainerPage.Url["Photo"].ValueInt); // if (photo.ThreadK > 0) // { // uiAdministrateChatAnchor.Text = "Administrate this photo's thread"; // uiAdministrateChatAnchor.NavigateUrl = "/pages/chatadmin/k-" + photo.ThreadK; // uiAdministrateChatAnchor.Style["display"] = ""; // } // else // { // uiAdministrateChatAnchor.Style["display"] = "none"; // } // } // else // { // ChatPanel.Visible = false; // } //} //else //{ // ChatPanel.Visible = false; //} }
void BindMisc() { Q UsrPromoterQ = null; if (CurrentPromoter != null) UsrPromoterQ = new Q(Bobs.Misc.Columns.PromoterK, CurrentPromoter.K); else UsrPromoterQ = new Q(Bobs.Misc.Columns.UsrK, Usr.Current.K); Query q = new Query(); q.NoLock = true; q.QueryCondition = new And( new Q(Bobs.Misc.Columns.Folder, CurrentFolder), UsrPromoterQ); q.OrderBy = new OrderBy(Bobs.Misc.Columns.DateTime, OrderBy.OrderDirection.Descending); MiscSet ms = new MiscSet(q); MiscNoFilesP.Visible = ms.Count == 0; MiscDataGridP.Visible = ms.Count > 0; if (ms.Count > 0) { MiscDataGrid.DataSource = ms; MiscDataGrid.DataBind(); } }
void FileAssignDropDownBuild() { Query q = new Query(); Q ExtQ = null; #region Leaderboard Q LeaderboardFlash = new And( new Q(Bobs.Misc.Columns.Extention, "swf"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 150 * 1024), new Or( new Q(Bobs.Misc.Columns.NeedsAuth, true), new And( new Q(Bobs.Misc.Columns.NeedsAuth, false), new Q(Bobs.Misc.Columns.BannerBroken, false) ) ) ); Q LeaderboardGif = new And( new Q(Bobs.Misc.Columns.Extention, "gif"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 150 * 1024), new Q(Bobs.Misc.Columns.Width, 728), new Q(Bobs.Misc.Columns.Height, 90) ); Q LeaderboardJpg = new And( new Q(Bobs.Misc.Columns.Extention, "jpg"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 150 * 1024), new Q(Bobs.Misc.Columns.Width, 728), new Q(Bobs.Misc.Columns.Height, 90) ); #endregion #region Skyscraper Q SkyscraperFlash = new And( new Q(Bobs.Misc.Columns.Extention, "swf"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 150 * 1024), new Or( new Q(Bobs.Misc.Columns.NeedsAuth, true), new And( new Q(Bobs.Misc.Columns.NeedsAuth, false), new Q(Bobs.Misc.Columns.BannerBroken, false) ) ) ); Q SkyscraperGif = new And( new Q(Bobs.Misc.Columns.Extention, "gif"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 150 * 1024), //XMAS new Q(Bobs.Misc.Columns.Width, 300), new Q(Bobs.Misc.Columns.Height, 250) //600 ); Q SkyscraperJpg = new And( new Q(Bobs.Misc.Columns.Extention, "jpg"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 150 * 1024), //XMAS new Q(Bobs.Misc.Columns.Width, 300), new Q(Bobs.Misc.Columns.Height, 250) //600 ); #endregion #region Hotbox Q HotboxFlash = new And( new Q(Bobs.Misc.Columns.Extention, "swf"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 150 * 1024), new Or( new Q(Bobs.Misc.Columns.NeedsAuth, true), new And( new Q(Bobs.Misc.Columns.NeedsAuth, false), new Q(Bobs.Misc.Columns.BannerBroken, false) ) ) ); Q HotboxGif = new And( new Q(Bobs.Misc.Columns.Extention, "gif"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 150 * 1024), new Or( new And(new Q(Bobs.Misc.Columns.Width, 191),new Q(Bobs.Misc.Columns.Height, 191)), new And(new Q(Bobs.Misc.Columns.Width, 300),new Q(Bobs.Misc.Columns.Height, 250)) ) ); Q HotboxJpg = new And( new Q(Bobs.Misc.Columns.Extention, "jpg"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 150 * 1024), new Or( new And(new Q(Bobs.Misc.Columns.Width, 191), new Q(Bobs.Misc.Columns.Height, 191)), new And(new Q(Bobs.Misc.Columns.Width, 300), new Q(Bobs.Misc.Columns.Height, 250)) ) ); #endregion #region PhotoBanner Q PhotoBannerFlash = new And( new Q(Bobs.Misc.Columns.Extention, "swf"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 30 * 1024), new Or( new Q(Bobs.Misc.Columns.NeedsAuth, true), new And( new Q(Bobs.Misc.Columns.NeedsAuth, false), new Q(Bobs.Misc.Columns.BannerBroken, false) ) ) ); Q PhotoBannerGif = new And( new Q(Bobs.Misc.Columns.Extention, "gif"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 30 * 1024), new Q(Bobs.Misc.Columns.Width, 450), new Q(Bobs.Misc.Columns.Height, 50) ); Q PhotoBannerJpg = new And( new Q(Bobs.Misc.Columns.Extention, "jpg"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 30 * 1024), new Q(Bobs.Misc.Columns.Width, 450), new Q(Bobs.Misc.Columns.Height, 50) ); #endregion #region EmailBanner //Q EmailBannerFlash = new Q(false); Q EmailBannerGif = new And( new Q(Bobs.Misc.Columns.Extention, "gif"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 40 * 1024), new Q(Bobs.Misc.Columns.Width, 331), new Q(Bobs.Misc.Columns.Height, 51) ); Q EmailBannerJpg = new And( new Q(Bobs.Misc.Columns.Extention, "jpg"), new Q(Bobs.Misc.Columns.Size, QueryOperator.LessThanOrEqualTo, 40 * 1024), new Q(Bobs.Misc.Columns.Width, 331), new Q(Bobs.Misc.Columns.Height, 51) ); #endregion if (CurrentBanner.Position.Equals(Banner.Positions.Leaderboard)) ExtQ = new Or(LeaderboardFlash, LeaderboardGif, LeaderboardJpg); else if (CurrentBanner.Position.Equals(Banner.Positions.Skyscraper)) ExtQ = new Or(SkyscraperFlash, SkyscraperGif, SkyscraperJpg); else if (CurrentBanner.Position.Equals(Banner.Positions.Hotbox)) ExtQ = new Or(HotboxFlash, HotboxGif, HotboxJpg); else if (CurrentBanner.Position.Equals(Banner.Positions.PhotoBanner)) ExtQ = new Or(PhotoBannerFlash, PhotoBannerGif, PhotoBannerJpg); else if (CurrentBanner.Position.Equals(Banner.Positions.EmailBanner)) ExtQ = new Or(EmailBannerGif, EmailBannerJpg); if (ExtQ != null) { q.QueryCondition = new And(new Q(Bobs.Misc.Columns.PromoterK, CurrentPromoter.K), ExtQ); q.OrderBy = Bobs.Misc.OrderBy; MiscSet ms = new MiscSet(q); if (ms.Count > 0) { FileAssignDropDown.DataSource = ms; FileAssignDropDown.DataTextField = "FullNameWithK"; FileAssignDropDown.DataValueField = "K"; FileAssignDropDown.DataBind(); FileAssignNoFiles.Visible = false; FileAssignDropDownP.Visible = true; } else { FileAssignNoFiles.Visible = true; FileAssignDropDownP.Visible = false; FileAssignNoFilesUploadLink.HRef = CurrentPromoter.UrlApp("files", "mode", "upload"); } } }