Beispiel #1
0
		private void Page_Load(object sender, System.EventArgs e)
		{
			Usr.KickUserIfNotLoggedIn();
			ContainerPage.SslPage = true;

			if (!Page.IsPostBack)
			{
				DonateLoggedOut.Visible = Usr.Current == null;
				DonateLoggedIn.Visible = Usr.Current != null;

				if (Usr.Current != null)
				{
					UsrDonationIcon udi = new UsrDonationIcon
					{
						DonationIconK = DonationIcon.K,
						UsrK = Usr.Current.K,
						BuyableLockDateTime = DateTime.Now,
						Enabled = false
					};
					udi.Update();

					InvoiceDataHolder i = new InvoiceDataHolder();
					InvoiceItemDataHolder iidh = new InvoiceItemDataHolder();
					if (DonationIcon.Vatable.Value)
						iidh.VatCode = InvoiceItem.VATCodes.T1;
					else
						iidh.VatCode = InvoiceItem.VATCodes.T9;

					if (DonationIcon.Charity)
					{
						iidh.Type = InvoiceItem.Types.CharityDonation;
						iidh.Description = "Charity donation";
						iidh.ShortDescription = "Charity donation";
					}
					else
					{
						iidh.Type = InvoiceItem.Types.UsrDonate;
						iidh.Description = "Profile icon";
						iidh.ShortDescription = "Profile icon";
					}

					iidh.SetTotal(DonationIcon.Price);
					iidh.KeyData = Usr.Current.K;
					iidh.BuyableObjectK = udi.K;
					iidh.BuyableObjectType = Model.Entities.ObjectType.UsrDonationIcon;
					iidh.RevenueStartDate = DateTime.Today;
					iidh.RevenueEndDate = DateTime.Today;
					i.InvoiceItemDataHolderList.Add(iidh);
					i.Type = Invoice.Types.Invoice;
					i.UsrK = Usr.Current.K;

					Payment.Invoices.Clear();
					Payment.Invoices.Add(i);
					Payment.PromoterK = 0;
					Payment.Initialize();
				}
			}
		}
Beispiel #2
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;
		}