private void btnDELETE_Click(object sender, EventArgs e) { if (!GetConfirmation("Do you want to delete this product ?", "Delete confirm")) { return; } if (MessageBox.Show("ARE YOU SURE TO DELETE THIS PRODUCT, THIS ACTION CAN CAUSE DATA LOSS", "DELETE CONFIRM", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } if (MessageBox.Show("THIS FEATURE IS STILL UNDER DEVELOP SO YOU CAN'T GET YOUR DATA BACK, ARE YOU SURE TO PROCEED?", "DELETE CONFIRM", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.No) { return; } try { CustomResult cr = bus.DeleteProduct((productBindingSource.Current as Product).Id); if (cr.Result == CustomResultType.Succeed) { MessageBox.Show(cr.ErrorMessage); } } catch (Exception ex) { ShowErrorMessagerBox(ex.Message); } }
private void btnDelete_Clicked(object sender, RoutedEventArgs e) { ProductBUS bus = new ProductBUS(); bus.DeleteProduct(ID); this.Close(); }
private void btnDelete_Click(object sender, EventArgs e) { toDo = 3; if (MessageBox.Show("Nếu bạn xóa sản phẩm này, những hóa đơn liên qua sẽ bị xóa, bạn có chắc muốn xóa? " + txbName.Text + " không?", "Xóa", MessageBoxButtons.YesNo) == DialogResult.Yes) { productDTO.ProductId = Convert.ToInt32(txbID.Text); productBUS.DeleteProduct(productDTO); productBUS.loadDataToDGV(dGVWareHouse, txbID, cboCategory, txbName, cboType, txbSize, nUDCount, txbPriceOut, txbPriceIn); MessageBox.Show("Xóa thành công!!!"); } }
private void button2_Click(object sender, EventArgs e) { if (listProducts.Count > 0) { DialogResult result = MessageBox.Show("Are you sure?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { int index = dataGridView1.CurrentCell.RowIndex; Product p = listProducts[index]; productBUS.DeleteProduct(p.ProductID); MessageBox.Show("Delete Product ID=" + p.ProductID.ToString() + " successfully", "Information"); listProducts.RemoveAt(index); dataGridView1.DataSource = null; dataGridView1.DataSource = listProducts; dataGridView1.Refresh(); } } }
private void btnDelete_Click(object sender, EventArgs e) { int index = dgvProducts.CurrentCell.RowIndex; ProductDTO product = new ProductDTO { ID = int.Parse(dgvProducts.Rows[index].Cells["ID"].Value.ToString()) }; if (MessageBox.Show("Do you want to delete Product-" + product.ID + "?", "Delete Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (productBUS.DeleteProduct(product)) { MessageBox.Show("Delete products was successfull!", "Delete Result", MessageBoxButtons.OK, MessageBoxIcon.Information); loadData(); } else { MessageBox.Show("Delete products was fail!", "Delete Result", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }