Esempio n. 1
0
		public VenueInfo(Bobs.Venue venue)
		{
			this.name = venue.Name;
			this.k = venue.K;
			this.place = new PlaceInfo(venue.Place);
			this.url = venue.Url();
			this.picPath = venue.AnyPicPath;
		}
Esempio n. 2
0
		public string ChatRoomLink(Bobs.Chat.RoomSpec spec)
		{
			//Guid roomGuid = spec.Guid;
			StringBuilder sb = new StringBuilder();
			spec.LinkHtmlAppend(sb);
			return sb.ToString();
			//return "<a href=\"#\" onclick=\"chatClientPinRoom('" + roomGuid.Pack() + "');return false;\">" + spec.GetName(Usr.Current) + "<img id=\"RoomsPage" + roomGuid.Pack() + "\" src=\"/gfx/pin2.gif\" style=\"margin-left:2px;\" border=\"0\" width=\"9\" height=\"8\" /></a>";
		}
Esempio n. 3
0
		public EventInfo(Bobs.Event e)
		{
			this.name = e.Name;
			this.k = e.K;
			this.date = e.DateTime;
			this.venueInfo = new VenueInfo(e.Venue);
			this.url = e.Url();
			this.picPath = e.AnyPicPath;
		}
Esempio n. 4
0
		private static void SetUpRequestRules(Bobs.Banner.Positions position, bool isHttpsContext, Identity id, RequestRules requestRules)
		{
			requestRules.Add(new BannerPositionRule(position));
			requestRules.Add(id.IdentityRules);
			requestRules.Add(new Rules.TypesOfRule.BannerIsLiveRule());
			if (isHttpsContext)
			{
				requestRules.Add(new BannerIsNotHtmlRule());
			}
		}
Esempio n. 5
0
        public void AddBob(Bob bob)
        {
            using (RoundSyncronizerLock.Lock())
            {
                if (Phase != CcjRoundPhase.OutputRegistration || Status != CcjRoundStatus.Running)
                {
                    throw new InvalidOperationException("Adding Bob is only allowed in OutputRegistration phase.");
                }
                if (Bobs.Any(x => x.ActiveOutputAddress == bob.ActiveOutputAddress))
                {
                    return;                     // Bob is already added.
                }

                Bobs.Add(bob);
            }

            Logger.LogInfo <CcjRound>($"Round ({RoundId}): Bob added.");
        }
Esempio n. 6
0
		public static Dictionary<string, string> GetDataItem(Bobs.Gallery g)
		{
			return new Dictionary<string, string>()
			{
				{Columns.Name.ToString(), g.Name},
				{Columns.Url.ToString(), g.Url()},
				{Columns.PicPath.ToString(), g.PicPath},
				{Columns.OwnerUrl.ToString(), g.Owner.Url()},
				{Columns.OwnerRollover.ToString(), g.Owner.Rollover},
				{Columns.OwnerNickNameSafe.ToString(), g.Owner.NickName},
				{Columns.PagedUrl.ToString(), g.PagedUrl()},
				{Columns.EventName.ToString(), g.Event.Name},
				{Columns.EventUrl.ToString(), g.Event.Url()},
				{Columns.VenueName.ToString(), g.Event.Venue.Name},
				{Columns.VenueUrl.ToString(), g.Event.Venue.Url()},
				{Columns.Date.ToString(), Cambro.Misc.Utility.FriendlyDate(g.Event.DateTime.Date)},
				{Columns.LivePhotos.ToString(), g.LivePhotos.ToString()},
			};

		}
