public void SubmitPageForRoom(PageData dataToSubmit)
 {
     foreach (IPageForRoomEventListener listener in IterateListeners<IPageForRoomEventListener>())
     {
         listener.SubmitPageForRoom(dataToSubmit);
     }
 }
        public void GivenPageWithPropertyValueAndPropertyGroups_CreateAndPopulateTypedInstance_ReturnsTypedInstanceWithPropertyValues()
        {
            PageData sourcePage = new PageData();

            sourcePage.Property.Add("LongStringProperty", new PropertyString());
            sourcePage.SetValue("LongStringProperty", "one");
            sourcePage.Property.Add("ImageOne-ImageUrl", new PropertyString());
            sourcePage.SetValue("ImageOne-ImageUrl", "two");
            sourcePage.Property.Add("ImageOne-AltText", new PropertyString());
            sourcePage.SetValue("ImageOne-AltText", "three");
            sourcePage.Property.Add("ImageTwo-ImageUrl", new PropertyString());
            sourcePage.SetValue("ImageTwo-ImageUrl", "four");
            sourcePage.Property.Add("ImageTwo-AltText", new PropertyString());
            sourcePage.SetValue("ImageTwo-AltText", "five");
            sourcePage.Property.Add("ImageThree-ImageUrl", new PropertyString());
            sourcePage.SetValue("ImageThree-ImageUrl", "six");
            sourcePage.Property.Add("ImageThree-AltText", new PropertyString());
            sourcePage.SetValue("ImageThree-AltText", "seven");

            TypedPageActivator activator = new TypedPageActivator();

            TestPageTypeWithPropertyGroups page = activator.CreateAndPopulateTypedInstance(sourcePage, typeof(TestPageTypeWithPropertyGroups)) as TestPageTypeWithPropertyGroups;

            Assert.Equal("one", page.LongStringProperty);
            Assert.Equal("two", page.ImageOne.ImageUrl);
            Assert.Equal("three", page.ImageOne.AltText);
            Assert.Equal("four", page.ImageTwo.ImageUrl);
            Assert.Equal("five", page.ImageTwo.AltText);
            Assert.Equal("six", page.ImageThree.ImageUrl);
            Assert.Equal("seven", page.ImageThree.AltText);

        }
 private SetupTeardownIncluder(PageData pageData)
 {
     this.isIssue = pageData;
     testPage = pageData.getWikiPage();
     pageCrawler = testPage.getPageCrawler();
     newPageContent = new StringBuffer();
 }
Example #4
0
        public static PageResult From(PageData item, ISessionAwareCoreService client, string currentUserId)
        {
            var template = (PageTemplateData)client.Read(item.PageTemplate.IdRef, new ReadOptions());
            string extension = template.FileExtension;

            var result = new PageResult
            {
                Template = LinkEntry.From(item.PageTemplate, Resources.LabelTemplate, currentUserId),
                FileName = TextEntry.From(string.Format(CultureInfo.InvariantCulture, "{0}.{1}", item.FileName, extension), Resources.LabelFileName),
            };

            if (result.FileName != null)
            {
                result.PathOnWebsite = GetPublishPath(item.LocationInfo as PublishLocationInfo, result.FileName.Value);
            }

            string componentPresentations = Resources.None;
            if (item.ComponentPresentations.Any())
            {
                int count = item.ComponentPresentations.Count();
                int templateCount = item.ComponentPresentations.DistinctBy(cp => cp.ComponentTemplate.IdRef).Count();
                componentPresentations = (templateCount == 1)
                    ? string.Format(CultureInfo.InvariantCulture, Resources.ComponentPresentationSummarySameTemplate, count)
                    : string.Format(CultureInfo.InvariantCulture, Resources.ComponentPresentationSummary, count, templateCount);
            }

            result.ComponentPresentations = TextEntry.From(componentPresentations, Resources.LabelComponentPresentations);

            AddCommonProperties(item, result);
            AddPropertiesForRepositoryLocalObject(item, result, currentUserId);
            return result;
        }
 public void PageTraded(PageData pageTraded)
 {
     foreach (IShopEventListener listener in IterateListeners<IShopEventListener>())
     {
         listener.PageTraded(pageTraded);
     }
 }
 public PageListBlockItemViewModel(PageData page)
 {
     Title = page.Name;
     ContentLink = page.ContentLink;
     Text = GetPageListBlockItemText(page);
     _imageUrl = GetPageListBlockItemImageUrl(page);
 }
        public void Should_Return_Correct_Search_Results()
        {
            var document1 = new HtmlDocument();
            document1.DocumentNode.AppendChild(HtmlNode.CreateNode("<title>Test title</title>"));
            document1.DocumentNode.AppendChild(HtmlNode.CreateNode("<body><p>Body with search phrase test</p></body>"));
            
            var document2 = new HtmlDocument();
            document2.DocumentNode.AppendChild(HtmlNode.CreateNode("<title>Test title</title>"));
            document2.DocumentNode.AppendChild(HtmlNode.CreateNode("<body><p>Body without search phrase</p></body>"));

            var page1 = new PageData { AbsolutePath = "/test-1", Content = document1, Id = Guid.NewGuid(), IsPublished = true};
            var page2 = new PageData { AbsolutePath = "/test-2", Content = document2, Id = Guid.NewGuid(), IsPublished = true };

            var service = new DefaultIndexerService(Container.Resolve<ICmsConfiguration>(), Container.Resolve<IRepository>(),
                Container.Resolve<ISecurityService>(), Container.Resolve<IAccessControlService>());

            if (service.OpenWriter())
            {
                service.AddHtmlDocument(page1);
                service.AddHtmlDocument(page2);
                service.CloseWriter();
            }

            var results = service.Search(new SearchRequest("test"));

            Assert.IsNotNull(results.Items);
            Assert.AreEqual(results.Items.Count, 1, "Should return one item.");
            Assert.IsTrue(results.Items[0].Link == page1.AbsolutePath);
        }
 /// <summary>
 /// Adds an item with the specified template.
 /// </summary>
 /// <param name="template"></param>
 /// <param name="item"></param>
 /// <param name="itemNumber"></param>
 /// <param name="selected"></param>
 protected void AddItemTemplate(ITemplate template, PageData item, int itemNumber, bool selected)
 {
     if (AddSeparator)
         AddSeparatorTemplate();
     AddTemplate(new PageDataItemTemplateContainer(item, itemNumber, selected), template);
     Added = true;
 }
 public DocumentSavingEventArgs(Document document, PageData pageData)
 {
     Document = document;
     PageData = pageData;
     ExcludeDefaultDocumentFromIndex = false;
     AdditionalDocuments = new List<DocumentData>();
 }
		public LinkStatus ExtractLinks()
		{
			if (String.Empty == m_strUrl)
			{
				throw new ArgumentException("No URL specified");
			}

			m_Links = new ImageDataCollection();
			CreateParser();
			if (m_obParser.Lexer.Page.mSource == null)
			{
				return LinkStatus.Broken;
			}

			INodeFilter obFilter = new NodeClassFilter(typeof(ImageTag));
			NodeList collNodes = m_obParser.Parse(obFilter);
			if (null != collNodes)
			{
				PageData obPageData = new PageData();
				obPageData.m_strUrl = m_obParser.URL;
				obPageData.m_iDepth = m_iLevel;
				for(Int32 i= 0; i < collNodes.Count; i++)
				{
					INode obNode = collNodes[i];
					ImageData obLinkData = new ImageData(obPageData, obNode as ImageTag);
					m_Links.Add(obLinkData);
				}
			}
			return LinkStatus.Ok;
		}
