protected void Page_Load(object sender, System.EventArgs e) { if (!this.Page.IsPostBack) { this.cboxCategory.DataSource = CategoryBrowser.GetAllCategories(); this.cboxCategory.DataTextField = "Name"; this.cboxCategory.DataValueField = "CategoryId"; this.cboxCategory.DataBind(); this.cboxBrand.DataSource = CategoryBrowser.GetBrandCategories(); this.cboxBrand.DataTextField = "BrandName"; this.cboxBrand.DataValueField = "BrandId"; this.cboxBrand.DataBind(); this.cboxType.DataSource = ProductTypeHelper.GetProductTypes(); this.cboxType.DataTextField = "TypeName"; this.cboxType.DataValueField = "TypeId"; this.cboxType.DataBind(); DataTable dtData = DistributorsBrower.GetDistributorProductRangeByUserid(int.Parse(Request.QueryString["UserID"])); if (dtData.Rows.Count > 0) { string strs = string.Empty; if (dtData.Rows[0]["ProductRange1"] != DBNull.Value) { strs = "," + dtData.Rows[0]["ProductRange1"].ToString().Trim() + ","; foreach (ListItem li in this.cboxCategory.Items) { if (strs.IndexOf(li.Value) > -1) { li.Selected = true; } } } if (dtData.Rows[0]["ProductRange2"] != DBNull.Value) { strs = "," + dtData.Rows[0]["ProductRange2"].ToString().Trim() + ","; foreach (ListItem li in this.cboxBrand.Items) { if (strs.IndexOf(li.Value) > -1) { li.Selected = true; } } } if (dtData.Rows[0]["ProductRange3"] != DBNull.Value) { strs = "," + dtData.Rows[0]["ProductRange3"].ToString().Trim() + ","; foreach (ListItem li in this.cboxType.Items) { if (strs.IndexOf(li.Value) > -1) { li.Selected = true; } } } } ViewState["dtData"] = dtData; } }
public override void DataBind() { this.Items.Clear(); foreach (ProductTypeInfo info in ProductTypeHelper.GetProductTypes(wid)) { base.Items.Add(new ListItem(info.TypeName, info.TypeId.ToString())); } }
public override void DataBind() { this.Items.Clear(); IList <ProductTypeInfo> productTypes = ProductTypeHelper.GetProductTypes(); foreach (ProductTypeInfo current in productTypes) { base.Items.Add(new ListItem(current.TypeName, current.TypeId.ToString())); } }
private void OutputProductTypes() { System.Collections.Generic.IList <ProductTypeInfo> productTypes = ProductTypeHelper.GetProductTypes(); System.Text.StringBuilder builder = new System.Text.StringBuilder(); builder.Append("<xml><types>"); foreach (ProductTypeInfo info in productTypes) { builder.Append("<item typeId=\"").Append(info.TypeId.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" typeName=\"").Append(info.TypeName).Append("\" />"); } builder.Append("</types></xml>"); this.txtProductTypeXml.Text = builder.ToString(); }
private void BindTypes() { DbQueryResult productTypes = ProductTypeHelper.GetProductTypes(new ProductTypeQuery { TypeName = this.searchkey, PageIndex = this.pager.PageIndex, PageSize = this.pager.PageSize }); this.grdProductTypes.DataSource = productTypes.Data; this.grdProductTypes.DataBind(); this.pager.TotalRecords = productTypes.TotalRecords; }
private void BindTypes() { ProductTypeQuery query = new ProductTypeQuery(); query.TypeName = searchkey; query.PageIndex = pager.PageIndex; query.PageSize = pager.PageSize; DbQueryResult productTypes = ProductTypeHelper.GetProductTypes(query); grdProductTypes.DataSource = productTypes.Data; grdProductTypes.DataBind(); pager.TotalRecords = productTypes.TotalRecords; }
private void OutputProductTypes() { IList <ProductTypeInfo> productTypes = ProductTypeHelper.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>"); this.txtProductTypeXml.Text = builder.ToString(); }
public override void DataBind() { this.Items.Clear(); IList <ProductTypeInfo> productTypes = ProductTypeHelper.GetProductTypes(wid); if (this.AllowNull) { base.Items.Add(new ListItem(this.NullToDisplay, string.Empty)); } foreach (ProductTypeInfo info in productTypes) { base.Items.Add(new ListItem(info.TypeName, info.TypeId.ToString())); } }
private DataGridViewModel <Dictionary <string, object> > GetDataList(ProductTypeQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { DbQueryResult productTypes = ProductTypeHelper.GetProductTypes(query); dataGridViewModel.rows = DataHelper.DataTableToDictionary(productTypes.Data); dataGridViewModel.total = productTypes.TotalRecords; foreach (Dictionary <string, object> row in dataGridViewModel.rows) { } } return(dataGridViewModel); }
private IList <ProductTypeInfo> GetProductTypeList() { return(ProductTypeHelper.GetProductTypes()); }
protected override void AttachChildControls() { int.TryParse(this.Page.Request.QueryString["TypeID"], out this.typeID); int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId); this.keyWord = this.Page.Request.QueryString["keyWord"]; this.imgUrl = (HiImage)this.FindControl("imgUrl"); this.litContent = (Literal)this.FindControl("litContent"); this.rptTypes = (VshopTemplatedRepeater)this.FindControl("rptTypes"); this.rptCategories = (VshopTemplatedRepeater)this.FindControl("rptCategories"); this.rptBrandsShow = (VshopTemplatedRepeater)this.FindControl("rptBrandsShow"); List <ProductTypeInfo> listProductTypeInfo = null; //卡拉萌购特殊需求 if (CustomConfigHelper.Instance.BrandShow) { rptCategories.Visible = false; listProductTypeInfo = (List <ProductTypeInfo>)ProductTypeHelper.GetProductTypes(); //定义左侧类型栏 if (rptTypes != null) { listProductTypeInfo.Add(new ProductTypeInfo() { TypeId = -1, TypeName = "品牌", PTCode = "9999", CompanyUrl = "http://shop18230.ewaywin.com/Vshop/SecondPage.aspx?SkinID=6fdd3099-b386-49a8-9348-f3f57f5574a1", }); this.rptTypes.DataSource = listProductTypeInfo; this.rptTypes.DataBind(); } if (this.typeID == 0 && listProductTypeInfo.Count > 0) { this.typeID = listProductTypeInfo.First().TypeId; } if (this.typeID > 0) { //根据传过来的typeId查找商品 string brandIds = string.Empty; string tableName = "Hishop_Products"; string where = "typeID=" + this.typeID + ""; DataTable dtProductInfo = DataBaseHelper.GetDataTable(tableName, where); if (dtProductInfo.Rows.Count > 0) { for (int i = 0; i < dtProductInfo.Rows.Count; i++) { if (dtProductInfo.Rows[i]["BrandId"].ToString().Trim() == "") { continue; } string[] brandIdArray = dtProductInfo.Rows[i]["BrandId"].ToString().Trim().Split(','); string strJoin = "'" + String.Join("','", brandIdArray) + "'"; brandIds += string.Format("{0},", strJoin); } if (brandIds.Length > 0) { brandIds = brandIds.TrimEnd(','); rptBrandsShow.TemplateFile = "/Tags/skin-Common_BrandsShow.ascx"; DataTable brandInfo = CategoryBrowser.GetBrandsShow(brandIds); this.rptBrandsShow.DataSource = brandInfo; this.rptBrandsShow.DataBind(); } } } else { this.Page.Response.Redirect("http://shop18230.ewaywin.com/Vshop/SecondPage.aspx?SkinID=6fdd3099-b386-49a8-9348-f3f57f5574a1"); } } else { listProductTypeInfo = (List <ProductTypeInfo>)ProductTypeHelper.GetProductTypes(); if (rptTypes != null) { listProductTypeInfo.Add(new ProductTypeInfo() { TypeId = -1, TypeName = "品牌", PTCode = "9999" }); this.rptTypes.DataSource = listProductTypeInfo; this.rptTypes.DataBind(); } this.rptCategories = (VshopTemplatedRepeater)this.FindControl("rptCategories"); this.rptCategories.ItemDataBound += new RepeaterItemEventHandler(this.rptCategories_ItemDataBound); if (this.typeID == 0 && listProductTypeInfo.Count > 0) { this.typeID = listProductTypeInfo.First().TypeId; } if (this.typeID > 0) { rptCategories.TemplateFile = "/Tags/skin-Common_Categories.ascx"; IList <CategoryInfo> listCategoryInfo = CatalogHelper.GetSequenceCategories(); this.rptCategories.DataSource = listCategoryInfo.Where(p => p.AssociatedProductType == this.typeID); this.rptCategories.DataBind(); } else { rptCategories.TemplateFile = "/Tags/skin-Common_Brands.ascx"; rptCategories.DataSource = CatalogHelper.GetBrandCategories(); rptCategories.DataBind(); } this.Page.Session["stylestatus"] = "4"; //IList<CategoryInfo> maxSubCategories = CategoryBrowser.GetMaxSubCategoriesRange(this.categoryId, 0x3e8, DistributorsBrower.GetCurrStoreProductRange()); //this.rptCategories.DataSource = maxSubCategories; //this.rptCategories.DataBind(); PageTitle.AddSiteNameTitle("分类搜索页"); } }