Esempio n. 7
0
		public List<BannerDataHolder> GetBanners(Bobs.Banner.Positions position, bool isHttpsContext, int numberOfBannersToGet, Identity id, RequestRules rules)
		{
			Timeslot currentTimeslot = Timeslots.GetCurrentTimeslot();
			currentTimeslot.CallsToBannerServer().Increment();

			SetUpRequestRules(position, isHttpsContext, id, rules);

			List<BannerDataHolder> chosenBanners = new List<BannerDataHolder>(numberOfBannersToGet);

			foreach (BannerQuerySetInfo bannerQuerySetInfo in rules.BannerQuerySetInfosInDescendingPriorityOrder(currentTimeslot))
			{
				AddBanners(numberOfBannersToGet, id, bannerQuerySetInfo, chosenBanners);
				if (chosenBanners.Count == chosenBanners.Capacity) { return chosenBanners; }
			}
			#region REMOVED DUE TO BANNER SERVER BUG
			//rules.RemoveBannersWhichHaveReachedTargetsFromCachedQuery(currentTimeslot);
			#endregion
			PadOutChosenBannersWithNulls(chosenBanners);
			return chosenBanners;
		}
Esempio n. 8
0
		public static void updateEmailFromFacebook(Bobs.MixmagSubscription ms, string emailFromFacebook)
		{
			ms.Email = emailFromFacebook;
			ms.IsEmailFromFacebook = true;
			ms.IsEmailBroken = false;
			ms.IsEmailComplete = true;
			ms.IsEmailVerified = true;
		}
Esempio n. 9
0
		public static void SendVerificationEmail(Bobs.MixmagSubscription s, string requestCode)
		{
			System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
			client.Host = Common.Properties.GetDefaultSmtpServer();
			System.Net.Mail.MailMessage m = new System.Net.Mail.MailMessage();

			

			DateTime? issueDate = null;
			int? coverId = null;
			int? pageNumber = null;
			string linkUrl = "";
			if (requestCode.Length > 0)
			{
				try
				{
					int year = int.Parse(requestCode.Substring(0, 4));
					int month = int.Parse(requestCode.Substring(4, 2));
					coverId = int.Parse(requestCode.Substring(6, 1));
					if (coverId == 0)
						coverId = null;

					issueDate = new DateTime(year, month, 1);
					if (requestCode.Length > 7)
						pageNumber = int.Parse(requestCode.Substring(7));

					linkUrl = MixmagIssue.UrlStatic(true, issueDate.Value, pageNumber, coverId);

				}
				catch { }
			}
			else
			{
				linkUrl = "http://www.mixmag-online.com/";
			}


			string str2 = s.K.ToString();
			string str3 = s.EmailVerificationSecret.ToLower();

			string body = @"Mixmag Online

To verify your email address, click the link below:

" + linkUrl + @"?k=" + str2 + @"&code=" + str3 + @"

";

			
			string subject = "Mixmag Online email verification";

			m.Subject = subject;
			m.Body = body;
			m.From = new System.Net.Mail.MailAddress("*****@*****.**", "Mixmag");
			m.ReplyTo = new System.Net.Mail.MailAddress("*****@*****.**", "Mixmag");
			if (Vars.DevEnv)
				m.To.Add("*****@*****.**");
			else
				m.To.Add(s.Email);

			m.IsBodyHtml = false;

			

			client.Send(m);
		}
Esempio n. 10
0
		public static string returnString(Bobs.MixmagSubscription s, bool facebookEmailPermission, bool facebookPublishPermission)
		{
			string email = s.Email == null ? "" : s.Email;
			if (email.EndsWith("@proxymail.facebook.com"))
				email = "*****@*****.**";

			return (facebookEmailPermission && s.SendMixmag.Value ? "1" : "0") +
					(facebookPublishPermission && s.PublishStoryOnRead.Value ? "1" : "0") +
					(s.IsAddressComplete.HasValue && s.IsAddressComplete.Value ? "1" : "0") +
					(s.IsEmailComplete.HasValue && s.IsEmailComplete.Value ? "1" : "0") +
					(s.IsEmailVerified.HasValue && s.IsEmailVerified.Value ? "1" : "0") +
					(s.IsEmailBroken.HasValue && s.IsEmailBroken.Value ? "1" : "0") +
					(s.IsEmailFromFacebook.HasValue && s.IsEmailFromFacebook.Value ? "1" : "0") +
					email;
		}
