public string GetSkuContent(string skuId) { string text = ""; if (!string.IsNullOrEmpty(skuId.Trim())) { System.Data.DataTable skuContentBySku = ControlProvider.Instance().GetSkuContentBySku(skuId); foreach (System.Data.DataRow dataRow in skuContentBySku.Rows) { if (!string.IsNullOrEmpty(dataRow["AttributeName"].ToString()) && !string.IsNullOrEmpty(dataRow["ValueStr"].ToString())) { object obj = text; text = string.Concat(new object[] { obj, dataRow["AttributeName"], ":", dataRow["ValueStr"], "; " }); } } } if (!(text == "")) { return(text); } return("无规格"); }
public override void DataBind() { this.Items.Clear(); foreach (ProductTypeInfo info in ControlProvider.Instance().GetProductTypes()) { base.Items.Add(new ListItem(info.TypeName, info.TypeId.ToString())); } }
public override void DataBind() { this.Items.Clear(); foreach (DataRow row in ControlProvider.Instance().GetBrandCategories().Rows) { int num = (int)row["BrandId"]; this.Items.Add(new ListItem((string)row["BrandName"], num.ToString(CultureInfo.InvariantCulture))); } }
public override void DataBind() { this.Items.Clear(); IList <ProductTypeInfo> productTypes = ControlProvider.Instance().GetProductTypes(); foreach (ProductTypeInfo current in productTypes) { base.Items.Add(new ListItem(current.TypeName, current.TypeId.ToString())); } }
public override void DataBind() { this.Items.Clear(); DataTable brandCategories = ControlProvider.Instance().GetBrandCategories(); foreach (DataRow dataRow in brandCategories.Rows) { this.Items.Add(new ListItem((string)dataRow["BrandName"], ((int)dataRow["BrandId"]).ToString(CultureInfo.InvariantCulture))); } }
private void OutputProductTypes() { System.Collections.Generic.IList <ProductTypeInfo> productTypes = ControlProvider.Instance().GetProductTypes(); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("<xml><types>"); foreach (ProductTypeInfo current in productTypes) { stringBuilder.Append("<item typeId=\"").Append(current.TypeId.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" typeName=\"").Append(current.TypeName).Append("\" />"); } stringBuilder.Append("</types></xml>"); this.txtProductTypeXml.Text = stringBuilder.ToString(); }
/// <summary> /// 绑定品牌 /// </summary> private void BindBrand() { DataTable brandCategories = ControlProvider.Instance().GetBrandCategories(); ddcBrand.DataTextField = "BrandName"; ddcBrand.DataValueField = "BrandId"; ddcBrand.DataSource = brandCategories; ddcBrand.DataBind(); }
private void OutputProductTypes() { IList <ProductTypeInfo> productTypes = ControlProvider.Instance().GetProductTypes(); StringBuilder builder = new StringBuilder(); builder.Append("<xml><types>"); foreach (ProductTypeInfo info in productTypes) { builder.Append("<item typeId=\"").Append(info.TypeId.ToString(CultureInfo.InvariantCulture)).Append("\" typeName=\"").Append(info.TypeName).Append("\" />"); } builder.Append("</types></xml>"); txtProductTypeXml.Text = builder.ToString(); }
protected void DoCallback() { base.Response.Clear(); base.Response.ContentType = "application/json"; string text = base.Request.QueryString["action"]; if (text.Equals("getPrepareData")) { int typeId = int.Parse(base.Request.QueryString["typeId"]); System.Collections.Generic.IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(typeId); System.Data.DataTable dataTable = ProductTypeHelper.GetBrandCategoriesByTypeId(typeId); if (dataTable.Rows.Count == 0) { dataTable = ControlProvider.Instance().GetBrandCategories(); } base.Response.Write(this.GenerateJsonString(attributes, dataTable)); attributes.Clear(); } else { if (text.Equals("getMemberGradeList")) { System.Collections.Generic.IList <MemberGradeInfo> memberGrades = MemberHelper.GetMemberGrades(); if (memberGrades == null || memberGrades.Count == 0) { base.Response.Write("{\"Status\":\"0\"}"); } else { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("{\"Status\":\"OK\",\"MemberGrades\":["); foreach (MemberGradeInfo current in memberGrades) { stringBuilder.Append("{"); stringBuilder.AppendFormat("\"GradeId\":\"{0}\",", current.GradeId); stringBuilder.AppendFormat("\"Name\":\"{0}\",", current.Name); stringBuilder.AppendFormat("\"Discount\":\"{0}\"", current.Discount); stringBuilder.Append("},"); } stringBuilder.Remove(stringBuilder.Length - 1, 1); stringBuilder.Append("]}"); base.Response.Write(stringBuilder.ToString()); } } } base.Response.End(); }
private string GetProductBrand() { DataTable table = null; string str = ""; int index = 2; table = ControlProvider.Instance().GetBrandCategories().Copy(); if (table != null) { do { table.Columns.RemoveAt(index); }while (table.Columns.Count > 2); } if (table != null) { str = JavaScriptConvert.SerializeObject(table, new JsonConverter[] { new ConvertTojson() }); } return(str); }
public string GetSkuContent(string skuId) { string str = ""; if (!string.IsNullOrEmpty(skuId.Trim())) { foreach (DataRow row in ControlProvider.Instance().GetSkuContentBySku(skuId).Rows) { if (!string.IsNullOrEmpty(row["AttributeName"].ToString()) && !string.IsNullOrEmpty(row["ValueStr"].ToString())) { object obj2 = str; str = string.Concat(new object[] { obj2, row["AttributeName"], ":", row["ValueStr"], "; " }); } } } if (!(str == "")) { return(str); } return("无规格"); }
void btnBatchBuy_Click(object sender, EventArgs e) { bool flag = false; foreach (GridViewRow row in this.batchbuys.Rows) { CheckBox box = (CheckBox)row.FindControl("checkboxCol"); if (box.Checked) { string skuId = this.batchbuys.DataKeys[row.RowIndex].Value.ToString(); TextBox box2 = (TextBox)row.FindControl("txtBuyNum"); Literal literal = (Literal)row.FindControl("litProductId"); if (string.IsNullOrEmpty(box2.Text.Trim()) || (int.Parse(box2.Text.Trim()) <= 0)) { this.ShowMessage("购买数量值不存在或为非法值", true); return; } DataTable skuContentBySku = ControlProvider.Instance().GetSkuContentBySku(skuId); string skuContent = string.Empty; foreach (DataRow row2 in skuContentBySku.Rows) { if (!string.IsNullOrEmpty(row2["AttributeName"].ToString()) && !string.IsNullOrEmpty(row2["ValueStr"].ToString())) { object obj2 = skuContent; skuContent = string.Concat(new object[] { obj2, row2["AttributeName"], ":", row2["ValueStr"], "; " }); } } flag = true; ShoppingCartProcessor.AddLineItem(int.Parse(literal.Text), skuId, skuContent, int.Parse(box2.Text.Trim())); } } if (flag) { this.ShowMessage("选择的商品已经放入购物车", true); } else { this.ShowMessage("请选择要购买的商品!", false); } }
private string GetProductBrand() { string result = ""; int index = 2; System.Data.DataTable dataTable = ControlProvider.Instance().GetBrandCategories().Copy(); if (dataTable != null) { do { dataTable.Columns.RemoveAt(index); }while (dataTable.Columns.Count > 2); } if (dataTable != null) { result = JavaScriptConvert.SerializeObject(dataTable, new JsonConverter[] { new ConvertTojson() }); } return(result); }
protected void DoCallback() { base.Response.Clear(); base.Response.ContentType = "application/json"; string str = base.Request.QueryString["action"]; if (str.Equals("getPrepareData")) { int typeId = int.Parse(base.Request.QueryString["typeId"]); IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(typeId); DataTable brandCategoriesByTypeId = ProductTypeHelper.GetBrandCategoriesByTypeId(typeId); if (brandCategoriesByTypeId.Rows.Count == 0) { brandCategoriesByTypeId = ControlProvider.Instance().GetBrandCategories(); } base.Response.Write(this.GenerateJsonString(attributes, brandCategoriesByTypeId)); attributes.Clear(); } else if (str.Equals("getMemberGradeList")) { IList <MemberGradeInfo> memberGrades = MemberHelper.GetMemberGrades(); if ((memberGrades == null) || (memberGrades.Count == 0)) { base.Response.Write("{\"Status\":\"0\"}"); } else { StringBuilder builder = new StringBuilder(); builder.Append("{\"Status\":\"OK\",\"MemberGrades\":["); foreach (MemberGradeInfo info in memberGrades) { builder.Append("{"); builder.AppendFormat("\"GradeId\":\"{0}\",", info.GradeId); builder.AppendFormat("\"Name\":\"{0}\",", info.Name); builder.AppendFormat("\"Discount\":\"{0}\"", info.Discount); builder.Append("},"); } builder.Remove(builder.Length - 1, 1); builder.Append("]}"); base.Response.Write(builder.ToString()); } } else if (str.Equals("getDistributorGradeList")) { DataTable distributorGrades = DistributorHelper.GetDistributorGrades(); if ((distributorGrades == null) || (distributorGrades.Rows.Count == 0)) { base.Response.Write("{\"Status\":\"0\"}"); } else { StringBuilder builder2 = new StringBuilder(); builder2.Append("{\"Status\":\"OK\",\"DistributorGrades\":["); foreach (DataRow row in distributorGrades.Rows) { builder2.Append("{"); builder2.AppendFormat("\"GradeId\":\"{0}\",", (int)row["GradeId"]); builder2.AppendFormat("\"Name\":\"{0}\",", (string)row["Name"]); builder2.AppendFormat("\"Discount\":\"{0}\"", (int)row["Discount"]); builder2.Append("},"); } builder2.Remove(builder2.Length - 1, 1); builder2.Append("]}"); base.Response.Write(builder2.ToString()); } } base.Response.End(); }
private IList <ProductTypeInfo> GetProductTypeList() { return(ControlProvider.Instance().GetProductTypes()); }
protected void Restore() { TplCfgInfo tplCfgById = VShopHelper.GetTplCfgById(this.id); this.txtBannerDesc.Text = tplCfgById.ShortDesc; this.ddlType.SelectedValue = tplCfgById.LocationType.ToString(); this.littlepic.Src = tplCfgById.ImageUrl; this.fmSrc.Value = tplCfgById.ImageUrl; switch (tplCfgById.LocationType) { case LocationType.Topic: this.ddlSubType.Attributes.CssStyle.Remove("display"); this.ddlSubType.DataSource = VShopHelper.Gettopics(); this.ddlSubType.DataTextField = "Title"; this.ddlSubType.DataValueField = "TopicId"; this.ddlSubType.DataBind(); this.ddlSubType.SelectedValue = tplCfgById.Url; break; case (LocationType)1: case LocationType.Home: case LocationType.ShoppingCart: case LocationType.OrderCenter: case LocationType.VipCard: case LocationType.GroupBuy: break; case LocationType.Brand: int BrandId = 0; if (tplCfgById != null && !string.IsNullOrEmpty(tplCfgById.Url)) { int.TryParse(tplCfgById.Url, out BrandId); } this.dropBrandTypes.Attributes.CssStyle.Remove("display"); this.dropBrandTypes.DataSource = ControlProvider.Instance().GetBrandCategories(); this.dropBrandTypes.DataTextField = "BrandName"; this.dropBrandTypes.DataValueField = "BrandId"; this.dropBrandTypes.DataBind(); if (BrandId > 0) { dropBrandTypes.SelectedValue = BrandId; } break; case LocationType.Category: int categoryId = 0; if (tplCfgById != null && !string.IsNullOrEmpty(tplCfgById.Url)) { //string[] str = tplCfgById.Url.Split('?'); //if (str.Length > 0) //{ // string[] str1 = (tplCfgById.Url.Split('?')[1]).Split('='); // int.TryParse(str1[1].ToString(), out categoryId); //} int.TryParse(tplCfgById.Url, out categoryId); } this.dropCategories.Attributes.CssStyle.Remove("display"); this.dropCategories.DataSource = CatalogHelper.GetMainCategories(); this.dropCategories.DataTextField = "Name"; this.dropCategories.DataValueField = "CategoryId"; this.dropCategories.DataBind(); if (categoryId > 0) { dropCategories.SelectedValue = categoryId; } break; case LocationType.ImportSourceType: int importSourceId = 0; if (tplCfgById != null && !string.IsNullOrEmpty(tplCfgById.Url)) { //string[] str = tplCfgById.Url.Split('?'); //if (str.Length > 0) //{ // string[] str1 = (tplCfgById.Url.Split('?')[1]).Split('='); // int.TryParse(str1[1].ToString(), out importSourceId); //} int.TryParse(tplCfgById.Url, out importSourceId); } this.dropImportSourceType.Attributes.CssStyle.Remove("display"); this.dropImportSourceType.DataSource = ImportSourceTypeHelper.GetAllImportSourceTypes(); this.dropImportSourceType.DataTextField = "CnArea"; this.dropImportSourceType.DataValueField = "ImportSourceId"; this.dropImportSourceType.DataBind(); if (importSourceId > 0) { dropImportSourceType.SelectedValue = importSourceId; } break; case LocationType.Activity: { this.ddlSubType.Attributes.CssStyle.Remove("display"); this.ddlSubType.BindEnum <EcShop.Entities.VShop.LocationType>(""); //修改1 this.ddlSubType.SelectedValue = tplCfgById.Url.Split(new char[] { ',' })[0]; this.ddlThridType.Attributes.CssStyle.Remove("display"); LotteryActivityType lotteryActivityType = (LotteryActivityType)System.Enum.Parse(typeof(LotteryActivityType), tplCfgById.Url.Split(new char[] { ',' })[0]); if (lotteryActivityType == LotteryActivityType.SignUp) { this.ddlThridType.DataSource = from item in VShopHelper.GetAllActivity() select new { ActivityId = item.ActivityId, ActivityName = item.Name }; } else { this.ddlThridType.DataSource = VShopHelper.GetLotteryActivityByType(lotteryActivityType); } this.ddlThridType.DataTextField = "ActivityName"; this.ddlThridType.DataValueField = "Activityid"; this.ddlThridType.DataBind(); this.ddlThridType.SelectedValue = tplCfgById.Url.Split(new char[] { ',' })[1]; return; } case LocationType.Link: this.Tburl.Text = tplCfgById.Url; this.Tburl.Attributes.CssStyle.Remove("display"); return; case LocationType.Phone: this.Tburl.Text = tplCfgById.Url; this.Tburl.Attributes.CssStyle.Remove("display"); return; case LocationType.Address: this.Tburl.Attributes.CssStyle.Remove("display"); this.navigateDesc.Attributes.CssStyle.Remove("display"); this.Tburl.Text = tplCfgById.Url; return; case LocationType.Article: { this.ddlSubType.Attributes.CssStyle.Remove("display"); System.Collections.Generic.IList <ArticleCategoryInfo> articleMainCategories = CommentBrowser.GetArticleMainCategories(); this.ddlSubType.Items.Clear(); int num = 0; int num2 = 0; if (!string.IsNullOrEmpty(tplCfgById.Url)) { int num3 = tplCfgById.Url.LastIndexOf('='); int.TryParse(tplCfgById.Url.Substring(num3 + 1), out num); } if (num > 0) { ArticleInfo article = CommentBrowser.GetArticle(num); if (article != null) { num2 = article.CategoryId; } } if (articleMainCategories != null && articleMainCategories.Count > 0) { foreach (ArticleCategoryInfo current in articleMainCategories) { this.ddlSubType.Items.Add(new System.Web.UI.WebControls.ListItem(current.Name, current.CategoryId.ToString())); } if (num2 > 0) { this.ddlSubType.SelectedValue = num2.ToString(); } } if (num > 0) { this.ddlThridType.Attributes.CssStyle.Remove("display"); System.Collections.Generic.IList <ArticleInfo> articleList = CommentBrowser.GetArticleList(num2, 1000); foreach (ArticleInfo current2 in articleList) { this.ddlThridType.Items.Add(new System.Web.UI.WebControls.ListItem(current2.Title, current2.ArticleId.ToString())); } this.ddlThridType.SelectedValue = num.ToString(); return; } break; } case LocationType.Product: this.linkSelectProduct.Attributes.CssStyle.Remove("display"); this.productName.Attributes.CssStyle.Remove("display"); this.productid.Value = tplCfgById.Url; int result; if (int.TryParse(tplCfgById.Url, out result)) { this.productName.InnerText = ProductHelper.GetProductDetails(result).ProductName; } break; default: return; } }
private System.Collections.Generic.IList <ProductTypeInfo> GetProductTypeList() { return(ControlProvider.Instance().GetProductTypes()); }