Exemplo n.º 1
0
        public tbl_SiteMap SaveSiteMap(string R301, int languageID, int menuID, int domainID, string css, bool isMenu, bool isFooter, string menuText, DateTime?date,
                                       string spriority, string notifyEmail, string path, bool requiresApproval, bool isSiteMap, ContentType type, string siteMapName, int parentID, int siteMapID,
                                       int?typeID = null, bool isPredefined = false, MenuDisplayType menuDisplayType = MenuDisplayType.UnderParent, DateTime?publishDate = null)
        {
            decimal priority = 0;

            Decimal.TryParse(spriority, out priority);

            if (siteMapID > 0)
            {
                var sitemap = SitemapRepository.GetByID(siteMapID);
                if (sitemap != null && sitemap.SM_IsPredefined)
                {
                    isPredefined = true;
                    typeID       = sitemap.SM_TypeID;
                }
            }

            return(SitemapRepository.SaveSiteMap(R301, languageID, menuID, domainID, Sanitizer.GetSafeHtmlFragment(css), isMenu, isFooter,
                                                 Sanitizer.GetSafeHtmlFragment(menuText), date, priority, Sanitizer.GetSafeHtmlFragment(notifyEmail), FriendlyUrl.CreateFriendlyUrl(path),
                                                 requiresApproval, isSiteMap, type, Sanitizer.GetSafeHtmlFragment(siteMapName), parentID, siteMapID, typeID, isPredefined, (int)menuDisplayType, publishDate));
        }
Exemplo n.º 2
0
        public ActionResult AddProdCategory(int domainID, int parentID, int taxID, string categoryTitle, bool live, SEOFieldsModel seoModel,
            string content, bool isMenu, MenuDisplayType displayType, bool featured = false, ProductType type = ProductType.Item)
        {
            if (ModelState.IsValid)
            {
                int parentsiteID = parentID;
                var sitemap = WebContentService.GetSitemapByDomainID(domainID);
                string url = "";
                if (parentsiteID == 0)
                {
                    if (type == ProductType.Item)
                        parentsiteID = sitemap.Where(m => m.SM_URL == WebContentService.GetSitemapUrlByType(SiteMapType.ProductShop, this.DomainID))
                            .Select(m => m.SiteMapID).FirstOrDefault();
                    else if (type == ProductType.Event)
                        parentsiteID = sitemap.Where(m => m.SM_URL == WebContentService.GetSitemapUrlByType(SiteMapType.EventShop, this.DomainID))
                            .Select(m => m.SiteMapID).FirstOrDefault();
                    url = String.Format("/{0}", categoryTitle);
                }
                else
                {
                    var parentsite = sitemap.Where(m => m.SiteMapID == parentsiteID).FirstOrDefault();
                    if (parentsite == null)
                        return Json(new { success = false, error = "Parent Category ID is invalid" });
                    url = String.Format("{0}/{1}", parentsite.SM_URL, categoryTitle);
                }
                if (WebContentService.CheckSitemapUniqueUrl(url, 0, domainID))
                    return Json(new { success = false, error = "Please change 'Title'. There is another page with the same URL already registered." });

                SiteMapType sitemapType = type == ProductType.Event ? SiteMapType.EventShop : SiteMapType.ProductShop;
                tbl_SiteMap section = WebContentService.SaveSiteMap(seoModel.R301, 1, 0, domainID, String.Empty, isMenu, false, seoModel.Title,
                    null, "0.5", String.Empty, url, true, true, ContentType.Category, seoModel.Title, parentsiteID, 0, (int)sitemapType, false, displayType);

                tbl_Content tContent = (section != null) ?
                    WebContentService.SaveContent(String.Empty, content, seoModel.Desc, 0, String.Empty, seoModel.Keywords, seoModel.Title,
                        seoModel.MetaData, 0, String.Empty, String.Empty, String.Empty, seoModel.Title, String.Empty, false, section.SiteMapID, 0) :
                    null;

                tbl_ProdCategories category = ECommerceService.SaveProdCategory(categoryTitle, live, parentID, taxID == 0 ? (int?)null : taxID, section.SiteMapID, type, featured);

                return Json(new
                {
                    success = section != null && tContent != null && category != null,
                    categoryID = (category != null) ? category.CategoryID : 0,
                    contentID = (tContent != null) ? tContent.ContentID : 0
                });
            }
            return Json(new { success = false });
        }
Exemplo n.º 3
0
        public ActionResult UpdateGallery(int domainID, string galleryTitle, int galleryCategoryID, bool live,
            SEOFieldsModel seoModel, MenuDisplayType displayType, string content, int galleryID, int customerID=0)
        {
            if (ModelState.IsValid && galleryID > 0)
            {
                var parent = WebContentService.GetSitemapByType(SiteMapType.Gallery, this.DomainID);
                string url = String.Format("/{0}", galleryTitle);
                if (WebContentService.CheckSitemapUniqueUrl(url, galleryID, domainID))
                    return Json(new { success = false, error = "Please change the 'Gallery Title'. There is another page with the same URL already registered." });

                tbl_SiteMap section = WebContentService.SaveSiteMap(seoModel.R301, 1, 0, domainID, String.Empty, false, false, galleryTitle,
                    null, "0.5", String.Empty, galleryTitle, true, true, ContentType.Gallery, seoModel.Title, parent.SiteMapID, galleryID, (int)SiteMapType.Gallery, false, displayType);

                tbl_Content tContent = (section != null) ?
                        WebContentService.SaveContent(String.Empty, content, seoModel.Desc, 0, String.Empty, seoModel.Keywords, galleryTitle,
                            seoModel.MetaData, 0, String.Empty, String.Empty, String.Empty, seoModel.Title, String.Empty, false, section.SiteMapID, 0) :
                        null;

                tbl_Gallery gallery = GalleryService.SaveGallery(galleryTitle, live, customerID, galleryCategoryID, galleryID);

                return Json(new
                {
                    success = section != null && tContent != null && gallery != null,
                    galleryID = (gallery != null) ? gallery.GalleryID : 0,
                    contentID = (tContent != null) ? tContent.ContentID : 0
                });
            }
            return Json(new { success = false });
        }
Exemplo n.º 4
0
        public tbl_SiteMap SaveSiteMap(string R301, int languageID, int menuID, int domainID, string css, bool isMenu, bool isFooter, string menuText, DateTime? date,
            string spriority, string notifyEmail, string path, bool requiresApproval, bool isSiteMap, ContentType type, string siteMapName, int parentID, int siteMapID,
            int? typeID = null, bool isPredefined = false, MenuDisplayType menuDisplayType = MenuDisplayType.UnderParent, DateTime? publishDate = null)
        {
            decimal priority = 0;
            Decimal.TryParse(spriority, out priority);

            if (siteMapID > 0)
            {
                var sitemap = SitemapRepository.GetByID(siteMapID);
                if (sitemap != null && sitemap.SM_IsPredefined)
                {
                    isPredefined = true;
                    typeID = sitemap.SM_TypeID;
                }
            }

            return SitemapRepository.SaveSiteMap(R301, languageID, menuID, domainID, Sanitizer.GetSafeHtmlFragment(css), isMenu, isFooter,
                Sanitizer.GetSafeHtmlFragment(menuText), date, priority, Sanitizer.GetSafeHtmlFragment(notifyEmail), FriendlyUrl.CreateFriendlyUrl(path),
                requiresApproval, isSiteMap, type, Sanitizer.GetSafeHtmlFragment(siteMapName), parentID, siteMapID, typeID, isPredefined, (int)menuDisplayType, publishDate);
        }