public override void Render(DotLiquid.Context context, TextWriter result)
        {
            NavigationMenuItemDrop navigationMenuItemDrop = (NavigationMenuItemDrop)null;

            if (!this.contextProperty.IsBlank())
            {
                object obj = context[this.contextProperty];
                if (obj is int)
                {
                    this.variantKeyFromMarkup = (int)obj;
                }
                else if (obj is NavigationMenuItemDrop)
                {
                    navigationMenuItemDrop = obj as NavigationMenuItemDrop;
                }
            }
            if (navigationMenuItemDrop == null)
            {
                AbstractPage page = DependencyLocator.Current.GetInstance <IContentHelper>().GetPageByVariantKey(this.variantKeyFromMarkup, false).Page;
                navigationMenuItemDrop = !(page is ICatalogNavigationPage) ? this.CreateContentNavigationLink(DependencyLocator.Current.GetInstance <IContentHelper>(), page, this.viewNameFromMarkup, 0) : this.CreateCatalogNavigationLink(((ICatalogNavigationPage)page).CategoryNavRoot, this.viewNameFromMarkup, 0);
            }
            string str = DependencyLocator.Current.GetInstance <IContentItemTemplateRenderer>().RenderNavigationMenu(navigationMenuItemDrop);

            result.Write(str);
        }
コード例 #2
0
        public MenuViewModel Build(IStartPage startPage, AbstractPage currentPage)
        {
            if (startPage == null)
            {
                return(null);
            }

            var model = new MenuViewModel();

            var topLevelItems = startPage.GetChildren()
                                .Where(w => w.IsPage)
                                .OfType <AbstractPage>()
                                .Where(p => p.IsVisible)
                                .OrderBy(o => o.SortOrder);

            var currentPageId = (currentPage?.Id).GetValueOrDefault(0);//currentPage может быть Null, если страница не в структуре сайта

            foreach (var tlitem in topLevelItems)
            {
                var resultBuildMenu = BuildMenu(tlitem, MenuDepth, currentPageId);
                model.Items.Add(new MenuItem
                {
                    Title          = tlitem.Title,
                    Alias          = tlitem.Alias,
                    Href           = tlitem.GetUrl(UrlTransformator),
                    Children       = resultBuildMenu,
                    IsActive       = tlitem.Id == currentPageId,
                    HasActiveChild = resultBuildMenu.Where(w => w.IsActive).Any()
                });
            }

            model.Items = model.Items?.OrderBy(o => o.Order).ToList();

            return(model);
        }
コード例 #3
0
        public ActionResult Edit(int ID, Settings item, List <string> Roles)
        {
            if (ModelState.IsValid)
            {
                List <string> DomainRoles = SF.GetRoleObjectsList().Where(r => r.IsSystem == true).Select(r => r.Title).ToList();
                if (Roles != null)
                {
                    DomainRoles.AddRange(Roles);
                }
                item.Roles = SF.RolesListToString(DomainRoles);

                _db.Entry(item).State = EntityState.Modified;
                _db.SaveChanges();

                //update lang name of pages
                AbstractPage ap = _db.AbstractPages.FirstOrDefault(r => r.ID == item.DomainPageID);
                SF.SetLanguageCode(ap, 100, item.LanguageCode);

                CleanCache.CleanOutputCache();
                CleanCache.CleanSettingsCache();
                CleanCache.CleanMenuCache();

                return(RedirectToAction("Index"));
            }
            item.Roles = SF.RolesListToString(Roles);
            return(View(item));
        }
        private NavigationMenuItemDrop CreateContentNavigationLink(
            IContentHelper contentHelper,
            AbstractPage page,
            string viewName,
            int level = 0)
        {
            string str = page.CustomUrl;

            if (str.IsBlank())
            {
                str = !(page is ILinkableContent) || DependencyLocator.Current.GetInstance <IContentModeProvider>().CurrentContentMode != ContentMode.Viewing ? DependencyLocator.Current.GetInstance <IUrlProvider>().PrepareUrl("/Content/Item/" + (object)page.ContentKey) : DependencyLocator.Current.GetInstance <IUrlProvider>().PrepareUrl((page as ILinkableContent).Url);
            }
            NavigationMenuItemDrop navigationMenuItemDrop = new NavigationMenuItemDrop();

            navigationMenuItemDrop.Level = level;
            navigationMenuItemDrop.NavigationMenuType = NavigationMenuType.Content;
            navigationMenuItemDrop.Identifier         = page.ContentKey.ToString();
            navigationMenuItemDrop.Title = page.Title;
            navigationMenuItemDrop.Url   = str;
            bool?openInNewTab = page.OpenInNewTab;

            navigationMenuItemDrop.OpenInNewTab = openInNewTab.HasValue && openInNewTab.GetValueOrDefault();
            navigationMenuItemDrop.ViewName     = viewName;
            navigationMenuItemDrop.Children     = (IList <NavigationMenuItemDrop>)contentHelper.GetChildPagesForVariantKey <AbstractPage>(page.VariantKey.Value, true).Where <AbstractPage>((Func <AbstractPage, bool>)(o => !o.ExcludeFromNavigation)).OrderBy <AbstractPage, int>((Func <AbstractPage, int>)(o => o.SortOrder)).Select((Func <AbstractPage, NavigationMenuItemDrop>)(o => this.CreateContentNavigationLink(contentHelper, o, viewName, ++level))).ToList <NavigationMenuItemDrop>();
            return(navigationMenuItemDrop);
        }
