private void Delete(HttpContext context) { int value = base.GetIntParam(context, "typeId", false).Value; if (value <= 0) { throw new HidistroAshxException("错误的参数"); } if (ProductTypeHelper.DeleteProductType(value)) { base.ReturnSuccessResult(context, "删除成功!", 0, true); return; } throw new HidistroAshxException("删除商品类型失败, 可能有商品正在使用该类型!"); }
private void grdProductTypes_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { int typeId = (int)this.grdProductTypes.DataKeys[e.RowIndex].Value; System.Collections.Generic.IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(typeId, AttributeUseageMode.Choose); if (ProductTypeHelper.DeleteProductType(typeId)) { foreach (AttributeInfo current in attributes) { foreach (AttributeValueInfo current2 in current.AttributeValues) { StoreHelper.DeleteImage(current2.ImageUrl); } } this.BindTypes(); this.ShowMsg("成功删除了一个商品类型", true); return; } this.ShowMsg("删除商品类型失败, 可能有商品正在使用该类型", false); }
private void grdProductTypes_RowDeleting(object sender, GridViewDeleteEventArgs e) { int typeId = (int)this.grdProductTypes.DataKeys[e.RowIndex].Value; IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(typeId, AttributeUseageMode.Choose); if (ProductTypeHelper.DeleteProductType(typeId)) { foreach (AttributeInfo info in attributes) { foreach (AttributeValueInfo info2 in info.AttributeValues) { StoreHelper.DeleteImage(info2.ImageUrl); } } this.BindTypes(); this.ShowMsg("成功删除了一个商品类型", true); } else { this.ShowMsg("删除商品类型失败, 可能有商品正在使用该类型", false); } }