Example #1
0
        void btnAddExpert_Click(object sender, EventArgs e)
        {
            if (
                (this.txtFriendlyUrl.Text.Length > 0) &&
                (this.txtRealUrl.Text.Length > 0)
                )
            {
                if (WebPageInfo.IsPhysicalWebPage("~/" + txtFriendlyUrl.Text))
                {
                    this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning;
                    return;
                }

                if (FriendlyUrl.Exists(siteSettings.SiteId, txtFriendlyUrl.Text))
                {
                    this.lblError.Text = Resource.FriendlyUrlDuplicateWarning;
                    return;
                }

                FriendlyUrl url = new FriendlyUrl();
                url.SiteId   = siteSettings.SiteId;
                url.SiteGuid = siteSettings.SiteGuid;
                url.Url      = this.txtFriendlyUrl.Text;
                url.RealUrl  = this.txtRealUrl.Text;
                url.Save();

                WebUtils.SetupRedirect(this, Request.RawUrl);
            }
            else
            {
                this.lblError.Text = Resource.FriendlyUrlInvalidEntryMessage;
            }
        }
Example #2
0
        public async Task <IActionResult> AddItems(ManuallyNewItemsViewModel model)
        {
            if (ModelState.IsValid)
            {
                var   slug     = FriendlyUrl.GetFriendlyTitle(model.Name);
                Items newItems = new Items(model.Name, model.Price, model.Description, 0, @"temp", _categoryRepository.GetByName(model.Category), _sellerRepository.GetBySellerId(model.SellerId), model.Offer, slug, true);
                _itemsRepository.Add(newItems);
                _itemsRepository.SaveChanges();

                newItems.Image = @"images\items\" + newItems.ItemsId + @"\";
                _itemsRepository.SaveChanges();

                var filePath = @"wwwroot/images/items/" + newItems.ItemsId + "/thumb.jpg";
                Directory.CreateDirectory(Path.GetDirectoryName(filePath));
                var fileStream = new FileStream(filePath, FileMode.Create);
                await model.Thumbnail.CopyToAsync(fileStream);

                fileStream.Close();

                for (int i = 0; i < model.Image.Count; i++)
                {
                    filePath = @"wwwroot/images/items/" + newItems.ItemsId + "/Image/" + (i + 1) + ".jpg";
                    Directory.CreateDirectory(Path.GetDirectoryName(filePath));
                    fileStream = new FileStream(filePath, FileMode.Create);
                    await model.Image[i].CopyToAsync(fileStream);
                    fileStream.Close();
                }


                return(RedirectToAction("ItemsOverview"));
            }
            ViewData["category"] = new SelectList(_categoryRepository.GetAll().Select(c => c.Name));
            ViewData["offer"]    = Offer();
            return(View(nameof(AddItems), model));
        }
Example #3
0
        public tbl_ProductImages SaveImage(int productID, string description, string name, bool primary, string view)
        {
            var image = new tbl_ProductImages()
            {
                I_Description = description,
                I_Primary     = primary,
                I_View        = view
            };

            this.Create(image);
            this.Context.SaveChanges();

            image.I_Name = String.Format("{0}_{1}{2}", FriendlyUrl.CreateFriendlyUrl(Path.GetFileNameWithoutExtension(name)), image.ImageID, Path.GetExtension(name));

            var product = this.Context.Set <tbl_Products>().FirstOrDefault(p => p.ProductID == productID);

            if (product != null)
            {
                image.tbl_ProductImageLink.Add(new tbl_ProductImageLink {
                    PI_ProductID = product.ProductID, PI_ImageID = image.ImageID
                });
            }

            this.Context.SaveChanges();
            return(image);
        }
Example #4
0
        private void btnDelete_Click(Object sender, ImageClickEventArgs e)
        {
            if (lbPages.SelectedIndex > -1)
            {
                ContentMetaRespository metaRepository = new ContentMetaRespository();

                foreach (mojoSiteMapNode page in sitePages)
                {
                    if ((page.PageId.ToString() == lbPages.SelectedValue) && ((canEditAnything) || (WebUser.IsInRoles(page.EditRoles))))
                    {
                        if (WebConfigSettings.LogIpAddressForContentDeletions)
                        {
                            log.Info("user deleted page " + page.Url + " from ip address " + SiteUtils.GetIP4Address());
                        }

                        PageSettings pageSettings = new PageSettings(siteSettings.SiteId, page.PageId);
                        metaRepository.DeleteByContent(page.PageGuid);
                        Module.DeletePageModules(page.PageId);
                        PageSettings.DeletePage(page.PageId);
                        FriendlyUrl.DeleteByPageGuid(page.PageGuid);

                        mojoPortal.SearchIndex.IndexHelper.ClearPageIndexAsync(pageSettings);
                    }
                }

                CacheHelper.ResetSiteMapCache();

                WebUtils.SetupRedirect(this, Request.RawUrl);
            }
            else
            {
                // no page selected
                litWarning.Text = Resource.PagesNoSelectionWarning;
            }
        }
        private void btnDelete_Click(Object sender, ImageClickEventArgs e)
        {
            if (lbPages.SelectedIndex > -1)
            {
                foreach (CSiteMapNode page in sitePages)
                {
                    if ((page.PageId.ToString() == lbPages.SelectedValue) && ((canEditAnything) || (WebUser.IsInRoles(page.EditRoles))))
                    {
                        Module.DeletePageModules(page.PageId);
                        PageSettings.DeletePage(page.PageId);
                        FriendlyUrl.DeleteUrlByPageId(page.PageId);
                        PageSettings pageSettings = new PageSettings(siteSettings.SiteId, page.PageId);
                        IndexHelper.ClearPageIndexAsync(pageSettings);
                    }
                }

                CacheHelper.ResetSiteMapCache();

                WebUtils.SetupRedirect(this, Request.RawUrl);
            }
            else
            {
                // no page selected
                litWarning.Text = Resource.PagesNoSelectionWarning;
            }
        }
Example #6
0
        public tbl_Image SaveImage(int categoryID, string heading, string desc, int galleryID, short height, bool isCMS, int?order, string path, int?sitemapID, string name, short width, int?linkID = null)
        {
            var image = new tbl_Image()
            {
                I_CatID       = categoryID,
                I_InCMS       = isCMS,
                I_SitemapID   = sitemapID,
                I_Gallery     = galleryID,
                I_Description = desc,
                I_Heading     = heading,
                I_Height      = height,
                I_Order       = order,
                I_Path        = path,
                I_Width       = width,
                I_LinkID      = linkID
            };

            this.Create(image);
            this.Context.SaveChanges();

            //image.I_Thumb = String.Format("{0}{1}.{2}", FriendlyUrl.CreateFriendlyUrl(name.Split('.')[0]), image.ImageID, name.Split('.')[1]);
            image.I_Thumb = String.Format("{0}{1}.{2}", FriendlyUrl.CreateFriendlyUrl(Path.GetFileNameWithoutExtension(name)), image.ImageID, Path.GetExtension(name).Replace(".", ""));

            this.Context.SaveChanges();
            return(image);
        }
Example #7
0
        private void Reload()
        {
            var id  = ddlProducts.SelectedValue;
            var url = FriendlyUrl.Href("~/", "Order", id);

            Response.Redirect(url);
        }
Example #8
0
        private void BindForSearch()
        {
            using (IDataReader reader = FriendlyUrl.GetPage(
                       siteSettings.SiteId,
                       searchTerm,
                       pageNumber,
                       pageSize,
                       out totalPages))
            {
                if (this.totalPages > 1)
                {
                    string pageUrl = SiteRoot + "/Admin/UrlManager.aspx?pagenumber={0}&amp;s=" + Server.UrlEncode(searchTerm);

                    pgrFriendlyUrls.PageURLFormat = pageUrl;
                    pgrFriendlyUrls.ShowFirstLast = true;
                    pgrFriendlyUrls.CurrentIndex  = pageNumber;
                    pgrFriendlyUrls.PageSize      = pageSize;
                    pgrFriendlyUrls.PageCount     = totalPages;
                }
                else
                {
                    pgrFriendlyUrls.Visible = false;
                }

                dlUrlMap.DataSource = reader;
                dlUrlMap.DataBind();
            }
        }
