public void Add() { if (CheckAjax()) { if (CheckRight()) { if (IsPost) { M.ProductAttribute attr = new M.ProductAttribute() { Name = Request["Name"], CategoryId = int.Parse(Request["CategoryId"]), SortNum = int.Parse(Request["SortNum"]) }; SetResult(attr.Insert(DataSource), () => { WritePostLog("ADD"); }); } else { NotFound(); } } } }
public void Mod() { if (CheckAjax()) { if (CheckRight()) { if (IsPost) { M.ProductAttribute attr = new M.ProductAttribute() { Id = int.Parse(Request["Id"]), Name = Request["Name"], SortNum = int.Parse(Request["SortNum"]) }; SetResult(attr.Update(DataSource), () => { WritePostLog("MOD"); }); } else { NotFound(); } } } }
protected override bool HasReferences(DataSource ds) { if (ExecuteCount <StoreCategory>(ds, P("ParentId", Id)) > 0) { return(true); } if (ProductBrand.GetCountByCategoryId(ds, Id) > 0) { return(true); } if (Product.GetCountByCategoryId(ds, Id) > 0) { return(true); } if (ProductAttribute.GetCountByCategoryId(ds, Id) > 0) { return(true); } if (OneProduct.GetCountByCategoryId(ds, Id) > 0) { return(true); } return(false); }
public void Del() { if (CheckAjax()) { if (CheckRight()) { if (IsPost) { M.ProductAttribute attr = new M.ProductAttribute() { Id = int.Parse(Request["Id"]) }; SetResult(attr.Delete(DataSource), () => { WritePostLog("DEL"); }); } else { NotFound(); } } } }