Esempio n. 11
0
        public async Task ExecuteNextPhaseAsync(CcjRoundPhase expectedPhase, Money feePerInputs = null, Money feePerOutputs = null)
        {
            using (await RoundSynchronizerLock.LockAsync())
            {
                try
                {
                    Logger.LogInfo <CcjRound>($"Round ({RoundId}): Phase change requested: {expectedPhase.ToString()}.");

                    if (Status == CcjRoundStatus.NotStarted)                     // So start the input registration phase
                    {
                        if (expectedPhase != CcjRoundPhase.InputRegistration)
                        {
                            return;
                        }

                        // Calculate fees.
                        if (feePerInputs is null || feePerOutputs is null)
                        {
                            (Money feePerInputs, Money feePerOutputs)fees = await CalculateFeesAsync(RpcClient, ConfirmationTarget);

                            FeePerInputs  = feePerInputs ?? fees.feePerInputs;
                            FeePerOutputs = feePerOutputs ?? fees.feePerOutputs;
                        }
                        else
                        {
                            FeePerInputs  = feePerInputs;
                            FeePerOutputs = feePerOutputs;
                        }

                        Status = CcjRoundStatus.Running;
                    }
                    else if (Status != CcjRoundStatus.Running)                     // Aborted or succeeded, swallow
                    {
                        return;
                    }
                    else if (Phase == CcjRoundPhase.InputRegistration)
                    {
                        if (expectedPhase != CcjRoundPhase.ConnectionConfirmation)
                        {
                            return;
                        }

                        Phase = CcjRoundPhase.ConnectionConfirmation;
                    }
                    else if (Phase == CcjRoundPhase.ConnectionConfirmation)
                    {
                        if (expectedPhase != CcjRoundPhase.OutputRegistration)
                        {
                            return;
                        }

                        Phase = CcjRoundPhase.OutputRegistration;
                    }
                    else if (Phase == CcjRoundPhase.OutputRegistration)
                    {
                        if (expectedPhase != CcjRoundPhase.Signing)
                        {
                            return;
                        }

                        // Build CoinJoin:

                        Money newDenomination = CalculateNewDenomination();
                        var   transaction     = Network.Consensus.ConsensusFactory.CreateTransaction();

                        // 2. Add Bob outputs.
                        foreach (Bob bob in Bobs.Where(x => x.Level == MixingLevels.GetBaseLevel()))
                        {
                            transaction.Outputs.AddWithOptimize(newDenomination, bob.ActiveOutputAddress.ScriptPubKey);
                        }

                        // 2.1 newDenomination may differs from the Denomination at registration, so we may not be able to tinker with
                        // additional outputs.
                        bool tinkerWithAdditionalMixingLevels = CanUseAdditionalOutputs(newDenomination);

                        if (tinkerWithAdditionalMixingLevels)
                        {
                            foreach (MixingLevel level in MixingLevels.GetLevelsExceptBase())
                            {
                                IEnumerable <Bob> bobsOnThisLevel = Bobs.Where(x => x.Level == level);
                                if (bobsOnThisLevel.Count() <= 1)
                                {
                                    break;
                                }

                                foreach (Bob bob in bobsOnThisLevel)
                                {
                                    transaction.Outputs.AddWithOptimize(level.Denomination, bob.ActiveOutputAddress.ScriptPubKey);
                                }
                            }
                        }

                        BitcoinWitPubKeyAddress coordinatorAddress = Constants.GetCoordinatorAddress(Network);
                        // 3. If there are less Bobs than Alices, then add our own address. The malicious Alice, who will refuse to sign.
                        for (int i = 0; i < MixingLevels.Count(); i++)
                        {
                            var aliceCountInLevel = Alices.Count(x => i < x.BlindedOutputScripts.Length);
                            var missingBobCount   = aliceCountInLevel - Bobs.Count(x => x.Level == MixingLevels.GetLevel(i));
                            for (int j = 0; j < missingBobCount; j++)
                            {
                                var denomination = MixingLevels.GetLevel(i).Denomination;
                                transaction.Outputs.AddWithOptimize(denomination, coordinatorAddress);
                            }
                        }

                        // 4. Start building Coordinator fee.
                        var   baseDenominationOutputCount = transaction.Outputs.Count(x => x.Value == newDenomination);
                        Money coordinatorBaseFeePerAlice  = newDenomination.Percentage(CoordinatorFeePercent * baseDenominationOutputCount);
                        Money coordinatorFee = baseDenominationOutputCount * coordinatorBaseFeePerAlice;

                        if (tinkerWithAdditionalMixingLevels)
                        {
                            foreach (MixingLevel level in MixingLevels.GetLevelsExceptBase())
                            {
                                var denominationOutputCount = transaction.Outputs.Count(x => x.Value == level.Denomination);
                                if (denominationOutputCount <= 1)
                                {
                                    break;
                                }

                                Money coordinatorLevelFeePerAlice = level.Denomination.Percentage(CoordinatorFeePercent * denominationOutputCount);
                                coordinatorFee += coordinatorLevelFeePerAlice * denominationOutputCount;
                            }
                        }

                        // 5. Add the inputs and the changes of Alices.
                        var spentCoins = new List <Coin>();
                        foreach (Alice alice in Alices)
                        {
                            foreach (var input in alice.Inputs)
                            {
                                transaction.Inputs.Add(new TxIn(input.Outpoint));
                                spentCoins.Add(input);
                            }

                            Money changeAmount = alice.InputSum - alice.NetworkFeeToPay - newDenomination - coordinatorBaseFeePerAlice;

                            if (tinkerWithAdditionalMixingLevels)
                            {
                                for (int i = 1; i < alice.BlindedOutputScripts.Length; i++)
                                {
                                    MixingLevel level = MixingLevels.GetLevel(i);
                                    var         denominationOutputCount = transaction.Outputs.Count(x => x.Value == level.Denomination);
                                    if (denominationOutputCount <= 1)
                                    {
                                        break;
                                    }

                                    changeAmount -= (level.Denomination + FeePerOutputs + (level.Denomination.Percentage(CoordinatorFeePercent * denominationOutputCount)));
                                }
                            }

                            if (changeAmount > Money.Zero)                                       // If the coordinator fee would make change amount to be negative or zero then no need to pay it.
                            {
                                Money minimumOutputAmount      = Money.Coins(0.0001m);           // If the change would be less than about $1 then add it to the coordinator.
                                Money onePercentOfDenomination = newDenomination.Percentage(1m); // If the change is less than about 1% of the newDenomination then add it to the coordinator fee.
                                Money minimumChangeAmount      = Math.Max(minimumOutputAmount, onePercentOfDenomination);
                                if (changeAmount < minimumChangeAmount)
                                {
                                    coordinatorFee += changeAmount;
                                }
                                else
                                {
                                    transaction.Outputs.AddWithOptimize(changeAmount, alice.ChangeOutputAddress.ScriptPubKey);
                                }
                            }
                            else
                            {
                                // Alice has no money enough to pay the coordinator fee then allow her to pay what she can.
                                coordinatorFee += changeAmount;
                            }
                        }

                        // 6. Add Coordinator fee only if > about $3, else just let it to be miner fee.
                        if (coordinatorFee > Money.Coins(0.0003m))
                        {
                            transaction.Outputs.AddWithOptimize(coordinatorFee, coordinatorAddress);
                        }

                        // 7. Create the unsigned transaction.
                        var builder = Network.CreateTransactionBuilder();
                        UnsignedCoinJoin = builder
                                           .ContinueToBuild(transaction)
                                           .AddCoins(spentCoins)              // It makes sure the UnsignedCoinJoin goes through TransactionBuilder optimizations.
                                           .BuildTransaction(false);

                        // 8. Try optimize fees.
                        await OptimizeFeesAsync(spentCoins);

                        SignedCoinJoin = Transaction.Parse(UnsignedCoinJoin.ToHex(), Network);

                        Phase = CcjRoundPhase.Signing;
                    }
                    else
                    {
                        return;
                    }

                    Logger.LogInfo <CcjRound>($"Round ({RoundId}): Phase initialized: {expectedPhase.ToString()}.");
                }
Esempio n. 12
0
		private PhotoStub CreatePhotoStub(Bobs.Photo photo, bool includeEventInfo)
		{
			return new PhotoStub()
			{
				k = photo.K,
				url = photo.Url(),
				iconPath = photo.IconPath,
				webPath = photo.WebPath,
				thumbPath = photo.ThumbPath,
				thumbWidth = (int)(photo.ThumbWidth),
				thumbHeight = (int)(photo.ThumbHeight),
				width = (int)(photo.WebWidth),
				height = (int)(photo.WebHeight),
				takenByDetailsHtml = photo.TakenByDetailsHtml(includeEventInfo),
				usrLink = photo.Usr.Link(),
				isPhoto = photo.IsPhoto,
				isVideo = photo.IsVideo,
				usrsInPhotoHtml = photo.UsrsInPhotoHtml,
				usrIsInPhoto = Usr.Current != null ? photo.UsrsInPhoto.FindFirstIndex(u => u.K == Usr.Current.K).HasValue : false,
				rolloverMouseOverText = photo.RolloverMouseOverText,
				linkToPhotoUrl = photo.Link,
				embedThisPhotoHtml = photo.EmbedHtml,
				photoVideoLabel = photo.PhotoVideoLabel,
				quickBrowserUrl = photo.QuickBrowserUrl,
				downloadPhotoLinkHtml = photo.DownloadPhotoLinkHtml,
				videoMedWidth = photo.VideoMedWidth,
				videoMedHeight = photo.VideoMedHeight,
				videoMedPath = photo.VideoMedPath,

				isFavourite = photo.IsFavourite,
				isInCompetitionGroup = photo.IsInCompetitionGroup,
				canEnterCompetition = photo.CanEnterCompetition,

				photoUsageAdminString = Usr.Current != null && Usr.Current.IsAdmin ? photo.Usr.PhotoUsageAdminString : "",

				chatRoomGuid = new Chat.RoomSpec(SpottedScript.Controls.ChatClient.Shared.RoomType.Normal, Model.Entities.ObjectType.Photo, photo.K).Guid.Pack(),
				
				threadK = photo.ThreadK ?? 0,
				commentsCount = photo.ThreadK > 0 && photo.Thread != null ? photo.Thread.TotalComments : 0
			};
		}
Esempio n. 13
0
		private PhotoResult GetPhotos(Bobs.ChildInterfaces.IHasChildPhotos parentBob, int pageNumber, bool includeEventInfo, Q extraWhereConditions, params KeyValuePair<object, OrderBy.OrderDirection>[] orderBy)
		{
			Common.IPagedDataService<Photo> photoPagedDataService = parentBob.ChildPhotos(new And(Photo.EnabledQueryCondition, extraWhereConditions), orderBy);
			Photo[] photoSet = photoPagedDataService.Page(pageNumber, Common.Properties.PhotoBrowser.IconsPerPage);
			int lastPage = (int)Math.Ceiling((double)photoPagedDataService.Count / (double)Common.Properties.PhotoBrowser.IconsPerPage);
			
			return new PhotoResult()
			{
				photos = photoSet.ConvertAll(p => CreatePhotoStub(p, includeEventInfo)),
				lastPage = (int)Math.Ceiling((double)photoPagedDataService.Count / (double)Common.Properties.PhotoBrowser.IconsPerPage)
			};
		}
Esempio n. 14
0
 public abstract double GetNumberOfTrafficBlocksBetweenDates(DateTime startDateTime, DateTime endDateTime, Bobs.Banner.Positions position);
Esempio n. 15
0
		public PlaceInfo(Bobs.Place place)
		{
			this.name = place.UniqueName;
			this.k = place.K;
			this.country = new CountryInfo(place.Country);
		}
Esempio n. 16
0
		public BannerDataHolder GetBanner(Bobs.Banner.Positions position, bool isHttpsContext, Identity identity, RequestRules requestRules)
		{
			List<BannerDataHolder> banners = GetBanners(position, isHttpsContext, 1, identity, requestRules);
			return banners[0];
		}
Esempio n. 17
0
		public CountryInfo(Bobs.Country country)
		{
			this.name = country.Name;
			this.k = country.K;
		}
Esempio n. 18
0
		internal BannerPositionRule(Bobs.Banner.Positions position)
		{
            this.position = position;
		}
 public override double GetNumberOfTrafficBlocksBetweenDates(DateTime startDateTime, DateTime endDateTime, Bobs.Banner.Positions position)
 {
     return endDateTime.Subtract(startDateTime).TotalMinutes;
 }
Esempio n. 20
0
		private void RenderErrorPage(Bobs.SpottedException spottedEx)
		{
			HttpResponse resp = HttpContext.Current.Response;
			resp.Clear();
			resp.StatusCode = 500;

			System.Web.UI.WebControls.Literal openPage = new System.Web.UI.WebControls.Literal();
			openPage.Text = @"
<html><head><style>
.{
	font-family: Verdana;
	font-size:12px;
	font-weight:bold;
}
p{
	font-family: Verdana;
	font-size:12px;
	font-weight:bold;
	margin-bottom:3px;
	margin-top:3px;
	line-height:130%;
}
a:link, 
a:visited         { color:#000000; }
a:hover           { color:#FF0000; }
</style></head><body>&nbsp;<br>&nbsp;
<center>
<table width=""400"" cellpadding=""0"" cellspacing=""0"" border=""0"">
			<tr>
				<td valign=bottom align=left width=""100%"" rowspan=""2"">
				
				
<center>
<a href=""/""><img src=""/gfx/dsi-sign-100.png"" border=0 style=""border:1px solid #000000;""></a>
</center>

<div style=""padding:10px;"">
<div style=""width:100%;border:solid 1px #000000;padding:2px 4px 2px 4px; margin:0px 0px 13px 0px;"">
	";

			System.Web.UI.WebControls.Literal closePage = new System.Web.UI.WebControls.Literal();
			closePage.Text = @"
</div>
</td></tr></table>
</center></body></html>";

			System.Web.UI.WebControls.Label exceptionLabel = new System.Web.UI.WebControls.Label();
			exceptionLabel.Text = "<p>";

			if (spottedEx != null && spottedEx.ExceptionType == typeof(Bobs.MalformedUrlException).ToString())
			{
				exceptionLabel.Text += "Page not found.";
			}
			else if (spottedEx != null && (Bobs.Usr.Current != null && Bobs.Usr.Current.IsAdmin || HttpContext.Current.Request.UserHostAddress.StartsWith("84.45.14.") || HttpContext.Current.Request.UserHostAddress.StartsWith("192.168.113.") || HttpContext.Current.Request.UserHostAddress.Equals("127.0.0.1")))
			{
				exceptionLabel.Text += spottedEx.Message + "</p><p>" + spottedEx.StackTrace;
			}
			else if (spottedEx != null && (spottedEx.ShowMessageToUsrs))
			{
				exceptionLabel.Text += spottedEx.Message;
			}
			else
			{
				exceptionLabel.Text += "An error has occurred.";
			}

			exceptionLabel.Text += "</p><p><br></p><p>If this problem persists, you may wish to report this to an Admin";
			if (spottedEx != null && spottedEx.K > 0) exceptionLabel.Text += ", quoting error #" + spottedEx.K;
			exceptionLabel.Text += ".</p>";

			System.Web.UI.WebControls.Button retryButton = new System.Web.UI.WebControls.Button();
			retryButton.Text = "Retry";
			retryButton.OnClientClick = "location.reload();";

			System.Web.UI.WebControls.Button historyBackButton = new System.Web.UI.WebControls.Button();
			historyBackButton.Text = "Back";
			historyBackButton.OnClientClick = @"history.back();";

			System.Web.UI.WebControls.Button homeButton = new System.Web.UI.WebControls.Button();
			homeButton.Text = "Home";
			homeButton.OnClientClick = @"location = ""/"";";


			System.IO.StringWriter stringWriter = new System.IO.StringWriter();

			System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(stringWriter);
			openPage.RenderControl(htmlWriter);

			exceptionLabel.RenderControl(htmlWriter);



			htmlWriter.RenderBeginTag("center");
			retryButton.RenderControl(htmlWriter);
			historyBackButton.RenderControl(htmlWriter);
			homeButton.RenderControl(htmlWriter);
			htmlWriter.RenderEndTag();

			closePage.RenderControl(htmlWriter);

			resp.Write(stringWriter.ToString());
		}
Esempio n. 21
0
		//#region GetKeyStatic
		//public static string GetKeyStatic(
		//    ObjectType parentObjectType,
		//    int parentObjectK,
		//    DateType dateType,
		//    int musicTypeK,
		//    int pageIndex)
		//{
		//    return
		//        ((int)parentObjectType).ToString() + "_" +
		//        parentObjectK.ToString() + "_" +
		//        ((int)dateType).ToString() + "_" +
		//        musicTypeK.ToString() + "_" +
		//        pageIndex.ToString();
		//}
		//#endregion

		#region public EventPageDetails
		public EventPageDetails(
#if SCRIPT
			Controller controller,
#else
			string parentClientID,
			Bobs.EventSet es,
#endif
			EventPageStub data,
			bool isLoading
			)
		{
			Data = data;
			IsLoading = isLoading;

#if SCRIPT
			Controller = controller;
			ParentClientID = Controller.ClientID;
#else
			ParentClientID = parentClientID;
#endif
			ClientID = ParentClientID + "_" + GetKey();
			
			Events = new EventDetails[8];
#if SCRIPT
#else
			Data.events = new EventStub[8];
#endif
			bool gotEvent = false;
			bool gotNullEvent = false;
			for (int i = 0; i < 8; i++)
			{
#if SCRIPT
				Events[i] = new EventDetails(i, this, Data.events != null && Data.events.Length > i && Data.events[i] != null ? Data.events[i] : null, isLoading);
				if (Data.events == null || Data.events.Length <= i || Data.events[i] == null)
					gotNullEvent = true;
				else
					gotEvent = true;
#else
				Events[i] = new EventDetails(i, this, es != null && es.Count > i && es[i] != null ? es[i] : null, isLoading);
				Data.events[i] = Events[i].Data;
				if (es == null || es.Count <= i || es[i] == null)
					gotNullEvent = true;
				else
					gotEvent = true;
#endif
			}
			HasIncompleteEventData = gotNullEvent;
			IsEmpty = !gotEvent;

			Html = new EventPageHtml(this);
		}
Esempio n. 22
0
		private PhotoResult GetPhotos(Bobs.ChildInterfaces.IHasChildPhotos parentBob, int pageNumber, bool includeEventInfo)
		{
			return GetPhotos(parentBob, pageNumber, includeEventInfo, new Q(true),
				new KeyValuePair<object, OrderBy.OrderDirection>(Photo.Columns.ParentDateTime, OrderBy.OrderDirection.Ascending),
				new KeyValuePair<object, OrderBy.OrderDirection>(Photo.Columns.DateTime, OrderBy.OrderDirection.Ascending),
				new KeyValuePair<object, OrderBy.OrderDirection>(Photo.Columns.K, OrderBy.OrderDirection.Ascending));
		}
Esempio n. 23
0
		public double GetNumberOfTrafficBlocksUntil(DateTime endDate, Bobs.Banner.Positions position)
        {
            return GetNumberOfTrafficBlocksBetweenDates(Time.Now, endDate, position);
        }