Example #11
0
        public PageData ScrapeData(bool useCurrent = true)
        {
            RunUserScript();

            ScrapePage();

            var size = GetViewportSize();
            var cookies = GetCookies();
            var screenshot = GetScreenshotImage();
            var resources = GetPageResources();

            var pageData = new PageData
            {
                BrowserName = "PhantomJS",
                BrowserVersion = string.Empty,
                Platform = "Windows",
                Cookies = cookies,
                ElementsJson = _elements,
                Html = _html,
                Resources = resources,
                Screenshot = screenshot,
                Size = size,
                Url = _request.Url
            };

            return pageData;
        }
		/// <summary>
		/// Creates new instance of <see cref="LinkData"></see> object.
		/// </summary>
		/// <param name="obPage"></param>
		public LinkData(PageData obPage)
		{
			if (null == obPage)
			{
				throw new ArgumentNullException("obPage", "Null Page object specified");
			}
			this.m_Page = obPage;
		}
Example #13
0
        private static bool IsAccessibleToEveryone(PageData page)
        {
            var visitorPrinciple = new System.Security.Principal.GenericPrincipal(
                new System.Security.Principal.GenericIdentity("visitor"),
                new[] { "Everyone" });

            return page.ACL.QueryDistinctAccess(visitorPrinciple, EPiServer.Security.AccessLevel.Read);
        }
 public QueryData()
 {
     Page = new PageData
         {
             Number = 0,
             Size = 10
         };
 }
        protected override XElement GenerateSiteElement(PageData pageData, string url)
        {
            var element = base.GenerateSiteElement(pageData, url);

            // add <mobile:mobile/> to standard sitemap url element
            element.Add(new XElement(MobileNamespace + "mobile"));

            return element;
        }
 /// <summary>
 /// Checks if the specified page has any children that should be visible in the menu
 /// </summary>
 /// <param name="page"></param>
 /// <returns></returns>
 protected bool HasChildren(PageData page)
 {
     //Use lookup to avoid multiple expensive calls to this method fropm the markup
     return _hasChildrenlookup.GetOrAdd(page.PageLink, (pageLink) =>
         {
             return DataFactory.Instance.GetChildren(pageLink, 0, 10)
                     .Any(p => !_treeFilter.ShouldFilter(p) && p.VisibleInMenu);
         });
 }
        private NavigationItem CreatNavigationItem(PageData x)
        {
            var navItem = new NavigationItem()
            {
                Name = x.Name,
                Link = x.LinkURL
            };

            return navItem;
        }
Example #18
0
 private static bool RuleSideValidation(PageData pageToValidate, Rule rule, bool validateLeftSide)
 {
     if (ValidatePageType(rule, pageToValidate.PageTypeName, validateLeftSide))
     {
         int startPage = (validateLeftSide ? rule.RelationHierarchyStartLeft : rule.RelationHierarchyStartRight);
         if (startPage < 1 || IsDescendent(pageToValidate.PageLink.ID, startPage))
             return true;
     }
     return false;
 }
 // Constructor
 public MainPage()
 {
     InitializeComponent();
     Loaded += (sender, e) =>
     {
         var p = new PageData();
         this.DataContext = p;
         p.LoadData();
     };
 }
    //Sets Page Data and adds to PageDataList
    private static void UpdatePageList(PageState _pageState)
    {
        //Create new PageData object and set stuff.
        PageData _pageData = new PageData();
        _pageData.State = _pageState;
        _pageData.ID = (int)_pageState.GetHashCode();//Get ID from enum HashCode 0-4

        //Update dictionary with ChapterState and ChapterData
        PageDataList.Add(_pageData);
    }
