protected void Load(object sender, EventArgs e)
		{
			var d = new DonationIcon(int.Parse(uiK.Text));
			this.uiName.Text = d.IconName;
			this.uiText.Text = d.IconText;
			this.uiGuid.Text = d.ImgGuid.Value.ToString();
			this.uiExtension.Text = d.ImgExtension;
			this.uiThreadK.Text = d.ThreadK.ToString();
			this.uiActivationDate.Date = d.StartDateTime;
			this.uiActivationTime.Time = d.StartDateTime;
			this.uiEnabled.Checked = d.Enabled;
			this.uiVatable.Checked = d.Vatable.Value;
			SetLink(d.K);
		}
		protected void Save(object sender, EventArgs e)
		{
			var d = new DonationIcon() {PriceWhenActive = 5, PriceWhenRetroactive = 10, DonatePageControl = DonationIcon.Control.Basic};
			if (!string.IsNullOrEmpty(uiK.Text))
			{
				d = new DonationIcon(int.Parse(uiK.Text));
			}
			d.IconName = this.uiName.Text;
			d.IconText = this.uiText.Text;
			d.ImgGuid = new Guid(this.uiGuid.Text);
			d.ImgExtension = this.uiExtension.Text;
			d.ThreadK = (!string.IsNullOrEmpty(this.uiThreadK.Text)) ? int.Parse(this.uiThreadK.Text) : 0;
			d.StartDateTime = uiActivationDate.Date.AddHours(uiActivationTime.Time.Hour).AddMinutes(uiActivationTime.Minute);
			d.Enabled = this.uiEnabled.Checked;
			d.Vatable = this.uiVatable.Checked;

			d.Update();
			this.uiK.Text = d.K.ToString();
			SetLink(d.K);
		}
