private void grd_editStockEntry_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; long stockEctryId = 0; BLL.ClsStockData stockData = new BLL.ClsStockData(); try { //check permission for do action if (COMM_METHODS.checkActPermission(this.Name, USERNAME)) { if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { stockEctryId = Convert.ToInt64(senderGrid.SelectedCells[e.ColumnIndex].Value); stockData = MANAGEDB.getSingleStockDetail(stockEctryId); FrmAdjustStock frmUser = new FrmAdjustStock(stockData, USERNAME); frmUser.WindowState = FormWindowState.Normal; frmUser.ShowDialog(); fillGrid(SEARCH); //grd_editStockEntry.DataSource = MANAGEDB.getStockDetails(SEARCHTYPE); } } else { COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!"); } } catch (Exception ex) { COM_MESSAGE.exceptionMessage(ex.Message); } }
private void grd_stockCurrent_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; long stockEntryId = 0; BLL.ClsStockData stockData = new BLL.ClsStockData(); try { //check for do action if (COMM_METHODS.checkActPermission(this.Name, USERNAME)) { if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { stockEntryId = Convert.ToInt64(senderGrid.SelectedCells[e.ColumnIndex].Value); stockData = MANAGEDB.getSingleStockDetail(stockEntryId); if (stockData._releaseFlg == 0) { FrmAdjustStock frmUser = new FrmAdjustStock(stockData, USERNAME); frmUser.WindowState = FormWindowState.Normal; frmUser.ShowDialog(); fillGrid(); } else { COM_MESSAGE.warningMessage("The Entry you are trying to edit is released !!!", "Released Entry"); } } } else { COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!"); } } catch (Exception ex) { COM_MESSAGE.exceptionMessage(ex.Message); } }