protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int rowIndex = e.RowIndex;

            Order order = new Order();

            order.Order_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value);

            OrderProvider provider = new OrderProvider();

            if (provider.Delete(order))
            {
                this.Alert("删除成功!!!");

                if (this.txt_Name.Text == "")
                {
                    this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1;
                    this.BindSource(null);
                }
                else
                {
                    this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1;
                    this.BindSource("%" + this.txt_Name.Text + "%");
                }
            }
        }
Esempio n. 2
0
        public ActionResult Delete(string id)
        {
            var viewModel = new GenericModel <OrderModel>();

            try
            {
                var success = OrderProvider.Delete(Helpers.GetAuthenticator(), id);

                viewModel.ResultMessage = !success ? Resources.UnsuccesfullyDeleted : Resources.SuccesfullyDeleted;
            }
            catch (Exception ex)
            {
                viewModel.ErrorMessage = ex.GetBaseException().Message;
            }

            viewModel.Criteria.Add("criteriaId", id);

            return(View("Index", viewModel));
        }