示例#1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult option;
                option = MessageBox.Show("Do you really want to delete?", "SysBusiness", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (option == DialogResult.OK)
                {
                    string Code;
                    string resp = "";

                    foreach (DataGridViewRow row in dataList.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            Code = Convert.ToString(row.Cells[1].Value);
                            resp = BProduct.Delete(Convert.ToInt32(Code));

                            if (resp.Equals("OK"))
                            {
                                this.MessageOk("Success deleted");
                            }
                            else
                            {
                                this.MessageError(resp);
                            }
                        }
                    }
                    this.ShowValues();
                }
            }
            catch (Exception ex)
            {
            }
        }
示例#2
0
        public ActionResult Delete()
        {
            string name = Request.Form["pId"];

            List <DeleteId> models = LitJson.JsonMapper.ToObject <List <DeleteId> >(name);

            if (models == null)
            {
                return(Content(ReturnMsg.fail.ToString()));
            }

            bool isSucc = BProduct.Delete(models.Select(_ => _.Id).ToList());

            if (isSucc)
            {
                return(Content(ReturnMsg.success.ToString()));
            }
            else
            {
                return(Content(ReturnMsg.fail.ToString()));
            }
        }
示例#3
0
 /// <summary>
 /// 删除
 /// </summary>
 private void MasterToolBar_DoDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确定要删除吗?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.OK)
     {
         try
         {
             GetCurrentSelectedTable();
             if (_currentProductTable != null)
             {
                 bProduct.Delete(_currentProductTable.CODE);
                 Search(this.pgControl.GetCurrentPage());
             }
             else
             {
                 MessageBox.Show("请选择正确的行!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("删除失败,请重试或与系统管理员联系。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         _currentProductTable = null;
     }
 }