private void BindProducts() { LoadParameters(); ProductQuery entity = new ProductQuery(); entity.Keywords = productName; entity.ProductCode = productCode; entity.CategoryId = categoryId; entity.ProductLineId = lineId; entity.PublishStatus = publishStatus; entity.PageSize = pager.PageSize; entity.PageIndex = pager.PageIndex; entity.SortOrder = SortAction.Desc; entity.SortBy = "DisplaySequence"; entity.StartDate = startDate; entity.EndDate = endDate; if (categoryId.HasValue) { entity.MaiCategoryPath = SubsiteCatalogHelper.GetCategory(categoryId.Value).Path; } Globals.EntityCoding(entity, true); DbQueryResult toTaobaoProducts = SubSiteProducthelper.GetToTaobaoProducts(entity); grdProducts.DataSource = toTaobaoProducts.Data; grdProducts.DataBind(); txtSearchText.Text = entity.Keywords; txtSKU.Text = entity.ProductCode; dropCategories.SelectedValue = entity.CategoryId; dropLines.SelectedValue = entity.ProductLineId; pager1.TotalRecords = pager.TotalRecords = toTaobaoProducts.TotalRecords; }
public override void DataBind() { this.Items.Clear(); this.Items.Add(new System.Web.UI.WebControls.ListItem(this.NullToDisplay, string.Empty)); if (this.IsUnclassified) { this.Items.Add(new System.Web.UI.WebControls.ListItem("未分类商品", "0")); } System.Collections.Generic.IList <CategoryInfo> list; if (this.IsTopCategory) { list = SubsiteCatalogHelper.GetMainCategories(); using (System.Collections.Generic.IEnumerator <CategoryInfo> enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { CategoryInfo current = enumerator.Current; this.Items.Add(new System.Web.UI.WebControls.ListItem(Globals.HtmlDecode(current.Name), current.CategoryId.ToString())); } return; } } list = SubsiteCatalogHelper.GetSequenceCategories(); for (int i = 0; i < list.Count; i++) { this.Items.Add(new System.Web.UI.WebControls.ListItem(this.FormatDepth(list[i].Depth, Globals.HtmlDecode(list[i].Name)), list[i].CategoryId.ToString(System.Globalization.CultureInfo.InvariantCulture))); } }
private void BindProducts() { ProductQuery query = new ProductQuery(); query.Keywords = keywords; query.CategoryId = categoryId; if (categoryId.HasValue) { query.MaiCategoryPath = SubsiteCatalogHelper.GetCategory(categoryId.Value).Path; } query.PageSize = 10; query.PageIndex = pager.PageIndex; query.SaleStatus = ProductSaleStatus.OnSale; query.SortOrder = SortAction.Desc; query.SortBy = "DisplaySequence"; DbQueryResult products = SubSiteProducthelper.GetProducts(query); dlstProducts.DataSource = products.Data; dlstProducts.DataBind(); pager.TotalRecords = products.TotalRecords; }
private void BindProducts() { ProductQuery productQuery = new ProductQuery(); productQuery.Keywords = this.productName; productQuery.ProductCode = this.productCode; productQuery.CategoryId = this.categoryId; productQuery.TagId = this.tagId; if (this.categoryId.HasValue) { productQuery.MaiCategoryPath = SubsiteCatalogHelper.GetCategory(this.categoryId.Value).Path; } productQuery.PageSize = this.pager.PageSize; productQuery.PageIndex = this.pager.PageIndex; productQuery.IsAlert = this.isAlert; productQuery.SaleStatus = this.saleStatus; productQuery.SortOrder = SortAction.Desc; productQuery.SortBy = "DisplaySequence"; Globals.EntityCoding(productQuery, true); DbQueryResult products = SubSiteProducthelper.GetProducts(productQuery); this.grdProducts.DataSource = products.Data; this.grdProducts.DataBind(); this.pager.TotalRecords = products.TotalRecords; this.pager1.TotalRecords = products.TotalRecords; }
private void btnSaveCategory_Click(object sender, EventArgs e) { CategoryInfo category = this.GetCategory(); if (category != null) { ValidationResults results = Hishop.Components.Validation.Validation.Validate <CategoryInfo>(category, new string[] { "ValCategory" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (IEnumerable <ValidationResult>)results) { msg = msg + Formatter.FormatErrorMessage(result.Message); } this.ShowMsg(msg, false); } else if (SubsiteCatalogHelper.AddCategory(category) == CategoryActionStatus.Success) { base.Response.Redirect("ManageMyCategories.aspx", true); } else { this.ShowMsg("添加商品分类失败,未知错误", false); } } }
private string GetCategorys() { string result = ""; string[] propertyName = new string[] { "CategoryId", "Name", "Depth" }; System.Data.DataTable dataTable; if (Hidistro.Membership.Context.HiContext.Current.SiteSettings.IsDistributorSettings) { dataTable = this.ConvertListToDataTable <CategoryInfo>(SubsiteCatalogHelper.GetSequenceCategories(), propertyName); } else { dataTable = this.ConvertListToDataTable <CategoryInfo>(CatalogHelper.GetSequenceCategories(), propertyName); } if (dataTable != null) { result = JavaScriptConvert.SerializeObject(dataTable, new JsonConverter[] { new ConvertTojson() }); } return(result); }
protected void Page_Load(object sender, System.EventArgs e) { if (!int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId)) { base.GotoResourceNotFound(); return; } this.btnSaveCategory.Click += new System.EventHandler(this.btnSaveCategory_Click); //this.btnPicDelete.Click += new System.EventHandler(this.btnPicDelete_Click); if (!this.Page.IsPostBack) { CategoryInfo category = SubsiteCatalogHelper.GetCategory(this.categoryId); this.dropProductTypes.DataBind(); this.dropProductTypes.SelectedValue = category.AssociatedProductType; if (category == null) { base.GotoResourceNotFound(); return; } Globals.EntityCoding(category, false); this.BindCategoryInfo(category); if (category.Depth > 1) { this.liRewriteName.Style.Add("display", "none"); } } }
private void BindProducts() { ProductQuery entity = new ProductQuery(); entity.Keywords = productName; entity.ProductCode = productCode; entity.CategoryId = categoryId; if (categoryId.HasValue) { entity.MaiCategoryPath = SubsiteCatalogHelper.GetCategory(categoryId.Value).Path; } entity.PageSize = pager.PageSize; entity.PageIndex = pager.PageIndex; entity.SaleStatus = ProductSaleStatus.OnSale; entity.SortOrder = SortAction.Desc; entity.SortBy = "DisplaySequence"; Globals.EntityCoding(entity, true); DbQueryResult products = SubSiteProducthelper.GetProducts(entity); grdProducts.DataSource = products.Data; grdProducts.DataBind(); pager.TotalRecords = products.TotalRecords; pager1.TotalRecords = products.TotalRecords; }
private void btnSaveAddCategory_Click(object sender, EventArgs e) { CategoryInfo category = this.GetCategory(); if (category != null) { if (SubsiteCatalogHelper.AddCategory(category) == CategoryActionStatus.Success) { this.ShowMsg("成功添加了商品分类", true); this.dropCategories.DataBind(); this.dropProductTypes.DataBind(); this.txtCategoryName.Text = string.Empty; this.txtRewriteName.Text = string.Empty; this.txtPageKeyTitle.Text = string.Empty; this.txtPageKeyWords.Text = string.Empty; this.txtPageDesc.Text = string.Empty; this.fckNotes1.Text = string.Empty; this.fckNotes2.Text = string.Empty; this.fckNotes3.Text = string.Empty; } else { this.ShowMsg("添加商品分类失败,未知错误", false); } } }
protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(Page.Request.QueryString["categoryId"], out categoryId)) { base.GotoResourceNotFound(); } else { btnSaveCategory.Click += new EventHandler(btnSaveCategory_Click); if (!Page.IsPostBack) { CategoryInfo category = SubsiteCatalogHelper.GetCategory(categoryId); dropProductTypes.DataBind(); if (category == null) { base.GotoResourceNotFound(); } else { Globals.EntityCoding(category, false); BindCategoryInfo(category); if (category.Depth > 1) { liRewriteName.Style.Add("display", "none"); } } } } }
private void grdProducts_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Literal literal = (Literal)e.Row.FindControl("litMainCategory"); literal.Text = "-"; object obj2 = DataBinder.Eval(e.Row.DataItem, "CategoryId"); if ((obj2 != null) && (obj2 != DBNull.Value)) { literal.Text = SubsiteCatalogHelper.GetFullCategory((int)obj2); } DistributorProductCategoriesDropDownList list = (DistributorProductCategoriesDropDownList)e.Row.FindControl("dropAddToCategories"); list.DataBind(); Literal literal2 = (Literal)e.Row.FindControl("litExtendCategory"); literal2.Text = "-"; object obj3 = DataBinder.Eval(e.Row.DataItem, "ExtendCategoryPath"); if ((obj3 != null) && (obj3 != DBNull.Value)) { string s = (string)obj3; if (s.Length > 0) { s = s.Substring(0, s.Length - 1); if (s.Contains("|")) { s = s.Substring(s.LastIndexOf('|') + 1); } literal2.Text = SubsiteCatalogHelper.GetFullCategory(int.Parse(s)); list.SelectedValue = new int?(int.Parse(s)); } } } }
protected void DoCallback() { this.LoadParameters(); ProductQuery query = new ProductQuery { PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SaleStatus = ProductSaleStatus.OnSale, IsIncludePromotionProduct = false, IsIncludeBundlingProduct = false, Keywords = this.txtSearchText.Text }; if (this.brandId.HasValue) { query.BrandId = new int?(this.brandId.Value); } query.CategoryId = this.categoryId; if (this.categoryId.HasValue) { query.MaiCategoryPath = SubsiteCatalogHelper.GetCategory(this.categoryId.Value).Path; } DbQueryResult products = SubSiteProducthelper.GetProducts(query); DataTable data = (DataTable)products.Data; this.pager1.TotalRecords = this.pager.TotalRecords = products.TotalRecords; this.grdproducts.DataSource = data; this.grdproducts.DataBind(); }
private void BindData() { DropdownColumn dropdownColumn = (DropdownColumn)this.grdTopCategries.Columns[1]; dropdownColumn.DataSource = this.GetThemes(); this.grdTopCategries.DataSource = SubsiteCatalogHelper.GetMainCategories(); this.grdTopCategries.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(this.Page.Request.QueryString["ProductId"], out this.productId)) { base.GotoResourceNotFound(); } else { int.TryParse(base.Request.QueryString["categoryId"], out this.categoryId); if (!this.Page.IsPostBack) { ProductInfo product = SubSiteProducthelper.GetProduct(this.productId); if (product == null) { base.GotoResourceNotFound(); } else { if (!string.IsNullOrEmpty(base.Request.QueryString["categoryId"])) { this.litCategoryName.Text = SubsiteCatalogHelper.GetFullCategory(this.categoryId); this.ViewState["ProductCategoryId"] = this.categoryId; this.lnkEditCategory.NavigateUrl = "SelectMyCategory.aspx?categoryId=" + this.categoryId.ToString(CultureInfo.InvariantCulture); } else { this.litCategoryName.Text = SubsiteCatalogHelper.GetFullCategory(product.CategoryId); this.ViewState["ProductCategoryId"] = product.CategoryId; this.lnkEditCategory.NavigateUrl = "SelectMyCategory.aspx?categoryId=" + product.CategoryId.ToString(CultureInfo.InvariantCulture); } this.lnkEditCategory.NavigateUrl = this.lnkEditCategory.NavigateUrl + "&productId=" + product.ProductId.ToString(CultureInfo.InvariantCulture); IList <int> productTags = new List <int>(); productTags = SubSiteProducthelper.GetProductTags(this.productId); this.litralProductTag.SelectedValue = productTags; if (productTags.Count > 0) { foreach (int num in productTags) { this.txtProductTag.Text = this.txtProductTag.Text + num.ToString() + ","; } this.txtProductTag.Text = this.txtProductTag.Text.Substring(0, this.txtProductTag.Text.Length - 1); } this.dropProductTypes.Enabled = false; this.dropProductTypes.DataBind(); this.dropProductTypes.SelectedValue = product.TypeId; this.dropProductLines.Enabled = false; this.dropProductLines.DataBind(); this.dropProductLines.SelectedValue = new int?(product.LineId); this.dropBrandCategories.Enabled = false; this.dropBrandCategories.DataBind(); this.dropBrandCategories.SelectedValue = product.BrandId; this.LoadProudct(product); } } } }
protected void Page_Load(object sender, System.EventArgs e) { if (!int.TryParse(this.Page.Request.QueryString["ProductId"], out this.productId)) { base.GotoResourceNotFound(); return; } int.TryParse(base.Request.QueryString["categoryId"], out this.categoryId); if (!this.Page.IsPostBack) { ProductInfo product = SubSiteProducthelper.GetProduct(this.productId); if (product == null) { base.GotoResourceNotFound(); return; } if (!string.IsNullOrEmpty(base.Request.QueryString["categoryId"])) { this.litCategoryName.Text = SubsiteCatalogHelper.GetFullCategory(this.categoryId); this.ViewState["ProductCategoryId"] = this.categoryId; this.lnkEditCategory.NavigateUrl = "SelectMyCategory.aspx?categoryId=" + this.categoryId.ToString(System.Globalization.CultureInfo.InvariantCulture); } else { this.litCategoryName.Text = SubsiteCatalogHelper.GetFullCategory(product.CategoryId); this.ViewState["ProductCategoryId"] = product.CategoryId; this.lnkEditCategory.NavigateUrl = "SelectMyCategory.aspx?categoryId=" + product.CategoryId.ToString(System.Globalization.CultureInfo.InvariantCulture); } System.Web.UI.WebControls.HyperLink expr_148 = this.lnkEditCategory; expr_148.NavigateUrl = expr_148.NavigateUrl + "&productId=" + product.ProductId.ToString(System.Globalization.CultureInfo.InvariantCulture); System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>(); list = SubSiteProducthelper.GetProductTags(this.productId); this.litralProductTag.SelectedValue = list; if (list.Count > 0) { foreach (int current in list) { TrimTextBox expr_1B4 = this.txtProductTag; expr_1B4.Text = expr_1B4.Text + current.ToString() + ","; } this.txtProductTag.Text = this.txtProductTag.Text.Substring(0, this.txtProductTag.Text.Length - 1); } this.dropProductTypes.Enabled = false; this.dropProductTypes.DataBind(); this.dropProductTypes.SelectedValue = product.TypeId; this.dropProductLines.Enabled = false; this.dropProductLines.DataBind(); this.dropProductLines.SelectedValue = new int?(product.LineId); this.dropBrandCategories.Enabled = false; this.dropBrandCategories.DataBind(); this.dropBrandCategories.SelectedValue = product.BrandId; this.LoadProudct(product); } }
public override void DataBind() { this.Items.Clear(); System.Collections.Generic.IList <CategoryInfo> sequenceCategories = SubsiteCatalogHelper.GetSequenceCategories(); for (int i = 0; i < sequenceCategories.Count; i++) { this.Items.Add(new System.Web.UI.WebControls.ListItem(this.FormatDepth(sequenceCategories[i].Depth, Globals.HtmlDecode(sequenceCategories[i].Name)), sequenceCategories[i].CategoryId.ToString(System.Globalization.CultureInfo.InvariantCulture))); } System.Web.UI.WebControls.ListItem item = new System.Web.UI.WebControls.ListItem("--所有--", "0"); this.Items.Insert(0, item); }
private void SaveAll() { DropdownColumn dropdownColumn = (DropdownColumn)this.grdTopCategries.Columns[1]; foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdTopCategries.Rows) { string themeName = dropdownColumn.SelectedValues[gridViewRow.RowIndex]; int categoryId = (int)this.grdTopCategries.DataKeys[gridViewRow.RowIndex].Value; SubsiteCatalogHelper.SetCategoryThemes(categoryId, themeName); } }
private void DoCallback() { string text = base.Request.QueryString["action"]; base.Response.Clear(); base.Response.ContentType = "application/json"; if (text.Equals("getlist")) { int num = 0; int.TryParse(base.Request.QueryString["parentCategoryId"], out num); System.Collections.Generic.IList <CategoryInfo> list = (num == 0) ? SubsiteCatalogHelper.GetMainCategories() : SubsiteCatalogHelper.GetSubCategories(num); if (list != null && list.Count != 0) { base.Response.Write(this.GenerateJson(list)); } else { base.Response.Write("{\"Status\":\"0\"}"); } } else { if (text.Equals("getinfo")) { int num2 = 0; int.TryParse(base.Request.QueryString["categoryId"], out num2); if (num2 <= 0) { base.Response.Write("{\"Status\":\"0\"}"); } else { CategoryInfo category = SubsiteCatalogHelper.GetCategory(num2); if (category == null) { base.Response.Write("{\"Status\":\"0\"}"); } else { base.Response.Write(string.Concat(new string[] { "{\"Status\":\"OK\", \"Name\":\"", category.Name, "\", \"Path\":\"", category.Path, "\"}" })); } } } } base.Response.End(); }
/// <summary> /// 页面加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(Page.Request.QueryString["ProductId"], out productId)) { base.GotoResourceNotFound(); } else { int.TryParse(base.Request.QueryString["categoryId"], out categoryId); if (!Page.IsPostBack) { ProductInfo product = SubSiteProducthelper.GetProduct(productId); if (product == null) { base.GotoResourceNotFound(); } else { if (!string.IsNullOrEmpty(base.Request.QueryString["categoryId"])) { litCategoryName.Text = SubsiteCatalogHelper.GetFullCategory(categoryId); ViewState["ProductCategoryId"] = categoryId; lnkEditCategory.NavigateUrl = "SelectMyCategory.aspx?categoryId=" + categoryId.ToString(CultureInfo.InvariantCulture); } else { litCategoryName.Text = SubsiteCatalogHelper.GetFullCategory(product.CategoryId); ViewState["ProductCategoryId"] = product.CategoryId; lnkEditCategory.NavigateUrl = "SelectMyCategory.aspx?categoryId=" + product.CategoryId.ToString(CultureInfo.InvariantCulture); } lnkEditCategory.NavigateUrl = lnkEditCategory.NavigateUrl + "&productId=" + product.ProductId.ToString(CultureInfo.InvariantCulture); dropProductTypes.Enabled = false; dropProductTypes.DataBind(); dropProductTypes.SelectedValue = product.TypeId; dropProductLines.Enabled = false; dropProductLines.DataBind(); dropProductLines.SelectedValue = new int?(product.LineId); dropBrandCategories.Enabled = false; dropBrandCategories.DataBind(); dropBrandCategories.SelectedValue = product.BrandId; LoadProudct(product); } } } }
public override void DataBind() { Items.Clear(); DataTable categories = SubsiteCatalogHelper.GetCategories(); string cateid = ""; for (int i = 0; i < categories.Rows.Count; i++) { cateid = categories.Rows[i]["CategoryId"].ToString(); Items.Add(new ListItem(FormatDepth((int)categories.Rows[i]["Depth"], Globals.HtmlDecode((string)categories.Rows[i]["Name"])), cateid)); } }
public override void DataBind() { this.Items.Clear(); IList <CategoryInfo> sequenceCategories = SubsiteCatalogHelper.GetSequenceCategories(); for (int i = 0; i < sequenceCategories.Count; i++) { this.Items.Add(new ListItem(this.FormatDepth(sequenceCategories[i].Depth, Globals.HtmlDecode(sequenceCategories[i].Name)), sequenceCategories[i].CategoryId.ToString(CultureInfo.InvariantCulture))); } ListItem item = new ListItem("--所有--", "0"); this.Items.Insert(0, item); }
protected void DoCallback() { this.Page.Response.Clear(); base.Response.ContentType = "text/json"; System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); int num = 0; int num2 = 0; int pageIndex = 1; int.TryParse(base.Request.Params["categoryId"], out num); int.TryParse(base.Request.Params["brandId"], out num2); int.TryParse(base.Request.Params["page"], out pageIndex); ProductQuery productQuery = new ProductQuery(); productQuery.PageSize = 15; productQuery.PageIndex = pageIndex; productQuery.SaleStatus = ProductSaleStatus.OnSale; productQuery.IsIncludePromotionProduct = new bool?(false); productQuery.IsIncludeBundlingProduct = new bool?(false); productQuery.Keywords = base.Request.Params["serachName"]; if (num2 != 0) { productQuery.BrandId = new int?(num2); } productQuery.CategoryId = new int?(num); if (num != 0) { productQuery.MaiCategoryPath = SubsiteCatalogHelper.GetCategory(num).Path; } DbQueryResult products = SubSiteProducthelper.GetProducts(productQuery); System.Data.DataTable dataTable = (System.Data.DataTable)products.Data; stringBuilder.Append("{'data':["); for (int i = 0; i < dataTable.Rows.Count; i++) { stringBuilder.Append("{'ProductId':'"); stringBuilder.Append(dataTable.Rows[i]["ProductId"].ToString().Trim()); stringBuilder.Append("','Name':'"); stringBuilder.Append(dataTable.Rows[i]["ProductName"].ToString()); stringBuilder.Append("','Price':'"); stringBuilder.Append(((decimal)dataTable.Rows[i]["SalePrice"]).ToString("F2")); stringBuilder.Append("','Stock':'"); stringBuilder.Append(dataTable.Rows[i]["Stock"].ToString()); stringBuilder.Append("'},"); } stringBuilder.Append("],'recCount':'"); stringBuilder.Append(products.TotalRecords); stringBuilder.Append("'}"); base.Response.Write(stringBuilder.ToString()); base.Response.End(); }
private void dropAddToCategories_SelectedIndexChanged(object sender, System.EventArgs e) { DistributorProductCategoriesDropDownList distributorProductCategoriesDropDownList = (DistributorProductCategoriesDropDownList)sender; System.Web.UI.WebControls.GridViewRow gridViewRow = (System.Web.UI.WebControls.GridViewRow)distributorProductCategoriesDropDownList.NamingContainer; if (distributorProductCategoriesDropDownList.SelectedValue.HasValue) { SubsiteCatalogHelper.SetProductExtendCategory((int)this.grdProducts.DataKeys[gridViewRow.RowIndex].Value, SubsiteCatalogHelper.GetCategory(distributorProductCategoriesDropDownList.SelectedValue.Value).Path + "|"); this.ReBind(); return; } SubsiteCatalogHelper.SetProductExtendCategory((int)this.grdProducts.DataKeys[gridViewRow.RowIndex].Value, null); this.ReBind(); }
private void grdTopCategries_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = ((GridViewRow)((Control)e.CommandSource).NamingContainer).RowIndex; int categoryId = (int)grdTopCategries.DataKeys[rowIndex].Value; if (e.CommandName == "Fall") { SubsiteCatalogHelper.SwapCategorySequence(categoryId, CategoryZIndex.Down); } else if (e.CommandName == "Rise") { SubsiteCatalogHelper.SwapCategorySequence(categoryId, CategoryZIndex.Up); } BindData(); }
protected void grdTopCategries_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Save") { int rowIndex = ((GridViewRow)((Control)e.CommandSource).NamingContainer).RowIndex; int categoryId = (int)grdTopCategries.DataKeys[rowIndex].Value; DropdownColumn column = (DropdownColumn)grdTopCategries.Columns[1]; string themeName = column.SelectedValues[rowIndex]; if (SubsiteCatalogHelper.SetCategoryThemes(categoryId, themeName)) { BindData(); ShowMsg("保存分类模板成功", true); } } }
private void SaveAll() { DropdownColumn column = (DropdownColumn)grdTopCategries.Columns[1]; int categoryId = 0; foreach (GridViewRow row in grdTopCategries.Rows) { string themeName = column.SelectedValues[row.RowIndex]; categoryId = (int)grdTopCategries.DataKeys[row.RowIndex].Value; SubsiteCatalogHelper.SetCategoryThemes(categoryId, themeName); } }
private void grdTopCategries_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (e.CommandName == "Save") { int rowIndex = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex; int categoryId = (int)this.grdTopCategries.DataKeys[rowIndex].Value; DropdownColumn dropdownColumn = (DropdownColumn)this.grdTopCategries.Columns[1]; string themeName = dropdownColumn.SelectedValues[rowIndex]; if (SubsiteCatalogHelper.SetCategoryThemes(categoryId, themeName)) { this.BindData(); this.ShowMsg("保存分类模板成功", true); } } }
private void dropAddToCategories_SelectedIndexChanged(object sender, EventArgs e) { DistributorProductCategoriesDropDownList list = (DistributorProductCategoriesDropDownList)sender; GridViewRow namingContainer = (GridViewRow)list.NamingContainer; if (list.SelectedValue.HasValue) { SubsiteCatalogHelper.SetProductExtendCategory((int)grdProducts.DataKeys[namingContainer.RowIndex].Value, SubsiteCatalogHelper.GetCategory(list.SelectedValue.Value).Path + "|"); ReBind(); } else { SubsiteCatalogHelper.SetProductExtendCategory((int)grdProducts.DataKeys[namingContainer.RowIndex].Value, null); ReBind(); } }
/// <summary> /// 绑定模板 /// </summary> private void BindData() { DropdownColumn column = (DropdownColumn)grdTopCategries.Columns[1]; IList <ManageThemeInfo> themes = GetThemes(); if (themes.Count != 0) { column.DataSource = themes; grdTopCategries.DataSource = SubsiteCatalogHelper.GetMainCategories(); grdTopCategries.DataBind(); } else { ShowMsg("分销模板不存在,请检查!", false); } }
private void btnDownload_Click(object sender, EventArgs e) { if (this.grdTopCategries.Rows.Count > 0) { this.ShowMsg("子站已有商品分类,请先删除所有商品分类再下载!", false); } else if (SubsiteCatalogHelper.DownloadCategory() > 0) { this.grdTopCategries.SelectedIndex = -1; this.BindData(); this.ShowMsg("成功下载了主站分类", true); } else { this.ShowMsg("商品没有铺货,主站商品分类下载失败", false); } }