📄 productview.aspx.cs
字号:
}
if (Product.CharacterIsExists((ProductCharacter) characterValue, ProductCharacter.Download))
{
builder.Append("下载");
builder.Append(" ");
}
if (Product.CharacterIsExists((ProductCharacter) characterValue, ProductCharacter.Card))
{
builder.Append("点卡");
}
return builder.ToString();
}
private decimal GetChildGroupPrice(int groupId, IList<ProductPriceInfo> productPriceInfoList)
{
foreach (ProductPriceInfo info in productPriceInfoList)
{
if (info.GroupId == groupId)
{
return info.Price;
}
}
return 0M;
}
private string GetDependentProduct(string dependentProduct)
{
StringBuilder sb = new StringBuilder();
foreach (string str in ProductCommon.GetProductList(dependentProduct).Values)
{
StringHelper.AppendString(sb, str);
}
return sb.ToString();
}
private string GetPresent(string productNum)
{
PresentInfo presentByPresentNum = PowerEasy.Shop.Present.GetPresentByPresentNum(productNum);
if (!presentByPresentNum.IsNull)
{
return presentByPresentNum.PresentName;
}
return string.Empty;
}
private string GetPropertySetting(bool isIsHot, bool isNew, bool isBest)
{
StringBuilder builder = new StringBuilder();
if (isIsHot)
{
builder.Append("热销");
builder.Append(" ");
}
if (isNew)
{
builder.Append("新品");
builder.Append(" ");
}
if (isBest)
{
builder.Append("精品");
builder.Append(" ");
}
return builder.ToString();
}
private string GetSalePromotionType(int salePromotionType, int minNumber, int presentNumber, string PresentID)
{
switch (salePromotionType)
{
case 0:
return "不促销";
case 1:
return string.Concat(new object[] { "买", minNumber.ToString(), "送", presentNumber, "同样的商品" });
case 2:
return string.Concat(new object[] { "买", minNumber.ToString(), "送", presentNumber, " ", this.GetPresent(PresentID), "" });
case 3:
return ("买 就 送" + presentNumber + "同样的商品");
case 4:
return string.Concat(new object[] { "买 就 送", presentNumber, " ", this.GetPresent(PresentID), " " });
}
return "";
}
private string GetStars(int stars)
{
switch (stars)
{
case 1:
return "★";
case 2:
return "★★";
case 3:
return "★★★";
case 4:
return "★★★★";
case 5:
return "★★★★★";
}
return "";
}
private string GetStocksProject(StocksProject stocksProject)
{
switch (stocksProject)
{
case StocksProject.ActualStock:
return "实际库存";
case StocksProject.VirtualStock:
return "虚拟库存";
}
return "";
}
protected void InitContent()
{
IList<FieldInfo> fieldList = Field.GetFieldList(DataConverter.CLng(this.ContentDataTable.Rows[0]["ModelID"].ToString()), false);
IList<FieldInfo> list2 = new List<FieldInfo>();
foreach (FieldInfo info in fieldList)
{
if (info.FieldType != FieldType.Property)
{
list2.Add(info);
}
}
this.RptProduct.DataSource = list2;
this.RptProduct.DataBind();
this.LblNodeNavigation.Text = PowerEasy.Contents.Nodes.ShowNodeNavigation(DataConverter.CLng(this.ContentDataTable.Rows[0]["NodeID"]));
this.InitSpecial();
this.InitInfoType();
}
private void InitInfoType()
{
int generalId = DataConverter.CLng(HttpContext.Current.Request["GeneralId"]);
StringBuilder builder = new StringBuilder();
if (generalId > 0)
{
foreach (CommonModelInfo info in ContentManage.GetInfoList(generalId))
{
builder.Append("<span>");
builder.Append(PowerEasy.Contents.Nodes.ShowNodesAndRootNavigation(info.NodeId));
builder.Append("<br /></span>");
}
}
if (builder.Length <= 0)
{
builder.Append("<span>无其它节点<br /></span>");
}
this.DivNode.InnerHtml = builder.ToString();
}
private void InitPage()
{
if (base.Request.UrlReferrer != null)
{
this.ViewState["UrlReferrer"] = base.Request.UrlReferrer.ToString();
}
this.InitContent();
this.InitProduct();
CommonModelInfo prevInfo = ContentManage.GetPrevInfo(DataConverter.CLng(this.ContentDataTable.Rows[0]["NodeId"]), this.m_GeneralId);
if (!prevInfo.IsNull)
{
this.LblGetPrevInfo.Text = "<a href='" + ModelManager.GetModelInfoById(prevInfo.ModelId).PreviewInfoFilePath + "?GeneralID=" + prevInfo.GeneralId.ToString() + "'>" + DataSecurity.HtmlEncode(prevInfo.Title) + "</a>";
}
else
{
this.LblGetPrevInfo.Text = "没有了";
}
CommonModelInfo nextInfo = ContentManage.GetNextInfo(DataConverter.CLng(this.ContentDataTable.Rows[0]["NodeId"]), this.m_GeneralId);
if (!nextInfo.IsNull)
{
this.LblGetNextInfo.Text = "<a href='" + ModelManager.GetModelInfoById(prevInfo.ModelId).PreviewInfoFilePath + "?GeneralID=" + nextInfo.GeneralId.ToString() + "'>" + DataSecurity.HtmlEncode(nextInfo.Title) + "</a>";
}
else
{
this.LblGetNextInfo.Text = "没有了";
}
}
private void InitProduct()
{
Product product = new Product();
product.GetProductAllDataById(this.m_GeneralId);
ProductInfo productInfoData = product.ProductInfoData;
this.m_ProductDataInfoList = product.ProductDataInfoList;
this.m_ProductInfo = productInfoData;
this.ContentDataTable = productInfoData.Fields;
this.SetCommonModelInfo(product.CommonModelInfo);
this.LblProductNum.Text = productInfoData.ProductNum;
this.LblBarCode.Text = productInfoData.BarCode;
this.LblProductCharacter.Text = this.GetCharacter((int) productInfoData.ProductCharacter);
if (Product.CharacterIsExists(productInfoData.ProductCharacter, ProductCharacter.Download))
{
this.PlhDownloadUrl.Visible = true;
}
else
{
this.PlhDownloadUrl.Visible = false;
}
this.LblProductName.Text = productInfoData.ProductName;
if (!string.IsNullOrEmpty(productInfoData.ProductThumb))
{
this.ImgProductThumb.ImageUrl = Utility.ConvertAbsolutePath(SiteConfig.SiteInfo.VirtualPath + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir), productInfoData.ProductThumb);
}
this.LblKeyword.Text = productInfoData.Keyword;
this.LblUnit.Text = productInfoData.Unit;
this.LblStocks.Text = productInfoData.Stocks.ToString();
this.LblStocksProject.Text = this.GetStocksProject(productInfoData.StocksProject);
this.LblWeight.Text = productInfoData.Weight.ToString();
this.LblBuyTimes.Text = productInfoData.BuyTimes.ToString();
this.LblProducerName.Text = productInfoData.ProducerName;
this.LblTrademarkName.Text = productInfoData.TrademarkName;
this.LblTaxRateType.Text = BasePage.EnumToHtml<TaxRateType>(productInfoData.IncludeTax);
this.LblTaxRate.Text = productInfoData.TaxRate.ToString();
this.LblServiceTerm.Text = productInfoData.ServiceTerm.ToString();
this.LblServiceTermUnit.Text = BasePage.EnumToHtml<ServiceTermUnit>(productInfoData.ServiceTermUnit);
this.LblEnableSale.Text = this.GetBoolString(productInfoData.EnableSale);
this.LblDownloadUrl.Text = productInfoData.DownloadUrl;
this.LblRemark.Text = productInfoData.Remark;
this.LblEnableBuyWhenOutofstock.Text = this.GetBoolString(productInfoData.EnableBuyWhenOutofstock);
this.LblPresentPoint.Text = productInfoData.PresentPoint.ToString();
this.LblPresentMoney.Text = productInfoData.PresentMoney.ToString("0.00");
this.LblPresentExp.Text = productInfoData.PresentExp.ToString();
this.LblAlarmNum.Text = productInfoData.AlarmNum.ToString();
if (productInfoData.LimitNum <= 0)
{
this.LblLimitNum.Text = "不限购";
}
else
{
this.LblLimitNum.Text = productInfoData.LimitNum.ToString();
}
this.LblSalePromotionType.Text = this.GetSalePromotionType(productInfoData.SalePromotionType, productInfoData.MinNumber, productInfoData.PresentNumber, productInfoData.PresentId.ToString());
this.LblProductIntro.Text = productInfoData.ProductIntro;
this.LblProductExplain.Text = productInfoData.ProductExplain;
this.LblProductType.Text = BasePage.EnumToHtml<ProductType>(productInfoData.ProductType);
this.LblPropertySetting.Text = this.GetPropertySetting(productInfoData.IsHot, productInfoData.IsNew, productInfoData.IsBest);
this.LblStars.Text = this.GetStars(productInfoData.Stars);
if (productInfoData.EnableSingleSell)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -