Esempio n. 1
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdCategory_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ViewState["BGT_CATEGORYID"] = e.CommandArgument;
                GetCategoryDetails();
                SetUpdateMode(true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                CategoryBLL CategoryBLLobj = new CategoryBLL();
                message = CategoryBLLobj.DeleteCategory(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }

                ClearAll();
                SetUpdateMode(false);
                BindGrid(false, true);
            }

            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
        public void DeleteProcess(string _ID)
        {
            if (MessageBox.Show("Bạn muốn xóa?", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                TabPage tp = tabMenu.SelectedTab;
                switch (tabMenu.SelectedIndex)
                {
                case TAB_FOOD:
                    _thucAnBll.DeleteThucAnOf(_ID);
                    break;

                case TAB_DRINK:
                    _nuocUongBll.DeleteNuocUongOf(_ID);
                    break;

                case TAB_CARD:
                    _theCaoBll.DeleteCardOf(_ID);
                    break;

                case TAB_CATEGORY:
                    _category.DeleteCategory(_ID);
                    break;
                }
                ResetControl(tp);
                Load_ComboBox();
                Load_GridView();
                MessageBox.Show("Xóa thành công!");
            }
        }
 public IHttpActionResult DeleteCategory(long id)
 {
     if (CategoryBLL.DeleteCategory(id) == false)
     {
         return(NotFound());
     }
     return(Ok());
 }
        public ActionResult DeleteCategory(Models.Category category)
        {
            int result = categoryBLL.DeleteCategory(category.id);

            if (result == 1)
            {
                return(Json(new { success = true, responseText = "" }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { success = false, responseText = "Error in Deleting category !" }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
 public static bool DeletingCategory(int eid)
 {
     try
     {
         var categoryBLL = new CategoryBLL();
         return(categoryBLL.DeleteCategory(eid));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public JsonResult DeleteCategory(int ID)
        {
            List <PostImageDTO> postimagelist = bll.DeleteCategory(ID);

            foreach (var item in postimagelist)
            {
                if (System.IO.File.Exists(Server.MapPath("~/Areas/Admin/Content/PostImage/" + item.ImagePath)))
                {
                    System.IO.File.Delete(Server.MapPath("~/Areas/Admin/Content/PostImage/" + item.ImagePath));
                }
            }
            return(Json(""));
        }
Esempio n. 7
0
        public JsonResult DeleteCategory(int ID)
        {
            List <PostImageDTO> postImageList = bll.DeleteCategory(ID);

            foreach (PostImageDTO item in postImageList)
            {
                string imageFullPath = Server.MapPath("~/Areas/Admin/Content/PostImages/" + item.ImagePath);
                if (System.IO.File.Exists(imageFullPath))
                {
                    System.IO.File.Delete(imageFullPath);
                }
            }
            return(Json(""));
        }
Esempio n. 8
0
    protected void CategoryGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string categoryId = e.CommandArgument.ToString();

        if (e.CommandName.Equals("DeleteData"))
        {
            try
            {
                CategoryBLL.DeleteCategory(categoryId);
                SystemMessages.DisplaySystemMessage(Resources.Categories.MessageDeletedCategory);
                CategoryGridView.DataBind();
            }
            catch (Exception exc)
            {
                SystemMessages.DisplaySystemErrorMessage(exc.Message);
            }
        }
        else if (e.CommandName.Equals("EditData"))
        {
            Category theData = null;
            try
            {
                theData = CategoryBLL.GetCategoryById(categoryId);
            }
            catch (Exception exc)
            {
                SystemMessages.DisplaySystemErrorMessage(exc.Message);
            }

            if (theData != null)
            {
                IDTextBox.Text              = theData.ID;
                IDTextBox.ReadOnly          = true;
                NameTextBox.Text            = theData.Name;
                pnlEditData.Visible         = true;
                CategoryIdHiddenField.Value = theData.ID;
            }
        }
        else if (e.CommandName.Equals("ViewItems"))
        {
            Session["CATEGORYID"] = categoryId;
            Response.Redirect("~/Category/CategoryDetails.aspx");
        }
    }
Esempio n. 9
0
 public void DeleteCategory(int id)
 {
     bll.DeleteCategory(id);
 }
Esempio n. 10
0
 public void Delete(int id)
 {
     _dB.DeleteCategory(id);
 }
Esempio n. 11
0
 public IActionResult DeleteConfirmed(int?id)
 {
     _dB.DeleteCategory(id);
     return(RedirectToAction("Index"));
 }