Ejemplo n.º 1
0
		public void Buy_Click(object o, System.EventArgs e)
		{
			EnsureSecure();
			if (Page.IsValid)
			{
				GuestlistCredit gc = new GuestlistCredit();
				gc.DateTimeCreated = DateTime.Now;
				gc.Credits = int.Parse(BuyCredits.Text);
				gc.PromoterK = CurrentPromoter.K;
				gc.TotalPrice = CurrentPromoter.GuestlistCharge * int.Parse(BuyCredits.Text);
				gc.Done = false;
				gc.Update();

				ChangePanel(PanelPay);

				this.ViewState["GuestlistCreditK"] = gc.K;

				InvoiceDataHolder i = new InvoiceDataHolder();
				InvoiceItemDataHolder iidh = new InvoiceItemDataHolder();
				iidh.VatCode = InvoiceItem.VATCodes.T1;
				iidh.PriceBeforeDiscount = gc.TotalPrice;
				iidh.Type = InvoiceItem.Types.GuestlistCredit;
				iidh.KeyData = gc.K;
				iidh.BuyableObjectK = gc.K;
				iidh.BuyableObjectType = Model.Entities.ObjectType.GuestlistCredit;
				iidh.RevenueStartDate = DateTime.Today;
				iidh.RevenueEndDate = DateTime.Today;
				iidh.Description = gc.Credits.ToString("#,###") + " guestlist credits";
				i.InvoiceItemDataHolderList.Add(iidh);
				
				i.PromoterK = CurrentPromoter.K;
				i.UsrK = Usr.Current.K;
				i.VatCode = Invoice.VATCodes.T1;
				
				Payment.Invoices.Clear();
				Payment.Invoices.Add(i);
				Payment.PromoterK = CurrentPromoter.K;
				Payment.Initialize();
				ContainerPage.SslPage = true;

				//Response.Redirect("https://www.paypal.com/xclick/business=paypal%40dontstayin.com&item_name=Payment+for+"+int.Parse(BuyCredits.Text).ToString()+"+guestlist+credits+code+guestlist-"+gc.K.ToString()+"&amount="+gc.TotalPrice.ToString("0.00")+"&no_note=1&currency_code=GBP");
			}
		}
Ejemplo n.º 2
0
		public void Pay_Cancel(object o, System.EventArgs e)
		{
			try
			{
				int GuestlistCreditK = (int)this.ViewState["GuestlistCreditK"];
				GuestlistCredit guestlistCredit = new GuestlistCredit(GuestlistCreditK);
				if (!guestlistCredit.Done)
				{
					//guestlistCredit.Delete();
					//guestlistCredit.Update();
					this.Payment.Reset();
				}
				this.ViewState["GuestlistCreditK"] = null;
			}
			catch { }
			ChangePanel(PanelBuy);
		}
Ejemplo n.º 3
0
		public static IBob Get(Model.Entities.ObjectType type, int k)
		{
			IBob b = null;
			bool wrongType = false;
			try
			{
				switch (type)
				{
					case Model.Entities.ObjectType.Photo:
						b = new Photo(k);
						break;
					case Model.Entities.ObjectType.Event:
						b = new Event(k);
						break;
					case Model.Entities.ObjectType.Venue:
						b = new Venue(k);
						break;
					case Model.Entities.ObjectType.Place:
						b = new Place(k);
						break;
					case Model.Entities.ObjectType.Thread:
						b = new Thread(k);
						break;
					case Model.Entities.ObjectType.Country:
						b = new Country(k);
						break;
					case Model.Entities.ObjectType.Article:
						b = new Article(k);
						break;
					case Model.Entities.ObjectType.Para:
						b = new Para(k);
						break;
					case Model.Entities.ObjectType.Brand:
						b = new Brand(k);
						break;
					case Model.Entities.ObjectType.Promoter:
						b = new Promoter(k);
						break;
					case Model.Entities.ObjectType.Usr:
						b = new Usr(k);
						break;
					case Model.Entities.ObjectType.Region:
						b = new Region(k);
						break;
					case Model.Entities.ObjectType.Gallery:
						b = new Gallery(k);
						break;
					case Model.Entities.ObjectType.Group:
						b = new Group(k);
						break;
					case Model.Entities.ObjectType.Banner:
						b = new Banner(k);
						break;
					case Model.Entities.ObjectType.GuestlistCredit:
						b = new GuestlistCredit(k);
						break;
					case Model.Entities.ObjectType.Ticket:
						b = new Ticket(k);
						break;
					case Model.Entities.ObjectType.Invoice:
						b = new Invoice(k);
						break;
					case Model.Entities.ObjectType.InsertionOrder:
						b = new InsertionOrder(k);
						break;
					case Model.Entities.ObjectType.CampaignCredit:
						b = new CampaignCredit(k);
						break;
					case Model.Entities.ObjectType.UsrDonationIcon:
						b = new UsrDonationIcon(k);
						break;
					default:
						wrongType = true;
						b = null;
						break;
				}
			}
			catch { }
			if (wrongType)
				throw new Exception("Bob.Get attempted to get " + type.ToString() + " - can't do it!!! DUH!");
			return b;
		}