Example #21
0
 public PreviewBlock(PageData currentPage, IContent previewContent)
     : base(currentPage)
 {
     PreviewContent = previewContent;
     ContentArea = new ContentArea();
     ContentArea.Items.Add(new ContentAreaItem
     {
         ContentLink = PreviewContent.ContentLink
     });
 }
        /// <summary>
        /// Adds an item, using item or selected item template as required.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="itemNumber"></param>
        protected void AddItemCheckSelected(PageData item, int itemNumber)
        {
            if (IsSelected(item))
                if (SelectedItemTemplate != null)
                    AddItemTemplate(SelectedItemTemplate, item, itemNumber, true);
                else if (ItemTemplate != null)
                    AddItemTemplate(ItemTemplate, item, itemNumber, true);

            if (!Added && ItemTemplate != null)
                AddItemTemplate(ItemTemplate, item, itemNumber);
        }
Example #23
0
        private static bool IsSitemapPropertyEnabled(PageData page)
        {
            var property = page.Property[PropertySEOSitemaps.PropertyName] as PropertySEOSitemaps;

            if (null != property && !property.Enabled)
            {
                return false;
            }

            return true;
        }
        public LayoutViewModel CreateLayoutViewModel(PageData currentPage)
        {
            var homePage = _epiServerDependencies.ContentRepository.Get<StartPage>(ContentReference.StartPage);
            
            var layoutModel = new LayoutViewModel
                {
                    MetaDataProperties = CreateSeoViewModel(homePage),
                    Menu = CreateMenu(homePage)
                };

            return layoutModel;
        }
        public static bool IsCustomConstraintImplementaionViolated(PageData page, out string reason)
        {
            reason = string.Empty;
            var typedPage = page as TypedPageData;
            if (typedPage == null)
            {
                return false;
            }

            var constraintPage = page as IConstraintPage;
            return constraintPage != null && constraintPage.IsViolated(out reason);
        }
Example #26
0
        private static string GetPageContentUrl(PageData page)
        {
            ContentLanguage.Instance.SetCulture(page.LanguageBranch);

            var urlBuilder = new UrlBuilder(page.LinkURL);

            if (UrlRewriteProvider.IsFurlEnabled)
            {
                Global.UrlRewriteProvider.ConvertToExternal(urlBuilder, page.PageLink, Encoding.UTF8);
            }

            return urlBuilder.Uri.ToString();
        }
        public void GivenPageWithPropertyValue_CreateAndPopulateTypedInstance_ReturnsTypedInstanceWithPropertyValue()
        {
            PageData sourcePage = new PageData();
            string propertyName = TestValueUtility.CreateRandomString();
            sourcePage.Property.Add(propertyName, new PropertyString());
            string propertyValue = TestValueUtility.CreateRandomString();
            sourcePage.SetValue(propertyName, propertyValue);
            TypedPageActivator activator = new TypedPageActivator();

            TestPageType page = (TestPageType)activator.CreateAndPopulateTypedInstance(sourcePage, typeof(TestPageType));

            Assert.Equal<string>(propertyValue, page.GetValue(propertyName) as string);
        }
Example #28
0
        public static string GetContentUrl(PageData page)
        {
            var pageUrl = GetPageContentUrl(page);

            var ub = new UrlBuilder(pageUrl);
            var host = ub.Host;

            if (!string.IsNullOrEmpty(host))
            {
                pageUrl = ub.Path;
            }

            return pageUrl;
        }
        /// <summary>
        /// Checks if a specific page is located beneath another page
        /// </summary>
        public static bool IsDescendantOf(this PageData page, PageData parent)
        {
            while (!PageReference.IsNullOrEmpty(page.ParentLink))
            {
                if (page.ParentLink.CompareToIgnoreWorkID(parent.PageLink))
                {
                    return true;
                }

                page = page.ParentLink.GetPage();
            }

            return false;
        }
        /// <summary>
        /// The handle format.
        /// </summary>
        /// <param name="page">
        /// The page.
        /// </param>
        /// <param name="context">
        /// The context.
        /// </param>
        public void HandleFormat(PageData page, HttpContextBase context)
        {
            if (!OutputHelper.IsValidRequest(page, context, Logger))
            {
                return;
            }

            context.Response.Clear();
            context.Response.AddHeader("Content-Type", OutputConstants.TextPlain);
            
            context.Response.Write(GenerateTxt(page));

            context.Response.End();
        }
Example #31
0
        public async Task <IActionResult> GetOperatingLogPage(string linkid, string summary, DateTime?start, DateTime?end, string orderBy, int page, int size)
        {
            PageData <OperatingLog> data = await _logBll.GetPageOperatingLogAsync(linkid, summary, start, end, "CreateDate desc", page, size);

            return(new JsonResult(new { success = true, data }));
        }
 public MenuItem(PageData page)
 {
     Page = page;
 }
Example #33
0
        public ActionResult GetList(SearchModel search, PageParam pageParam)
        {
            PageData <EnrollDto> pageData = _helper.GetPageList(search, o => o.UpdateTime, pageParam, false);

            return(Success(pageData));
        }
Example #34
0
 /// <summary>
 ///     Returns friendly URL for provided page.
 /// </summary>
 /// <param name="page">Page for which to create friendly url.</param>
 /// <param name="language">Language of content</param>
 /// <param name="includeHost">Mark if include host name in the url.</param>
 /// <param name="ignoreContextMode">Mark if Url should be generating ignoring context mode. Settings this parameter to <c>true</c> friendly Url will be generated, even in EPiServer EditMode.</param>
 /// <returns>String representation of URL for provided page.</returns>
 public static string GetFriendlyUrl(this PageData page, string language, bool includeHost = false, bool ignoreContextMode = false)
 {
     return(page != null?page.ContentLink.GetFriendlyUrl(language, includeHost, ignoreContextMode) : string.Empty);
 }