Esempio n. 3
0
		public void MainPanelMisc_Load(object o, System.EventArgs e)
		{
			if (ThisUsr != null && !ThisUsr.IsSkeleton)
			{
				if (ThisUsr.CommentCount > 0)
					UsrCommentsLabel.Text = "<a href=\"" + ThisUsr.UrlMyComments() + "\">" + ThisUsr.CommentCount.ToString("#,##0") + " comment" + (ThisUsr.CommentCount == 1 ? "" : "s") + "</a>";
				else
					UsrCommentsLabel.Text = "no comments";

				GroupInviteAnchor.HRef = ThisUsr.UrlApp("invite");
				GroupInviteAnchor.InnerHtml = GroupInviteAnchor.InnerHtml.Replace("xxx", ThisUsr.NickName);

				if (ThisUsr.CommentCount > 0)
				{
					UsrChatArchiveAnchor.HRef = ThisUsr.UrlApp("chat");
					UsrChatArchiveAnchor.InnerHtml = UsrChatArchiveAnchor.InnerHtml.Replace("xxx", "Read comments posted by " + ThisUsr.NickName);
				}
				else
					UsrChatArchiveAnchorP.Visible = false;

				if (ThisUsr.ChatMessageCount == 0)
					UsrChatLabel.Text = "I've not posted in the live-chat yet";
				else if (ThisUsr.ChatMessageCount == 1)
					UsrChatLabel.Text = "one live chat message";
				else
					UsrChatLabel.Text = ThisUsr.ChatMessageCount.ToString("#,##0") + " live chat messages";

				if (ThisUsr.PhotosMeCount == 0)
					UsrPhotoLabel.Text = ", and I've not been spotted yet.";
				else if (ThisUsr.PhotosMeCount == 1)
					UsrPhotoLabel.Text = ", and I've been <a href=\"" + ThisUsr.Url() + "#PhotosMe\">spotted once</a>.";
				else if (ThisUsr.PhotosMeCount <= 18)
					UsrPhotoLabel.Text = ", and I've been <a href=\"" + ThisUsr.Url() + "#PhotosMe\">spotted " + ThisUsr.PhotosMeCount.ToString("#,##0") + " times</a>.";
				else
					UsrPhotoLabel.Text = ", and I've been <a href=\"" + ThisUsr.UrlMyPhotos() + "\">spotted " + ThisUsr.PhotosMeCount.ToString("#,##0") + " times</a>.";

				AdminIconPanel.Visible = ThisUsr.IsAdmin;
				ModeratorIconPanel.Visible = !ThisUsr.IsAdmin && ThisUsr.IsSenior;
				EventModeratorIconPanel.Visible = !ThisUsr.IsAdmin && ThisUsr.IsSuper;
				SuperIconPanel.Visible = ThisUsr.IsSuperUser;
				DsiRegularIconPanel.Visible = ThisUsr.IsDsiRegular & !ThisUsr.IsSuperUser;
				//Donate1Panel.Visible = ThisUsr.Donate1IconShown;
				//Donate2Panel.Visible = ThisUsr.Donate2IconShown;
				DjIconPanel.Visible = ThisUsr.IsDj.HasValue && ThisUsr.IsDj.Value;

				var ds = DonationIcon.GetIconsForUsr(ThisUsr.K);
				if (ds != null && ds.Count > 0)
				{
					int i = 0;
					foreach (var d in ds)
					{
						uiDonationIconsHtml.Text +=
							string.Format(
								"<a href='/pages/icons/k-{0}' class='CleanLinks'><img src='{1}' border='0' align='absmiddle' style='margin-right:3px;' width='26' height='21'></a>",
								d.K, d.IconPath);
					}
					uiDonationIconsPanel.Visible = true;

					try
					{
						DonationIcon d = new DonationIcon(ThisUsr.RolloverDonationIconK.Value);
						DonationIconTopP.InnerHtml = string.Format(@"<a href=""/pages/icons/k-{0}""><img src=""{1}"" border=""0"" align=""absmiddle"" style=""margin-right:3px;"" width=""26"" height=""21"" />{2}</a>",
							d.K.ToString(),
							d.IconPath,
							d.IconText);
					}
					catch {
						DonationIconTopP.Visible = false;
					}

					if (Usr.Current != null && ThisUsr.K == Usr.Current.K)
					{
						DonationRolloverP.Visible = true;

						{

							if (!Page.IsPostBack)
							{
								DonationRolloverDrop.DataSource = DonationIcon.GetIconsForUsr(ThisUsr.K);
								DonationRolloverDrop.DataTextField = "IconText";
								DonationRolloverDrop.DataValueField = "K";
								DonationRolloverDrop.DataBind();
							}

							try
							{
								DonationIcon d = new DonationIcon(Usr.Current.RolloverDonationIconK.Value);

								

								if (!Page.IsPostBack)
									DonationRolloverDrop.SelectedValue = d.K.ToString();
								DonationRolloverImage.Src = d.IconPath;
							}
							catch {
								
							}
						}
					}
					else
						DonationRolloverP.Visible = false;
				}
				else
				{
					uiDonationIconsPanel.Visible = false;
					DonationRolloverP.Visible = false;
				}


				DonationIconLegendP.Visible = ThisUsr.IsDonationIconLegend;

				ExtraIconPanel.Visible = ThisUsr.ExtraIconInUse > 0;
				TicketIconPanel.Visible = ThisUsr.HasTicket && ThisUsr.LastTicketEventDateTime > DateTime.Now.AddDays(-1);

				SpotterIconPanel.Visible = ThisUsr.IsSpotter;
				if (SpotterIconPanel.Visible)
				{
					SpotterIcon.Src = ThisUsr.SpotterIconPath;
					SpotterLink.HRef = ThisUsr.IsProSpotter ? "/pages/prospotters" : "/pages/spotters";
					SpotterLabel.Text = ThisUsr.SpotterStatus(true, true, true);

					SpotterSpottingsLabel.Text = (ThisUsr.SpottingsTotal > 0 ? "<a href=\"" + ThisUsr.UrlSpottings() + "\">" : "") + ThisUsr.SpottingsTotal.ToString("#,##0") + " " + (ThisUsr.SpottingsTotal == 1 ? "person" : "people") + (ThisUsr.SpottingsTotal > 0 ? "</a>" : "");
				}

				if (ThisUsr.PicPhotoK > 0)
				{
					try
					{
						PicAnchor.HRef = ThisUsr.PicPhoto.Url();
					}
					catch { }
				}

				ChatterboxIconPanel.Visible = ThisUsr.IsChatterBox;
				NewUserIconPanel.Visible = ThisUsr.IsNewUser;
				DiscussionModeratorIconPanel.Visible = !ThisUsr.IsAdmin && ThisUsr.IsJunior;

				if (ThisUsr.MusicTypesFavouriteCount > 0)
				{
					UsrMusicTypesPanel.Visible = true;
					UsrMusicTypesLabel.Text = "";
					for (int i = 0; i < ThisUsr.MusicTypesFavourite.Count; i++)
					{
						UsrMusicTypesLabel.Text += (i > 0 ? ", " : "") + ThisUsr.MusicTypesFavourite[i].GenericName;
					}
				}
				else
					UsrMusicTypesPanel.Visible = false;

				if (ThisUsr.PlacesVisitCount > 0)
				{
					UsrPlaceVisitPanel.Visible = true;
					UsrPlaceVisitLabel.Text = "";
					PlaceSet ps = ThisUsr.PlacesVisit(Place.LinkColumns, 0);
					for (int i = 0; i < ps.Count; i++)
					{
						UsrPlaceVisitLabel.Text += (i > 0 ? ", " : "") + "<a href=\"" + ps[i].Url() + "\">" + ps[i].Name + "</a>";
					}
				}
				else
					UsrPlaceVisitPanel.Visible = false;
			}
		}