コード例 #1
0
        public bool Delete(string productId)
        {
            ProductDAL ProductDAL = new ProductDAL();

            ProductDAL.DeleteProduct(productId);
            return(true);
        }
コード例 #2
0
        private void dgvProduct_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataTable data = ProductDAL.GetAllProduct();

            if (dgvProduct.Columns[e.ColumnIndex].Name.Equals("Edit"))
            {
                this.Visible = false;
                Product x = new Product(data.Rows[e.RowIndex]["ProductId"].ToString(),
                                        data.Rows[e.RowIndex]["ProductName"].ToString(),
                                        data.Rows[e.RowIndex]["CategoryId"].ToString(),
                                        data.Rows[e.RowIndex]["Unit"].ToString(),
                                        int.Parse(data.Rows[e.RowIndex]["Price"].ToString()),
                                        int.Parse(data.Rows[e.RowIndex]["Quantity"].ToString()),
                                        bool.Parse(data.Rows[e.RowIndex]["Discontinued"].ToString()),
                                        DateTime.Parse(data.Rows[e.RowIndex]["CreateDate"].ToString()));

                this.Visible = false;
                EditProductGUI editProductGUI = new EditProductGUI(x);
                editProductGUI.ShowDialog();
                RefreshProduct();
                this.Visible = true;
            }
            if (dgvProduct.Columns[e.ColumnIndex].Name.Equals("Delete"))
            {
                if (MessageBox.Show("Do you want delete the this row?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ProductDAL.DeleteProduct(data.Rows[e.RowIndex]["ProductId"].ToString());
                    RefreshProduct();
                }
                else
                {
                    MessageBox.Show("Delete false.");
                }
            }
        }
コード例 #3
0
        public ActionResult RemoveFromCart()
        {
            ProductDAL proDAL = new ProductDAL();
            int        id     = Convert.ToInt32(TempData["pid"]);

            proDAL.DeleteProduct(id);
            return(RedirectToAction("ShowCart"));
        }
コード例 #4
0
        }//End of deactivateProduct(.)

        public Boolean DeleteProduct(Product product)
        {
            if (product == null)
            {
                throw new ArgumentException("The product was null, therefore it cannot be deleted.");
            }
            return(ProductDAL.DeleteProduct(product, _connection));
        }//End of deleteProduct(.)
コード例 #5
0
ファイル: ProductBUS.cs プロジェクト: AGU18PM/Do-An-Nam-3
        public void DeleteProduct(ProductDTO product)
        {
            BillInfoDTO billInfo = new BillInfoDTO();
            BillDTO     billDTO  = new BillDTO();

            billInfo.Tivi = product;
            billInfoBUS.DelNGetBill(billInfo);
            data.DeleteProduct(product);
        }
コード例 #6
0
        public IActionResult DeleteProduct(string PID)
        {
            InitView();
            ProductModel product = null;

            try
            {
                var productDal = new ProductDAL(_configuration);
                product = productDal.GetProduct(Convert.ToInt32(PID));
                productDal.DeleteProduct(PID);
                ViewBag.ErrorMessage = string.Empty;
            }
            catch (Exception)
            {
                ViewBag.ErrorMessage = "Unable to delete product from database";
            }


            return(View("DeleteProduct", product));
        }
コード例 #7
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            // get the id of  Products which we ant to Delete
            proBll.Id = int.Parse(txtProductID.Text);
            //Cerating bool Variable to Delete The  Product
            bool success = proDal.DeleteProduct(proBll);

            if (success == true)
            {
                MessageBox.Show(" Product DELETED Successfully");
                Clear();
                //Refreshing DataGrid View
                DataTable dt = proDal.SelectProduct();
                dGVProducts.DataSource = dt;
            }
            else
            {
                MessageBox.Show("Failed to Delete  Product");
            }
        }
コード例 #8
0
        public HttpResponseMessage DeleteProduct(Product product)
        {
            ResponseMessage <Product> objResponseData = new ResponseMessage <Product>();

            try
            {
                int isDeleted = objProductDAL.DeleteProduct(product);

                if (isDeleted > 0)
                {
                    objResponseData = ResponseHandler <Product> .CreateResponse(objResponseData, "Product Has Been Deleted.", HttpStatusCode.OK);
                }
                else
                {
                    objResponseData = ResponseHandler <Product> .CreateResponse(objResponseData, "Can't Delete Product", HttpStatusCode.NoContent);
                }
            }
            catch (System.Exception ex)
            {
                objErrorLogger.ErrorLog(ex);
                objResponseData = ResponseHandler <Product> .CreateErrorResponse(objResponseData);
            }
            return(Request.CreateResponse(objResponseData.StatusCode, objResponseData));
        }
コード例 #9
0
 public bool DeleteProduct(int id)
 {
     return(productDAL.DeleteProduct(id));
 }
コード例 #10
0
 public void DeleteProduct(int id)
 {
     productDal.DeleteProduct(id);
 }
コード例 #11
0
 /// <summary>
 /// delete
 /// </summary>
 /// <param name="id"></param>
 public void DeleteProduct(int id)
 {
     ProdDAL.DeleteProduct(id);
 }
コード例 #12
0
 /// <summary>
 /// Delete the product(s)
 /// </summary>
 /// <param name="Ids">The product ids to delete</param>
 public void DeleteProduct(List <int> Ids, int?userId)
 {
     productDAL.DeleteProduct(Ids, userId);
 }
コード例 #13
0
 public ActionResult Delete(string id)
 {
     pDAL.DeleteProduct(Convert.ToInt32(id));
     return(RedirectToAction("Index"));
 }