private void btnAdd_Click(object sender, EventArgs e) { int id = TextUtils.ToInt(treeData.FocusedNode.GetValue(colIDTree)); DataTable dt = TextUtils.Select("select * from MaterialGroup where ParentID = " + id); if (dt.Rows.Count > 0) { MessageBox.Show("Không thể thêm vật tư vào nhóm chính!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } frmMaterial frm = new frmMaterial(); frm.GroupID = id; //if (frm.ShowDialog() == DialogResult.OK) //{ // LoadInfoSearch(); //} frm.LoadDataChange += main_LoadDataChange; frm.Show(); }
private void btnEdit_Click(object sender, EventArgs e) { int id = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); if (id == 0) { return; } MaterialModel model = (MaterialModel)MaterialBO.Instance.FindByPK(id); _rownIndex = grvData.FocusedRowHandle; frmMaterial frm = new frmMaterial(); frm.GroupID = model.MaterialGroupID; frm.Material = model; //if (frm.ShowDialog() == DialogResult.OK) //{ // LoadInfoSearch(); //} frm.LoadDataChange += main_LoadDataChange; frm.Show(); }