Ejemplo n.º 1
0
		protected void Page_Load(object sender, EventArgs e)
		{
			Usr.KickUserIfNotLoggedIn("You must log in to view this page...");
			TicketRun tr = new TicketRun(ContainerPage.Url[0]);
			if (!Usr.Current.IsPromoterK(tr.PromoterK) && !Usr.Current.IsAdmin)
			{
				throw new Exception("You must be a member of the " + tr.Promoter.Name + " promoter account to view this page.");
			}
			H1.InnerText = tr.Description;
			Query q = new Query();
			q.QueryCondition=new Q(Ticket.Columns.TicketRunK, (int)ContainerPage.Url[0]);
			q.OrderBy = new OrderBy(Ticket.Columns.K);
			TicketSet ts = new TicketSet(q);
			foreach (Ticket t in ts)
			{
				HtmlTableRow tRow = new HtmlTableRow();

				

				HtmlTableCell refCell = new HtmlTableCell();
				refCell.InnerText = t.InvoiceItemK.ToString();
				tRow.Cells.Add(refCell);

				HtmlTableCell dateCell = new HtmlTableCell();
				dateCell.InnerText = t.BuyDateTime.ToString();
				tRow.Cells.Add(dateCell);

				HtmlTableCell nameCell = new HtmlTableCell();
				nameCell.InnerText = t.FirstName + " " + t.LastName;
				tRow.Cells.Add(nameCell);

				HtmlTableCell mobileCell = new HtmlTableCell();
				mobileCell.InnerText = "0"+t.MobileNumber;
				tRow.Cells.Add(mobileCell);
				
				HtmlTableCell postcodeCell = new HtmlTableCell();
				postcodeCell.InnerText = t.AddressPostcode;
				tRow.Cells.Add(postcodeCell);

				HtmlTableCell qtyCell = new HtmlTableCell();
				qtyCell.InnerText = t.Quantity.ToString();
				tRow.Cells.Add(qtyCell);

			//	HtmlTableCell cardCell = new HtmlTableCell();
			//	cardCell.InnerText = t.CardDigits;
			//	tRow.Cells.Add(cardCell);

				Tab.Rows.Add(tRow);


			}
		}
Ejemplo n.º 2
0
		protected void Page_Load(object sender, EventArgs e)
		{	
			this.ContactEmailRegularExpressionValidator.ValidationExpression = Cambro.Misc.RegEx.Email;
			this.TicketPriceCustomValidator.ErrorMessage = "Ticket price must be at least " + MINIMUM_TICKET_PRICE.ToString("c"); 
			this.NonEventSpecificDiv.Visible = false;
			this.JavascriptLabel.Visible = false;
            this.TicketRunDefaultNoteLabel.Visible = false;

            if (CurrentPromoter.AddressCountryK != 224 || (CurrentPromoter.VatCountryK != 224 && CurrentPromoter.VatCountryK != 0))
            {

                ErrorMessageP.Visible = true;
                this.AddEditTicketRunPanel.Visible = false;
                return;
            }
			if (CurrentTicketRun.PromoterK <= 0)
				CurrentTicketRun.PromoterK = CurrentPromoter.K;

            ShowHideAdvancedOptions();
			if (!ContainerPage.Url["ReferringPage"].IsNull && ContainerPage.Url["ReferringPage"].IsInt)
			{
				try
				{
					referringPage = (ReferringPageType)Convert.ToInt32(ContainerPage.Url["ReferringPage"].Value);
				}
				catch { }
			}

			if (!ContainerPage.Url["K"].IsNull && ContainerPage.Url["K"].IsInt)
			{
				try
				{
					CurrentTicketRun = new Bobs.TicketRun(Convert.ToInt32(ContainerPage.Url["K"].Value));
				}
				catch
				{
					throw new DsiUserFriendlyException("Invalid ticket run number");
				}
				
				CurrentTicketRun.CalculateSoldTicketsAndUpdate();
				List<Event> ticketRunEvents = new List<Event>();
				ticketRunEvents.Add(CurrentTicketRun.Event);
				SetupEventDropDownList(ticketRunEvents);
				ProcessSavedTicketRun();
				
				if (!Usr.Current.IsAdmin && CurrentPromoter.K != CurrentTicketRun.PromoterK)
					throw new DsiUserFriendlyException("You cannot edit this ticket run! It does not belong to your promoter account.");
			}
			else if (!ContainerPage.Url["EventK"].IsNull && ContainerPage.Url["EventK"].IsInt)
			{
				try
				{
					EventK = Convert.ToInt32(ContainerPage.Url["EventK"].Value);
					CurrentTicketRun.Event = new Event(EventK);
					if (!this.IsPostBack)
					{
						EventSpecific = true;
						List<Event> ticketRunEvents = new List<Event>();
						ticketRunEvents.Add(CurrentTicketRun.Event);
						SetupEventDropDownList(ticketRunEvents);
						this.NonEventSpecificDiv.Visible = false;
					}
				}
				catch
				{
					throw new DsiUserFriendlyException("Invalid event");
				}
				if (!Usr.Current.IsAdmin && !CurrentTicketRun.Event.IsPromoter(CurrentPromoter.K))
					throw new DsiUserFriendlyException("You cannot edit this ticket run! It does not belong to your promoter account.");
			}
			else 
			{
				this.NonEventSpecificDiv.Visible = EditMode;
				if(!this.IsPostBack)
					SetupPromoterEvents();		
			}

            if (CurrentTicketRun.Event == null && EventDropDownList.Items.Count > 0)
            {
                CurrentTicketRun.Event = new Event(Convert.ToInt32(EventDropDownList.SelectedValue));
            }
            if (CurrentTicketRun.Event != null)
            {
                this.EventLabel.Text = CurrentTicketRun.Event.LinkShortNewWindow(50, true);
            }

			if (!this.IsPostBack)
			{
				ViewState["DuplicateGuid"] = Guid.NewGuid();
				if (CurrentTicketRun.K == 0)
				{
					this.LoadScreenFromEvent();
					ShowHideControlsForTicketRun();
				}
			}

            if(CurrentTicketRun.K > 0)
                ((Spotted.Master.DsiPage)this.Page).SetPageTitle("Edit Ticket Run");
            else
                ((Spotted.Master.DsiPage)this.Page).SetPageTitle("Add Ticket Run");
		}
