Beispiel #1
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         cust = Fac.GetCustomer(txtCustomerName.Text);
         if (cust != null)
         {
             string returnMessage = Fac.DeleteCustomer(cust);
             if (returnMessage == "SUCCESS")
             {
                 MessageBox.Show("Customer renoved successfully");
             }
             else if (returnMessage == "FAILED")
             {
                 MessageBox.Show("Unable to remove custome right now ,pleas try later");
             }
             else
             {
                 MessageBox.Show(returnMessage);
             }
         }
         ClearForm();
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #2
0
        /// <summary>
        /// 删除
        /// </summary>
        private void DoDeleteSelectedCustomer()
        {
            CustomerEntity removeEntity = SelectedCustomerRow;

            if (removeEntity == null)
            {
                MsgBox.Warn("没有要删除的数据。");
                return;
            }

            if (MsgBox.AskOK(string.Format("确定要删除客户“{0}({1})”吗?", removeEntity.CustomerName, removeEntity.CustomerCode)) == DialogResult.OK)
            {
                bool ret = customerDal.DeleteCustomer(removeEntity.CustomerCode);
                if (ret)
                {
                    bindingSource1.Remove(removeEntity);
                }
                else
                {
                    MsgBox.Warn("删除失败。");
                }
            }
        }
 public ActionResult DeleteConfirmed(int id)
 {
     Customers.DeleteCustomer(id);
     return(RedirectToAction("Index"));
 }