📄 productview.aspx.cs
字号:
{
this.LblEnableSingleSell.Text = "是";
}
else
{
this.LblEnableSingleSell.Text = "不允许,需购买从属商品 " + this.GetDependentProduct(productInfoData.DependentProducts);
}
this.LblPrice_Market.Text = productInfoData.PriceMarket.ToString("0.00");
this.LblPrice.Text = productInfoData.PriceInfo.Price.ToString("0.00");
if (productInfoData.PriceInfo.PriceMember == -1M)
{
this.LblPrice_Member.Visible = false;
this.PnlMember.Visible = true;
this.RptGroupPrice.Visible = true;
this.RptGroupPrice.DataSource = UserGroups.GetGroupTable(GroupType.Register);
this.RptGroupPrice.DataBind();
this.SetGroupPrice(product.ProductPriceInfoList);
}
else if (productInfoData.PriceInfo.PriceMember == 0M)
{
this.LblPrice_Member.Text = "使用会员组折扣率";
}
else
{
this.LblPrice_Member.Text = productInfoData.PriceInfo.PriceMember.ToString("0.00") + " 元";
}
if (productInfoData.PriceInfo.PriceAgent == -1M)
{
this.LblPrice_Agent.Visible = false;
this.PnlAgent.Visible = true;
this.RptAgentGroupPrice.DataSource = UserGroups.GetGroupTable(GroupType.Agent);
this.RptAgentGroupPrice.DataBind();
this.SetAgentGroupPrice(product.ProductPriceInfoList);
}
else if (productInfoData.PriceInfo.PriceAgent == 0M)
{
this.LblPrice_Agent.Text = "使用代理商组折扣率";
}
else
{
this.LblPrice_Agent.Text = productInfoData.PriceInfo.PriceAgent.ToString("0.00") + " 元";
}
if (productInfoData.EnableWholesale)
{
this.LblWholesale.Visible = false;
this.PnlWholesale.Visible = true;
this.LblNumberWholesale1.Text = productInfoData.PriceInfo.NumberWholesale1.ToString();
this.LblNumberWholesale2.Text = productInfoData.PriceInfo.NumberWholesale2.ToString();
this.LblNumberWholesale3.Text = productInfoData.PriceInfo.NumberWholesale3.ToString();
this.LblPriceWholesale1.Text = productInfoData.PriceInfo.PriceWholesale1.ToString("0.00");
this.LblPriceWholesale2.Text = productInfoData.PriceInfo.PriceWholesale2.ToString("0.00");
this.LblPriceWholesale3.Text = productInfoData.PriceInfo.PriceWholesale3.ToString("0.00");
}
else
{
this.LblWholesale.Text = "不允许批发";
}
if (!string.IsNullOrEmpty(productInfoData.Properties))
{
this.SetChildProductVisible(productInfoData);
}
}
private void InitSpecial()
{
int generalId = DataConverter.CLng(HttpContext.Current.Request["GeneralId"]);
StringBuilder builder = new StringBuilder();
if (generalId > 0)
{
string[] strArray = Special.GetSpecialInfoIds(generalId).Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < strArray.Length; i++)
{
SpecialInfo specialInfoById = Special.GetSpecialInfoById(DataConverter.CLng(strArray[i]));
SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(specialInfoById.SpecialCategoryId);
builder.Append("\n<span>");
builder.Append(specialCategoryInfoById.SpecialCategoryName + ">>" + specialInfoById.SpecialName);
builder.Append("<br /></span>");
}
}
if (builder.Length <= 0)
{
builder.Append("<span>无专题<br /></span>");
}
this.DivSpecial.InnerHtml = builder.ToString();
}
protected void Page_Load(object sender, EventArgs e)
{
this.m_GeneralId = BasePage.RequestInt32("GeneralID");
if (!this.Page.IsPostBack)
{
if (this.m_GeneralId == 0)
{
AdminPage.WriteErrMsg("<li>没有找到对应ID的商品信息!</li>");
}
else
{
this.ContentDataTable = ContentManage.GetContentDataById(this.m_GeneralId);
if ((this.ContentDataTable == null) || (this.ContentDataTable.Rows.Count == 0))
{
AdminPage.WriteErrMsg("<li>指定商品不存在!</li>");
}
this.InitPage();
}
if (SiteConfig.ThumbsConfig.ThumbsWidth > 0)
{
this.ImgProductThumb.Width = SiteConfig.ThumbsConfig.ThumbsWidth;
}
if (SiteConfig.ThumbsConfig.ThumbsHeight > 0)
{
this.ImgProductThumb.Height = SiteConfig.ThumbsConfig.ThumbsHeight;
}
}
}
protected void RptProduct_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.AlternatingItem) || (e.Item.ItemType == ListItemType.Item))
{
FieldInfo dataItem = e.Item.DataItem as FieldInfo;
Literal literal = e.Item.FindControl("LitProductText") as Literal;
if (dataItem.FieldType != FieldType.Property)
{
literal.Text = this.ContentDataTable.Rows[0][dataItem.FieldName].ToString();
}
}
}
private void SetAgentGroupPrice(IList<ProductPriceInfo> priceInfoList)
{
if (priceInfoList != null)
{
for (int i = 0; i < this.RptAgentGroupPrice.Items.Count; i++)
{
int num2 = DataConverter.CLng(((HiddenField) this.RptAgentGroupPrice.Items[i].FindControl("HdnGroupID")).Value);
foreach (ProductPriceInfo info in priceInfoList)
{
if (info.GroupId == num2)
{
((Label) this.RptAgentGroupPrice.Items[i].FindControl("LblAgentGroupPrice")).Text = info.Price.ToString("0.00");
break;
}
}
}
}
}
private void SetChildProductVisible(ProductInfo productInfo)
{
this.AddTemplateField("LblProperty", "商品属性", true);
this.AddTemplateField("LblChildStocks", "库存数量", true);
this.AddTemplateField("LblChildAlarmNum", "库存报警下限", true);
this.AddTemplateField("LblChildPrice", "零售价格", true);
bool visible = false;
bool flag2 = false;
switch (productInfo.PriceInfo.PriceMember.ToString("0.00"))
{
case "0.00":
break;
case "-1.00":
flag2 = true;
break;
default:
visible = true;
break;
}
this.AddTemplateField("LblUserPrice", "会员价格", visible);
foreach (UserGroupsInfo info in UserGroups.GetGroupTable(GroupType.Register))
{
this.AddTemplateField("LblGroupPrice" + info.GroupId, info.GroupName, flag2);
}
bool flag3 = false;
bool flag4 = false;
switch (productInfo.PriceInfo.PriceAgent.ToString("0.00"))
{
case "0.00":
break;
case "-1.00":
flag4 = true;
break;
default:
flag3 = true;
break;
}
this.AddTemplateField("LblAgentPrice", "代理商价格", flag3);
foreach (UserGroupsInfo info2 in UserGroups.GetGroupTable(GroupType.Agent))
{
this.AddTemplateField("LblAgentGroupPrice" + info2.GroupId, info2.GroupName, flag4);
}
this.AddTemplateField("LblNumber_Wholesale1", "批发数量一", productInfo.EnableWholesale);
this.AddTemplateField("LblPrice_Wholesale1", "批发价格一", productInfo.EnableWholesale);
this.AddTemplateField("LblNumber_Wholesale2", "批发数量二", productInfo.EnableWholesale);
this.AddTemplateField("LblPrice_Wholesale2", "批发价格二", productInfo.EnableWholesale);
this.AddTemplateField("LblNumber_Wholesale3", "批发数量三", productInfo.EnableWholesale);
this.AddTemplateField("LblPrice_Wholesale3", "批发价格三", productInfo.EnableWholesale);
this.EgdvChildProductsDataBind();
}
private void SetCommonModelInfo(CommonModelInfo commonInfo)
{
this.LblEliteLevel.Text = commonInfo.EliteLevel.ToString();
this.LblPriority.Text = commonInfo.Priority.ToString();
this.LblHits.Text = commonInfo.Hits.ToString();
this.LblDayHits.Text = commonInfo.DayHits.ToString();
this.LblWeekHits.Text = commonInfo.WeekHits.ToString();
this.LblMonthHits.Text = commonInfo.MonthHits.ToString();
this.LblUpdateTime.Text = commonInfo.UpdateTime.ToString();
this.LblTemplate.Text = DataSecurity.HtmlEncode(commonInfo.TemplateFile);
}
private void SetGroupPrice(IList<ProductPriceInfo> priceInfoList)
{
if (priceInfoList != null)
{
for (int i = 0; i < this.RptGroupPrice.Items.Count; i++)
{
int num2 = DataConverter.CLng(((HiddenField) this.RptGroupPrice.Items[i].FindControl("HdnGroupID")).Value);
foreach (ProductPriceInfo info in priceInfoList)
{
if (info.GroupId == num2)
{
((Label) this.RptGroupPrice.Items[i].FindControl("LblGroupPrice")).Text = info.Price.ToString("0.00");
break;
}
}
}
}
}
protected DataTable ContentDataTable
{
get
{
return (DataTable) this.ViewState["ContentDataTable"];
}
set
{
this.ViewState["ContentDataTable"] = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -