Exemple #1
0
    public void BindMyWishList()
    {
        string         flagShowAll   = "0";
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

        aspxCommonObj.StoreID     = StoreID;
        aspxCommonObj.PortalID    = PortalID;
        aspxCommonObj.UserName    = UserName;
        aspxCommonObj.CultureName = CultureName;
        string modulePath             = this.AppRelativeTemplateSourceDirectory;
        string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName;
        string aspxRootPath           = ResolveUrl("~/");

        hst = AppLocalized.getLocale(modulePath);
        string               pageExtension = SageFrameSettingKeys.PageExtension;
        WishItemController   ctrl          = new WishItemController();
        List <WishItemsInfo> lstWishItem   = ctrl.GetRecentWishItemList(aspxCommonObj, flagShowAll,
                                                                        NoOfRecentAddedWishItems);
        StringBuilder recentWishList = new StringBuilder();

        recentWishList.Append("<div class=\"cssClassCommonSideBoxTable wishItem\">");
        if (lstWishItem != null && lstWishItem.Count > 0)
        {
            recentWishList.Append("<table class=\"cssClassMyWishItemTable\" id=\"tblWishItem\" width=\"100%\">");
            string myWishListLink = "";
            if (userFriendlyURL)
            {
                myWishListLink = WishListURL + pageExtension;
            }
            else
            {
                myWishListLink = WishListURL;
            }
            recentWishList.Append("<tbody>");
            for (int i = 0; i < lstWishItem.Count; i++)
            {
                string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + lstWishItem[i].ImagePath;
                if (string.IsNullOrEmpty(lstWishItem[i].ImagePath))
                {
                    imagePath = NoImageWishItemPath;
                }
                else
                {
                    //Resize Image Dynamically
                    InterceptImageController.ImageBuilder(lstWishItem[i].ImagePath, ImageType.Small, ImageCategoryType.Item, aspxCommonObj);
                }
                if (lstWishItem[i].AlternateText == "")
                {
                    lstWishItem[i].AlternateText = lstWishItem[i].ItemName;
                }
                var href = "";
                if (lstWishItem[i].CostVariantValueIDs == "")
                {
                    href = aspxRedirectPath + "item/" + lstWishItem[i].SKU + pageExtension;
                }
                else
                {
                    href = aspxRedirectPath + "item/" + lstWishItem[i].SKU + pageExtension + "?varId=" +
                           lstWishItem[i].CostVariantValueIDs;
                }
                StringBuilder dataContent = new StringBuilder();
                dataContent.Append("data-class=\"addtoCart\" data-type=\"button\" data-addtocart=\"");
                dataContent.Append("addtocart");
                dataContent.Append(lstWishItem[i].ItemID);
                dataContent.Append("\" data-title=\"");
                dataContent.Append(lstWishItem[i].ItemName);
                dataContent.Append("\" data-onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                dataContent.Append(lstWishItem[i].ItemID);
                dataContent.Append(",");
                dataContent.Append(lstWishItem[i].Price);
                dataContent.Append(",'");
                dataContent.Append(lstWishItem[i].SKU);
                dataContent.Append("',");
                dataContent.Append(1);
                dataContent.Append(",'");
                dataContent.Append(lstWishItem[i].IsCostVariantItem);
                dataContent.Append("',this);\"");
                if (i % 2 == 0)
                {
                    recentWishList.Append("<tr class=\"sfEven\" id=\"trWishItem_" + lstWishItem[i].ItemID +
                                          "\"><td class=\"cssClassWishItemDetails\">");
                    if (ShowWishedItemImage.ToLower() == "true")
                    {
                        recentWishList.Append("<a href =\"" + href + "\">");
                        recentWishList.Append("<div class=\"cssClassImage\"><img src=\"" + aspxRootPath +
                                              imagePath.Replace("uploads", "uploads/Small") + "\" alt=\"" +
                                              lstWishItem[i].AlternateText + "\"  title=\"" +
                                              lstWishItem[i].AlternateText +
                                              "\"/></div></a>");
                    }
                    if (lstWishItem[i].ItemCostVariantValue != "")
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "(" +
                                              lstWishItem[i].ItemCostVariantValue + ")" + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              decimal.Parse(lstWishItem[i].Price).ToString("N2") + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"wishItemsFront.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                    else
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              decimal.Parse(lstWishItem[i].Price).ToString("N2") + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"wishItemsFront.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                }
                else
                {
                    recentWishList.Append("<tr class=\"sfOdd\" id=\"trWishItem_" + lstWishItem[i].ItemID +
                                          "\"><td class=\"cssClassWishItemDetails\">");
                    if (ShowWishedItemImage.ToLower() == "true")
                    {
                        recentWishList.Append("<a href =\"" + href + "\">");
                        recentWishList.Append("<div class=\"cssClassImage\"><img src=\"" + aspxRootPath +
                                              imagePath.Replace("uploads", "uploads/Small") + "\" alt=\"" +
                                              lstWishItem[i].AlternateText + "\"  title=\"" +
                                              lstWishItem[i].AlternateText + "\"/></div></a>");
                    }
                    if (lstWishItem[i].ItemCostVariantValue != "")
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "(" +
                                              lstWishItem[i].ItemCostVariantValue + ")" + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              decimal.Parse(lstWishItem[i].Price).ToString("N2") + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"wishItemsFront.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                    else
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              decimal.Parse(lstWishItem[i].Price).ToString("N2") + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"wishItemsFront.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                }
            }
            recentWishList.Append("</tbody>");
            recentWishList.Append("</table>");
            recentWishList.Append("<div class=\"cssClassWishLink\">");
            recentWishList.Append("<a href=\"" + aspxRedirectPath + myWishListLink + "\" id=\"lnkGoToWishlist\">");
            recentWishList.Append("<span class=\"gowishlist\">" + getLocale("Go to Wishlist") + "</span></a>");
            recentWishList.Append("</div></div>");
        }
        else
        {
            recentWishList.Append("<tbody>");
            recentWishList.Append("<tr><td><span class=\"cssClassNotFound\">" + getLocale("Your Wishlist is empty!") +
                                  "</span></td></tr>");
            recentWishList.Append("</tbody>");
            recentWishList.Append("</table></div>");
        }

        ltrWishItem.Text = recentWishList.ToString();
    }
    public void BindMyWishList()
    {
        string         flagShowAll   = "0";
        decimal        rate          = 1;
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

        aspxCommonObj.StoreID     = StoreID;
        aspxCommonObj.PortalID    = PortalID;
        aspxCommonObj.UserName    = UserName;
        aspxCommonObj.CultureName = CultureName;
        StoreSettingConfig ssc            = new StoreSettingConfig();
        decimal            additionalCCVR = decimal.Parse(ssc.GetStoreSettingsByKey(StoreSetting.AdditionalCVR, aspxCommonObj.StoreID, aspxCommonObj.PortalID, aspxCommonObj.CultureName));
        string             MainCurrency   = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, aspxCommonObj.StoreID, aspxCommonObj.PortalID, aspxCommonObj.CultureName);

        if (HttpContext.Current.Session["CurrencyRate"] != null)
        {
            if (Session["CurrencyCode"].ToString() != MainCurrency)
            {
                decimal rate1 = decimal.Parse(Session["CurrencyRate"].ToString());
                rate = Math.Round(rate1 + (rate1 * additionalCCVR / 100), 4);
            }
            else
            {
                rate = decimal.Parse(Session["CurrencyRate"].ToString());
            }
        }
        string modulePath             = this.AppRelativeTemplateSourceDirectory;
        string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName;
        string aspxRootPath           = ResolveUrl("~/");

        hst = AppLocalized.getLocale(modulePath);
        string pageExtension             = SageFrameSettingKeys.PageExtension;
        List <WishItemsInfo> lstWishItem = AspxWishItemController.GetRecentWishItemList(aspxCommonObj, flagShowAll,
                                                                                        NoOfRecentAddedWishItems);
        StringBuilder recentWishList = new StringBuilder();

        recentWishList.Append("<div class=\"cssClassCommonSideBoxTable wishItem\">");
        if (lstWishItem != null && lstWishItem.Count > 0)
        {
            recentWishList.Append("<table class=\"cssClassMyWishItemTable\" id=\"tblWishItem\" width=\"100%\">");
            //recentWishList.Append("<thead><tr><td>");
            //recentWishList.Append("<h3><label ID=\"lblWishListTitle\" class=\"cssClassGowishlistHead\">");
            //recentWishList.Append("<span>" + getLocale("Last Added Items") + "</span><label></h3>");
            //recentWishList.Append("</td></tr></thead>");
            string myWishListLink = "";
            if (userFriendlyURL)
            {
                myWishListLink = WishListURL + pageExtension;
            }
            else
            {
                myWishListLink = WishListURL;
            }
            recentWishList.Append("<tbody>");
            for (int i = 0; i < lstWishItem.Count; i++)
            {
                string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + lstWishItem[i].ImagePath;
                if (string.IsNullOrEmpty(lstWishItem[i].ImagePath))
                {
                    imagePath = NoImageWishItemPath;
                }
                if (lstWishItem[i].AlternateText == "")
                {
                    lstWishItem[i].AlternateText = lstWishItem[i].ItemName;
                }
                var href = "";
                if (lstWishItem[i].CostVariantValueIDs == "")
                {
                    href = aspxRedirectPath + "item/" + lstWishItem[i].SKU + pageExtension;
                }
                else
                {
                    href = aspxRedirectPath + "item/" + lstWishItem[i].SKU + pageExtension + "?varId=" +
                           lstWishItem[i].CostVariantValueIDs;
                }

                if (i % 2 == 0)
                {
                    recentWishList.Append("<tr class=\"sfEven\" id=\"trWishItem_" + lstWishItem[i].ItemID +
                                          "\"><td class=\"cssClassWishItemDetails\">");
                    if (ShowWishedItemImage.ToLower() == "true")
                    {
                        recentWishList.Append("<a href =\"" + href + "\">");
                        recentWishList.Append("<div class=\"cssClassImage\"><img src=\"" + aspxRootPath +
                                              imagePath.Replace("uploads", "uploads/Small") + "\" alt=\"" +
                                              lstWishItem[i].AlternateText + "\"  title=\"" +
                                              lstWishItem[i].AlternateText +
                                              "\"/></div></a>");
                    }
                    if (lstWishItem[i].ItemCostVariantValue != "")
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "(" +
                                              lstWishItem[i].ItemCostVariantValue + ")" + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              Math.Round(decimal.Parse(lstWishItem[i].Price) * rate, 2) + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"WishItems.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                    else
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              Math.Round(decimal.Parse(lstWishItem[i].Price) * rate, 2) + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"WishItems.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                }
                else
                {
                    recentWishList.Append("<tr class=\"sfOdd\" id=\"trWishItem_" + lstWishItem[i].ItemID +
                                          "\"><td class=\"cssClassWishItemDetails\">");
                    if (ShowWishedItemImage.ToLower() == "true")
                    {
                        recentWishList.Append("<a href =\"" + href + "\">");
                        recentWishList.Append("<div class=\"cssClassImage\"><img src=\"" + aspxRootPath +
                                              imagePath.Replace("uploads", "uploads/Small") + "\" alt=\"" +
                                              lstWishItem[i].AlternateText + "\"  title=\"" +
                                              lstWishItem[i].AlternateText + "\"/></div></a>");
                    }
                    if (lstWishItem[i].ItemCostVariantValue != "")
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "(" +
                                              lstWishItem[i].ItemCostVariantValue + ")" + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              Math.Round(decimal.Parse(lstWishItem[i].Price) * rate, 2) + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"WishItems.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                    else
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              Math.Round(decimal.Parse(lstWishItem[i].Price) * rate, 2) + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"WishItems.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                }
            }
            recentWishList.Append("</tbody>");
            recentWishList.Append("</table>");
            recentWishList.Append("<div class=\"cssClassWishLink\">");
            recentWishList.Append("<a href=\"" + aspxRedirectPath + myWishListLink + "\" id=\"lnkGoToWishlist\">");
            recentWishList.Append("<span class=\"gowishlist\">" + getLocale("Go to Wishlist") + "</span></a>");
            recentWishList.Append("</div></div>");
        }
        else
        {
            recentWishList.Append("<tbody>");
            recentWishList.Append("<tr><td><span class=\"cssClassNotFound\">" + getLocale("Your Wishlist is empty!") +
                                  "</span></td></tr>");
            recentWishList.Append("</tbody>");
            recentWishList.Append("</table></div>");
        }

        ltrWishItem.Text = recentWishList.ToString();
    }