Ejemplo n.º 3
0
		public void AssignRandomTicketCodesToTicketRun(object o, System.EventArgs e)
		{
			try
			{
				int ticketRunK = Convert.ToInt32(TicketRunK.Text);
				TicketRun tr = new TicketRun(ticketRunK);
				foreach (Ticket t in tr.Tickets)
				{
					t.SetRandomCode();
					t.Update();
				}
			}
			catch { }
		}
Ejemplo n.º 4
0
		public bool IsCircularDependancy()
		{
			try
			{
				if (this.K == 0 || this.FollowsTicketRunK == 0)
					return false;
				else
				{
					TicketRun followsTicketRun = this.FollowsTicketRun;
					while (followsTicketRun.FollowsTicketRunK != 0)
					{
						if (followsTicketRun.FollowsTicketRunK == this.K)
							return true;
						else
							followsTicketRun = followsTicketRun.FollowsTicketRun;
					}

					return false;
				}
			}
			catch
			{
				return false;
			}
		}
Ejemplo n.º 5
0
		protected void TicketRunsGridView_RowCommand(object sender, GridViewCommandEventArgs e)
		{
			if (e.CommandName == "StopTicketRun" || e.CommandName == "PauseResumeTicketRun")
			{
				GridViewRow row = (GridViewRow)((Control)e.CommandSource).Parent.Parent;

				Bobs.TicketRun ticketRun = new Bobs.TicketRun(Convert.ToInt32(((TextBox)row.FindControl("TicketRunKTextBox")).Text));
				if (e.CommandName == "StopTicketRun")
				{
					ticketRun.EndTicketRun();
				}
				else if (e.CommandName == "PauseResumeTicketRun")
				{
					ticketRun.Paused = !ticketRun.Paused;
					ticketRun.Update();
				}
				else
					return;

				LoadPromoterTicketRuns();
			}
		}