Example #35
0
        public RestResult Get(int?id, ItemRange range)
        {
            if (id.HasValue)
            {
                ContentReference currentContentRef = new PageReference(id.Value);
                if (new ContentReference(id.Value) != null && EPiServer.DataFactory.Instance.Get <IContent>(new ContentReference(id.Value)) as PageData != null)
                {
                    PageData currentPage = EPiServer.DataFactory.Instance.GetPage(new PageReference(id.Value));
                    var      pageId      = currentPage.ContentLink.ID;
                    var      _rules      = new List <RuleDescription>();

                    List <Rule> _rulesLeft  = RuleEngine.Instance.GetRulesLeft(pageId) as List <Rule>;
                    List <Rule> _rulesRight = RuleEngine.Instance.GetRulesRight(pageId) as List <Rule>;

                    AccessControlList list = currentPage.ACL;

                    foreach (Rule leftRule in _rulesLeft)
                    {
                        RuleDescription rd = new RuleDescription()
                        {
                            RuleName = leftRule.RuleTextLeft, RuleDesc = leftRule.RuleDescriptionLeft, RuleDirection = "left", RuleGuid = leftRule.Id.ExternalId.ToString(), RuleId = leftRule.RuleName
                        };
                        if (HasAccess(list, leftRule.EditModeAccessLevel) && leftRule.RuleVisibleLeft)
                        {
                            _rules.Add(rd);
                        }
                    }



                    foreach (Rule rightRule in _rulesRight)
                    {
                        RuleDescription rd = new RuleDescription()
                        {
                            RuleName = rightRule.RuleTextRight, RuleDesc = rightRule.RuleDescriptionRight, RuleDirection = "right", RuleGuid = rightRule.Id.ExternalId.ToString(), RuleId = rightRule.RuleName
                        };
                        if (HasAccess(list, rightRule.EditModeAccessLevel) && rightRule.RuleVisibleRight && rightRule.RuleTextLeft != rightRule.RuleTextRight)
                        {
                            _rules.Add(rd);
                        }
                    }

                    /*
                     *
                     * List<RuleDescription> result = new List<RuleDescription>();
                     * int cnt = 0;
                     *
                     * foreach (Rule rule in _rules)
                     * {
                     *  bool isLeftRule = (RuleEngine.Instance.IsLeftRule(pageId, RuleEngine.Instance.GetRule(rule.RuleName)));
                     *  if ((from p in result where p.RuleName == rule.RuleName select p).Any())
                     *      result.Add(new RuleDescription() { RuleGuid = rule.Id.ExternalId.ToString(), RuleId = rule.RuleName, RuleDirection = "left", RuleName = rule.RuleTextLeft + "2", RuleDesc = (RuleEngine.Instance.IsLeftRule(pageId, RuleEngine.Instance.GetRule(rule.RuleName))) ? rule.RuleDescriptionLeft : rule.RuleDescriptionRight });
                     *  else
                     *      result.Add(new RuleDescription() { RuleGuid = rule.Id.ExternalId.ToString(), RuleId = rule.RuleName, RuleDirection = "left", RuleName = rule.RuleTextLeft, RuleDesc = (RuleEngine.Instance.IsLeftRule(pageId, RuleEngine.Instance.GetRule(rule.RuleName))) ? rule.RuleDescriptionLeft : rule.RuleDescriptionRight });
                     *  cnt++;
                     * }
                     *
                     * foreach (Rule rule in _rulesRight)
                     * {
                     *  bool isLeftRule = (RuleEngine.Instance.IsLeftRule(pageId, RuleEngine.Instance.GetRule(rule.RuleName)));
                     *  if ((from p in result where p.RuleName == rule.RuleName select p).Any())
                     *      result.Add(new RuleDescription() { RuleGuid = rule.Id.ExternalId.ToString(), RuleId = rule.RuleName, RuleDirection = "right", RuleName = rule.RuleTextRight + "2", RuleDesc = (RuleEngine.Instance.IsLeftRule(pageId, RuleEngine.Instance.GetRule(rule.RuleName))) ? rule.RuleDescriptionLeft : rule.RuleDescriptionRight });
                     *  else
                     *      result.Add(new RuleDescription() { RuleGuid = rule.Id.ExternalId.ToString(), RuleId = rule.RuleName, RuleDirection = "right", RuleName = rule.RuleTextRight, RuleDesc = (RuleEngine.Instance.IsLeftRule(pageId, RuleEngine.Instance.GetRule(rule.RuleName))) ? rule.RuleDescriptionLeft : rule.RuleDescriptionRight });
                     *  cnt++;
                     * }
                     */
                    return(Rest(_rules.Select(m => new { Guid = m.RuleGuid, Name = TryTranslate(m.RuleName), Id = m.RuleId, Description = TryTranslate(m.RuleDesc), Direction = m.RuleDirection })));
                }
            }
            return(null);
        }
