protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteProduct") { if (_typeFlag == ProductOnMain.TypeFlag.None) { return; } ProductOnMain.DeleteProductByType(Convert.ToInt32(e.CommandArgument), _typeFlag); } }
protected void lbDeleteSelected_Click(object sender, EventArgs e) { if ((_selectionFilter != null) && (_selectionFilter.Values != null)) { if (!_inverseSelection) { foreach (var id in _selectionFilter.Values) { ProductOnMain.DeleteProductByType(Convert.ToInt32(id), _typeFlag); } } else { var itemsIds = _paging.ItemsIds <int>("Product.ProductId as ID"); foreach (int id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString(CultureInfo.InvariantCulture)))) { ProductOnMain.DeleteProductByType(id, _typeFlag); } } } }