Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            string cId = context.Request.QueryString["cId"];

            if (!string.IsNullOrEmpty(cId))
            {
                if (StringHelper.IsNumber(cId))
                {
                    int sId = int.Parse(cId);

                    int clsId = clsBll.GetProductById(sId).cDeptId;
                    if (clsBll.Delete(sId))
                    {
                        context.Response.Redirect("ProductList.ashx");
                    }
                }
                else
                {
                    context.Response.Write("你给的参数不是数字!<a href ='ProductList.ashx'>点击这里</a>");
                }
            }
            else
            {
                context.Response.Redirect("ProductList.ashx");
            }
        }
Example #2
0
        /// <summary>
        /// 清空回收站按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ClearButton_Click(object sender, EventArgs e)
        {
            CheckAdminPower("DeleteProduct", PowerCheckType.Single);
            List <ProductInfo> productRecycleList = ProductBLL.SearchList(new ProductSearchInfo {
                IsDelete = 1
            });
            string deleteID = string.Empty;

            foreach (ProductInfo pro in productRecycleList)
            {
                if (deleteID == string.Empty)
                {
                    deleteID = pro.Id.ToString();
                }
                else
                {
                    deleteID += "," + pro.Id.ToString();
                }
            }

            if (deleteID != string.Empty)
            {
                ProductBLL.Delete(deleteID);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecordCompletely"), ShopLanguage.ReadLanguage("Product"), deleteID);
                ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteCompletelyOK"), RequestHelper.RawUrl);
            }
        }
Example #3
0
        /// <summary>
        /// 删除按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            CheckAdminPower("DeleteProduct", PowerCheckType.Single);
            string deleteID = RequestHelper.GetIntsForm("SelectID");

            if (deleteID != string.Empty)
            {
                ProductBLL.Delete(deleteID);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecordCompletely"), ShopLanguage.ReadLanguage("Product"), deleteID);
                ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteCompletelyOK"), RequestHelper.RawUrl);
            }
        }
Example #4
0
    protected void btnDel_Click(object sender, EventArgs e)
    {
        int delcount = 0;

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            CheckBox chkSel = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("chkSelect");
            if (chkSel.Checked == true)
            {
                delcount++;
                pdBLL.Delete((int)GridView1.DataKeys[i].Value);
            }
        }
        if (delcount != 0)
        {
            this.ShowMessage(this.Getmessage("30014") + " 刪除數:" + delcount);
        }
        else
        {
            this.ShowMessage(this.Getmessage("30013") + " 請至少選擇一筆資料");
        }
        GridView1.DataBind();
    }
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            ProductBLL bll = new ProductBLL();

            bool ret = bll.Delete(txtProductID.Text);

            if (ret)
            {
                gvProduct.DataSource = bll.GetProducts();
                MessageBox.Show("Deleted successfully");
            }
            else
            {
                MessageBox.Show("Delete failure");
            }
        }
        public IHttpActionResult DelProduct(RequestDelProduct request)
        {
            var tokenResult = IdentityValid.ValidateToken(request.Token);

            if (!tokenResult.IsSuccess)
            {
                return(Json(tokenResult));
            }

            var productBll = new ProductBLL();

            bool isSuccess = productBll.Delete(o => o.UserName == tokenResult.userName && o.ProdcutId == request.ProdcutId);

            return(Json(new ResponseMsg()
            {
                IsSuccess = isSuccess
            }));
        }
        private void btnProductDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Tem certeza que deseja excluir?", "", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                Product product = new Product();
                product.ID = Convert.ToInt32(lblID.Text);
                Response response = _productBLL.Delete(product);
                MessageBox.Show(response.Message);
                if (response.Success)
                {
                    this.ClearForm();
                    _suppliers.Clear();
                    UpdateGrid();
                    UpdateComponentsRegister();
                }
            }
        }
Example #8
0
        public ActionResult Delete(Product product)
        {
            if (ModelState.IsValid)
            {
                if (_productBll.Delete(product))
                {
                    ViewBag.SuccesMsg = "Deleted Data";
                }
                else
                {
                    ViewBag.FailedMsg = "Failed";
                }
            }
            else
            {
                ViewBag.FailedMsg = "Validation Failed";
            }

            return(View(product));
        }
Example #9
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (detail.ProductID == 0)
     {
         MessageBox.Show("Please select a product from table");
     }
     else
     {
         DialogResult result = MessageBox.Show("Are you sure?", "Warning!!", MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             if (bll.Delete(detail))
             {
                 MessageBox.Show("Product was Deleted");
                 bll = new ProductBLL();
                 dto = bll.Select();
                 dataGridView1.DataSource = dto.Products;
                 cmbCategory.DataSource   = dto.Categories;
                 CleanFilters();
             }
         }
     }
 }
Example #10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (op == Operation.Insert)
                {
                    foreach (Control c in gbInfo.Controls)
                    {
                        if (c is TextBox && c.Text == "")
                        {
                            MessageBox.Show("请输入所有值!");
                            c.Focus();
                            return;
                        }
                    }
                    p               = new Product();
                    p.ProductID     = txtProductID.Text;
                    p.ProductName   = txtProductName.Text;
                    p.SpellingCode  = txtSpellingCode.Text;
                    p.BarCode       = txtBarCode.Text;
                    p.Special       = txtSpecial.Text;
                    p.Unit          = txtUnit.Text;
                    p.Origin        = txtOrigin.Text;
                    p.CategoryID    = cbCategoryIDP.SelectedValue.ToString();
                    p.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
                    p.SalePrice     = Convert.ToDecimal(txtSalePrice.Text);
                    p.Quantity      = Convert.ToInt32(txtQuantity.Text);
                    if (pBLL.Insert(p))
                    {
                        MessageBox.Show("新增成功!");
                        BindDate();
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (list[i].ProductID == p.ProductID)
                            {
                                dgProductInfo.Rows[i].Selected = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("新增失败!");
                    }
                }
                else if (op == Operation.Update)
                {
                    if (p == null)
                    {
                        MessageBox.Show("请选择要修改的记录!");
                        return;
                    }
                    p.ProductName = txtProductName.Text.Trim();
                    p.BarCode     = txtBarCode.Text.Trim();
                    p.Special     = txtSpecial.Text.Trim();
                    p.Unit        = txtUnit.Text.Trim();
                    p.Origin      = txtOrigin.Text.Trim();
                    p.CategoryID  = cbCategoryIDP.SelectedValue.ToString();

                    if (pBLL.Update(p))
                    {
                        MessageBox.Show("修改成功!");
                        BindDate();
                        dgProductInfo.Rows[currentIndex].Selected = true;
                    }
                    else
                    {
                        MessageBox.Show("修改失败!");
                    }
                }
                else if (op == Operation.Delete)
                {
                    if (p == null)
                    {
                        MessageBox.Show("请选择要删除的记录!");
                        return;
                    }
                    if (pBLL.Delete(p))
                    {
                        MessageBox.Show("删除成功!");
                        BindDate();
                        p = null;
                    }
                    else
                    {
                        MessageBox.Show("删除失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult Delete(string id)
        {
            var json = _proBll.Delete(id);

            return(Json(json, JsonRequestBehavior.AllowGet));
        }
Example #12
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (op == Operation.INSERT)   //新增按钮被点击
            {
                //判断是否输入了所有的值
                foreach (Control col in gbInfo.Controls)
                {
                    if (col is TextBox && col.Text == "")
                    {
                        MessageBox.Show("请输入所有的值", "提示");
                        return;
                    }
                }

                SetProductParmeters();  //调用方法 赋值

                try
                {
                    //判断执行是否成功(新增)
                    if (productBLL.Insert(prod))
                    {
                        MessageBox.Show("新增成功!", "提示");
                        //清空
                        foreach (Control col in gbInfo.Controls)
                        {
                            if (col is TextBox)
                            {
                                ((TextBox)col).Text = string.Empty;
                            }
                        }

                        BindDateGridView();                         //调用填充方法 重新填充DateGridView的数据(刷新结果)
                        dgProductInfo.CurrentRow.Selected = false;  //取消行的选中状态(第一行)

                        for (int i = 0; i < list.Count; i++)        //新增的当前行被选中
                        {
                            if (list[i].ProductID == prod.ProductID)
                            {
                                dgProductInfo.Rows[i].Selected = true;
                                //自动跳转到查找到的行
                                dgProductInfo.FirstDisplayedScrollingRowIndex = i;
                                break;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("新增失败!", "提示");
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            else if (op == Operation.UPDATE)   //修改按钮被点击
            {
                if (prod == null)
                {
                    MessageBox.Show("请选择要修改的数据!", "提示");
                }


                SetProductParmeters();  //调用方法 赋值

                try
                {
                    //判断执行是否成功(更新)
                    if (productBLL.Update(prod))
                    {
                        MessageBox.Show("更新成功!", "提示");
                        BindDateGridView();                                    //重新填充ateGridView (刷新结果)
                        dgProductInfo.CurrentRow.Selected             = false; //取消行的选中状态(第一行)
                        dgProductInfo.Rows[currentRowsIndex].Selected = true;  //将当前被更新的行进行反蓝色显示
                        //自动跳转到查找到的行
                        dgProductInfo.FirstDisplayedScrollingRowIndex = currentRowsIndex;
                    }
                    else
                    {
                        MessageBox.Show("更新失败!", "提示");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            else if (op == Operation.DELETE)   //删除按钮被点击
            {
                if (prod == null)
                {
                    MessageBox.Show("请选择要删除的数据!", "提示");
                }

                //弹出是否确认删除的对话框
                DialogResult result = MessageBox.Show("您是否真的要删除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    try
                    {
                        if (productBLL.Delete(prod))
                        {
                            MessageBox.Show("删除成功", "提示");
                            BindDateGridView();
                            dgProductInfo.CurrentRow.Selected = false;   //取消行的选中状态(第一行)
                            prod = null;                                 //清空参数

                            //直接初始化 当前窗口
                            btnNewAdd.Enabled = btnModify.Enabled = btnDelete.Enabled = true;
                            gbInfo.Visible    = false;
                        }
                        else
                        {
                            MessageBox.Show("删除失败!", "提示");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        return;
                    }
                }
            }
        }
 public string Delete(int Id)
 {
     return(productBLL.Delete(Id));
 }
Example #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ReadProduct", PowerCheckType.Single);

                foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList())
                {
                    ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|"));
                }
                ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty));

                BrandID.DataSource     = ProductBrandBLL.ReadList();
                BrandID.DataTextField  = "Name";
                BrandID.DataValueField = "ID";
                BrandID.DataBind();
                BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty));

                ClassID.Text      = RequestHelper.GetQueryString <string>("ClassID");
                BrandID.Text      = RequestHelper.GetQueryString <string>("BrandID");
                Key.Text          = RequestHelper.GetQueryString <string>("Key");
                StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate");
                EndAddDate.Text   = RequestHelper.GetQueryString <string>("EndAddDate");


                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.Key          = RequestHelper.GetQueryString <string>("Key");
                productSearch.ClassId      = RequestHelper.GetQueryString <string>("ClassID");
                productSearch.BrandId      = RequestHelper.GetQueryString <int>("BrandID");
                productSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate");
                productSearch.EndAddDate   = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate"));
                productSearch.IsDelete     = 1;//逻辑删除的商品
                //PageSize = 10;
                PageSize           = Session["AdminPageSize"] == null ? 20 : Convert.ToInt32(Session["AdminPageSize"]);
                AdminPageSize.Text = Session["AdminPageSize"] == null ? "20" : Session["AdminPageSize"].ToString();
                List <ProductInfo> productList = ProductBLL.SearchList(CurrentPage, PageSize, productSearch, ref Count);
                BindControl(productList, RecordList, MyPager);

                var pid = RequestHelper.GetQueryString <int>("ID");

                switch (RequestHelper.GetQueryString <string>("Action"))
                {
                case "Recover":
                    if (pid > 0)
                    {
                        ProductBLL.Recover(pid);
                        AdminLogBLL.Add(ShopLanguage.ReadLanguage("RecoverRecord"), ShopLanguage.ReadLanguage("Product"), pid);
                        ScriptHelper.Alert(ShopLanguage.ReadLanguage("RecoverOK"), Request.UrlReferrer.ToString());
                    }
                    break;

                case "Delete":
                    if (pid > 0)
                    {
                        ProductBLL.Delete(pid);
                        AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecordCompletely"), ShopLanguage.ReadLanguage("Product"), pid);
                        ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteCompletelyOK"), Request.UrlReferrer.ToString());
                    }
                    break;

                default:
                    break;
                }
            }
        }
 public void Delete(int id)
 {
     productService.Delete(id);
 }
Example #16
0
 protected void gridViewProduct_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     productDTO.Id = Convert.ToInt32(gridViewProduct.DataKeys[e.RowIndex].Value.ToString());
     productBLL.Delete(productDTO);
     ShowGridViewProduct();
 }
Example #17
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     MessageBox.Show(productBLL.Delete(product).Message);
     dgvProducts.DataSource = productBLL.GetAllProductsByActive().Data;
 }
 public IHttpActionResult Delete(int ProductID)
 {
     _ProductService.Delete(ProductID, User.Identity.GetUserId());
     return(Ok());
 }
Example #19
0
        public int Delete(Product parameter)
        {
            ProductBLL bll = new ProductBLL();

            return(bll.Delete(parameter));
        }