Ejemplo n.º 6
0
		//protected void TicketRunsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
		//{
		//    if (e.Row.RowType == DataControlRowType.DataRow && Usr.Current.IsSuperAdmin)
		//    {				
		//        try
		//        {
		//            Button refundButton = (Button)e.Row.FindControl("RefundTicketRunButton");
		//            //if (!refundButton.Enabled)
		//            //{
		//                refundButton.Attributes.Add("onmouseover", "stt('You must stop the ticket run before refunding it.');");
		//            //}
		//        }
		//        catch
		//        { }				
		//    }
		//}
		protected void RefundTicketRunButton_Click(object sender, EventArgs e)
		{
			GridViewRow row = (GridViewRow)((Button)sender).Parent.Parent;// ((Control)e.CommandSource).Parent.Parent;

			Bobs.TicketRun ticketRun = new Bobs.TicketRun(Convert.ToInt32(((TextBox)row.FindControl("TicketRunKTextBox")).Text));
			ticketRun.CalculateSoldTicketsAndUpdate();
			if (ticketRun.SoldTickets > 0)
			{
				Ticket.Refund(Usr.Current, ticketRun.Tickets);
				ticketRun.CalculateSoldTicketsAndUpdate();
				if (ticketRun.Status == TicketRun.TicketRunStatus.Refunded)
				{
					this.TicketRunsJavascriptLabel.Text = "<script type=\"text/javascript\">alert('TicketRun #" + ticketRun.K.ToString() + " refunded.');</script>";
					this.TicketRunsJavascriptLabel.Visible = true;
				}
			}
			LoadTicketRuns();
		}
Ejemplo n.º 7
0
		public void AssignTicketsToPurchase(List<Ticket> ticketsToPurchase)
		{
			if (ticketsToPurchase != null && ticketsToPurchase.Count > 0)
			{
				if (Usr.Current == null)
					Response.Redirect(this.StyledObject.UrlStyledApp("login") + "?url=" + HttpUtility.UrlEncode(HttpContext.Current.Request.Url.ToString()));

				try
				{
					foreach (RepeaterItem rpi in RunningTicketRunsForPromoterRepeater.Items)
					{
						if (rpi.ItemType == ListItemType.Item || rpi.ItemType == ListItemType.AlternatingItem)
						{
							foreach (Ticket ticket in ticketsToPurchase)
							{
								if (ticket.TicketRunK == 0)
									break;

								try
								{
									TicketRun ticketRun = new TicketRun(Convert.ToInt32(((TextBox)rpi.FindControl("TicketRunKTextBox")).Text));
									if (ticket.TicketRunK == ticketRun.K)
									{
										if (ticket.Quantity > ticketRun.MaxTickets - ticketRun.SoldTickets)
										{
											ticket.Quantity = ticketRun.MaxTickets - ticketRun.SoldTickets;
										}

										int currentUsrTicketQuantity = CurrentEvent.TicketsSoldForUsr(Usr.Current.K);
										if (ticket.Quantity > Vars.TICKETS_MAX_PER_USR - currentUsrTicketQuantity)
										{
											ticket.Quantity = Vars.TICKETS_MAX_PER_USR - currentUsrTicketQuantity;
										}

										try
										{
											((HtmlSelect)rpi.FindControl("NumberOfTicketsDropDownList")).Value = ticket.Quantity.ToString();
										}
										catch { }

										break;
									}
								}
								catch { }
							}
						}
					}
				}
				catch { }
			}
		}
Ejemplo n.º 8
0
		public List<Ticket> GetTicketsFromScreen()
		{
			List<Ticket> tickets = new List<Ticket>();

			if (Usr.Current == null)
			{
				// Redirect to login page
				Response.Redirect(this.StyledObject.UrlStyledApp("login") + "?url=" + HttpUtility.UrlEncode(HttpContext.Current.Request.Url.ToString()));
			}

			try
			{
				foreach (RepeaterItem rpi in RunningTicketRunsForPromoterRepeater.Items)
				{
					if (rpi.ItemType == ListItemType.Item || rpi.ItemType == ListItemType.AlternatingItem)
					{
						Ticket ticket = new Ticket();
						int quantity = 0;
						try
						{
							quantity = Convert.ToInt32(((HtmlSelect)rpi.FindControl("NumberOfTicketsDropDownList")).Value);
						}
						catch { }

						if (quantity > 0)
						{
							TicketRun ticketRun = new TicketRun(Convert.ToInt32(((TextBox)rpi.FindControl("TicketRunKTextBox")).Text));
							ticket = ticketRun.CreateTicket(Usr.Current, quantity);
							//double ticketPrice = Utilities.ConvertMoneyStringToDecimal(((Label)rpi.FindControl("TicketRunPriceLabel")).Text);
							//if (Math.Round(ticketPrice * quantity, 2) != Math.Round(ticket.Price, 2))
							//    throw new DsiUserFriendlyException("Price doesn't match.");

							ticket.SetIpAddressAndCountry();
							ticket.SetBrowserGuidToDsiCookieGuid();

							tickets.Add(ticket);
						}
					}
				}
			}
			catch
			{
				throw new DsiUserFriendlyException("Failed to get tickets. Please try again.");
			}

			return tickets;
		}