Example #9
0
        public bool DeleteContent(string newsId)
        {
            try
            {
                SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();
                News         news         = new News(siteSettings.SiteId, Convert.ToInt32(newsId));

                if (news != null && news.NewsID != -1)
                {
                    NewsHelper.DeleteFolder(siteSettings.SiteId, news.NewsID);

                    ContentMedia.DeleteByContent(news.NewsGuid);

                    var listAtributes = ContentAttribute.GetByContentAsc(news.NewsGuid);
                    foreach (ContentAttribute item in listAtributes)
                    {
                        ContentLanguage.DeleteByContent(item.Guid);
                    }
                    ContentAttribute.DeleteByContent(news.NewsGuid);
                    ContentLanguage.DeleteByContent(news.NewsGuid);

                    news.Delete();
                    FriendlyUrl.DeleteByPageGuid(news.NewsGuid);

                    FileAttachment.DeleteByItem(news.NewsGuid);
                }
            }
            catch (Exception) { return(false); }

            return(true);
        }
Example #10
0
        public string AddPostToBlog(int moduleId, string username, Post post, bool publish)
        {
            Module   module = new Module(moduleId);
            SiteUser user   = new SiteUser(_siteSettings, username);
            ITransmorgifier <Post, Blog> postToBlog = new CreateBlog(_siteSettings, module, user);

            Blog blog = postToBlog.Transmorgify(post);

            blog.UserGuid             = user.UserGuid;
            blog.LastModUserGuid      = user.UserGuid;
            blog.ModuleId             = moduleId;
            blog.ModuleGuid           = module.ModuleGuid;
            blog.IncludeInFeed        = true;
            blog.AllowCommentsForDays = 90; // TODO [TO080506@2125] Doesn't look like there is a default value for this.

            //added 2009-08-30 by Joe Audette
            if ((post.dateCreated != null) && (post.dateCreated > DateTime.MinValue) && (post.dateCreated < DateTime.MaxValue))
            {
                if (!WebConfigSettings.DisableUseOfPassedInDateForMetaWeblogApi)
                {
                    blog.StartDate = post.dateCreated;
                }
            }


            // [TO080506@2135] Maybe this should be wrapped up in a transaction?

            // need to get the page id to use for real url mapping
            DataTable modulePages = Module.GetPageModulesTable(moduleId);
            int       pageId      = GetPageIdForModule(moduleId);

            string newUrl = FriendlyUrl.SuggestFriendlyUrl(blog.Title, _siteSettings);

            blog.ItemUrl         = "~/" + newUrl;
            blog.ContentChanged += new ContentChangedEventHandler(blog_ContentChanged);

            blog.Save();

            FriendlyUrl newFriendlyUrl = new FriendlyUrl();

            newFriendlyUrl.SiteId   = _siteSettings.SiteId;
            newFriendlyUrl.SiteGuid = _siteSettings.SiteGuid;
            newFriendlyUrl.PageGuid = blog.BlogGuid;
            newFriendlyUrl.Url      = newUrl;
            newFriendlyUrl.RealUrl  = "~/Blog/ViewPost.aspx?pageid="
                                      + pageId.ToString(CultureInfo.InvariantCulture)
                                      + "&mid=" + blog.ModuleId.ToString(CultureInfo.InvariantCulture)
                                      + "&ItemID=" + blog.ItemId.ToString(CultureInfo.InvariantCulture);

            if (pageId > -1)
            {
                newFriendlyUrl.Save();
            }

            AddCategoriesToBlog(blog, post.categories);

            SiteUtils.QueueIndexing();

            return(blog.ItemId.ToString());
        }
Example #11
0
        public void TestUI_FriendlyUrl_DecodesCorrectly()
        {
            const string expectedUrl = "100% true";
            const string originalUrl = "100%%20true";
            string       encodedUrl  = FriendlyUrl.FriendlyUrlDecode(originalUrl);

            Assert.AreEqual(expectedUrl, encodedUrl, "Unexpected encoding");
        }
Example #12
0
        //protected void ddlGameID_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    Reload();
        //}

        private void Reload()
        {
            //var id = ddlGameID.SelectedValue;
            //var url = FriendlyUrl.Href("~/GameProfile", id);
            var url = FriendlyUrl.Href("~/GameProfile");

            Response.Redirect(url);
        }
        public void TestUI_FriendlyUrl_EncodesCorrectly()
        {
            string originalUrl = "with space";
            string expectedUrl = "with+space";
            string encodedUrl  = FriendlyUrl.FriendlyUrlEncode(originalUrl);

            Assert.AreEqual(expectedUrl, encodedUrl, "Unexpected encoding");
        }
Example #14
0
        protected void Unnamed_Click1(object sender, EventArgs e)
        {
            LinkButton     btn       = (LinkButton)(sender);
            string         yourValue = btn.CommandArgument;
            IList <string> segments  = Request.GetFriendlyUrlSegments();

            Response.Redirect(FriendlyUrl.Href("~/Checkout/CheckoutReview/", int.Parse(segments[0]), int.Parse(segments[1]), yourValue));
        }
