public Count(ITwitchClientManager client, IRepeater repeater, TextWriter writer) : base(client, writer) { Repeater = repeater; Repeater.Action = SpoolCount; Repeater.Interval = TimeSpan.FromSeconds(3); }
public Connection(DiscordSocketClient client, ICommandHandler handler, IDiscordLogger logger, IRepeater repeater) { _client = client ?? throw new ArgumentNullException(nameof(client)); _handler = handler ?? throw new ArgumentNullException(nameof(handler)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _repeater = repeater ?? throw new ArgumentNullException(nameof(repeater)); }
private void Demo() { var list = new IRepeater[] { new SomeGeneratedClass0(), new SomeGeneratedClass1(), new SomeGeneratedClass0(), new SomeGeneratedClass3() }; var result = list.OfType <SomeGeneratedClass3>().Count(); result.Print(); var data = Data.Cars.ToList(); var data2 = Data.Cars.ToList(); Console.WriteLine(data.Equals(data2)); var r = data.Zip(data2, (left, right) => { if (!left.Equals(right)) { return(left.ToString() + " " + right.ToString()); } else { return("same"); } }); r.Print(); }
public override bool ShowObject(string settingsXml) { string template = "AssemblyInfo.ascx"; string repeater = "AssemblyInfo.ascx"; if (WidgetHost.OutputTemplate != null) { if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.OutputTemplateControl)) { template = WidgetHost.OutputTemplate.OutputTemplateControl; } if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.RepeaterControl)) { repeater = WidgetHost.OutputTemplate.RepeaterControl; } } Control ctrl = LoadControl("~/UserControls/Repeaters/" + repeater); IRepeater rep = ctrl as IRepeater; rep.OutputTemplate = template; this.Ph.Controls.Add(ctrl); return(true); }
public Span Handle(IList <Token> tokens, Options options) { IRepeater month = null; var day = 0; IList <Token> remainingTokens = null; if (tokens.Count > 3) { month = tokens[2].GetTag <RepeaterMonthName>(); day = tokens[3].GetTag <OrdinalDay>().Value; remainingTokens = tokens.Take(2).ToList(); } else { month = tokens[1].GetTag <RepeaterMonthName>(); day = tokens[2].GetTag <OrdinalDay>().Value; remainingTokens = tokens.Take(1).ToList(); } if (Time.IsMonthOverflow(options.Clock().Year, (int)month.RawValue, day)) { return(null); } return(Utils.HandleMD(month, day, remainingTokens, options)); }
private void Demo() { var list = new IRepeater[] { new SomeGeneratedClass0(), new SomeGeneratedClass1(), new SomeGeneratedClass0(), new SomeGeneratedClass3() }; var result = list.OfType<SomeGeneratedClass3>().Count(); result.Print(); var data = Data.Cars.ToList(); var data2 = Data.Cars.ToList(); Console.WriteLine(data.Equals(data2)); var r = data.Zip(data2, (left, right) => { if (!left.Equals(right)) { return left.ToString() + " " + right.ToString(); } else return "same"; }); r.Print(); }
public Repeat(ITwitchClientManager client, IRepeater repeater, TextWriter console) : base(client, console) { Repeater = repeater; Repeater.Action = SpoolRepeatMessages; Repeater.Interval = TimeSpan.FromSeconds(0.3); }
public RepeatDateAppointment(DateTime startDate, TimeSpan length, DateTime endDate, IRepeater repeater) : base(startDate, length) { StartDate = startDate; EndDate = endDate; Repeater = repeater; }
public RepeatConditionAppointment(TimeSpan time, ICondition condition, TimeSpan length, DateTime startDate, DateTime endDate, IRepeater repeater) : base(time, condition, length) { StartDate = startDate; EndDate = endDate; Repeater = repeater; }
private IRepeater LoadMyObjects(int pageSize, bool showPagerTop, bool showPagerBottom, int amount, QuickSort sortBy, string repeater, string template, int relatedObjectType, string tagList, Guid?excludeObjectId) { DataObject community = DataObject.Load <DataObject>(this.CommunityID); QuickParameters paras = new QuickParameters(); paras.Udc = UserDataContext.GetUserDataContext(); paras.ObjectType = relatedObjectType; paras.Tags1 = QuickParameters.GetDelimitedTagIds(tagList, Constants.TAG_DELIMITER); paras.ExcludeObjectIds = excludeObjectId.ToString(); if (amount >= 0) { paras.Amount = amount; } paras.PageNumber = 1; paras.PageSize = pageSize; paras.DisablePaging = (!showPagerTop && !showPagerBottom); paras.SortBy = QuickSort.Title; if (sortBy == QuickSort.Title) { paras.Direction = QuickSortDirection.Asc; } paras.IgnoreCache = false; paras.WithCopy = false; paras.OnlyConverted = true; paras.ShowState = ObjectShowState.Published; Control ctrl = LoadControl("~/UserControls/Repeaters/" + repeater); IRepeater overview = ctrl as IRepeater; if (overview != null) { overview.QuickParameters = paras; overview.OutputTemplate = template; overview.TopPagerVisible = showPagerTop; overview.BottomPagerVisible = showPagerBottom; } ISettings settings = ctrl as ISettings; if (settings != null) { if (settings.Settings == null) { settings.Settings = new System.Collections.Generic.Dictionary <string, object>(); } if (!settings.Settings.ContainsKey("ParentPageType")) { settings.Settings.Add("ParentPageType", (int)_Host.ParentPageType); } settings.Settings.Add("Width", _Host.ColumnWidth); } return(overview); }
public static Span HandleMD(IRepeater month, int day, IList<Token> timeTokens, Options options) { month.Now = options.Clock(); var span = month.GetCurrentSpan(options.Context); var date = span.Start.Value; var dayStart = Time.New(date.Year, date.Month, day); return Utils.DayOrTime(dayStart, timeTokens, options); }
public override bool ShowObject(string settingsXml) { if (!string.IsNullOrEmpty(Request.QueryString["OID"])) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(settingsXml); int relatedObjectType = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "RelatedObjectType", 0); int pageSize = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "NumberRelations", 5); QuickSort sortBy = (QuickSort)XmlHelper.GetElementValue(xmlDocument.DocumentElement, "SortBy", (int)QuickSort.Title); bool showPagerTop = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerTop", true); bool showPagerBottom = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerBottom", true); xmlDocument = null; Guid objectId = Request.QueryString["OID"].ToGuid(); DataObject dataObject = DataObject.Load <DataObject>(objectId); if (string.IsNullOrEmpty(dataObject.TagList)) { return(false); } if (relatedObjectType == 0) { relatedObjectType = dataObject.ObjectType; } string template = "SmallOutputObject.ascx"; string repeater = "DataObjectLists.ascx"; if (_Host.OutputTemplate != null) { if (!string.IsNullOrEmpty(_Host.OutputTemplate.OutputTemplateControl)) { template = _Host.OutputTemplate.OutputTemplateControl; } if (!string.IsNullOrEmpty(_Host.OutputTemplate.RepeaterControl)) { repeater = _Host.OutputTemplate.RepeaterControl; } } int amount = -1; // default aus SiteConfig lesen if (!showPagerTop && !showPagerBottom) { amount = pageSize; } IRepeater overview = LoadMyObjects(pageSize, showPagerTop, showPagerBottom, amount, sortBy, repeater, template, relatedObjectType, dataObject.TagList, dataObject.ObjectID); if (overview != null) { this.Ph.Controls.Add((Control)overview); return(overview.HasContent); } } return(false); }
private IRepeater LoadLastVisitors(int pageSize, bool showPagerTop, bool showPagerBottom, int amount, QuickSort sortBy, string repeater, string template) { DataObject community = DataObject.Load <DataObject>(this.CommunityID); QuickParametersUser paras = new QuickParametersUser(); paras.ObjectType = 2; paras.Udc = UserDataContext.GetUserDataContext(); paras.ViewLogParams = new ViewLogParams() { ObjectID = community.ObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity") ? community.UserID : this.CommunityID, }; if (amount >= 0) { paras.Amount = amount; } paras.PageNumber = 1; paras.PageSize = pageSize; paras.DisablePaging = (!showPagerTop && !showPagerBottom); paras.SortBy = sortBy; paras.IgnoreCache = false; paras.WithCopy = false; paras.OnlyConverted = true; paras.ShowState = ObjectShowState.Published; Control ctrl = LoadControl("~/UserControls/Repeaters/" + repeater); IRepeater overview = ctrl as IRepeater; if (overview != null) { overview.QuickParameters = paras; overview.OutputTemplate = template; overview.TopPagerVisible = showPagerTop; overview.BottomPagerVisible = showPagerBottom; overview.ItemNameSingular = language.GetString("TextLastVisitorsSingular"); overview.ItemNamePlural = language.GetString("TextLastVisitorsPlural"); } ISettings settings = ctrl as ISettings; if (settings != null) { if (settings.Settings == null) { settings.Settings = new System.Collections.Generic.Dictionary <string, object>(); } if (!settings.Settings.ContainsKey("ParentPageType")) { settings.Settings.Add("ParentPageType", (int)_Host.ParentPageType); } } return(overview); }
public static Span HandleMD(IRepeater month, int day, IList <Token> timeTokens, Options options) { month.Now = options.Clock(); var span = month.GetCurrentSpan(options.Context); var date = span.Start.Value; var dayStart = Time.New(date.Year, date.Month, day); return(DayOrTime(dayStart, timeTokens, options)); }
public override bool ShowObject(string settingsXml) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(settingsXml); var searchableObjectTypes = SiteObjectSection.CachedInstance.SiteObjects.LINQEnumarable.Where(x => x.IsSearchable); Dictionary <int, int> numberItems = new Dictionary <int, int>(); foreach (var objectType in searchableObjectTypes) { QuickParameters quickParameters = new QuickParameters(); quickParameters.FromNameValueCollection(Request.QueryString); quickParameters.Udc = UserDataContext.GetUserDataContext(); quickParameters.ObjectType = objectType.NumericId; quickParameters.PageSize = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "NumberResults", 5); quickParameters.Amount = objectType.DefaultLoadAmount; quickParameters.SortBy = QuickSort.Title; quickParameters.Direction = QuickSortDirection.Asc; quickParameters.ShowState = ObjectShowState.Published; quickParameters.DateQueryMethode = QuickDateQueryMethode.BetweenStartOpenEndOpen; quickParameters.FromStartDate = DateTime.Now; quickParameters.ToEndDate = DateTime.Now; Control control = LoadControl("~/UserControls/Repeaters/SearchResults.ascx"); control.ID = "SRB" + objectType.NumericId; IRepeater overview = control as IRepeater; if (overview != null) { overview.QuickParameters = quickParameters; overview.OutputTemplate = ""; // template; overview.TopPagerVisible = false; overview.BottomPagerVisible = true; } Ph.Controls.Add(control); if (((IBrowsable)control).GetNumberItems() > 0) { numberItems.Add(objectType.NumericId, ((IBrowsable)control).GetNumberItems()); } } DlRes.DataSource = numberItems; DlRes.DataBind(); if (numberItems.Count == 0) { Ph.Controls.Add(new LiteralControl(GuiLanguage.GetGuiLanguage("WidgetSearchResults").GetString("MessageNothingFound"))); } return(true); }
public override bool ShowObject(string settingsXml) { XmlDocument xmlDom = new XmlDocument(); xmlDom.LoadXml(settingsXml); int communityListType = XmlHelper.GetElementValue(xmlDom.DocumentElement, "CommunityListsType", 0); int pageSize = XmlHelper.GetElementValue(xmlDom.DocumentElement, "PageSize", 5); QuickSort sortBy = (QuickSort)XmlHelper.GetElementValue(xmlDom.DocumentElement, "SortBy", (int)QuickSort.Title); bool showPagerTop = XmlHelper.GetElementValue(xmlDom.DocumentElement, "ShowPagerTop", true); bool showPagerBottom = XmlHelper.GetElementValue(xmlDom.DocumentElement, "ShowPagerBottom", true); string template = "CommunityListsLarge.ascx"; string repeater = "CommunityLists.ascx"; if (WidgetHost.OutputTemplate != null) { if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.OutputTemplateControl)) { template = WidgetHost.OutputTemplate.OutputTemplateControl; } if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.RepeaterControl)) { repeater = WidgetHost.OutputTemplate.RepeaterControl; } } int amount = 0; // default aus SiteConfig lesen if (!showPagerTop && !showPagerBottom) { amount = pageSize; } IRepeater overview = null; if (communityListType == 1) { overview = LoadMyCommunities(pageSize, showPagerTop, showPagerBottom, amount, sortBy, repeater, template); } else if (communityListType == 2) { overview = LoadMyMemberships(pageSize, showPagerTop, showPagerBottom, amount, sortBy, repeater, template); } if (overview != null) { this.Ph.Controls.Add((Control)overview); hasContent = overview.HasContent; } return(true); }
private IRepeater LoadCommunityMembers(int pageSize, bool showPagerTop, bool showPagerBottom, int amount, QuickSort sortBy, string repeater, string template) { QuickParametersUser paras = new QuickParametersUser(); paras.ObjectType = 2; paras.Udc = UserDataContext.GetUserDataContext(); paras.MembershipParams = new MembershipParams() { CommunityID = this.WidgetHost.ParentCommunityID }; if (amount >= 0) { paras.Amount = amount; } paras.PageNumber = 1; paras.PageSize = pageSize; paras.DisablePaging = (!showPagerTop && !showPagerBottom); paras.SortBy = QuickSort.Title; paras.Direction = QuickSortDirection.Asc; paras.IgnoreCache = false; paras.WithCopy = false; paras.OnlyConverted = true; paras.ShowState = ObjectShowState.Published; Control ctrl = LoadControl("~/UserControls/Repeaters/" + repeater); IRepeater overview = ctrl as IRepeater; if (overview != null) { overview.QuickParameters = paras; overview.OutputTemplate = template; overview.TopPagerVisible = showPagerTop; overview.BottomPagerVisible = showPagerBottom; overview.ItemNameSingular = language.GetString("TextCommunityMembersSingular"); overview.ItemNamePlural = language.GetString("TextCommunityMembersPlural"); } ISettings settings = ctrl as ISettings; if (settings != null) { if (settings.Settings == null) { settings.Settings = new System.Collections.Generic.Dictionary <string, object>(); } if (!settings.Settings.ContainsKey("ParentPageType")) { settings.Settings.Add("ParentPageType", (int)WidgetHost.ParentPageType); } } return(overview); }
public override bool ShowObject(string settingsXml) { if (!string.IsNullOrEmpty(Request.QueryString["OID"])) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(settingsXml); string relatedObjectType = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "RelatedObjectType", "0"); int pageSize = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "NumberRelations", 5); QuickSort sortBy = (QuickSort)XmlHelper.GetElementValue(xmlDocument.DocumentElement, "SortBy", (int)QuickSort.Title); QuickSortDirection sortDirection = (QuickSortDirection)XmlHelper.GetElementValue(xmlDocument.DocumentElement, "SortDirection", (int)QuickSortDirection.Desc); bool showPagerTop = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerTop", true); bool showPagerBottom = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerBottom", true); Guid objectId = Request.QueryString["OID"].ToGuid(); DataObject dataObject = DataObject.Load <DataObject>(objectId); if (string.IsNullOrEmpty(dataObject.TagList)) { return(false); } if (relatedObjectType == "0") { relatedObjectType = dataObject.ObjectType.ToString(); } string template = "SmallOutputObject.ascx"; string repeater = "DataObjectLists.ascx"; if (WidgetHost.OutputTemplate != null) { if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.OutputTemplateControl)) { template = WidgetHost.OutputTemplate.OutputTemplateControl; } if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.RepeaterControl)) { repeater = WidgetHost.OutputTemplate.RepeaterControl; } } IRepeater overview = LoadMyObjects(pageSize, showPagerTop, showPagerBottom, sortBy, sortDirection, repeater, template, Helper.GetObjectTypeNumericID(relatedObjectType), dataObject.TagList, dataObject.ObjectID); if (overview != null) { this.Ph.Controls.Add((Control)overview); return(overview.HasContent); } } return(false); }
public Cookie( ITwitchClientManager client, IRepeater repeater, ISpinWaitService spinWait, TextWriter writer, IDateTimeService dateTime) : base(client, writer) { Repeater = repeater; SpinWait = spinWait; DateTime = dateTime; Repeater.Action = SpoolRepeatMessages; Repeater.Interval = TimeSpan.FromHours(1); Channel = "thepositivebot"; }
private void LoadVisitors() { DataObject community = DataObject.Load <DataObject>(UserProfile.Current.ProfileCommunityID); QuickParametersUser paras = new QuickParametersUser(); paras.ObjectType = 2; paras.Udc = UserDataContext.GetUserDataContext(); paras.ViewLogParams = new ViewLogParams() { ObjectID = UserProfile.Current.ProfileCommunityID }; paras.Amount = 12; paras.PageNumber = 1; paras.PageSize = 12; paras.DisablePaging = false; paras.SortBy = QuickSort.InsertedDate; paras.IgnoreCache = false; paras.WithCopy = false; paras.OnlyConverted = true; paras.ShowState = ObjectShowState.Published; Control repeaterControl = LoadControl("~/UserControls/Repeaters/UserLists.ascx"); IRepeater overview = repeaterControl as IRepeater; if (overview != null) { overview.QuickParameters = paras; overview.OutputTemplate = "UserListsSmall.ascx"; overview.TopPagerVisible = false; overview.BottomPagerVisible = false; overview.ItemNameSingular = " "; overview.ItemNamePlural = " "; } ISettings settings = repeaterControl as ISettings; if (settings != null) { if (settings.Settings == null) { settings.Settings = new System.Collections.Generic.Dictionary <string, object>(); } if (!settings.Settings.ContainsKey("ParentPageType")) { settings.Settings.Add("ParentPageType", (int)PageType.None); } } PhFriends.Controls.Add(repeaterControl); }
public IndexModule(IRepeater repeater, ICommandBus commandBus) { this.RequiresAuthentication(); this.RequiresClaims(AccessRights.Access); _repeater = repeater; _commandBus = commandBus; Get["/"] = parameters => "Its working!!!"; Get["/{value}"] = parameters => _repeater.Repeat(parameters.value); Get["/oopserror"] = _ => throw new ArgumentException("message"); Post["/{value}"] = parameters => { var command = new IndexCommand(parameters.value); return(_commandBus.Handle(command)); }; OnError += HandleException; }
private IRepeater CreateControl(QuickParameters paras, bool showPagerTop, bool showPagerBottom, string repeater, string template, bool manageSiblings, bool renderHtml) { Control ctrl = LoadControl("~/UserControls/Repeaters/" + repeater); IRepeater overview = ctrl as IRepeater; if (overview != null) { overview.QuickParameters = paras; overview.OutputTemplate = template; overview.TopPagerVisible = showPagerTop; overview.BottomPagerVisible = showPagerBottom; overview.RenderHtml = renderHtml; } ISettings settings = ctrl as ISettings; if (settings != null) { if (settings.Settings == null) { settings.Settings = new System.Collections.Generic.Dictionary <string, object>(); } if (!settings.Settings.ContainsKey("ParentPageType")) { settings.Settings.Add("ParentPageType", (int)WidgetHost.ParentPageType); } if (WidgetHost.WidgetInstance.INS_HeadingTag.HasValue) { settings.Settings["HeadingTag"] = WidgetHost.WidgetInstance.INS_HeadingTag.Value; } if (manageSiblings) { settings.Settings.Add("SelectCurrentPage", manageSiblings); } settings.Settings.Add("Width", WidgetHost.ColumnWidth - WidgetHost.ContentPadding); settings.Settings.Add("WidgetInstanceId", WidgetHost.WidgetInstance.INS_ID.ToString()); } return(overview); }
private IRepeater CreateControl(QuickParameters paras, bool showPagerTop, bool showPagerBottom, string repeater, string template, bool manageSiblings, bool renderHtml) { Control ctrl = LoadControl("~/UserControls/Repeaters/" + repeater); IRepeater overview = ctrl as IRepeater; if (overview != null) { overview.QuickParameters = paras; overview.OutputTemplate = template; overview.TopPagerVisible = showPagerTop; overview.BottomPagerVisible = showPagerBottom; overview.RenderHtml = renderHtml; } ISettings settings = ctrl as ISettings; if (settings != null) { if (settings.Settings == null) { settings.Settings = new System.Collections.Generic.Dictionary <string, object>(); } if (!settings.Settings.ContainsKey("ParentPageType")) { settings.Settings.Add("ParentPageType", (int)_Host.ParentPageType); } if (manageSiblings) { settings.Settings.Add("SelectCurrentPage", manageSiblings); } } return(overview); }
public override bool ShowObject(string settingsXml) { XmlDocument xmlDom = new XmlDocument(); xmlDom.LoadXml(settingsXml); int userListType = XmlHelper.GetElementValue(xmlDom.DocumentElement, "UserListType", 0); int pageSize = XmlHelper.GetElementValue(xmlDom.DocumentElement, "PageSize", 5); QuickSort sortBy = (QuickSort)XmlHelper.GetElementValue(xmlDom.DocumentElement, "SortBy", (int)QuickSort.InsertedDate); bool showPagerTop = XmlHelper.GetElementValue(xmlDom.DocumentElement, "ShowPagerTop", true); bool showPagerBottom = XmlHelper.GetElementValue(xmlDom.DocumentElement, "ShowPagerBottom", true); string template = "UserListsLarge.ascx"; string repeater = "UserLists.ascx"; if (_Host.OutputTemplate != null) { if (!string.IsNullOrEmpty(_Host.OutputTemplate.OutputTemplateControl)) { template = _Host.OutputTemplate.OutputTemplateControl; } if (!string.IsNullOrEmpty(_Host.OutputTemplate.RepeaterControl)) { repeater = _Host.OutputTemplate.RepeaterControl; } } int amount = -1; // default aus SiteConfig lesen if (!showPagerTop && !showPagerBottom) { amount = pageSize; } IRepeater overview = null; if (userListType == 1) { overview = LoadNewestUsers(pageSize, showPagerTop, showPagerBottom, amount, sortBy, repeater, template); } else if (userListType == 2) { overview = LoadMyFriends(pageSize, showPagerTop, showPagerBottom, amount, sortBy, repeater, template); } else if (userListType == 3) { overview = LoadCommunityMembers(pageSize, showPagerTop, showPagerBottom, amount, sortBy, repeater, template); } else if (userListType == 4) { overview = LoadLastVisitors(pageSize, showPagerTop, showPagerBottom, amount, sortBy, repeater, template); } else if (userListType == 5) { overview = LoadLastOnlineUsers(pageSize, showPagerTop, showPagerBottom, amount, sortBy, repeater, template); } if (overview != null) { this.Ph.Controls.Add((Control)overview); hasContent = overview.HasContent; } return(hasContent); }
public override bool ShowObject(string settingsXml) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(settingsXml); int dataSource = 1; bool saveObjectType = false; bool manageSiblings = false; bool byUrl = true; if (WidgetHost.ParentPageType == PageType.None) { if (WidgetHost.ParentObjectType == 1) { dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 3); } else if (WidgetHost.ParentObjectType == 19) { dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 0); } byUrl = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ByUrl", false); } else if (WidgetHost.ParentPageType == PageType.Overview || WidgetHost.ParentPageType == PageType.Homepage) { if (WidgetHost.ParentObjectType == 1) { dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 3); } else if (WidgetHost.ParentObjectType == 19) { dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 0); } byUrl = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ByUrl", true); } else if (WidgetHost.ParentPageType == PageType.Detail) { if (WidgetHost.ParentObjectType == 1) { dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 3); } else if (WidgetHost.ParentObjectType == 19) { dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 0); } else if (!string.IsNullOrEmpty(Request.QueryString["OID"])) { dataSource = 4; } byUrl = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ByUrl", true); } else { dataSource = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DataSource", 1); byUrl = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ByUrl", false); } string objectType = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ObjectType", "0"); string userId = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "UserId", string.Empty); string communitId = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "CommunityId", string.Empty); int pageSize = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "MaxNumber", 5); QuickSort sortBy = (QuickSort)XmlHelper.GetElementValue(xmlDocument.DocumentElement, "SortBy", (int)QuickSort.StartDate); QuickSortDirection sortDirection = (QuickSortDirection)XmlHelper.GetElementValue(xmlDocument.DocumentElement, "SortDirection", (int)QuickSortDirection.Desc); bool showPagerTop = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerTop", true); bool showPagerBottom = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerBottom", true); int featured = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Featured", 0); DateConstraint dateConstraint = (DateConstraint)Enum.Parse(typeof(DateConstraint), XmlHelper.GetElementValue(xmlDocument.DocumentElement, "DateConstraint", "None")); bool renderHtml = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "RenderHtml", false); if (objectType == "0") { if (string.IsNullOrEmpty(Request.QueryString["OT"])) { return(false); } else { objectType = Request.QueryString["OT"]; } } else { saveObjectType = true; } string template = "SmallOutputObject.ascx"; string repeater = "DataObjectLists.ascx"; if (WidgetHost.OutputTemplate != null) { if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.OutputTemplateControl)) { template = WidgetHost.OutputTemplate.OutputTemplateControl; } if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.RepeaterControl)) { repeater = WidgetHost.OutputTemplate.RepeaterControl; } } QuickParameters paras = new QuickParameters(); if (WidgetHost.ParentObjectType == 1) // Community { paras.QuerySourceType = QuerySourceType.Community; } else if (WidgetHost.ParentObjectType == 19) // Profile { paras.QuerySourceType = QuerySourceType.Profile; } else if (WidgetHost.ParentObjectType == 20) // Page { paras.QuerySourceType = QuerySourceType.Page; } else { paras.QuerySourceType = QuerySourceType.MyContent; } if (XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Anonymous", false)) { paras.Udc = UserDataContext.GetUserDataContext(Constants.ANONYMOUS_USERNAME); } else { paras.Udc = UserDataContext.GetUserDataContext(); } paras.ObjectType = Helper.GetObjectTypeNumericID(objectType); if (featured > 0) { paras.Featured = featured; } if (dataSource != 4) { paras.Tags1 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList1", string.Empty), Constants.TAG_DELIMITER); paras.Tags2 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList2", string.Empty), Constants.TAG_DELIMITER); paras.Tags3 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList3", string.Empty), Constants.TAG_DELIMITER); } if (dataSource == 0) { DataObject profil = DataObject.Load <DataObject>(this.WidgetHost.ParentCommunityID); paras.UserID = profil.UserID; byUrl = false; } else if (!string.IsNullOrEmpty(userId)) { paras.UserID = userId.ToGuid(); } else if (dataSource == 2) { paras.Communities = communitId.Replace(",", "|"); } else if (dataSource == 3) { paras.CommunityID = this.WidgetHost.ParentCommunityID; } else if (dataSource == 4) { DataObject detail = DataObject.Load <DataObject>(Request.QueryString["OID"].ToGuid()); paras.CommunityID = detail.CommunityID; //paras.ExcludeObjectIds = detail.ObjectID.ToString(); byUrl = false; manageSiblings = true; } else if (dataSource != 1) { return(false); } if ((!showPagerTop && !showPagerBottom) || sortBy == QuickSort.Random) { paras.Amount = pageSize; paras.DisablePaging = true; if (sortBy == QuickSort.Random) { paras.IgnoreCache = true; } } else { paras.PageNumber = 1; paras.PageSize = pageSize; } paras.SortBy = sortBy; paras.Direction = sortDirection; paras.ShowState = ObjectShowState.Published; switch (dateConstraint) { case DateConstraint.UntilYesterday: paras.FromStartDate = SqlDateTime.MinValue.Value; paras.ToStartDate = DateTime.Today.GetEndOfDay() - new TimeSpan(1, 0, 0, 0); paras.FromEndDate = SqlDateTime.MinValue.Value; paras.ToEndDate = DateTime.Today.GetEndOfDay() - new TimeSpan(1, 0, 0, 0); paras.DateQueryMethode = QuickDateQueryMethode.BetweenStartRangeEndRange; break; case DateConstraint.UntilToday: paras.FromStartDate = SqlDateTime.MinValue.Value; paras.ToStartDate = DateTime.Today.GetEndOfDay(); paras.FromEndDate = SqlDateTime.MinValue.Value; paras.ToEndDate = DateTime.Today.GetEndOfDay(); paras.DateQueryMethode = QuickDateQueryMethode.BetweenStartRangeEndRange; break; case DateConstraint.Today: paras.FromStartDate = SqlDateTime.MinValue.Value; paras.ToStartDate = DateTime.Today.GetEndOfDay(); paras.FromEndDate = DateTime.Today.GetStartOfDay(); paras.ToEndDate = SqlDateTime.MaxValue.Value; paras.DateQueryMethode = QuickDateQueryMethode.BetweenStartRangeEndRange; break; case DateConstraint.FromToday: paras.FromStartDate = DateTime.Today.GetStartOfDay(); paras.ToStartDate = SqlDateTime.MaxValue.Value; paras.FromEndDate = DateTime.Today.GetStartOfDay(); paras.ToEndDate = SqlDateTime.MaxValue.Value; paras.DateQueryMethode = QuickDateQueryMethode.BetweenStartRangeEndRange; break; case DateConstraint.FromTomorrow: paras.FromStartDate = DateTime.Today.GetStartOfDay() + new TimeSpan(1, 0, 0, 0); paras.ToStartDate = SqlDateTime.MaxValue.Value; paras.FromEndDate = DateTime.Today.GetStartOfDay() + new TimeSpan(1, 0, 0, 0); paras.ToEndDate = SqlDateTime.MaxValue.Value; paras.DateQueryMethode = QuickDateQueryMethode.BetweenStartRangeEndRange; break; } if (byUrl) { paras.FromNameValueCollection(Request.QueryString); if (saveObjectType) { paras.ObjectType = Helper.GetObjectTypeNumericID(objectType); } } if (paras.SortBy != QuickSort.Title && paras.SortBySecond == QuickSort.NotSorted) { paras.SortBySecond = QuickSort.Title; paras.DirectionSecond = QuickSortDirection.Asc; } IRepeater overview = CreateControl(paras, showPagerTop, showPagerBottom, repeater, template, manageSiblings, renderHtml); if (overview != null) { this.Ph.Controls.Add((Control)overview); return(overview.HasContent); } return(false); }
public StatusConsumerRepeater(IConsumer consumer, IRepeater repeater) { this.consumer = consumer; this.repeater = repeater; }
public Service(IRepeater repeater) { this.repeater = repeater; }
private IRepeater LoadMyObjects(int pageSize, bool showPagerTop, bool showPagerBottom, QuickSort sortBy, QuickSortDirection sortDirection, string repeater, string template, int relatedObjectType, string tagList, Guid?excludeObjectId) { DataObject community = DataObject.Load <DataObject>(this.WidgetHost.ParentCommunityID); QuickParameters paras = new QuickParameters(); paras.Udc = UserDataContext.GetUserDataContext(); paras.ObjectType = relatedObjectType; paras.Tags1 = QuickParameters.GetDelimitedTagIds(tagList, Constants.TAG_DELIMITER); if ((!showPagerTop && !showPagerBottom) || sortBy == QuickSort.Random) { paras.Amount = pageSize; paras.DisablePaging = true; if (sortBy == QuickSort.Random) { paras.IgnoreCache = true; } } else { paras.PageNumber = 1; paras.PageSize = pageSize; } paras.SortBy = sortBy; paras.Direction = sortDirection; if (paras.SortBy != QuickSort.Title && paras.SortBySecond == QuickSort.NotSorted) { paras.SortBySecond = QuickSort.Title; paras.DirectionSecond = QuickSortDirection.Asc; } paras.ShowState = ObjectShowState.Published; Control ctrl = LoadControl("~/UserControls/Repeaters/" + repeater); IRepeater overview = ctrl as IRepeater; if (overview != null) { overview.QuickParameters = paras; overview.OutputTemplate = template; overview.TopPagerVisible = showPagerTop; overview.BottomPagerVisible = showPagerBottom; } ISettings settings = ctrl as ISettings; if (settings != null) { if (settings.Settings == null) { settings.Settings = new System.Collections.Generic.Dictionary <string, object>(); } if (!settings.Settings.ContainsKey("ParentPageType")) { settings.Settings.Add("ParentPageType", (int)WidgetHost.ParentPageType); } settings.Settings.Add("Width", WidgetHost.ColumnWidth - WidgetHost.ContentPadding); settings.Settings.Add("SelectCurrentPage", true); settings.Settings.Add("WidgetInstanceId", WidgetHost.WidgetInstance.INS_ID.ToString()); } return(overview); }
public override bool ShowObject(string settingsXml) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(settingsXml); int dataSource = 1; bool saveObjectType = false; bool manageSiblings = false; string objectType = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ObjectType", "0"); string userId = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "UserId", string.Empty); string communitId = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "CommunityId", string.Empty); string parentOID = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ParentOID", string.Empty); int pageSize = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "MaxNumber", 5); QuickSort sortBy = (QuickSort)XmlHelper.GetElementValue(xmlDocument.DocumentElement, "SortBy", (int)QuickSort.StartDate); bool showPagerTop = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerTop", true); bool showPagerBottom = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ShowPagerBottom", true); int featured = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Featured", 0); bool renderHtml = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "RenderHtml", false); bool byUrl = XmlHelper.GetElementValue(xmlDocument.DocumentElement, "ByUrl", true); if (objectType == "0") { if (string.IsNullOrEmpty(Request.QueryString["OT"])) { return(false); } else { objectType = Request.QueryString["OT"]; } } else { saveObjectType = true; } string template = "SmallOutputObject.ascx"; string repeater = "DataObjectLists.ascx"; if (WidgetHost.OutputTemplate != null) { if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.OutputTemplateControl)) { template = WidgetHost.OutputTemplate.OutputTemplateControl; } if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.RepeaterControl)) { repeater = WidgetHost.OutputTemplate.RepeaterControl; } } QuickParameters paras = new QuickParameters(); if (XmlHelper.GetElementValue(xmlDocument.DocumentElement, "Anonymous", false)) { paras.Udc = UserDataContext.GetUserDataContext(Constants.ANONYMOUS_USERNAME); } else { paras.Udc = UserDataContext.GetUserDataContext(); } paras.ObjectType = Helper.GetObjectTypeNumericID(objectType); if (featured > 0) { paras.Featured = featured; } if (dataSource != 4) { paras.Tags1 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList1", string.Empty), Constants.TAG_DELIMITER); paras.Tags2 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList2", string.Empty), Constants.TAG_DELIMITER); paras.Tags3 = QuickParameters.GetDelimitedTagIds(XmlHelper.GetElementValue(xmlDocument.DocumentElement, "TagList3", string.Empty), Constants.TAG_DELIMITER); } if (dataSource == 0) { DataObject profil = DataObject.Load <DataObject>(this.WidgetHost.ParentCommunityID); paras.UserID = profil.UserID; byUrl = false; } else if (!string.IsNullOrEmpty(userId)) { paras.UserID = userId.ToGuid(); } else if (dataSource == 2) { paras.Communities = communitId.Replace(",", "|"); } else if (dataSource == 3) { paras.CommunityID = this.WidgetHost.ParentCommunityID; } else if (dataSource == 4) { DataObject detail = DataObject.Load <DataObject>(Request.QueryString["OID"].ToGuid()); paras.CommunityID = detail.CommunityID; //paras.ExcludeObjectIds = detail.ObjectID.ToString(); byUrl = false; manageSiblings = true; } else if (byUrl && WidgetHost.ParentPageType == PageType.Detail) { parentOID = Request.QueryString["OID"]; } else if (dataSource != 1) { return(false); } xmlDocument = null; if (!showPagerTop && !showPagerBottom) { paras.Amount = pageSize; } paras.PageNumber = 1; paras.PageSize = pageSize; paras.DisablePaging = (!showPagerTop && !showPagerBottom); paras.SortBy = sortBy; if (sortBy == QuickSort.Title) { paras.Direction = QuickSortDirection.Asc; } paras.IgnoreCache = false; paras.WithCopy = false; paras.OnlyConverted = true; paras.ShowState = ObjectShowState.Published; if (byUrl) { paras.FromNameValueCollection(Request.QueryString); if (saveObjectType) { paras.ObjectType = Helper.GetObjectTypeNumericID(objectType); paras.RelationParams = new RelationParams(); // override the OID parameter if there is Relation Parent OID set in the URL (used for scenarios where a detail view shouldn't left -> Chreisgleis.tv) if (!string.IsNullOrEmpty(Request.QueryString["rpoid"])) { paras.RelationParams.ParentObjectID = Request.QueryString["rpoid"].ToGuid(); } else { paras.RelationParams.ParentObjectID = paras.ObjectID; } paras.ObjectID = null; paras.CommunityID = null; } } if (!string.IsNullOrEmpty(parentOID)) { paras.RelationParams = new RelationParams(); paras.RelationParams.ParentObjectID = parentOID.ToGuid();; paras.ObjectID = null; paras.CommunityID = null; } IRepeater overview = CreateControl(paras, showPagerTop, showPagerBottom, repeater, template, manageSiblings, renderHtml); if (overview != null) { this.Ph.Controls.Add((Control)overview); return(overview.HasContent); } return(false); }
public static Span GetAnchor(this IEnumerable <Token> @this, Options options) { var grabber = new Grabber(Grabber.Type.This); Pointer.Type pointer = Pointer.Type.Future; List <Token> tokens = @this.ToList(); IList <IRepeater> repeaters = tokens.GetRepeaters(); for (int i = 0; i < repeaters.Count; i++) { tokens.RemoveAt(tokens.Count - 1); } if (tokens.Count > 0 && tokens[0].IsTaggedAs <Grabber>()) { grabber = tokens[0].GetTag <Grabber>(); tokens.RemoveAt(tokens.Count - 1); } IRepeater head = repeaters[0]; repeaters.RemoveAt(0); head.Now = options.Clock(); Span outerSpan; Grabber.Type grabberType = grabber.Value; if (grabberType == Grabber.Type.Last) { outerSpan = head.GetNextSpan(Pointer.Type.Past); } else if (grabberType == Grabber.Type.This) { if (repeaters.Count > 0) { outerSpan = head.GetCurrentSpan(Pointer.Type.None); } else { outerSpan = head.GetCurrentSpan(options.Context); } } else if (grabberType == Grabber.Type.Next) { outerSpan = head.GetNextSpan(Pointer.Type.Future); } else { throw new ArgumentException("Invalid grabber type " + grabberType + "."); } Logger.Log(() => "Handler-class: " + head.GetType().Name); Logger.Log(() => "--" + outerSpan.ToString()); Span anchor = repeaters.FindWithin(outerSpan, pointer, options); return(anchor); }