private void btnDelete_Click(object sender, EventArgs e) { try { if (gridList.SelectedRows.Count > 0) { id = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString()); if (id != 0) { DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Factories.CreateSupplyInventory().Delete(id); LocalUtils.ShowDeleteSuccessMessage(this); ShowMainGrid(); id = 0; } } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception) { throw; } }
private void DeleteProductRawMaterial() { if (gridProductRawMaterials.SelectedRows.Count > 0) { productRawMaterialID = int.Parse(gridProductRawMaterials.SelectedRows[0].Cells[0].Value.ToString()); if (productRawMaterialID != 0) { DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Factories.CreateProduct().DeleteProductRawMaterial(productRawMaterialID); LocalUtils.ShowDeleteSuccessMessage(this); LoadProductRawMaterialGridList(); productRawMaterialID = 0; } } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } }
private void Delete() { try { if (gridList.SelectedRows.Count > 0) { userID = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString()); if (userID != 0) { DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { Factories.CreateUser().Delete(userID); LocalUtils.ShowDeleteSuccessMessage(this); ShowMainGrid(); userID = 0; } } else { LocalUtils.ShowNoRecordFoundMessage(this); } } else { LocalUtils.ShowNoRecordSelectedMessage(this); } } catch (Exception) { throw; } }