Example #15
0
        public override void DeleteContent(int moduleId, Guid moduleGuid)
        {
            Blog.DeleteByModule(moduleId);
            ContentMetaRespository metaRepository = new ContentMetaRespository();

            metaRepository.DeleteByModule(moduleGuid);

            FriendlyUrl.DeleteByPageGuid(moduleGuid);
        }
Example #16
0
        public tbl_GalleryTags SaveTag(string title, bool isImageTag, int tagID)
        {
            if (String.IsNullOrEmpty(title))
            {
                return(null);
            }

            return(this.GalleryTagRepository.SaveTag(title, FriendlyUrl.CreateFriendlyUrl(title).Replace("/", ""), isImageTag, tagID));
        }
Example #17
0
        //////Grid methods
        //-RowDeleting
        //-RowEditing
        //-RowCancelingEdit
        //-RowUpdating
        //-RowCommand

        //Row Deleting
        protected void ItemListTable_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //Index of grid recuperation
            int productID = Convert.ToInt32(ItemListTable.Rows[e.RowIndex].Cells[1].Text);

            var urlF = FriendlyUrl.Href("/UL/Admin/DetailPageAdmin", productID);

            Response.Redirect(ConfigurationManager.AppSettings["SecurePath"] + urlF);
        }
Example #18
0
        private void Reload()
        {
            var id  = ddlrefSelect.SelectedValue; //this where try passing session state to here???
            var url = FriendlyUrl.Href("~/RefereeProfile", id);

            Response.Redirect(url);

            //var id = ddlrefSelect.SelectedValue;
            //Response.Redirect("~/RefereeProfile/" + id);
        }
Example #19
0
        public void DeleteBlogPost(int postId)
        {
            Blog blog = new Blog(postId);

            blog.ContentChanged += new ContentChangedEventHandler(blog_ContentChanged);
            blog.Delete();
            FriendlyUrl.DeleteByPageGuid(blog.BlogGuid);

            SiteUtils.QueueIndexing();
        }
Example #20
0
        public static FriendlyUrl GetFriendlyUrlByUrl(string friendlyUrl)
        {
            FriendlyUrl page = null;

            using (var ctx = new FriendlyUrlEntities())
            {
                page = ctx.FriendlyUrls.SingleOrDefault(c => c.FriendlyUrl1 == friendlyUrl);
            }

            return(page);
        }
Example #21
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //LinkButton btn = (LinkButton)(sender);
            //string yourValue = btn.CommandArgument;
            string myValue = TextBox1.Text;

            if (myValue != "")
            {
                Response.Redirect(FriendlyUrl.Href("~/ProductList/", 0, myValue));
            }
        }
Example #22
0
        protected void TextBox1_TextChanged(object sender, EventArgs e)
        {
            string yourValue = Server.HtmlEncode(TextBox1.Text);

            if (yourValue != "")
            {
                Response.Redirect(FriendlyUrl.Href("~/ProductList/", 0, yourValue));
            }

            Response.Redirect(FriendlyUrl.Href("~/ProductList/"));
        }
Example #23
0
        /// <summary>
        /// Validate the model
        /// </summary>
        /// <param name="context">the validation context</param>
        /// <returns></returns>
        public IEnumerable <ValidationResult> Validate(ValidationContext context)
        {
            var localizedResourceService = HostContainer.GetInstance <IEzCMSLocalizedResourceService>();

            /*
             * Check if friendly url is valid or not
             *  - Check if friendly url is match with other friendly url or not
             *  - Check if friendly url is match with other application routes or not
             */
            FriendlyUrl = string.IsNullOrWhiteSpace(FriendlyUrl) ? Title.ToUrlString() : FriendlyUrl.ToUrlString();
            if (_pageService.IsFriendlyUrlExisted(Id, FriendlyUrl))
            {
                yield return
                    (new ValidationResult(
                         localizedResourceService.T("Page_Message_ExistingFriendlyUrl"), new[] { "FriendlyUrl" }));
            }
            else if (!FriendlyUrl.IsFriendlyUrlValid())
            {
                yield return(new ValidationResult(localizedResourceService.T("Page_Message_FriendlyUrlMatchApplicationRoute"), new[] { "FriendlyUrl" }));
            }

            if (_pageService.IsHomepageOffline(Id, Status))
            {
                yield return(new ValidationResult(localizedResourceService.T("Page_Message_InvalidHomePageStatus"), new[] { "Status" }));
            }

            /*Can only choose 1 type of template*/
            if (PageTemplateId.HasValue && FileTemplateId.HasValue)
            {
                yield return(new ValidationResult(localizedResourceService.T("Page_Message_MultipleTemplates"), new[] { "PageTemplateId", "FileTemplateId" }));
            }

            if (IsWordContent)
            {
                if (File == null)
                {
                    yield return
                        (new ValidationResult(
                             localizedResourceService.T("Page_Message_WordFileMissing"), new[] { "File" }));
                }
                else
                {
                    if (!FileUtilities.GetMimeMapping("docx").Equals(File.ContentType))
                    {
                        yield return
                            (new ValidationResult(
                                 localizedResourceService.T("Page_Message_WordFileWrongType"), new[] { "File" }));
                    }
                }
            }
        }
