コード例 #1
0
 //[HttpPost]
 public ActionResult Delete(string Code)
 {
     try
     {
         var aCustomer = _customer.GetCustomerById(Code);
         if (aCustomer != null)
         {
             var isDelete = _customer.Delete(aCustomer);
             if (isDelete)
             {
                 ViewBag.SDeleted = "Delete Success.";
                 //return RedirectToAction("Show");
             }
             else
             {
                 ViewBag.NSDelete = "Delete Failed.";
             }
         }
         else
         {
             ViewBag.FMsg = "Customer not found.";
         }
     }
     catch (Exception exception)
     {
         ViewBag.FMsg = exception.Message;
     }
     return(View());
 }
コード例 #2
0
 // GET: Items/Delete/5
 public JsonResult Delete(int id)
 {
     status = _customerBll.Delete(id);
     if (status == true)
     {
         return(Json(1));
     }
     return(Json(0));
 }
コード例 #3
0
        private void deleteButton_Click(object sender, EventArgs e)
        {
            //Set Id as Mandatory
            if (String.IsNullOrEmpty(idTextBox.Text))
            {
                MessageBox.Show("Id Text Box can not be Empty!!!");
                return;
            }

            //Delete
            if (_customerBll.Delete(Convert.ToInt32(idTextBox.Text)))
            {
                MessageBox.Show("Deleted");
            }
            else
            {
                MessageBox.Show("Not Deleted");
            }

            showDataGridView.DataSource = _customerBll.Display();
        }
コード例 #4
0
        /// <summary>
        /// 删除用户
        /// </summary>
        public void Delete()
        {
            int    id       = Convert.ToInt32(Request["cutomerId"]);
            Result isDelete = cbll.IsDelete("T_LibraryCollection", "customerId", id.ToString());

            if (isDelete == Result.关联引用)
            {
                Response.Write("该客户已被关联到其他表,不能删除!");
            }
            else
            {
                Result row = cbll.Delete(id);
                if (row == Result.除成功)
                {
                    Response.Write("删除成功");
                    Response.End();
                }
                else
                {
                    Response.Write("删除失败");
                    Response.End();
                }
            }
        }