Example #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int id = this.GetIdInDvg();

            if (id > 0)
            {
                if (MessageBox.Show("Esta operação é irreversível. Deseja continuar?", "Confirmação de exclusão", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        string message = ProductCtrl.Delete(id);
                        UpdateDgvProducts();
                    }
                    catch (AggregateException ex)
                    {
                        MessageBox.Show("Aplicação servidora não responde: " + ex.Message);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Problema na solicitação: " + ex.Message);
                    }
                }
            }
            else
            {
                MessageBox.Show("Nenhum item selecionado!");
            }
        }
Example #2
0
        public ActionResult DelProduct(string SID)
        {
            string      acc         = "AC003";
            ProductCtrl productCtrl = new ProductCtrl(acc, SID);

            //删除前先判断商品是否有使用
            productCtrl.Delete();
            var resulst = new
            {
                productCtrl.Code,
                productCtrl.Msg
            };

            return(Json(resulst, "text/html", JsonRequestBehavior.AllowGet));
        }