Esempio n. 1
0
		private void LoadFlyer(Flyer f)
		{
			FlyerK = f.K;
			uiNameTextBox.Text = f.Name;
			uiSubjectTextBox.Text = f.Subject;
			uiFromDisplayNameTextBox.Text = f.MailFromDisplayName;
			uiBackgroundColor.Text = f.BackgroundColor;
			uiUrlTextBox.Text = f.LinkTargetUrl;
			uiSendTime.Time = f.SendDateTime;
			uiSendDate.Date = f.SendDateTime;
			uiPromotersAutoComplete.Value = f.PromoterK.ToString();
			uiPromotersAutoComplete.Text = (f.PromoterK > 0) ? f.Promoter.Name : "";

			uiPlaceTargettingHidden.Value = f.PlaceKs;
			uiMusicTargettingHidden.Value = f.MusicTypeKs;
			uiPromotersOnly.Checked = f.PromotersOnly;
			uiIsHtml.Checked = f.IsHtml;
			uiHtml.Text = f.Html;
			uiTextAlternative.Text = f.TextAlternative;


			if (!string.IsNullOrEmpty(f.EventKs))
			{
				uiEvents.Text = string.Join("<br />",
					f.EventKs.CommaSeparatedValuesToIntList().ConvertAll(k => new Event(k)).ConvertAll(e => e.VerboseInfo).ToArray());
				uiEventKs.Value = f.EventKs;
			}
			SetTargettingTexts();

			if (f.MiscK > 0)
			{
				uiPreviewFile.NavigateUrl = f.Misc.Url();
				uiPreviewFile.Target = "_blank";
				uiPreviewFile.Visible = true;
				
			}
			else
			{
				uiPreviewFile.Visible = false;
			}

			if (f.MiscK > 0 || f.IsHtml)
			{
				uiTestButton.Visible = true;
				uiTestEmail.Visible = true;
				uiTestEmail.Text = Usr.Current.Email;
			}
			else
			{
				uiTestButton.Visible = false;
				uiTestEmail.Visible = false;
			}

			if (!f.IsEditable)
			{
				uiSaveButton.Enabled = false;
			}
		}
Esempio n. 2
0
		public void ProcessRequest(HttpContext context)
		{
			string[] splitPath = context.Request.Path.Split('/');
			if (splitPath.Length == 4 && splitPath[1].ToLower() == "images" && splitPath[2].ToLower() == "flyer")
			{
				string fileName = splitPath[3];
				int flyerK = int.Parse(fileName.Substring(0, fileName.IndexOf(".")));
				Flyer f = new Flyer(flyerK);
				
				if (f.MiscK == 0)
					Storage.WriteFileToHttpResponse(context, Storage.Stores.Pix, new Guid("5a106560-1989-4ecb-86bd-e52ba8689352"), "gif");
				else
					Storage.WriteFileToHttpResponse(context, Storage.Stores.Pix, f.Misc.Guid, f.Misc.Extention);

				Utilities.GetSafeThread(() => f.LogView()).Start();
			}
			else if ((splitPath.Length == 4 || splitPath.Length == 6) && splitPath[1].ToLower() == "images" && (splitPath[2].ToLower() == "pix" || splitPath[2].ToLower() == "master"))
			{
				string fileName = splitPath[splitPath.Length - 1];
				Guid guid = new Guid(fileName.Substring(0, fileName.IndexOf(".")));
				string extention = fileName.Substring(fileName.IndexOf(".") + 1);
				Storage.WriteFileToHttpResponse(context, splitPath[2].ToLower() == "pix" ? Storage.Stores.Pix : Storage.Stores.Master, guid, extention);
			}
			else if ((splitPath.Length == 4 || splitPath.Length == 6) && splitPath[1].ToLower() == "images" && (splitPath[2].ToLower() == "pixredirect" || splitPath[2].ToLower() == "masterredirect"))
			{
				string fileName = splitPath[splitPath.Length - 1];
				Guid guid = new Guid(fileName.Substring(0, fileName.IndexOf(".")));
				string extention = fileName.Substring(fileName.IndexOf(".") + 1);
				HttpContext.Current.Response.Redirect(Storage.Path(guid, extention, splitPath[2].ToLower() == "pixredirect" ? Storage.Stores.Pix : Storage.Stores.Master)); 
				//Storage.WriteFileToHttpResponse(context, splitPath[2].ToLower() == "pix" ? Storage.Stores.Pix : Storage.Stores.Master, guid, extention);
			}
			else if (splitPath.Length == 4 && splitPath[1].ToLower() == "files" && splitPath[2].ToLower() == "styledcss" && splitPath[3].ToLower().EndsWith(".css"))
			{
				string[] filename = splitPath[3].ToLower().Split('-');
				string objectType = filename[0];
				int K = int.Parse(filename[1].Substring(0, filename[1].Length - 4));

				if (objectType == "brand")
				{
					Brand b = new Brand(K);
					context.Response.Write(b.StyledCss);
				}
				else if (objectType == "venue")
				{
					Venue v = new Venue(K);
					context.Response.Write(v.StyledCss);
				}
			}
		}
Esempio n. 3
0
		protected void Save(object sender, EventArgs e)
		{
			if (!Page.IsValid)
			{
				return;
			}

			try
			{
				Misc m = SaveMisc();

				Flyer f;
				if (FlyerK > 0)
				{
					f = new Flyer(FlyerK);
				}
				else
				{
					f = new Flyer();
				}

				f.Name = uiNameTextBox.Text;
				if (m.K > 0) f.MiscK = m.K;
				f.LinkTargetUrl = uiUrlTextBox.Text.Trim();
				f.Subject = uiSubjectTextBox.Text;
				f.MailFromDisplayName = uiFromDisplayNameTextBox.Text.Trim();
				f.BackgroundColor = uiBackgroundColor.Text;
				f.PromoterK = int.Parse(uiPromotersAutoComplete.Value);
				f.SendDateTime = uiSendDate.Date.AddHours(uiSendTime.Time.Hour).AddMinutes(uiSendTime.Minute);
				f.PlaceKs = uiPlaceTargettingHidden.Value;
				f.MusicTypeKs = uiMusicTargettingHidden.Value;
				f.PromotersOnly = uiPromotersOnly.Checked;
				f.IsHtml = uiIsHtml.Checked;
				f.Html = uiHtml.Text;
				f.TextAlternative = uiTextAlternative.Text;
				f.EventKs = uiEventKs.Value;
				f.Update();

				uiSavedLabel.Text = "Saved as Flyer #" + f.K;
				uiSavedLabel.ForeColor = System.Drawing.Color.Black;

				LoadFlyer(f);
			}
			catch (Exception ex)
			{
				this.uiSavedLabel.Text = "ERROR: " + ex.Message;
				this.uiSavedLabel.ForeColor = System.Drawing.Color.Red;
			}
		}