Example #24
0
    public void InsertParentItem()
    {
        this.menuTop.Items.Clear();
        //ChucNang cn = new ChucNang();
        //DataSet ds = cn.GetChucNangByUser(Page.User.Identity.Name);
        //if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
        //{
        RadMenuItem chucNang = new RadMenuItem();

        chucNang.Value       = "1";
        chucNang.Text        = "Các danh mục";
        chucNang.NavigateUrl = "";
        this.menuTop.Items.Add(chucNang);
        InsertChildItem(chucNang);

        RadMenuItem cnQLBenhNhan = new RadMenuItem();

        cnQLBenhNhan.Value       = "2";
        cnQLBenhNhan.Text        = "Quản lý bệnh nhân";
        cnQLBenhNhan.NavigateUrl = "";
        this.menuTop.Items.Add(cnQLBenhNhan);
        InsertChildItemBN(cnQLBenhNhan);

        RadMenuItem chucNangCon5 = new RadMenuItem();

        chucNangCon5.Value       = Constant_Table.MEDICINE_DELIVERY;
        chucNangCon5.Text        = "Nhật ký cấp phát thuốc";
        chucNangCon5.NavigateUrl = FriendlyUrl.Href("~/list", Constant_Table.MEDICINE_DELIVERY).ToLower();
        this.menuTop.Items.Add(chucNangCon5);

        RadMenuItem chucNangCon6 = new RadMenuItem();

        chucNangCon6.Value       = Constant_Table.MEDICINE_PLAN;
        chucNangCon6.Text        = "Lập dự trù thuốc";// +Constant_Table.MEDICINE_PLAN;
        chucNangCon6.NavigateUrl = FriendlyUrl.Href("~/list", Constant_Table.MEDICINE_PLAN).ToLower();
        this.menuTop.Items.Add(chucNangCon6);


        RadMenuItem chucNangCon13 = new RadMenuItem();

        chucNangCon13.Value       = Constant_Table.WAREHOUSE;
        chucNangCon13.Text        = "Tồn kho tại từng phòng khám"; //+Constant_Table.WAREHOUSE;
        chucNangCon13.NavigateUrl = FriendlyUrl.Href("~/list", Constant_Table.WAREHOUSE).ToLower();
        this.menuTop.Items.Add(chucNangCon13);

        if (htCheckMenu != null)
        {
            htCheckMenu.Clear();
            htCheckMenu = null;
        }
    }
Example #25
0
        protected void Unnamed_Click1(object sender, EventArgs e)
        {
            LinkButton btn       = (LinkButton)(sender);
            string     yourValue = btn.CommandArgument;

            int myOrderId = Int32.Parse(yourValue);

            using (ProductContext db = new ProductContext())
            {
                var myShippingId = db.OrderShippings.Where(en => en.OrderId == myOrderId && en.Shipping.SType == SType.Billing).Select(en => en.ShippingId).FirstOrDefault();

                Response.Redirect(FriendlyUrl.Href("~/Admin/Shippings/Default", 0, myShippingId));
            }
        }