Example #36
0
 private static bool IsLink(PageData page)
 {
     return(page.LinkType == PageShortcutType.External ||
            page.LinkType == PageShortcutType.Shortcut ||
            page.LinkType == PageShortcutType.Inactive);
 }
        /// <summary>
        /// Create annotator instance depending on type of annotation
        /// </summary>
        /// <param name="annotationData">AnnotationDataEntity</param>
        /// <param name="pageData">PageData</param>
        /// <returns></returns>
        public static BaseAnnotator createAnnotator(AnnotationDataEntity annotationData, PageData pageData)
        {
            switch (annotationData.type)
            {
            case "text":
                return(new TextAnnotator(annotationData, pageData));

            case "area":
                return(new AreaAnnotator(annotationData, pageData));

            case "point":
                return(new PointAnnotator(annotationData, pageData));

            case "textStrikeout":
                return(new TexStrikeoutAnnotator(annotationData, pageData));

            case "polyline":
                return(new PolylineAnnotator(annotationData, pageData));

            case "textField":
                return(new TextFieldAnnotator(annotationData, pageData));

            case "watermark":
                return(new WatermarkAnnotator(annotationData, pageData));

            case "textReplacement":
                return(new TextReplacementAnnotator(annotationData, pageData));

            case "arrow":
                return(new ArrowAnnotator(annotationData, pageData));

            case "textRedaction":
                return(new TextRedactionAnnotator(annotationData, pageData));

            case "resourcesRedaction":
                return(new ResourceRedactionAnnotator(annotationData, pageData));

            case "textUnderline":
                return(new TexUnderlineAnnotator(annotationData, pageData));

            case "distance":
                return(new DistanceAnnotator(annotationData, pageData));

            default:
                throw new System.Exception("Wrong annotation data without annotation type!");
            }
        }
Example #38
0
 public Enumerator(PageData pageData)
 {
     _pageData = pageData;
     _state = 0;
     _current = default;
 }
Example #39
0
 /// <returns>
 /// Returns a string representation of the date for the specified PageData using
 /// standard formating
 /// </returns>
 /// <remarks>
 /// In this case the DateTime object is formated to show only the date according
 /// to the websites CultureInfo before it is returned as a string
 /// </remarks>
 protected string GetFormattedDate(PageData page)
 {
     return(GetFormattedDate(page, "d"));
 }
 public static IEnumerable <PageData> GetSiblings(this PageData pageData) => GetSiblings(pageData, _contentLoader.Value);
        public static IEnumerable <PageData> GetSiblings(this PageData pageData, IContentLoader contentLoader)
        {
            var filter = new FilterContentForVisitor();

            return(contentLoader.GetChildren <PageData>(pageData.ParentLink).Where(page => !filter.ShouldFilter(page)));
        }
        /// <summary>
        /// 新增課程
        /// </summary>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //第幾次上課
            string SubCount = txtSubCount1.Text.Trim() + int.Parse(txtSubCount2.Text).ToString("00").Trim();

            string SubName     = "生命建造程序 C2 課程報名";
            string SUCondition = txtSUCondition.Text.Trim();
            string SubLocation = txtSubLocation.Text.Trim();
            string SubStrDate  = txtSubStrDate.Text.Trim();
            string SubEndDate  = txtSubEndDate.Text.Trim();
            string Memo        = txtMemo.Text.Trim();


            StringBuilder sb = new StringBuilder();

            sb.Append("<div class='class-info'>");
            sb.Append("<div role='alert' class='el - alert el - alert--info'>");
            sb.Append("<!---->");
            sb.Append("<div class='el - alert__content'>");
            sb.Append("<!---->");
            sb.Append("<p class='el - alert__description'>");
            sb.Append("本表個人資料將作建檔處理,並於日後會務活動運作之目的內,由教會及同工作為聯絡通訊、關懷及相關合理運用。我們會盡善良管理人責任,妥善保管資料,避免外洩或不當用途之使用。");
            sb.Append("</p>");
            sb.Append("<i class='el - alert__closebtn el - icon - close' style='display: none; '>");
            sb.Append("</i>");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<ul class='class-detail'>");
            sb.Append("<li>");

            sb.Append("<div class='class-detail-title'>");
            sb.Append("報名條件:"); //SUCondition
            sb.Append("</div>");
            sb.Append("<div class='class-detail-text'>");
            //2018年1月~2018年12月來的新朋友,或是還沒上過的會友。
            sb.Append(SUCondition);
            sb.Append("</div>");
            sb.Append("</li>");
            sb.Append("<li>");

            sb.Append("<div class='class-detail-title'>");
            sb.Append("上課日期:"); //SDate, SubTime
            sb.Append("</div>");
            sb.Append("<div class='class-detail-text'>");

            //08/05(日)、08/12(日) 下午 14:30~17:30
            if (ckbIsSub12.Checked)
            {
                sb.Append("C2 一、二課:" + txtSDate12.Text.Trim().Replace(DateTime.UtcNow.AddHours(8).Year.ToString() + "/", "") +
                          "(" + Api_Info.GetDayOfWeek(DateTime.Parse(txtSDate12.Text.Trim())) + ") " + " ");
                sb.Append(dropSubTime12.Text + " " + txtSubTime12.Text.Trim());
            }

            if (ckbIsSub34.Checked)
            {
                sb.Append("<br/>");
                sb.Append("C2 三、四課:" + txtSDate34.Text.Trim().Replace(DateTime.UtcNow.AddHours(8).Year.ToString() + "/", "") +
                          "(" + Api_Info.GetDayOfWeek(DateTime.Parse(txtSDate34.Text.Trim())) + ") " + " ");
                sb.Append(dropSubTime34.Text + " " + txtSubTime34.Text.Trim());
            }

            if (ckbIsSub5.Checked)
            {
                sb.Append("<br/>");
                sb.Append("C2 第五課:" + txtSDate5.Text.Trim().Replace(DateTime.UtcNow.AddHours(8).Year.ToString() + "/", "") +
                          "(" + Api_Info.GetDayOfWeek(DateTime.Parse(txtSDate5.Text.Trim())) + ") " + " ");
                sb.Append(dropSubTime5.Text + " " + txtSubTime5.Text.Trim());
            }

            sb.Append("</div>");
            sb.Append("</li>");
            sb.Append("<li>");

            sb.Append("<div class='class-detail-title'>");
            sb.Append("地點:"); //SubLocation
            sb.Append("</div>");
            sb.Append("<div class='class-detail-text'>");
            //江子翠行道會主會堂
            sb.Append(SubLocation.Replace("\r\n", "<br/>"));
            sb.Append("</div>");
            sb.Append("</li>");
            sb.Append("<li>");

            sb.Append("<div class='class-detail-title'>");
            sb.Append("報名日期:"); //SubEndDate
            sb.Append("</div>");
            sb.Append("<div class='class-detail-text'>");
            //即日起~07/31(二) 截止報名,之後請現場報名。
            sb.Append("即日起~" +
                      SubEndDate.Replace(DateTime.UtcNow.AddHours(8).Year.ToString() + "/", "") +
                      "(" + Api_Info.GetDayOfWeek(DateTime.Parse(SubEndDate)) + ") " +
                      "截止報名。");
            sb.Append("</div>");

            sb.Append("<div class='class-detail-title'>");
            sb.Append("備註:"); //Memo
            sb.Append("</div>");
            sb.Append("<div class='class-detail-text'>");
            sb.Append(Memo.Replace("\r\n", "<br/>"));
            sb.Append("</div>");


            sb.Append("</li>");
            sb.Append("</ul>");
            sb.Append("</div>");
            string HtmlSubDesc = sb.ToString();

            SubjectInfo.InsSubjectInfo(SubCount, "C2", SubName, SUCondition, SubLocation,
                                       SubStrDate, SubEndDate, Memo, HtmlSubDesc, 99999);

            DataTable dtSubjectInfo = SubjectInfo.QueryMaxSIDBySubjectInfo("C2");
            int       SID           = int.Parse(dtSubjectInfo.Rows[0]["SID"].ToString());

            //C2 一、二課
            if (txtSDate12.Text.Trim() != "")
            {
                SubjectDate.InsSubjectDate(SID, "C212", txtSDate12.Text.Trim(),
                                           dropSubTime12.Text + " " + txtSubTime12.Text.Trim());
            }

            //C2 三、四課
            if (txtSDate34.Text.Trim() != "")
            {
                SubjectDate.InsSubjectDate(SID, "C234", txtSDate34.Text.Trim(),
                                           dropSubTime34.Text + " " + txtSubTime34.Text.Trim());
            }

            //C2 五課
            if (txtSDate5.Text.Trim() != "")
            {
                SubjectDate.InsSubjectDate(SID, "C25", txtSDate5.Text.Trim(),
                                           dropSubTime5.Text + " " + txtSubTime5.Text.Trim());
            }

            sheetName = "C2報名";

            //先創建工作表, 若有存在就清空資料
            try
            {
                CreateV4Sheets();

                #region Header

                PageData PageData = new PageData();
                PageData.CreateTime = "時間戳記";
                PageData.Ename      = "姓名";
                PageData.group_1    = "所屬牧區/小組:家庭弟兄";
                PageData.group_2    = "所屬牧區/小組:家庭姊妹";
                PageData.group_3    = "所屬牧區/小組:社青";
                PageData.group_4    = "所屬牧區/小組:學青";
                PageData.SubDate    = "上課時段";

                AddDataByV4Sheets(PageData);

                #endregion
            }
            catch { }

            btnSave.PostBackUrl = "~/Admin/SubjectData/SubjectList.aspx";
            ScriptManager.RegisterStartupScript(Page, GetType(), "Save", "<script>clickSave()</script>", false);
            //Response.Write("<script>alert('C2課程新增成功!');location.href='SubjectList.aspx?id=C2';</script>");
        }
