示例#1
0
        public ActionResult AddSection(PageDetailsModel detailsModel, SEOFieldsModel seoModel, string content)
        {
            if (!ModelState.IsValid)
                return Json(new { success = false });

            tbl_SiteMap parent = WebContentService.GetSitemapByID(detailsModel.ParentID);
            string url = (parent != null ? parent.SM_URL : String.Empty) + "/" + detailsModel.Path.Trim('/');
            if (WebContentService.CheckSitemapUniqueUrl(url, detailsModel.SiteMapID, detailsModel.DomainID))
                return Json(new { success = false, error = "Please change 'Page URL'. There is another page with the same URL already registered." });

            tbl_SiteMap section = WebContentService.SaveSiteMap(seoModel.R301, 1, 0, detailsModel.DomainID, String.Empty, detailsModel.Menu,
                detailsModel.Footer, detailsModel.MenuText, null, seoModel.Priority, string.Empty, detailsModel.Path, true, seoModel.SiteMap,
                ContentType.Content, detailsModel.Name, detailsModel.TopLevel ? 0 : detailsModel.ParentID, 0);

            if (section != null && section.SM_URL == WebContentService.GetSitemapUrlByType(SiteMapType.ProductShop, this.DomainID))
                WebContentService.UpdateSitemapsParents(section.SiteMapID, ProductType.Item);
            else if (section != null && section.SM_URL == WebContentService.GetSitemapUrlByType(SiteMapType.EventShop, this.DomainID))
                WebContentService.UpdateSitemapsParents(section.SiteMapID, ProductType.Event);

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

            return Json(new
            {
                success = section != null && tContent != null,
                sectionID = (section != null) ? section.SiteMapID : 0,
                contentID = (tContent != null) ? tContent.ContentID : 0
            });
        }
示例#2
0
        public ActionResult AddProduct(ProductModel productModel, SEOFieldsModel seoModel)
        {
            if (ModelState.IsValid)
            {
                var category = ECommerceService.GetProdCategoryByID(productModel.CategoryID);
                if (category == null)
                    return Json(new { success = false });
                if (WebContentService.CheckSitemapUniqueUrl(ProductUrl(productModel, category), 0, productModel.DomainID))
                    return Json(new { success = false, error = "Please change 'Title'. There is another page with the same URL already registered." });

                SiteMapType sitemapType = productModel.ProductType == ProductType.Event ? SiteMapType.EventShop : SiteMapType.ProductShop;
                tbl_SiteMap section = WebContentService.SaveSiteMap(seoModel.R301, 1, 0, productModel.DomainID, String.Empty, false, false, seoModel.Title,
                    null, "0.5", String.Empty, String.Format("{0}/{1}", category.tbl_SiteMap.SM_URL, productModel.ProductTitle), true, true, ContentType.Product, seoModel.Title,
                    category.tbl_SiteMap.SiteMapID, 0, (int)sitemapType);

                tbl_Content tContent = section != null ? WebContentService.SaveContent(String.Empty, productModel.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_Products product = ECommerceService.SaveProduct(0, productModel.CategoryID, String.Empty, DateTime.UtcNow, 1, productModel.Offer, productModel.ProductCode,
                    null, String.Empty, productModel.TaxID == 0 ? (int?)null : productModel.TaxID, productModel.ProductTitle, productModel.Live, productModel.StockControl,
                    productModel.ProductType, productModel.EventTypeID, productModel.Deliverable, productModel.Purchasable, productModel.Featured, productModel.AffiliateLink, section.SiteMapID);

                return Json(new
                {
                    success = section != null && tContent != null && product != null,
                    productID = (product != null) ?
                        product.ProductID :
                        0,
                    contentID = (tContent != null) ?
                        tContent.ContentID :
                        0
                });
            }
            return Json(new { success = false });
        }
示例#3
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 });
        }
示例#4
0
        public ActionResult UpdatePortfolio(int domainID, string portfolioTitle, int portfolioCategoryID, bool live, SEOFieldsModel seoModel,
            string content, int portfolioID, bool showlink, string link)
        {
            if (ModelState.IsValid && portfolioID > 0)
            {
                var parent = WebContentService.GetSitemapByType(SiteMapType.Portfolio, this.DomainID);
                string url = String.Format("/{1}", portfolioTitle);
                if (WebContentService.CheckSitemapUniqueUrl(url, portfolioID, domainID))
                    return Json(new { success = false, error = "Please change the 'Portfolio 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, portfolioTitle,
                    null, "0.5", String.Empty, portfolioTitle, true, true, ContentType.Portfolio, seoModel.Title, parent.SiteMapID, portfolioID,
                    (int)SiteMapType.Portfolio, false, MenuDisplayType.UnderParent);

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

                tbl_Portfolio portfolio = PortfolioService.SavePortfolio(portfolioTitle, portfolioCategoryID, link, showlink, String.Empty, false, string.Empty, live, portfolioID);

                return Json(new
                {
                    success = section != null && tContent != null && portfolio != null,
                    portfolioID = (portfolio != null) ? portfolio.PortfolioID : 0,
                    contentID = (tContent != null) ? tContent.ContentID : 0
                });
            }
            return Json(new { success = false });
        }
示例#5
0
        public ActionResult UpdateNews(int domainID, string blogDate, SEOFieldsModel seoFields, string content, string tweet, int sitemapID, string blogPublishDate)
        {
            if (ModelState.IsValid && sitemapID != 0)
            {
                var date = blogDate.ParseDateTime();

                DateTime? publishDate = null;
                DateTime tryPublishDate;
                if(!String.IsNullOrEmpty(blogPublishDate))
                    if(DateTime.TryParse(blogPublishDate, out tryPublishDate))
                        publishDate = tryPublishDate;

                var url = String.Format("/{0}/{1}/{2}", date.Year, date.Month, seoFields.Title);
                if (WebContentService.CheckSitemapUniqueUrl(url, sitemapID, domainID))
                    return Json(new { success = false, error = "Please change 'Title'. There is another page with the same URL already registered." });

                var news = WebContentService.GetSitemapByUrl(WebContentService.GetSitemapUrlByType(SiteMapType.News, this.DomainID), domainID).FirstOrDefault();

                tbl_SiteMap section = WebContentService.SaveSiteMap(seoFields.R301, 1, 0, domainID, String.Empty, false, false, seoFields.Title,
                    date, "0.5", String.Empty, url, true, true, ContentType.Blog, seoFields.Title, news != null ? news.SiteMapID : 0, sitemapID, (int)SiteMapType.News, publishDate: publishDate);

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

                return Json(new
                {
                    success = section != null && tContent != null,
                    sectionID = (section != null) ?
                        section.SiteMapID :
                        0,
                    contentID = (tContent != null) ?
                        tContent.ContentID :
                        0
                });
            }
            return Json(new { success = false });
        }
示例#6
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 });
        }