Example #26
0
 public ActionResult Create(FriendlyUrl url)
 {
     try
     {
         using (var db = new FriendlyUrlEntities())
         {
             db.FriendlyUrls.Add(url);
             db.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Example #27
0
 public ActionResult Edit(int id, FriendlyUrl link)
 {
     try
     {
         using (var db = new FriendlyUrlEntities())
         {
             db.Entry(link).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch
     {
         return(View());
     }
 }
Example #28
0
        private void btnAddFriendlyUrl_Click(object sender, EventArgs e)
        {
            if (this.txtFriendlyUrl.Text.Length > 0)
            {
                if (WebPageInfo.IsPhysicalWebPage("~/" + txtFriendlyUrl.Text))
                {
                    this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning;
                    return;
                }

                if (FriendlyUrl.Exists(siteSettings.SiteId, txtFriendlyUrl.Text))
                {
                    this.lblError.Text = Resource.FriendlyUrlDuplicateWarning;
                    return;
                }

                if (FriendlyUrl.Exists(siteSettings.SiteId, txtFriendlyUrl.Text.ToLower()))
                {
                    this.lblError.Text = Resource.FriendlyUrlDuplicateWarning;
                    return;
                }

                FriendlyUrl url = new FriendlyUrl();
                url.SiteId   = siteSettings.SiteId;
                url.SiteGuid = siteSettings.SiteGuid;

                int pageId = -1;
                if (int.TryParse(ddPages.SelectedValue, out pageId))
                {
                    if (pageId > -1)
                    {
                        PageSettings page = new PageSettings(siteSettings.SiteId, pageId);
                        url.PageGuid = page.PageGuid;
                    }
                }

                url.Url     = this.txtFriendlyUrl.Text;
                url.RealUrl = "Default.aspx?pageid=" + ddPages.SelectedValue;
                url.Save();

                WebUtils.SetupRedirect(this, Request.RawUrl);
            }
            else
            {
                this.lblError.Text = Resource.FriendlyUrlInvalidFriendlyUrlMessage;
            }
        }
Example #29
0
    protected void item_dataBound(object sender, ListViewItemEventArgs e)
    {
        var item = e.Item as ListViewDataItem;

        if (item == null)
        {
            return;
        }

        var product = item.DataItem as CategoryAssignedProduct;

        if (product != null)
        {
            var imgProd       = item.FindControl("imgProduct") as Image;
            var descProduct   = item.FindControl("descProduct") as HtmlGenericControl;
            var priceProduct  = item.FindControl("priceProduct") as HtmlGenericControl;
            var linkDettaglio = item.FindControl("lnkDettaglio_1") as HtmlAnchor;

            // Immagine
            //if (imgProd != null && product.imageurl != null) imgProd.ImageUrl = string.Format("../Handler.ashx?UrlFoto={0}&W_=215&H_=215", (product.imageurl));
            // if (imgProd != null && product.imageurl != null) imgProd.ImageUrl = product.imageurl;
            var imageName = Helper.GetImageName(product.imageurl);
            if (imgProd != null && imageName != null)
            {
                imgProd.ImageUrl = string.Format("{0}{1}", "~/Design/Images/Prodotti/", imageName);
            }
            // Descrizione
            if (descProduct != null && product.name != null)
            {
                descProduct.InnerHtml = Helper.GetShortString(product.name, 132);
            }
            // Prezzo
            if (priceProduct != null && product.price != null)
            {
                priceProduct.InnerHtml = Helper.FormatCurrency(product.price);
            }
            // Link pagina dettaglio

            if (linkDettaglio != null && product.name != null)
            {
                linkDettaglio.HRef = FriendlyUrl.Href("~/Design", "Dettaglio", CategoryName, product.product_id, product.name.Replace(" ", "-").TrimEnd('-').ToLowerInvariant());
            }

            SetItemStyleAttributes(item);
        }
    }
Example #30
0
 private void UpdateChild(tbl_SiteMap parent)
 {
     foreach (var item in DbSet.Where(s => !s.SM_Deleted && s.SM_ParentID == parent.SiteMapID))
     {
         if (item.IsType(ContentType.Product))
         {
             item.SM_URL  = FriendlyUrl.CreateFriendlyUrl(String.Format("{0}/{1}", parent.SM_URL, item.tbl_Products.P_Title));
             item.SM_Path = item.SM_URL.Trim('/');
         }
         else if (item.IsType(ContentType.Category))
         {
             item.SM_URL  = FriendlyUrl.CreateFriendlyUrl(String.Format("{0}/{1}", parent.SM_URL, item.tbl_ProdCategories.PC_Title));
             item.SM_Path = item.SM_URL.Trim('/');
             UpdateChild(item);
         }
     }
 }