Example #43
0
        public virtual PageData ConvertToTyped(PageData page)
        {
            Type type        = GetPageTypeType(page.PageTypeID);
            var  castingTest = page as TypedPageData;

            if (type == null || castingTest != null)
            {
                if (type != null)
                {
                    if (_logger.IsDebugEnabled)
                    {
                        _logger.Debug(string.Format("Cache hit on {0}", type.Name));
                    }
                }

                return(page);
            }

            var populated = Activator.CreateAndPopulateTypedInstance(page, type);

            if (page.WorkPageID != 0)
            {
                if (_logger.IsDebugEnabled)
                {
                    _logger.Debug(string.Format("Skipping page with work ID {0}", page.WorkPageID));
                }

                return(populated);
            }

            // Save to cache if its a final published version
            var pageProvider  = DataFactory.Instance.GetPageProvider(page.PageLink);
            var cacheSettings = new CacheSettings(PageCacheTimeout);

            if (_logger.IsDebugEnabled)
            {
                _logger.Debug(string.Format("Saving to cache {0}", type.Name));
            }

            string key  = DataFactoryCache.PageCommonCacheKey(page.PageLink);
            string str2 = DataFactoryCache.PageLanguageCacheKey(page.PageLink, page.LanguageBranch);

            if (cacheSettings.CancelCaching)
            {
                CacheManager.RemoveLocalOnly(key);
            }
            else
            {
                if (CacheManager.RuntimeCacheGet(key) == null)
                {
                    CacheManager.RuntimeCacheInsert(key, DateTime.UtcNow.Ticks, new CacheDependency(null, new string[] { "DataFactoryCache.MasterKey", pageProvider.ProviderCacheKey }), Cache.NoAbsoluteExpiration, PageCacheTimeout);
                }
                string[]      filenames = (cacheSettings.FileNames.Count > 0) ? cacheSettings.FileNames.ToArray() : null;
                List <string> list      = new List <string>(new string[] { "DataFactoryCache.MasterKey", pageProvider.ProviderCacheKey, key });
                list.AddRange(cacheSettings.CacheKeys);
                if (page.IsMasterLanguageBranch)
                {
                    CacheManager.RuntimeCacheInsert(DataFactoryCache.PageMasterLanguageCacheKey(page.PageLink), populated, new CacheDependency(filenames, list.ToArray()), cacheSettings.AbsoluteExpiration, cacheSettings.SlidingExpiration);
                }
                CacheManager.RuntimeCacheInsert(str2, populated, new CacheDependency(filenames, list.ToArray()), cacheSettings.AbsoluteExpiration, cacheSettings.SlidingExpiration);
            }

            return(populated);
        }
 public Type GetTargetPageType(PageData sourcePage)
 {
     return(_maps.ContainsKey(sourcePage.PageTypeName)
         ? _maps[sourcePage.PageTypeName].GetTargetType(sourcePage)
         : _maps[DefaultMapName].GetTargetType(sourcePage));
 }
