本文整理汇总了C#中XmlTextWriter.WriteCData方法的典型用法代码示例。如果您正苦于以下问题:C# XmlTextWriter.WriteCData方法的具体用法?C# XmlTextWriter.WriteCData怎么用?C# XmlTextWriter.WriteCData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlTextWriter
的用法示例。
在下文中一共展示了XmlTextWriter.WriteCData方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetItemRssFeedContents
private void GetItemRssFeedContents(AspxCommonInfo aspxCommonObj, XmlTextWriter rssXml, string pageURL,int count)
{
try
{
string noImageUrl = string.Empty;
StoreSettingConfig ssc = new StoreSettingConfig();
noImageUrl = ssc.GetStoreSettingsByKey(StoreSetting.DefaultProductImageURL, aspxCommonObj.StoreID,
aspxCommonObj.PortalID, aspxCommonObj.CultureName);
string[] path = pageURL.Split('?');
string pagepath = path[0];
string x = HttpContext.Current.Request.ApplicationPath;
string authority = HttpContext.Current.Request.Url.Authority;
string pageUrl = authority + x;
ServiceItemController sic = new ServiceItemController();
List<ServiceItemRss> itemRss = sic.GetServiceTypeRssFeedContent(aspxCommonObj, count);
if (itemRss.Count > 0)
{
foreach (ServiceItemRss rssItemData in itemRss)
{
string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + rssItemData.ImagePath;
if (rssItemData.ImagePath != "")
{
//Resize Image Dynamically
InterceptImageController.ImageBuilder(rssItemData.ImagePath, ImageType.Small, ImageCategoryType.Item, aspxCommonObj);
}
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", rssItemData.ServiceName);
rssXml.WriteElementString("link",
"http://" + pageUrl + "/service/" + rssItemData.ServiceName +
SageFrameSettingKeys.PageExtension);
rssXml.WriteStartElement("description");
var description = "";
if (rssItemData.ImagePath == "")
{
imagePath = noImageUrl;
}
description = "<div><a href=http://" + pageUrl + "/service/" + rssItemData.ServiceName +
SageFrameSettingKeys.PageExtension + "><img src=http://" + pageUrl + "/" +
imagePath.Replace("uploads", "uploads/Small") + " alt=" + rssItemData.ServiceName + " /> </a></div>";
description += "</br>" + HttpUtility.HtmlDecode(rssItemData.ShortDescription);
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteElementString("pubDate", rssItemData.AddedOn);
rssXml.WriteEndElement();
}
}
else
{
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", "");
rssXml.WriteElementString("link", "");
rssXml.WriteStartElement("description");
var description = "";
description = "<div><h2><span>This store has no items listed yet!</span></h2></div>";
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteEndElement();
}
}
catch (Exception ex)
{
throw ex;
}
}
示例2: GetBrandRssFeedContent
private void GetBrandRssFeedContent(AspxCommonInfo aspxCommonObj, XmlTextWriter rssXml, string pageURL, string rssOption, int count)
{
try
{
string[] path = pageURL.Split('?');
string pagepath = path[0];
string x = HttpContext.Current.Request.ApplicationPath;
string authority = HttpContext.Current.Request.Url.Authority;
string pageUrl = authority + x;
List<RssFeedBrand> brandRssContent = AspxRssFeedProvider.GetBrandRssContent(aspxCommonObj, rssOption, count);
foreach (RssFeedBrand rssFeedBrand in brandRssContent)
{
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", rssFeedBrand.BrandName);
rssXml.WriteElementString("link",
"http://" + pageUrl + "/brand/" + rssFeedBrand.BrandName + SageFrameSettingKeys.PageExtension);
rssXml.WriteStartElement("description");
string description = "";
description += "<div>";
description += "<div><a href=http://" + pageUrl + "/brand/" + rssFeedBrand.BrandName + SageFrameSettingKeys.PageExtension + ">";
string[] brandURL = rssFeedBrand.BrandImageUrl.Split('/');
string brandImage = brandURL[brandURL.Length - 1];
if (brandImage != "")
{
//Resize Image Dynamically
InterceptImageController.ImageBuilder(brandImage, ImageType.Small, ImageCategoryType.Brand, aspxCommonObj);
}
description += "<img src=http://" + pageUrl + "/" + rssFeedBrand.BrandImageUrl.Replace("uploads", "uploads/Small") + " />";
description += "</a></div>";
description += "<p>" + HttpUtility.HtmlDecode(rssFeedBrand.BrandDescription) + "</p>";
description += "</div>";
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteElementString("pubDate", rssFeedBrand.AddedOn);
rssXml.WriteEndElement();
}
}
catch (Exception ex)
{
throw ex;
}
}
示例3: GenerateFeed
//.........这里部分代码省略.........
if (userId > 0)
{
#region loop for multiple entry
foreach (GetTributesFeed tribute in _objTributeList)
{
strDates = string.Empty;
string strObituaryText = string.Empty;
//_tributeURL = "http://" + objVal.TypeDescription.ToLower() + "." + WebConfig.TopLevelDomain + "/" + objVal.TributeUrl;
//_tributeHomeUrl = WebConfig.AppBaseDomain + tribute.TributeUrl + "/";
_tributeHomeUrl = "http://" + tribute.TypeDescription.ToLower() + "." + WebConfig.TopLevelDomain + "/" + tribute.TributeUrl + "/";
_tributeImageUrl = virtualDir[2] + tribute.TributeImage.ToString();
if (!(string.IsNullOrEmpty(tribute.DOB)))
{
DOB = DateTime.Parse(tribute.DOB.ToString());
strDates = DOB.ToShortDateString() + " - ";
}
if (!(string.IsNullOrEmpty(tribute.DOD)))
{
DOD = DateTime.Parse(tribute.DOD);
strDates = strDates + DOD.ToShortDateString();
//strDates = strDates + DOD.ToString("dd MMMM yyyy");
}
strObituaryText = CleanMessage(tribute.MessageWithoutHtml.ToString());
if (strObituaryText.Length > 250)
{
strObituaryText = strObituaryText.Substring(0, 250) + "...";
}
#region item entry tag
xmlTextObject.WriteStartElement("entry");
xmlTextObject.WriteElementString("title", tribute.TributeName);
xmlTextObject.WriteElementString("published", tribute.DOD.ToString());
if (tribute.ModifiedDate != null)
{
xmlTextObject.WriteElementString("updated", tribute.ModifiedDate.ToString());
}
else
{
xmlTextObject.WriteElementString("updated", tribute.StartDate.ToString());
}
xmlTextObject.WriteStartElement("catagory");
xmlTextObject.WriteAttributeString("term", "Obituaries");
xmlTextObject.WriteEndElement();
xmlTextObject.WriteElementString("id", tribute.TributeId.ToString());
xmlTextObject.WriteStartElement("summary");
//xmlTextObject.WriteStartElement("summary", "<![CDATA[<div><img width='120' height='120' src=" + _tributeImageUrl + " alt='memorial_TributePhoto.jpg' title='memorial_TributePhoto.jpg' style='float:left;'/><span style='margin-left:150px;'><p>" + strDates + "</p>" + strObituaryText);
xmlTextObject.WriteAttributeString("type", "html");
xmlTextObject.WriteCData("<img height='120' src='" + _tributeImageUrl + "' alt='memorial_TributePhoto.jpg' title='memorial_TributePhoto.jpg' style='float:left; margin-right:20px;'/><span style='margin-left:150px;'><p>" + strDates + "</p>" + strObituaryText);
xmlTextObject.WriteEndElement();
xmlTextObject.WriteStartElement("content");
//xmlTextObject.WriteElementString("content", "<![CDATA[<p><iframe src=" + _tributeHomeUrl + " name='frame1' scrolling='auto' frameborder='no' align='center' height = '1100px' width = '962px'><br /></iframe></p>]]>");
xmlTextObject.WriteCData("<p><center><iframe src=" + _tributeHomeUrl + " name='frame1' scrolling='auto' frameborder='no' align='center' height = '1100px' width = '962px'><br /></iframe></center></p>");
xmlTextObject.WriteEndElement();
xmlTextObject.WriteEndElement();
#endregion
//}
}
#endregion
}
else
{
# region for each entry
foreach (GetTributesFeed tribute in _objTributeList)
{
strDates = string.Empty;
string strObituaryText = string.Empty;
_tributeHomeUrl = "http://" + tribute.TypeDescription.ToLower() + "." + WebConfig.TopLevelDomain + "/" + tribute.TributeUrl + "/";
_tributeImageUrl = virtualDir[2] + tribute.TributeImage.ToString();
if (!(string.IsNullOrEmpty(tribute.DOB)))
{
DOB = DateTime.Parse(tribute.DOB.ToString());
strDates = DOB.ToShortDateString() + " - ";
}
if (!(string.IsNullOrEmpty(tribute.DOD)))
{
DOD = DateTime.Parse(tribute.DOD);
strDates = strDates + DOD.ToShortDateString();
//strDates = strDates + DOD.ToString("dd MMMM yyyy");
}
strObituaryText = CleanMessage(tribute.MessageWithoutHtml.ToString());
#region item entry tag
xmlTextObject.WriteStartElement("entry");
xmlTextObject.WriteElementString("PersonsName", tribute.TributeName);
xmlTextObject.WriteElementString("PersonsPhoto", _tributeImageUrl);
xmlTextObject.WriteElementString("ObituaryText", strObituaryText);
xmlTextObject.WriteElementString("DeathDate", tribute.DOD.ToString());
xmlTextObject.WriteElementString("TributeLink", _tributeHomeUrl);
xmlTextObject.WriteElementString("FuneralHomeIdentifier", tribute.UserId.ToString());
xmlTextObject.WriteEndElement();
#endregion
}
#endregion
}
示例4: GetNewItemTagRssFeedContent
private void GetNewItemTagRssFeedContent(AspxCommonInfo aspxCommonObj, XmlTextWriter rssXml, string pageURL, string rssOption, int count)
{
try
{
string noImageUrl = string.Empty;
StoreSettingConfig ssc = new StoreSettingConfig();
noImageUrl = ssc.GetStoreSettingsByKey(StoreSetting.DefaultProductImageURL, aspxCommonObj.StoreID,
aspxCommonObj.PortalID, aspxCommonObj.CultureName);
string[] path = pageURL.Split('?');
string pagepath = path[0];
string x = HttpContext.Current.Request.ApplicationPath;
string authority = HttpContext.Current.Request.Url.Authority;
string pageUrl = authority + x;
List<RssFeedNewTag> popularTagRss = AspxRssFeedProvider.GetNewTagsRssContent(aspxCommonObj, rssOption, count);
foreach (RssFeedNewTag rssItemData in popularTagRss)
{
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", rssItemData.TagName);
rssXml.WriteElementString("link",
"http://" + pageUrl + "/tagsitems/tags" +
SageFrameSettingKeys.PageExtension + "?tagsId=" + rssItemData.TagIDs + "");
rssXml.WriteStartElement("description");
var description = "";
description += "<div><h2>Tag Name: " + rssItemData.TagName + "</h2></br><h2><span>Tag Status: " +
rssItemData.TagStatus +
"</span></h2><ul style=list-style-type: none><h2> Taged Item:</h2>";
foreach (var tagItemInfo in rssItemData.TagItemInfo)
{
string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + tagItemInfo.ImagePath;
if (tagItemInfo.ImagePath == "")
{
imagePath = noImageUrl;
}
else
{ //Resize Image Dynamically
InterceptImageController.ImageBuilder(tagItemInfo.ImagePath, ImageType.Small, ImageCategoryType.Item, aspxCommonObj);
}
description += "<li style=\"float: left;display: inline;padding-right: 50px\"><h2>" +
tagItemInfo.ItemName + "</h2><a href=http://" + pageUrl + "/item/" +
tagItemInfo.SKU + SageFrameSettingKeys.PageExtension + "><img alt=" +
tagItemInfo.ItemName + " src=http://" + pageUrl + "/" +
imagePath.Replace("uploads", "uploads/Small") + " /></a></li>";
}
description += "</ul></div>";
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteElementString("pubDate", rssItemData.AddedOn);
rssXml.WriteEndElement();
}
}
catch (Exception ex)
{
throw ex;
}
}
示例5: GetLowStockItemRssFeedContent
private void GetLowStockItemRssFeedContent(AspxCommonInfo aspxCommonObj, XmlTextWriter rssXml, string pageURL, string rssOption, int count)
{
try
{
string noImageUrl = string.Empty;
StoreSettingConfig ssc = new StoreSettingConfig();
noImageUrl = ssc.GetStoreSettingsByKey(StoreSetting.DefaultProductImageURL, aspxCommonObj.StoreID,
aspxCommonObj.PortalID, aspxCommonObj.CultureName);
string[] path = pageURL.Split('?');
string pagepath = path[0];
string x = HttpContext.Current.Request.ApplicationPath;
string authority = HttpContext.Current.Request.Url.Authority;
string pageUrl = authority + x;
List<RssFeedLowStock> bestSellItemRss = AspxRssFeedProvider.GetLowStockItemRssContent(aspxCommonObj, rssOption, count);
foreach (RssFeedLowStock rssItemData in bestSellItemRss)
{
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", rssItemData.ItemName);
rssXml.WriteElementString("link",
"http://" + pageUrl + "/item/" + rssItemData.SKU +
SageFrameSettingKeys.PageExtension);
rssXml.WriteStartElement("description");
string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + rssItemData.ImagePath;
if (rssItemData.ImagePath == "")
{
imagePath = noImageUrl;
}
else
{ //Resize Image Dynamically
InterceptImageController.ImageBuilder(rssItemData.ImagePath, ImageType.Small, ImageCategoryType.Item, aspxCommonObj);
}
var description = "";
description = "<div><a href=http://" + pageUrl + "/item/" + rssItemData.SKU +
SageFrameSettingKeys.PageExtension + "><img alt=" +
rssItemData.ItemName + " src=http://" + pageUrl + "/" +
imagePath.Replace("uploads", "uploads/Small") + " /> </a>";
description += "<div class=\"itemTable\"><table width=\"20%\">";
description += "<tr><td><h2>Price: </h2>" + rssItemData.Price + "</td><td><h2>Quantity: </h2>" +
rssItemData.Quantity + "</td></tr>";
description += "<tr><td><h2>Status: </h2>" + rssItemData.Status + "</td><td></td></tr>";
description += "</table></div>";
description += "</div>";
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteElementString("pubDate", "");
rssXml.WriteEndElement();
}
}
catch (Exception ex)
{
throw ex;
}
}
示例6: GetNewCustomerRssFeedContent
private void GetNewCustomerRssFeedContent(AspxCommonInfo aspxCommonObj, XmlTextWriter rssXml, string pageURL, string rssOption, int count)
{
try
{
string[] path = pageURL.Split('?');
string pagepath = path[0];
string x = HttpContext.Current.Request.ApplicationPath;
string authority = HttpContext.Current.Request.Url.Authority;
string pageUrl = authority + x;
List<RssFeedNewCustomer> categoryRss = AspxRssFeedProvider.GetNewCustomerRssFeedContent(aspxCommonObj, rssOption, count);
foreach (RssFeedNewCustomer rssItemData in categoryRss)
{
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", rssItemData.UserName);
rssXml.WriteElementString("link", "");
rssXml.WriteStartElement("description");
var description = "<div><ul>";
description += "<li><h2>UserName: " + rssItemData.UserName + "</h2></li>";
description += "<li><h2>Customer Name: " + rssItemData.CustomerName + "</h2></li>";
description += "<li><h2>Customer Email: " + rssItemData.Email + "</h2></li>";
description += "<li><h2>Registered On: " + rssItemData.AddedOn + "</h2></li>";
description += "</ul></div>";
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteElementString("pubDate", " ");
rssXml.WriteEndElement();
}
}
catch (Exception ex)
{
throw ex;
}
}
示例7: GetNewOrderRssFeedContent
private void GetNewOrderRssFeedContent(AspxCommonInfo aspxCommonObj, XmlTextWriter rssXml, string pageURL, string rssOption, int count)
{
try
{
string noImageUrl = string.Empty;
StoreSettingConfig ssc = new StoreSettingConfig();
noImageUrl = ssc.GetStoreSettingsByKey(StoreSetting.DefaultProductImageURL, aspxCommonObj.StoreID,
aspxCommonObj.PortalID, aspxCommonObj.CultureName);
string[] path = pageURL.Split('?');
string pagepath = path[0];
string x = HttpContext.Current.Request.ApplicationPath;
string authority = HttpContext.Current.Request.Url.Authority;
string pageUrl = authority + x;
List<RssFeedNewOrders> popularTagRss = AspxRssFeedProvider.GetNewOrdersRssContent(aspxCommonObj,
rssOption, count);
foreach (RssFeedNewOrders rssItemData in popularTagRss)
{
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", "");
rssXml.WriteElementString("link", " ");
rssXml.WriteStartElement("description");
var description = "";
description += "<div><table width=\"100%\"><tr><td colspan=\"2\">OrderID:" + rssItemData.OrderID + "</td></tr>";
description += "<tr><td>Order Date: " + rssItemData.AddedOn + "</td><td>Order Status: " + rssItemData.OrderStatus + "</td></tr>";
description += "<tr><td>Store Name: " + rssItemData.StoreName + "</td><td>Customer Name: " + rssItemData.CustomerName + "</td></tr>";
description += "<tr><td>Grand Total: " + rssItemData.GrandTotal + "</td><td>Payment Method Name: " + rssItemData.PaymentMethodName + "</td></tr>";
description += "</table></div>";
description += "<div><ul style=list-style-type: none><h2> Ordered Items:</h2>";
foreach (var orderItemInfo in rssItemData.OrderItemInfo)
{
if (orderItemInfo.ImagePath == "")
{
orderItemInfo.ImagePath = noImageUrl;
}
else
{ //Resize Image Dynamically
InterceptImageController.ImageBuilder(orderItemInfo.ImagePath, ImageType.Small, ImageCategoryType.Item, aspxCommonObj);
}
description += "<li style=\"float: left;display: inline;padding-right: 50px\"><h2>" +
orderItemInfo.ItemName + "</h2><a href=http://" + pageUrl + "/item/" +
orderItemInfo.SKU + SageFrameSettingKeys.PageExtension + "><img alt=" +
orderItemInfo.ItemName + " src=http://" + pageUrl + "/" +
orderItemInfo.ImagePath.Replace("uploads", "uploads/Small") + " /></a></li>";
}
description += "</ul></div>";
rssXml.WriteCData(description);
rssXml.WriteEndElement();
// rssXml.WriteElementString("pubDate", rssItemData.AddedOn);
rssXml.WriteElementString("pubDate", "");
rssXml.WriteEndElement();
}
}
catch (Exception ex)
{
throw ex;
}
}
示例8: BindLatestItemRss
private void BindLatestItemRss(List<LatestItemRssInfo> lstLatestItemRss, AspxCommonInfo aspxCommonObj)
{
string noImageUrl = string.Empty;
StoreSettingConfig ssc = new StoreSettingConfig();
noImageUrl = ssc.GetStoreSettingsByKey(StoreSetting.DefaultProductImageURL, aspxCommonObj.StoreID,
aspxCommonObj.PortalID, aspxCommonObj.CultureName);
string x = HttpContext.Current.Request.ApplicationPath;
string authority = HttpContext.Current.Request.Url.Authority;
string pageUrl = authority + x;
string pageURL = Request.Url.AbsoluteUri;
string[] path = pageURL.Split('?');
string pagepath = path[0];
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "text/xml";
XmlTextWriter rssXml = new XmlTextWriter(HttpContext.Current.Response.OutputStream, Encoding.UTF8);
rssXml.WriteStartDocument();
rssXml.WriteStartElement("rss");
rssXml.WriteAttributeString("version", "2.0");
rssXml.WriteStartElement("channel");
rssXml.WriteElementString("link", pagepath);
rssXml.WriteElementString("title", getLocale("AspxCommerce Latest Items"));
if (lstLatestItemRss.Count > 0)
{
foreach (LatestItemRssInfo rssItemData in lstLatestItemRss)
{
string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads" + rssItemData.ImagePath;
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", rssItemData.ItemName);
rssXml.WriteElementString("link",
"http://" + pageUrl + "/item/" + rssItemData.SKU +
SageFrameSettingKeys.PageExtension);
rssXml.WriteStartElement("description");
var description = "";
if (rssItemData.ImagePath == "")
{
imagePath = noImageUrl;
}
else
{
//Resize Image Dynamically
InterceptImageController.ImageBuilder(rssItemData.ImagePath, ImageType.Small, ImageCategoryType.Item, aspxCommonObj);
}
description = "<div><a href=http://" + pageUrl + "/item/" + rssItemData.SKU +
SageFrameSettingKeys.PageExtension + "><img src=http://" + pageUrl + "/" +
imagePath.Replace("uploads", "uploads/Small/") + " alt=" + rssItemData.ItemName + " /> </a></div>";
description += "</br>" + HttpUtility.HtmlDecode(rssItemData.ShortDescription);
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteElementString("pubDate", rssItemData.AddedOn);
rssXml.WriteEndElement();
}
}
else
{
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", "");
rssXml.WriteElementString("link", "");
rssXml.WriteStartElement("description");
var description = "";
description = "<div><h2><span>" + getLocale("This store has no items listed yet!") + "</span></h2></div>";
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteEndElement();
}
rssXml.WriteEndElement();
rssXml.WriteEndElement();
rssXml.WriteEndDocument();
rssXml.Flush();
rssXml.Close();
HttpContext.Current.Response.End();
}
示例9: BindBrandRss
private void BindBrandRss(List<BrandRssInfo> brandRssContent, AspxCommonInfo aspxCommonObj)
{
string x = HttpContext.Current.Request.ApplicationPath;
string authority = HttpContext.Current.Request.Url.Authority;
string pageUrl = authority + x;
string pageURL = Request.Url.AbsoluteUri;
string[] path = pageURL.Split('?');
string pagepath = path[0];
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "text/xml";
XmlTextWriter rssXml = new XmlTextWriter(HttpContext.Current.Response.OutputStream, Encoding.UTF8);
rssXml.WriteStartDocument();
rssXml.WriteStartElement("rss");
rssXml.WriteAttributeString("version", "2.0");
rssXml.WriteStartElement("channel");
rssXml.WriteElementString("link", pagepath);
switch (rssOption)
{
case "brands":
rssXml.WriteElementString("title", getLocale("AspxCommerce Popular Brands"));
break;
case "fbrands":
rssXml.WriteElementString("title", getLocale("AspxCommerce Featured Brands"));
break;
case "abrands":
rssXml.WriteElementString("title", getLocale("AspxCommerce All Brands"));
break;
default:
break;
}
if (brandRssContent.Count > 0)
{
foreach (BrandRssInfo rssFeedBrand in brandRssContent)
{
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", rssFeedBrand.BrandName);
rssXml.WriteElementString("link",
"http://" + pageUrl + "/brand/" +AspxUtility.fixedEncodeURIComponent(rssFeedBrand.BrandName) + SageFrameSettingKeys.PageExtension);
rssXml.WriteStartElement("description");
string description = "";
description += "<div>";
string []brandURL= rssFeedBrand.BrandImageUrl.Split('/');
string brandImage = brandURL[brandURL.Length - 1] ;
if (brandImage!="")
{
//Resize Image Dynamically
InterceptImageController.ImageBuilder(brandImage, ImageType.Small, ImageCategoryType.Brand, aspxCommonObj);
}
description += "<div><a href=http://" + pageUrl + "/brand/" + rssFeedBrand.BrandName + SageFrameSettingKeys.PageExtension + ">";
description += "<img src=http://" + pageUrl + "/" + rssFeedBrand.BrandImageUrl.Replace("uploads", "uploads/Small") + " />";
description += "</a></div>";
description += "<p>" + HttpUtility.HtmlDecode(rssFeedBrand.BrandDescription) + "</p>";
description += "</div>";
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteElementString("pubDate", rssFeedBrand.AddedOn);
rssXml.WriteEndElement();
}
}
else
{
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", "");
rssXml.WriteElementString("link", "");
rssXml.WriteStartElement("description");
var description = "";
description = "<div><h2><span>"+getLocale("This store has no items listed yet!")+"</span></h2></div>";
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteEndElement();
}
rssXml.WriteEndElement();
rssXml.WriteEndElement();
rssXml.WriteEndDocument();
rssXml.Flush();
rssXml.Close();
HttpContext.Current.Response.End();
}
示例10: GetPopularTagRssFeedContent
private void GetPopularTagRssFeedContent(AspxCommonInfo aspxCommonObj, XmlTextWriter rssXml, string pageURL, string rssOption, int count)
{
try
{
string noImageUrl = string.Empty;
StoreSettingConfig ssc = new StoreSettingConfig();
noImageUrl = ssc.GetStoreSettingsByKey(StoreSetting.DefaultProductImageURL, aspxCommonObj.StoreID,
aspxCommonObj.PortalID, aspxCommonObj.CultureName);
string[] path = pageURL.Split('?');
string pagepath = path[0];
string x = HttpContext.Current.Request.ApplicationPath;
string authority = HttpContext.Current.Request.Url.Authority;
string pageUrl = authority + x;
PopularTagsController ptc = new PopularTagsController();
List<PopularTagsRssFeedInfo> popularTagRss= ptc.GetRssFeedContens(aspxCommonObj, pageURL, rssOption, PopularTagRssCount);
if (popularTagRss.Count > 0)
{
foreach (PopularTagsRssFeedInfo rssItemData in popularTagRss)
{
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", rssItemData.TagName);
rssXml.WriteElementString("link", "http://" + pageUrl + "/tagsitems/tags" + SageFrameSettingKeys.PageExtension + "?tagsId=" + rssItemData.TagIDs +
"");
rssXml.WriteStartElement("description");
var description = "";
description += "<div><ul style=list-style-type: none><h2> Taged Items:</h2>";
foreach (var tagItemInfo in rssItemData.TagItemInfo)
{
string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + tagItemInfo.ImagePath;
if (tagItemInfo.ImagePath == "")
{
imagePath = noImageUrl;
}
description += "<li style=\"float: left;display: inline;padding-right: 50px\"><h2>" +
tagItemInfo.ItemName + "</h2><a href=http://" + pageUrl + "/item/" +
tagItemInfo.SKU + SageFrameSettingKeys.PageExtension + "><img alt=" +
tagItemInfo.ItemName + " src=http://" + pageUrl + "/" +
imagePath.Replace("uploads", "uploads/Small") + " /></a></li>";
}
description += "</ul></div>";
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteEndElement();
}
}
else
{
rssXml.WriteStartElement("item");
rssXml.WriteElementString("title", "");
rssXml.WriteElementString("link", "");
rssXml.WriteStartElement("description");
var description = "";
description = "<div><h2><span>Not any items have been tagged yet!</span></h2></div>";
rssXml.WriteCData(description);
rssXml.WriteEndElement();
rssXml.WriteEndElement();
}
}
catch (Exception ex)
{
throw ex;
}
}