private void btnEdit_Click(object sender, EventArgs e) { try { int focus = TextUtils.ToInt(grvData.FocusedRowHandle); int CDID = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); int LocationID = TextUtils.ToInt(grvDetail.GetFocusedRowCellValue(colLocationID)); if (CDID == 0 || LocationID == 0) { return; } LocationModel modelLocation = (LocationModel)LocationBO.Instance.FindByPK(LocationID); StockCDModel modelCD = (StockCDModel)StockCDBO.Instance.FindByPK(CDID); frmLocationDetail frm = new frmLocationDetail(); frm._Location = modelLocation; frm._CD = modelCD; if (frm.ShowDialog() == DialogResult.OK) { loadLocation(); grvDetail.FocusedRowHandle = focus; } } catch (Exception ex) { } }
private void btnNew_Click(object sender, EventArgs e) { frmLocationDetail frm = new frmLocationDetail(); int id = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); if (id == 0) { return; } StockCDModel model = (StockCDModel)StockCDBO.Instance.FindByPK(id); frm._CD = model; if (frm.ShowDialog() == DialogResult.OK) { loadLocation(); grvDetail.FocusedRowHandle = grvData.RowCount - 1; } }