protected void Grilla_RowCommand(Object sender, GridViewCommandEventArgs e) { var productBLL = new ProductBLL(); var user = (User)Session["UserEntity"]; if (user.ProfileType == EProfile.Administrator || user.ProfileType == EProfile.Operator) { if (e.CommandName == "DeleteProduct") { productBLL.DeleteProduct(e.CommandArgument.ToString()); LoadProducts(); } else if (e.CommandName == "ModifyProduct") { Session["SkuToModify"] = e.CommandArgument.ToString(); Response.Redirect("ModifyProduct.aspx"); } } else { Session["ErrorId"] = 1; Session["ErrorMessage"] = "You do not have permission to execute this action."; Response.Redirect("ErrorPage.aspx"); } }
public IHttpActionResult DeleteProduct(long id) { if (ProductBLL.DeleteProduct(id) == false) { return(NotFound()); } return(Ok()); }
public ActionResult DeleteProduct(int id) { if (ModelState.IsValid) { ProductBLL objProductBll = new ProductBLL(); objProductBll.DeleteProduct(id); } return(RedirectToAction("Index", "Product")); }
public async Task <IActionResult> DeleteConfirmed(int?id) { if (id == null) { return(NotFound()); } ResultObject resultObj; try { if (_cache.TryGetValue("CACHE_MASTER_PRODUCT", out List <M_Product> c_lstProd)) { var m_Product = c_lstProd.Find(p => p.Id == id); if (m_Product == null) { return(NotFound()); } m_Product.Updated_By = await base.CurrentUserId(); using (var prodBll = new ProductBLL()) { resultObj = await prodBll.DeleteProduct(m_Product); _cache.Remove("CACHE_MASTER_PRODUCT"); } return(Json(new { success = true, data = (M_Product)resultObj.ObjectValue, message = "Product Deleted." })); } using (var prodBll = new ProductBLL()) { var lstProd = await prodBll.GetProduct(id); var m_Product = lstProd.First(); if (m_Product == null) { return(NotFound()); } m_Product.Updated_By = await base.CurrentUserId(); resultObj = await prodBll.DeleteProduct(m_Product); _cache.Remove("CACHE_MASTER_PRODUCT"); } return(Json(new { success = true, data = (M_Product)resultObj.ObjectValue, message = "Product Deleted." })); } catch (Exception ex) { return(Json(new { success = false, message = ex.Message })); } }
public ActionResult Delete(int id, Product p) { try { var iplProduct = new ProductBLL(); iplProduct.DeleteProduct(id); return(RedirectToAction("Index")); } catch { return(View()); } }
private void btnXoa_Click(object sender, EventArgs e) { ProductBLL productBLL = new ProductBLL(); productBLL.DeleteProduct(id); txtProductname.Text = ""; txtDetail.Text = ""; amount.Value = 0; price.Value = 0; lblNameImage.Text = "Chưa có ảnh"; previewImage.Image = null; LoadListview(); flag = false; }
private void btnDelete_Click(object sender, EventArgs e) { try { int id = int.Parse(txtId.Text); productBLL.DeleteProduct(id); MessageBox.Show("Delete successful!"); loadData(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public dynamic DeleteProduct() { int id = Fun.Form("id", 0); int state = Fun.Form("state", 0); ProductBLL bll = new ProductBLL(); if (!bll.DeleteProduct(id, state)) { return("失败"); } else { return("成功"); } }
public ActionResult DeleteProduct(int id) { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 403)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } ProductBLL productBLL = new ProductBLL(); ProductObj productObj = productBLL.GetProduct(id); DeletePics(productObj.ProductPictures); DeletePics(productObj.Colors); productBLL.DeleteProduct(id); return(Json(new { success = true })); }
public IActionResult DeleteConfirmed(int?id) { _dB.DeleteProduct(id); return(RedirectToAction("Index")); }
public void Delete(int id) { _dB.DeleteProduct(id); }
public JsonResult DeleteProduct(int id) { var result = productBLL.DeleteProduct(id); return(Json(result)); }
public ActionResult DelProduct(long id) { productBll.DeleteProduct(id); return(RedirectToAction("GetProducts")); }