コード例 #5
0
    public void GoToPage(PageType pageType)
    {
        if(_currentPageType == pageType) return; //we're already on the same page, so don't bother doing anything

        AbstractPage pageToCreate = null;

        switch (pageType) {
        case PageType.BitmaskPuzzleShapesGame:
            pageToCreate = new BitmaskPuzzleGame();
            break;
        }

        if(pageToCreate != null) //destroy the old page and create a new one
        {
            _currentPageType = pageType;

            if(_currentPage != null)
            {
                _currentPage.Destroy();
                Futile.stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            Futile.stage.AddChild(_currentPage);
            _currentPage.Start();
        }
    }
コード例 #6
0
        public ActionResult Delete(int id, string Title)
        {
            if (CheckPermissions(id) == false)
            {
                return(Redirect("~/Account/LogOn?returnUrl=/Admin"));
            }

            if (id == 0)
            {
                RedirectToAction("View", new { id = id });
            }
            if (id == 1)
            {
                throw new NotImplementedException("Can't delete root page");
            }

            AbstractPage ap     = _db.AbstractPages.FirstOrDefault(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ID == id);
            int          parent = ap.ParentID;

            ap.OnDelete();
            DeleteChildPages(ap);
            _db.Entry(ap).State = EntityState.Deleted;
            _db.SaveChanges();

            ap.OnDeleted();

            CleanCache.CleanCacheAfterPageEdit();

            return(RedirectToAction("View", new { id = parent }));
        }
コード例 #7
0
    public void GoToPage(PageType pageType)
    {
        if (_currentPageType == pageType)
        {
            return;                                      //we're already on the same page, so don't bother doing anything
        }
        AbstractPage pageToCreate = null;

        switch (pageType)
        {
        case PageType.BitmaskPuzzleShapesGame:
            pageToCreate = new BitmaskPuzzleGame();
            break;
        }

        if (pageToCreate != null)        //destroy the old page and create a new one
        {
            _currentPageType = pageType;

            if (_currentPage != null)
            {
                _currentPage.Destroy();
                Futile.stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            Futile.stage.AddChild(_currentPage);
            _currentPage.Start();
        }
    }
コード例 #8
0
 public void AddPage(AbstractPage page)
 {
     if (pages.ContainsKey(page.Id))
     {
         throw new InvalidOperationException("The Id is already here.");
     }
     pages.Add(page.Id, page);
 }
コード例 #9
0
        public AbstractSteps(IWebDriver driver, ExtentTest extentTestReport)
        {
            this.driver           = driver;
            this.extentTestReport = extentTestReport;

            abstractPage     = new AbstractPage(driver);
            googleSearchPage = new GoogleHomePage(driver);
            restSharpPage    = new RestSharpPage(driver);
        }
コード例 #10
0
        public bool UnregisterPage(AbstractPage page)
        {
            if (Equals(Pager.SelectedItem, page))
            {
                Log.Warning($"Page '${page.PageType}' to be unregistered is currently loaded");
            }

            return(PageViewModel.Items.Remove(page));
        }
コード例 #11
0
 public void RegisterPage(AbstractPage page)
 {
     if (HasPageType(page.PageType))
     {
         Log.Warning($"Page type '${page.PageType}' is already assigned. Disposing old page.");
         UnregisterPage(page);
     }
     PageViewModel.Items.Add(page);
 }
コード例 #12
0
        public AbstractSteps(IWebDriver driver)
        {
            this.driver = driver;


            abstractPage     = new AbstractPage(driver);
            googleSearchPage = new GoogleHomePage(driver);
            restSharpPage    = new RestSharpPage(driver);
        }
コード例 #13
0
        private void OnActivePageChanged(AbstractPage oldPage, AbstractPage page)
        {
            EventHandler <ActivePageChangedEventArgs> handler = ActivePageChanged;

            if (handler != null)
            {
                handler(this, new ActivePageChangedEventArgs(oldPage, page));
            }
        }
コード例 #14
0
 public ActionResult View(int id)
 {
     if (_db.AbstractPages.Count(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ID == id) > 0)
     {
         AbstractPage ap = _db.AbstractPages.Single(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ID == id);
         return(View(ap));
     }
     return(Content("<h1>Can't find page</h1>"));
 }
コード例 #15
0
        public static void SetLanguageCode(AbstractPage ap, int MaxTimes, string LanguageCode)
        {
            List <int> Pages = new List <int>();

            Pages.Add(ap.ID);
            SF.SetLanguageCodeRecurcive(ap, 100, Pages);
            string FormatedPagesIDs = string.Join(",", Pages);

            _db.Database.ExecuteSqlCommand(string.Format("Update AbstractPages Set LanguageCode = '{0}' Where DomainID = '{1}' And ID IN ({2})", LanguageCode, ap.DomainID, FormatedPagesIDs));
        }
コード例 #16
0
 private void DeleteChildPages(AbstractPage ap)
 {
     foreach (AbstractPage item in _db.AbstractPages.Where(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ParentID == ap.ID).ToList())
     {
         DeleteChildPages(item);
         item.OnDelete();
         _db.Entry(item).State = EntityState.Deleted;
         _db.SaveChanges();
         item.OnDeleted();
     }
 }
コード例 #17
0
        private void SelectPage(AbstractPage page)
        {
            Logger.Info("Selecting page {0}", page.Id);
            AbstractPage oldPage = activePage;

            activePage = page;
            activePage.InitializeLocalization();
            activePage.PageChangeRequested += ActivePageChangeRequested;
            titleLabel.Content              = activePage.Title;
            contentGrid.Children.Clear();
            contentGrid.Children.Add(activePage);
            OnActivePageChanged(oldPage, activePage);
            activePage.Initialize();
        }
コード例 #18
0
 private bool CheckPermissions(int PageID)
 {
     if (SF.UsePermissions())
     {
         AbstractPage EditPage = _db.AbstractPages.FirstOrDefault(r => r.ID == PageID && r.DomainID == AdminCurrentSettingsRepository.ID);
         _db.Entry(EditPage).State = EntityState.Detached;
         if (EditPage == null)
         {
             return(false);
         }
         if (LS.CurrentUser.RolesList.Intersect(EditPage.RolesEditList).Count() == 0)
         {
             TempData["Error"] = "You don't have permissions to Edit this page";
             return(false);
         }
     }
     return(true);
 }
コード例 #19
0
ファイル: MainWindow.xaml.cs プロジェクト: Neophear/ITMat
        public void ChangePage(AbstractPage p)
        {
            if (frmContent.Content != null)
            {
                foreach (var menuItem in ((AbstractPage)frmContent.Content).Menu)
                {
                    mnuMain.Items.Remove(menuItem);
                }
            }

            p.OnPageChangeRequest += (_, newPage) => ChangePage(newPage);

            frmContent.Navigate(p);

            foreach (var menuItem in p.Menu)
            {
                mnuMain.Items.Add(menuItem);
            }
        }
コード例 #20
0
        private void AddPage(AbstractPage page, bool defaultPage = false)
        {
            page.SuspendLayout();

            page.Size     = radPageView1.Size;
            page.Location = new Point(0, 0);
            page.Dock     = DockStyle.Fill;

            var master = new RadPageViewPage();

            master.Controls.Add(page);

            radPageView1.Pages.Add(master);
            if (defaultPage)
            {
                _defaultPage = master;
            }

            page.ResumeLayout(false);
        }
コード例 #21
0
        public ActionResult Delete(int id)
        {
            if (CheckPermissions(id) == false)
            {
                return(Redirect("~/Account/LogOn?returnUrl=/Admin"));
            }

            if (id == 0)
            {
                RedirectToAction("View", new { id = id });
            }
            if (_db.AbstractPages.Count(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ID == id) == 0)
            {
                throw new NotImplementedException("Can't find page to delete");
            }

            AbstractPage ap = _db.AbstractPages.Single(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ID == id);

            ViewBag.id    = id;
            ViewBag.Title = ap.Title;
            return(View());
        }
コード例 #22
0
        private static List <int> SetLanguageCodeRecurcive(AbstractPage ap, int MaxTimes, List <int> Pages)
        {
            MaxTimes = MaxTimes - 1;
            if (MaxTimes <= 0)
            {
                return(Pages);
            }

            foreach (AbstractPage item in _db.AbstractPages.Where(r => r.ParentID == ap.ID).ToList())
            {
                if (item.RouteUrl == "l")
                {
                    continue;
                }

                Pages.Add(item.ID);

                SetLanguageCodeRecurcive(item, MaxTimes, Pages);
            }

            return(Pages);
        }
コード例 #23
0
        public void restSharpTest()
        {
            //init used pages
            extentTestReport = extentReports
                               .StartTest("Google search");
            extentReports.AddSystemInfo("Environment", ConfigurationManager.AppSettings["Environment"]);
            restSharpSteps = new RestSharpSteps(driver, extentTestReport);
            abstractPage   = new AbstractPage(driver);
            //abstractPage.navigateTo(baseUrl);
            //googleHomeSteps.SearchFor(searchTerm);
            //  googleHomeSteps.GetCategories("4.5384");
            restSharpSteps.postTest();
            restSharpSteps.getTestAfterPost();
            restSharpSteps.putTest();
            restSharpSteps.getTest();
            restSharpSteps.deleteTest();
            restSharpSteps.getTestAfterDelete();
            restSharpSteps.putTestAfterDelete();

            // String extractedTitle = abstractPage.waitForPageTitle(searchTerm);

            //SoftAssert.verifyTrue("Title is not as expected", "Hamster", extractedTitle );
        }
コード例 #24
0
        private List <MenuItem> BuildMenu(AbstractPage item, int level, int currentId)
        {
            if (level <= 0)
            {
                return(null);
            }

            var itemList = new List <MenuItem>();

            foreach (var itemlv in item.GetChildren().Where(w => w.IsPage).OfType <AbstractPage>().Where(p => p.IsVisible).OrderBy(o => o.SortOrder))
            {
                var resultBuidMenu = BuildMenu(itemlv, level - 1, currentId);
                itemList.Add(new MenuItem
                {
                    Title    = itemlv.Title,
                    Alias    = itemlv.Alias,
                    Href     = itemlv.GetUrl(UrlTransformator),
                    Children = resultBuidMenu,
                    IsActive = itemlv.Id == currentId || resultBuidMenu.Where(w => w.IsActive).Any()
                });
            }
            return(itemList);
        }
コード例 #25
0
        public static bool UserCanView(User CurrentUser, AbstractPage CurrentPage)
        {
            List <string> CurrentUserPermissions = new List <string>();

            if (CurrentUser == null)
            {
                CurrentUserPermissions.Add("Anonymous");
            }
            else
            {
                CurrentUserPermissions = SF.RolesStringToList(CurrentUser.Roles);
            }

            List <string> CurrentPagePermissions = SF.RolesStringToList(CurrentPage.PermissionsView);

            if (CurrentUserPermissions.Intersect <string>(CurrentPagePermissions).Count() > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #26
0
ファイル: AbstractSteps.cs プロジェクト: iripop/Test
 protected AbstractSteps(IWebDriver driver)
 {
     _abstractPage = new AbstractPage(driver);
     LoginPage     = new LoginPage(driver);
 }
コード例 #27
0
        public ActionResult _TreeDrop(int item, int destinationitem, string position)
        {
            if (CheckPermissions(item) == false || CheckPermissions(destinationitem) == false)
            {
                return(Content("false"));
            }

            AbstractPage ItemPage            = _db.AbstractPages.FirstOrDefault(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ID == item);
            AbstractPage DestinationItemPage = _db.AbstractPages.FirstOrDefault(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ID == destinationitem);

            if (ItemPage.ParentID == 0 || ItemPage.RouteUrl == "d")
            {
                return(Content("false"));
            }

            if (position == "over")
            {
                Type t = ItemPage.GetType();
                if (GetChildClasses(destinationitem).Contains(t))
                {
                    AbstractPage Parent = _db.AbstractPages.FirstOrDefault(r => r.ID == destinationitem);
                    ItemPage.ParentID = Parent.ID;
                    ItemPage.DomainID = Parent.DomainID;
                    if (ItemPage.RouteUrl != "l")
                    {
                        ItemPage.LanguageCode = Parent.LanguageCode;
                    }

                    _db.Entry(ItemPage).State = EntityState.Modified;
                    _db.SaveChanges();

                    CleanCache.CleanCacheAfterPageEdit();

                    return(Content("true"));
                }
                else
                {
                    return(Content("false"));
                }
            }
            else if (position == "before")
            {
                if (DestinationItemPage.ID == 1)
                {
                    return(Content("false"));
                }
                if (GetChildClasses((int)DestinationItemPage.ParentID).Contains(ItemPage.GetType()))
                {
                    ItemPage.ParentID         = DestinationItemPage.ParentID;
                    ItemPage.Order            = DestinationItemPage.Order;
                    _db.Entry(ItemPage).State = EntityState.Modified;

                    foreach (AbstractPage item2 in _db.AbstractPages.Where(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ParentID == (int)DestinationItemPage.ParentID && r.Order >= DestinationItemPage.Order && r.ID != (int)ItemPage.ID))
                    {
                        item2.Order            = item2.Order + 1;
                        _db.Entry(item2).State = EntityState.Modified;
                    }

                    _db.SaveChanges();

                    CleanCache.CleanCacheAfterPageEdit();

                    return(Content("true"));
                }
                else
                {
                    return(Content("false"));
                }
            }
            else if (position == "after")
            {
                if (DestinationItemPage.ID == 1)
                {
                    return(Content("false"));
                }
                if (GetChildClasses((int)DestinationItemPage.ParentID).Contains(ItemPage.GetType()))
                {
                    foreach (AbstractPage item2 in _db.AbstractPages.Where(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ParentID == (int)DestinationItemPage.ParentID && r.Order >= DestinationItemPage.Order && r.ID != (int)DestinationItemPage.ID))
                    {
                        item2.Order            = item2.Order + 2;
                        _db.Entry(item2).State = EntityState.Modified;
                    }

                    ItemPage.ParentID         = DestinationItemPage.ParentID;
                    ItemPage.Order            = DestinationItemPage.Order + 1;
                    _db.Entry(ItemPage).State = EntityState.Modified;

                    _db.SaveChanges();

                    CleanCache.CleanCacheAfterPageEdit();

                    return(Content("true"));
                }
                else
                {
                    return(Content("false"));
                }
            }

            return(Content("false"));
        }
コード例 #28
0
 public Button(AbstractPage page, string locator) : base(page, locator)
 {
 }
コード例 #29
0
        public ActionResult _TreeCopy(int item, int destinationitem)
        {
            if (CheckPermissions(item) == false || CheckPermissions(destinationitem) == false)
            {
                return(Content(LocalizationHelpers.GetLocalResource("~/Areas/Admin/Views/Shared/_TreeView.cshtml", "ErrorPermitions")));
            }

            AbstractPage ItemPage            = _db.AbstractPages.FirstOrDefault(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ID == item);
            AbstractPage DestinationItemPage = _db.AbstractPages.FirstOrDefault(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ID == destinationitem);

            if (ItemPage.ParentID == 0 || ItemPage.RouteUrl == "d")
            {
                return(Content(LocalizationHelpers.GetLocalResource("~/Areas/Admin/Views/Shared/_TreeView.cshtml", "ErrorDomain")));
            }

            Type t = ItemPage.GetType();

            if (GetChildClasses(destinationitem).Contains(t))
            {
                AbstractPage ap = ItemPage;

                AbstractPage Parent = _db.AbstractPages.FirstOrDefault(r => r.ID == destinationitem);
                ap.ParentID        = Parent.ID;
                ap.DomainID        = Parent.DomainID;
                ap.PermissionsEdit = Parent.PermissionsEdit;
                ap.PermissionsView = Parent.PermissionsView;

                Session["TreeCopy"] = true;

                if (ap.RouteUrl != "l")
                {
                    ap.LanguageCode = Parent.LanguageCode;
                }

                ap.Title      = ap.Title + "-Copy";
                ap.SeoUrlName = (_db.AbstractPages.Max(r => r.ID) + 1).ToString();

                if (_db.AbstractPages.Count(r => r.DomainID == ap.DomainID && r.SeoUrlName == ap.SeoUrlName) != 0)
                {
                    return(Content(LocalizationHelpers.GetLocalResource("~/Areas/Admin/Views/Shared/_TreeView.cshtml", "ErrorTitle")));
                }
                ap.CreateTime = DateTime.Now;
                if (_db.AbstractPages.Where(r => r.ParentID == ap.ParentID && r.DomainID == ap.DomainID).Count() == 0)
                {
                    ap.Order = 1;
                }
                else
                {
                    ap.Order = _db.AbstractPages.Where(r => r.ParentID == ap.ParentID && r.DomainID == ap.DomainID).Max(r => r.Order) + 1;
                }
                ap.OnCreate();
                _db.AbstractPages.Add(ap);

                try
                {
                    _db.SaveChanges();
                }
                catch (DataException error)
                {
                    return(Content(LocalizationHelpers.GetLocalResource("~/Areas/Admin/Views/Shared/_TreeView.cshtml", "ErrorGeneral") + error.Message));
                }

                AbstractPage CopyItem = _db.AbstractPages.FirstOrDefault(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ID == item);
                foreach (AbstractPage item2 in _db.AbstractPages.Where(r => r.ParentID == CopyItem.ID).ToList())
                {
                    CopyPage(ap, item2, 5);
                }

                CleanCache.CleanCacheAfterPageEdit();

                return(Content("true"));
            }
            else
            {
                return(Content(LocalizationHelpers.GetLocalResource("~/Areas/Admin/Views/Shared/_TreeView.cshtml", "ErrorParent")));
            }
        }
コード例 #30
0
        private void CopyPage(AbstractPage DestinationItemPage, AbstractPage ItemPage, int MaxLoops)
        {
            //copy
            AbstractPage CopyItem = _db.AbstractPages.FirstOrDefault(r => r.DomainID == AdminCurrentSettingsRepository.ID && r.ID == ItemPage.ID);
            AbstractPage ap       = ItemPage;

            AbstractPage Parent = _db.AbstractPages.FirstOrDefault(r => r.ID == DestinationItemPage.ID);

            if (Parent == null)
            {
                ap.ParentID = 0;
                ap.DomainID = CurrentSettings.ID;
                if (ap.RouteUrl != "l")
                {
                    ap.LanguageCode = CurrentSettings.LanguageCode;
                }
            }
            else
            {
                ap.ParentID = Parent.ID;
                ap.DomainID = Parent.DomainID;
                if (ap.RouteUrl != "l")
                {
                    ap.LanguageCode = Parent.LanguageCode;
                }
            }


            ap.Title = ap.Title + "-Copy";
            if (ap.SeoUrlName == null || ap.SeoUrlName == "")
            {
                ap.SeoUrlName = Uco.Infrastructure.SF.CleanUrl(ap.Title + "-Copy");
            }
            else
            {
                ap.SeoUrlName = Uco.Infrastructure.SF.CleanUrl(ap.SeoUrlName + "-Copy");
            }

            if (_db.AbstractPages.Count(r => r.DomainID == ap.DomainID && r.SeoUrlName == ap.SeoUrlName) != 0)
            {
                return;
            }

            ap.CreateTime = DateTime.Now;
            if (_db.AbstractPages.Where(r => r.ParentID == ap.ParentID && r.DomainID == ap.DomainID).Count() == 0)
            {
                ap.Order = 1;
            }
            else
            {
                ap.Order = _db.AbstractPages.Where(r => r.ParentID == ap.ParentID && r.DomainID == ap.DomainID).Max(r => r.Order) + 1;
            }
            ap.OnCreate();
            _db.AbstractPages.Add(ap);

            try
            {
                _db.SaveChanges();
            }
            catch
            {
                return;
            }

            if (MaxLoops <= 0)
            {
                return;
            }
            MaxLoops = MaxLoops - 1;

            foreach (AbstractPage item in _db.AbstractPages.Where(r => r.ParentID == CopyItem.ID).ToList())
            {
                CopyPage(ap, item, MaxLoops);
            }
        }
コード例 #31
0
 public void GivenIHaveLandedOnThePage()
 {
     driver.Navigate().GoToUrl("http://localhost:51529/");
     page = new LandingPage(driver);
 }