private void 除自选ToolStripMenuItem_Click(object sender, EventArgs e) { DataGridViewRow row = dgvQueryResultStocks.SelectedRows[0]; string code = row.Cells["Code"].Value.ToString(); stockDAL.DeleteStock(code); RefreshPersonalStockSetting(); DataService.ResetMyStock(); }
public ResultBM Delete(object entity) { try { StockDAL stockDal = new StockDAL(); DonationBLL donationBll = new DonationBLL(); StockBM stockBm = entity as StockBM; if (!stockDal.IsInUse(stockBm.id)) { stockDal.DeleteStock(stockBm.id); donationBll.UpdateToReceivedStatus(stockBm.donation.id); return(new ResultBM(ResultBM.Type.OK, "Se ha eliminado el registro.", stockBm)); } else { return(new ResultBM(ResultBM.Type.FAIL, SessionHelper.GetTranslation("STOCK_UNDELETEABLE_ERROR"), stockBm)); } } catch (Exception exception) { return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("DELETING_ERROR") + " " + exception.Message, exception)); } }