Example #45
0
 /// <summary>
 ///     Returns all siblings of PageData type of provided page.
 /// </summary>
 /// <param name="currentPage">Page for which to find siblings.</param>
 /// <param name="excludeSelf">Mark if exclude itself from sibling sequence.</param>
 /// <returns>Sequence of siblings of provided page.</returns>
 public static IEnumerable <PageData> GetSiblings(this PageData currentPage, bool excludeSelf = true)
 {
     return(currentPage.GetSiblings <PageData>(excludeSelf));
 }
Example #46
0
 public IActionResult Index(PageData page, int numberPage)
 {
     page.Histories = SortedByDate(DoFilter(_context.Histories.ToList(), page).ToList(), page);
     GetAnswerFilter(page);
     return(View(page));
 }
        public async Task NavigateToPageByPageData(Page navigateFromPage, PageData pageData)
        {
            Page page = await _pageService.LoadPageByPageData(pageData);

            await NavigateAndLoadBindingContext(navigateFromPage, page);
        }
        public ActionResult GetList(SearchModel search, PageParam pageParam)
        {
            PageData <QuestionDto> pageData = _helper.GetPageList(search, o => o.OrderIndex, pageParam, true);

            return(Success(pageData));
        }
Example #49
0
 /// <summary>
 /// Controls if a user can be notified about page changes. Called for each subscription being processed.
 /// </summary>
 /// <param name="profile">User's profile</param>
 /// <param name="rootPage">The root page for the suscription</param>
 /// <param name="changedPages">The pages that has changed</param>
 /// <returns>
 /// <b>True</b> if the subscription notification can be sent.
 ///     Returning <b>false</b> cancels the notification for this user.
 ///     </returns>
 protected virtual bool CanSendSubscription(EPiServerProfile profile, PageData rootPage, PageDataCollection changedPages)
 {
     return(true);
 }
Example #50
0
        protected override string GetContainerPageName(PageData childPage)
        {
            var pageType = ContentTypeRespository.Service.Load(childPage.PageTypeID);

            return(pageType.Name);
        }
        public PageData TryGetProjectPageVersion(ExternalReviewLink externalReviewLink, PageData routedContent, NameValueCollection queryString)
        {
            var contentReference = externalReviewLink.ContentLink;
            var page             = _contentLoader.Get <PageData>(contentReference);

            // If not Project associate with the link then use the ContentLink stored in DDS
            if (!externalReviewLink.ProjectId.HasValue)
            {
                return(page);
            }

            // If the url is not generated, meaning
            if (!PreviewUrlResolver.IsGeneratedForProjectPreview(queryString))
            {
                return(page);
            }

            var projectReference = GetProjectReference(routedContent.ContentLink,
                                                       externalReviewLink.ProjectId.Value, page.LanguageBranch());

            if (projectReference != null)
            {
                return(_contentLoader.Get <PageData>(projectReference));
            }

            var reviewsContentLoader = ServiceLocator.Current.GetInstance <ReviewsContentLoader>();

            if (routedContent.IsPublished())
            {
                return(routedContent);
            }

            var unpublished = reviewsContentLoader.LoadUnpublishedVersion(routedContent.ContentLink);

            return(_contentLoader.Get <PageData>(unpublished));
        }
Example #52
0
    public static VirtualPathData FriendlyUrl(this PageData pageData)
    {
        var contentReference = pageData.ContentLink;

        return(ServiceLocator.Current.GetInstance <UrlResolver>().GetVirtualPath(contentReference));
    }
Example #53
0
        public async Task <IActionResult> GetExceptionLogPage(DateTime?start, DateTime?end, int page, int size)
        {
            PageData <ExceptionLog> data = await _logBll.GetPageExceptionLogAsync(start, end, page, size);

            return(new JsonResult(new { success = true, data }));
        }
Example #54
0
 /// <summary>
 ///     Returns all descendants of PageData type for provided page and level deep.
 /// </summary>
 /// <param name="pageData">The page for which to find descendants.</param>
 /// <param name="levels">Level of how deep to look for descendants in page hiararchy.</param>
 /// <returns>Returns sequence of PageData of descendants for provided page.</returns>
 public static IEnumerable <PageData> GetDescendants(this PageData pageData, int levels)
 {
     return(pageData.GetDescendants <PageData>(levels));
 }
Example #55
0
 public WatermarkAnnotator(AnnotationDataEntity annotationData, PageData pageData)
     : base(annotationData, pageData)
 {
 }
Example #56
0
        void Instance_CreatingPage(object sender, PageEventArgs e)
        {
            if (this.IsImport() || e.Content == null)
            {
                return;
            }
            if (string.Equals(e.Page.PageTypeName, typeof(CompareStartPage).GetPageType().Name, StringComparison.OrdinalIgnoreCase))
            {
                //var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
                //CreateOrganisationalUnitsPage(contentRepository, e.Page.ContentLink);

                //var contentAssetHelper = ServiceLocator.Current.GetInstance<ContentAssetHelper>();
                //var contentAssetFolder = contentAssetHelper.GetOrCreateAssetFolder(e.Page.ContentLink);
            }
            else if (string.Equals(e.Page.PageTypeName, typeof(CategoryPage).GetPageType().Name, StringComparison.OrdinalIgnoreCase))
            {
                var categoryRepository = ServiceLocator.Current.GetInstance <CategoryRepository>();
                var category           = CategoryHelper.FindCompareCategory(categoryRepository, e.Page.Name);
                if (category == null)
                {
                    CategoryHelper.SaveCompareCategory(categoryRepository, e.Page.Name, e.Page.Name);
                }
            }
            else if (string.Equals(e.Page.PageTypeName, typeof(OrganisationalUnitPage).GetPageType().Name, StringComparison.OrdinalIgnoreCase))
            {
                var contentRepository = ServiceLocator.Current.GetInstance <IContentRepository>();

                PageData page         = contentRepository.Get <PageData>(e.Page.ParentLink);
                string   categoryName = null;
                if (page is CategoryPage)
                {
                    categoryName = page.Name;
                    page         = contentRepository.Get <PageData>(page.ParentLink);
                }

                PageData startPage = (page is CompareStartPage ? page : null);
                if (startPage != null)
                {
                    var ouFolderPage   = GetOrganisationalUnitsPageRef(startPage, contentRepository);
                    var existingOuPage = (ouFolderPage != null ? contentRepository.GetChildren <OrganisationalUnitPage>(ouFolderPage).FirstOrDefault() : null);
                    if (existingOuPage == null)
                    {
                        e.Page.ParentLink = GetOrganisationalUnitsPageRef(startPage, contentRepository);

                        if (!String.IsNullOrWhiteSpace(categoryName))
                        {
                            var      categoryRepository = ServiceLocator.Current.GetInstance <CategoryRepository>();
                            Category category           = CategoryHelper.FindCompareCategory(categoryRepository, categoryName);
                            if (category == null)
                            {
                                category = CategoryHelper.SaveCompareCategory(categoryRepository, categoryName, categoryName);
                            }

                            //add category to the ou page
                            e.Page.Category.Add(category.ID);
                        }
                    }
                    else
                    {
                        //cancel, ou page already exists in this comparison content
                        e.CancelReason = "An organisational unit with the name " + e.Page.Name + " already exists. Please choose another name or edit the existing one.";
                        e.CancelAction = true;
                    }
                }
                else
                {
                    //cancel, no compare start page
                    e.CancelReason = "Could not find the compare start page";
                    e.CancelAction = true;
                }
            }
        }
Example #57
0
 public DataSet GetList(int pagesize, int currentindex, string condition, out int allcount)
 {
     return(PageData.GetDataByPage("v_Exampaper", "ExampaperId", "ExampaperId desc", currentindex, pagesize, "*", condition, out allcount));
 }
Example #58
0
 public DataSet GetListByClient(int pagesize, int currentindex, string condition, out int allcount)
 {
     return(PageData.GetDataByPage("[v_Exampaper] a inner join [tb_School_QuestionCls] b on a.exampaperclsid=b.QuestionClsId", "a.ExampaperId", "a.ExampaperId desc", currentindex, pagesize, "a.*,b.ismust", condition, out allcount));
 }
Example #59
0
 /// <summary>
 ///     Returns all child pages of PageData type for provided parent page.
 /// </summary>
 /// <param name="parentPage">Parent page of PageData type for which to return children.</param>
 /// <returns>Returns PageDataCollection of child pages.</returns>
 public static PageDataCollection GetChildren(this PageData parentPage)
 {
     return(parentPage.GetChildren <PageData>().ToPageDataCollection());
 }
Example #60
0
        public IActionResult Submit(PageData page, string action)
        {
            if (action == "Evaluate")
            {
                var calculation = new StringCalc();
                var note        = new History
                {
                    Expression = page.Expression
                };
                note.Result          = calculation.DoCalculation(note.Expression).ToString();
                note.Host            = Request.Host.ToString();
                note.CreatedDateTime = DateTime.Now;
                _context.Histories.Add(note);
                _context.SaveChanges();
                page.PageNumber = 0;
            }

            var notes = _context.Histories.ToList();

            if (action == "Search")
            {
                page.PreviousSearchExpression = page.NewSearchExpression;
                page.PreviousSearchHost       = page.NewSearchHost;
                notes           = SortedByDate(DoFilter(notes, page), page);
                page.Histories  = notes;
                page.PageNumber = 0;
                GetAnswerFilter(page);
                return(View("Index", page));
            }

            if (action == "Previous")
            {
                if (page.PageNumber <= 0)
                {
                    page.PageNumber = 0;
                    page.Histories  = SortedByDate(DoFilter(notes, page).ToList(), page);;
                    GetAnswerFilter(page);
                    return(View("Index", page));
                }
                else
                {
                    --page.PageNumber;
                    page.Histories = SortedByDate(DoFilter(notes, page).ToList(), page);;
                    GetAnswerFilter(page);
                    return(View("Index", page));
                }
            }

            if (action == "Next")
            {
                if (page.PageNumber >= page.TotalPages)
                {
                    page.PageNumber = page.TotalPages;
                    page.Histories  = SortedByDate(DoFilter(notes, page).ToList(), page);
                    GetAnswerFilter(page);
                    return(View("Index", page));
                }
                else
                {
                    ++page.PageNumber;
                    page.Histories = SortedByDate(DoFilter(notes, page).ToList(), page);
                    GetAnswerFilter(page);
                    return(View("Index", page));
                }
            }

            page.Histories = SortedByDate(DoFilter(notes, page).ToList(), page);
            return(View("Index", page));
        }